-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOptionsDialog.xaml.cs
More file actions
94 lines (81 loc) · 3.75 KB
/
OptionsDialog.xaml.cs
File metadata and controls
94 lines (81 loc) · 3.75 KB
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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;
namespace ImpactAnalyzer
{
/// <summary>
/// Interaction logic for OptionsDialog.xaml
/// </summary>
public partial class OptionsDialog : Window
{
public ImpactAnalysisParams Params { get; set; }
private int MaxActivityDefinition = 5;
private double ActivityDefinitionTextBoxHeight = 20;
private double ActivityDefinitionLabelWidth = 200;
private double ActivityDefinitionWatermarkWidth = 100;
private double ActivityDefinitionTextBoxSpacing = 50;
private double ActivityDefinitionVerticalSpacing = 30;
private double CanvasStartY = 0;
private double CanvasStartX = 40;
private double CanvasFooterHeight = 120;
private double OkCancelSpacing = 30;
public OptionsDialog()
{
InitializeComponent();
}
private void Ok_Click(object sender, RoutedEventArgs e)
{
DialogResult = true;
}
private void Cancel_Click(object sender, RoutedEventArgs e)
{
DialogResult = false;
}
private void DisplayActivityDefinition()
{
this.Height = CanvasStartY + Math.Max(MaxActivityDefinition, Params.ActivityDefinitionList.Count) * (ActivityDefinitionTextBoxHeight + ActivityDefinitionVerticalSpacing) + CanvasFooterHeight;
this.Width = CanvasStartX + 2 * (ActivityDefinitionWatermarkWidth + ActivityDefinitionTextBoxSpacing) + ActivityDefinitionLabelWidth + ActivityDefinitionTextBoxSpacing;
okButton.Margin = new Thickness(this.Width - 2 * OkCancelSpacing - cancelButton.Width - okButton.Width,
this.Height - CanvasFooterHeight + CanvasFooterHeight / 3,
0, 0);
cancelButton.Margin = new Thickness(this.Width - OkCancelSpacing - cancelButton.Width,
this.Height - CanvasFooterHeight + CanvasFooterHeight / 3,
0, 0);
// Draw ActivityDefinitions
double Y = CanvasStartY;
foreach(ActivityDefinition activitydefinition in Params.ActivityDefinitionList)
{
TextBox tb = new TextBox();
tb.Height = ActivityDefinitionTextBoxHeight;
tb.Width = ActivityDefinitionLabelWidth;
tb.Margin = new Thickness(CanvasStartX, Y, 0, 0);
OptionsGrid.Children.Add(tb);
TextBox tb1 = new TextBox();
tb1.Height = ActivityDefinitionTextBoxHeight;
tb1.Width = ActivityDefinitionWatermarkWidth;
tb1.Margin = new Thickness(CanvasStartX + tb.Width + ActivityDefinitionTextBoxSpacing, Y, 0, 0);
OptionsGrid.Children.Add(tb1);
TextBox tb2 = new TextBox();
tb2.Height = ActivityDefinitionTextBoxHeight;
tb2.Width = ActivityDefinitionWatermarkWidth;
tb2.Margin = new Thickness(CanvasStartX + tb.Width + ActivityDefinitionTextBoxSpacing + tb1.Width + ActivityDefinitionTextBoxSpacing, Y, 0, 0);
OptionsGrid.Children.Add(tb2);
Y += ActivityDefinitionTextBoxHeight + ActivityDefinitionVerticalSpacing;
}
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
DisplayActivityDefinition();
}
}
}