annotate defical-sharp/defical-gui/main.xaml.cs @ 1:758381a85d76 default tip

Incorrect printf format.
author Edho Prima Arief <me@myconan.net>
date Mon, 28 Jun 2010 14:52:19 +0700
parents ebed2bd0d300
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
1 using System;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
2 using System.Collections.Generic;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
3 using System.Linq;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
4 using System.Text;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
5 using System.Windows;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
6 using System.Windows.Controls;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
7 using System.Windows.Data;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
8 using System.Windows.Documents;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
9 using System.Windows.Input;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
10 using System.Windows.Media;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
11 using System.Windows.Media.Imaging;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
12 using System.Windows.Navigation;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
13 using System.Windows.Shapes;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
14 using System.IO;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
15
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
16 namespace defical_gui
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
17 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
18 /// <summary>
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
19 /// Interaction logic for Window1.xaml
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
20 /// </summary>
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
21 public partial class main : Window
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
22 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
23 public main()
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
24 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
25 InitializeComponent();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
26 initBoxes();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
27 txtNumN.Focus();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
28 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
29 private delegate void StringDelegate(int errCode,string message);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
30 private void printMessage(int errCode,string message)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
31 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
32 switch (errCode)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
33 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
34 case 0:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
35 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
36 txtResult.Text += message;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
37 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
38 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
39 default:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
40 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
41 switch (errCode)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
42 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
43 case 200:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
44 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
45 message = "Started";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
46 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
47 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
48 case 201:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
49 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
50 message = "Stopped";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
51 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
52 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
53 case 400:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
54 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
55 message = "Found";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
56 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
57 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
58 case 401:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
59 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
60 message = "SEMT Labeing can't be constructed with first label of " + message;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
61 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
62 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
63
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
64 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
65 txtResult.Text += "[" + errCode.ToString() + "] " + DateTime.Now.ToString("[yyyy-MM-dd hh:mm:ss]") + ": " + message+"\n";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
66 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
67 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
68 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
69 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
70 private void initBoxes()
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
71 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
72 this.isProcessing = false;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
73 txtResult.Text =
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
74 txtNumDef.Text =
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
75 txtNumN.Text = "";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
76 validateInput();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
77 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
78 private void txtResult_TextChanged(object sender, TextChangedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
79 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
80 switchControls(this.isProcessing);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
81 if (txtResult.Text == "") { btnSave.IsEnabled = false; } else { btnSave.IsEnabled = true; }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
82 txtResult.ScrollToEnd();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
83 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
84 private bool validateInput()
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
85 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
86 btnStart.IsEnabled = false;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
87 if (txtNumN.Text == "" || txtNumDef.Text == "") { return false; }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
88 try
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
89 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
90 int numN = Convert.ToInt32(txtNumN.Text);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
91 int numDef = Convert.ToInt32(txtNumDef.Text);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
92 if (numN.ToString() == txtNumN.Text
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
93 && numDef.ToString() == txtNumDef.Text
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
94 && numN >= 3
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
95 && numDef >= 0)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
96 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
97 btnStart.IsEnabled = true;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
98 return true;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
99 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
100 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
101 catch { return false; }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
102 return false;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
103 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
104 private void switchControls(bool isWorking)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
105 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
106 grpGraph.IsEnabled =
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
107 grpLabels.IsEnabled =
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
108 btnStart.IsEnabled = !isWorking;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
109 btnStop.IsEnabled =
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
110 barProgress.IsIndeterminate = isWorking;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
111 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
112
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
113 private void txtNumN_TextChanged(object sender, TextChangedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
114 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
115 validateInput();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
116 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
117
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
118 private void txtNumDef_TextChanged(object sender, TextChangedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
119 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
120 validateInput();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
121 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
122
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
123 private void btnStart_Click(object sender, RoutedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
124 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
125 if (!validateInput()) { return; }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
126 switchControls(true);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
127 try
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
128 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
129 this.isFindEverything = (bool)chkIsFindAll.IsChecked;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
130 switch (cmbGraphType.Text)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
131 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
132 case "Wheel":
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
133 this.graphType= "wheel";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
134 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
135 case "Fan":
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
136 this.graphType = "fan";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
137 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
138 case "Double Fan":
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
139 this.graphType = "doublefan";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
140 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
141 default:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
142 throw new NotImplementedException();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
143 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
144 this.numVerDef = Convert.ToInt32(txtNumDef.Text);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
145 int numExtraVer = 0;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
146 switch (this.graphType)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
147 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
148 case "wheel":
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
149 case "fan":
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
150 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
151 numExtraVer = 1;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
152 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
153 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
154 case "doublefan":
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
155 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
156 numExtraVer = 2;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
157 break;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
158 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
159 default:
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
160 throw new NotImplementedException();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
161 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
162 this.numVerMain = numExtraVer + Convert.ToInt32(txtNumN.Text);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
163 mainThread = new System.Threading.Thread(go);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
164 mainThread.IsBackground = true;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
165 mainThread.Start();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
166 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
167 catch
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
168 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
169 switchControls(false);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
170 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
171 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
172
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
173 private void btnStop_Click(object sender, RoutedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
174 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
175 this.isProcessing = false;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
176 switchControls(false);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
177 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
178
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
179 private void btnSave_Click(object sender, RoutedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
180 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
181 try
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
182 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
183 System.Windows.Forms.SaveFileDialog dialogSave = new System.Windows.Forms.SaveFileDialog();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
184 dialogSave.DefaultExt = "txt";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
185 dialogSave.Filter = "Text file (*.txt)|*.txt|All files (*.*)|*.*";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
186 dialogSave.AddExtension = true;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
187 dialogSave.RestoreDirectory = true;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
188 dialogSave.Title = "Save result";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
189 dialogSave.InitialDirectory = Environment.ExpandEnvironmentVariables("%HOMEDRIVE%%HOMEPATH%");
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
190 dialogSave.FileName = "result-" + cmbGraphType.Text + "-" + txtNumN.Text + "," + txtNumDef.Text;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
191 if (dialogSave.ShowDialog() == System.Windows.Forms.DialogResult.OK)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
192 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
193 StreamWriter fileWriter = null;
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
194 if (File.Exists(dialogSave.FileName)) { fileWriter = File.AppendText(dialogSave.FileName); }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
195 else { fileWriter = File.CreateText(dialogSave.FileName); }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
196 fileWriter.Write(txtResult.Text);
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
197 fileWriter.Close();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
198 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
199 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
200 catch { }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
201 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
202
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
203 private void btnClear_Click(object sender, RoutedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
204 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
205 txtResult.Text = "";
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
206 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
207 private void btnExit_Click(object sender, RoutedEventArgs e)
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
208 {
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
209 this.Close();
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
210 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
211 }
ebed2bd0d300 Initial import from svn. History be damned.
Edho P. Arief <me@myconan.net>
parents:
diff changeset
212 }