@@ -41,120 +41,129 @@ namespace C_Sharf_Classes.Classes
41
41
{
42
42
class UI_events
43
43
{
44
- public void Show ( Form frm , Form form )
45
- {
46
- frm . Show ( ) ;
47
- form . Hide ( ) ;
48
- }
49
44
50
- public void Dialog ( Form frm )
51
- {
52
- frm . ShowDialog ( ) ;
53
- }
54
-
55
- public void FormShow ( Form frm , string dstyle = "Fill" )
56
- {
57
- try
58
- {
59
- foreach ( Form child in frmMain . ActiveForm . MdiChildren )
60
- {
61
- child . Close ( ) ;
62
- }
63
- } catch { }
64
-
65
- frm . MdiParent = frmMain . formParent ;
66
- switch ( dstyle )
45
+ #region Form Events
46
+
47
+ public void Show ( Form frmNew , Form frmOld )
67
48
{
68
- case "Fill" :
69
- frm . Dock = DockStyle . Fill ;
70
- break ;
71
- case "Top" :
72
- frm . Dock = DockStyle . Top ;
73
- break ;
74
- case "Right" :
75
- frm . Dock = DockStyle . Right ;
76
- break ;
77
- case "Bottom" :
78
- frm . Dock = DockStyle . Bottom ;
79
- break ;
80
- case "Left" :
81
- frm . Dock = DockStyle . Left ;
82
- break ;
83
- default :
84
- frm . Dock = DockStyle . None ;
85
- break ;
49
+ frmNew . Show ( ) ;
50
+ frmOld . Hide ( ) ;
86
51
}
87
- frm . Show ( ) ;
88
- }
89
52
90
- public void chart ( Chart chart , string SeriesName , string [ ] x , int [ ] y , string chartType = "Column" )
91
- {
92
- if ( chart . Series [ 0 ] . Name == "Series1" )
53
+ public void Dialog ( Form frm )
93
54
{
94
- //remove default series
95
- chart . Series . Remove ( chart . Series [ "Series1" ] ) ;
55
+ frm . ShowDialog ( ) ;
96
56
}
97
- //add new series
98
- chart . Series . Add ( SeriesName ) ;
99
57
100
- //chart Type
101
- switch ( chartType )
58
+ public void FormShow ( Form frm , string dstyle = "Fill" )
102
59
{
103
- case "Area" :
104
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Area ;
105
- break ;
106
- case "Bar" :
107
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Bar ;
108
- break ;
109
- case "BoxPlot" :
110
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . BoxPlot ;
111
- break ;
112
- case "Bubble" :
113
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Bubble ;
114
- break ;
115
- case "Candlestick" :
116
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Candlestick ;
117
- break ;
118
- case "Doughnut" :
119
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Doughnut ;
120
- break ;
121
- case "ErrorBar" :
122
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . ErrorBar ;
123
- break ;
124
- case "FastLine" :
125
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . FastLine ;
126
- break ;
127
- case "FastPoint" :
128
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . FastPoint ;
129
- break ;
130
- case "Funnel" :
131
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Funnel ;
132
- break ;
133
- case "Kagi" :
134
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Kagi ;
135
- break ;
136
- case "Line" :
137
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Line ;
138
- break ;
139
- case "Pie" :
140
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Pie ;
141
- break ;
142
- case "Point" :
143
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Point ;
144
- break ;
145
- default :
146
- chart . Series [ SeriesName ] . ChartType = SeriesChartType . Column ;
147
- break ;
60
+ try
61
+ {
62
+ foreach ( Form child in frmMain . ActiveForm . MdiChildren )
63
+ {
64
+ child . Close ( ) ;
65
+ }
66
+ } catch { }
67
+
68
+ frm . MdiParent = frmMain . formParent ;
69
+ switch ( dstyle )
70
+ {
71
+ case "Fill" :
72
+ frm . Dock = DockStyle . Fill ;
73
+ break ;
74
+ case "Top" :
75
+ frm . Dock = DockStyle . Top ;
76
+ break ;
77
+ case "Right" :
78
+ frm . Dock = DockStyle . Right ;
79
+ break ;
80
+ case "Bottom" :
81
+ frm . Dock = DockStyle . Bottom ;
82
+ break ;
83
+ case "Left" :
84
+ frm . Dock = DockStyle . Left ;
85
+ break ;
86
+ default :
87
+ frm . Dock = DockStyle . None ;
88
+ break ;
89
+ }
90
+ frm . Show ( ) ;
148
91
}
149
92
150
- int count = 0 ;
151
- //pass the legend & value
152
- foreach ( string addx in x )
93
+ #endregion
94
+
95
+ #region Data Visualization
96
+
97
+ public void chart ( Chart chart , string SeriesName , string [ ] x , int [ ] y , string chartType = "Column" )
153
98
{
154
- chart . Series [ SeriesName ] . Points . AddXY ( addx , y [ count ] ) ;
155
- count ++ ;
99
+ if ( chart . Series [ 0 ] . Name == "Series1" )
100
+ {
101
+ //remove default series
102
+ chart . Series . Remove ( chart . Series [ "Series1" ] ) ;
103
+ }
104
+ //add new series
105
+ chart . Series . Add ( SeriesName ) ;
106
+
107
+ //chart Type
108
+ switch ( chartType )
109
+ {
110
+ case "Area" :
111
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Area ;
112
+ break ;
113
+ case "Bar" :
114
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Bar ;
115
+ break ;
116
+ case "BoxPlot" :
117
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . BoxPlot ;
118
+ break ;
119
+ case "Bubble" :
120
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Bubble ;
121
+ break ;
122
+ case "Candlestick" :
123
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Candlestick ;
124
+ break ;
125
+ case "Doughnut" :
126
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Doughnut ;
127
+ break ;
128
+ case "ErrorBar" :
129
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . ErrorBar ;
130
+ break ;
131
+ case "FastLine" :
132
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . FastLine ;
133
+ break ;
134
+ case "FastPoint" :
135
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . FastPoint ;
136
+ break ;
137
+ case "Funnel" :
138
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Funnel ;
139
+ break ;
140
+ case "Kagi" :
141
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Kagi ;
142
+ break ;
143
+ case "Line" :
144
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Line ;
145
+ break ;
146
+ case "Pie" :
147
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Pie ;
148
+ break ;
149
+ case "Point" :
150
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Point ;
151
+ break ;
152
+ default :
153
+ chart . Series [ SeriesName ] . ChartType = SeriesChartType . Column ;
154
+ break ;
155
+ }
156
+
157
+ int count = 0 ;
158
+ //pass the legend & value
159
+ foreach ( string addx in x )
160
+ {
161
+ chart . Series [ SeriesName ] . Points . AddXY ( addx , y [ count ] ) ;
162
+ count ++ ;
163
+ }
156
164
}
157
- }
165
+
166
+ #endregion
158
167
159
168
}
160
169
}
0 commit comments