aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/MachineStudio/Tango.MachineStudio.UI/Windows/ExceptionWindow.xaml.cs
blob: 0a6f2de39feb426aaa59a0d7df8df00d0ab85f4b (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
53
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Tango.Core.Commands;
using Tango.MachineStudio.UI.ViewModels;

namespace Tango.MachineStudio.UI.Windows
{
    /// <summary>
    /// Interaction logic for ExceptionWindow.xaml
    /// </summary>
    public partial class ExceptionWindow : Window
    {
        public ExceptionResolutions Resolution { get; set; }

        public String Exception { get; set; }

        public RelayCommand<ExceptionResolutions> ResolveCommand { get; set; }

        public ExceptionWindow()
        {
            InitializeComponent();
            DataContext = this;
        }

        public ExceptionWindow(Exception ex, bool canReport) : this()
        {
            Exception = ex.FlattenException();
            ResolveCommand = new RelayCommand<ExceptionResolutions>(Resolve);

            if (!canReport)
            {
                btnReport.Visibility = Visibility.Collapsed;
            }
        }

        private void Resolve(ExceptionResolutions resolution)
        {
            Resolution = resolution;
            Close();
        }
    }
}
; i < Children.Count; i++) { SetRow(Children[i], currentRow); if (i % 2 != 0) { SetColumn(Children[i], 1); (Children[i] as FrameworkElement).Margin = new Thickness(20, 0, 0, 0); currentRow++; RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50, GridUnitType.Pixel) }); } (Children[i] as FrameworkElement).VerticalAlignment = VerticalAlignment.Bottom; } } } }