aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/FSE/Tango.FSE.UI/Dialogs/BugReportViewVM.cs
blob: 397510ef2c8d0a92f10d902493ca5edfff7e92ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
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; }

        public BugReportViewVM()
        {
            TangoIOC.Default.Inject(this);
            IsEditable = true;
            Bug = new Bug();
            CanClose = true;
            OKText = "SUBMIT";
            HasDefault = true;
        }

        public BugReportViewVM(Bug bug) : this()
        {
            if (bug != null)
            {
                Bug = bug;
                IsEditable = false;
            }
        }

        protected override void Accept()
        {
            if (Bug.Title.IsNotNullOrEmpty())
            {
                base.Accept();
            }
            else
            {
                NotificationProvider.ShowError("Report title cannot remain empty.");
            }
        }
    }
}