using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; using Tango.Core.DI; using Tango.FSE.Common; using Tango.FSE.Common.BugReporting; using Tango.FSE.Common.Notifications; namespace Tango.FSE.UI.Dialogs { public class BugReportViewVM : FSEDialogViewVM { [TangoInject] private INotificationProvider NotificationProvider { get; set; } public Bug Bug { get; set; } public bool IsEditable { get; set; } private String _title; [Required(ErrorMessage = "Title is required")] public String Title { get { return _title; } set { _title = value; RaisePropertyChangedAuto(); InvalidateRelayCommands(); } } private String _description; public String Description { get { return _description; } set { _description = value; RaisePropertyChangedAuto(); } } private String _comments; public String Comments { get { return _comments; } set { _comments = value; RaisePropertyChangedAuto(); } } public BugReportViewVM() { TangoIOC.Default.Inject(this); IsEditable = true; Bug = new Bug(); CanClose = true; OKText = "SUBMIT"; HasDefault = false; } public BugReportViewVM(Bug bug) : this() { if (bug != null) { Bug = bug; Title = Bug.Title; Description = Bug.Description; IsEditable = false; } } protected override void Accept() { if (Validate()) { Bug.Title = Title; Bug.Description = Description; Bug.Comments = Comments; base.Accept(); } } } }