@@ -13,38 +13,37 @@ public partial class ArcasMain : Form
13
13
public ArcasMain ( )
14
14
{
15
15
InitializeComponent ( ) ;
16
- #pragma warning disable CS0618 // Тип или член устарел
17
- tsVersion . Text = Updater . CurrentVersion ( ) ;
18
- #pragma warning restore CS0618 // Тип или член устарел
19
16
20
- foreach ( var tb in Locator . GetInstances < TabControlBase > ( ) )
17
+ Text = "Аркас " + Updater . CurrentVersion ( ) ;
18
+
19
+ tabs . AddRange ( Locator . GetInstances < TabControlBase > ( ) ) ;
20
+
21
+ foreach ( var tb in tabs )
21
22
{
22
23
var ts = new TabPage ( ) ;
23
24
24
25
ts . Controls . Add ( tb ) ;
25
26
ts . Name = tb . Name ;
26
27
ts . Text = tb . Text ;
27
28
ts . UseVisualStyleBackColor = true ;
28
- refreshTabAction . Add ( tb . RefreshTab ) ;
29
- rcloseAppAction . Add ( tb . CloseApp ) ;
30
29
tb . StateProgress += savbl_StatusMessages ;
31
30
tb . Dock = DockStyle . Fill ;
32
31
tcTabs . TabPages . Add ( ts ) ;
33
32
}
34
33
}
35
34
36
- private List < Action > refreshTabAction = new List < Action > ( ) ;
37
- private List < Action > rcloseAppAction = new List < Action > ( ) ;
35
+ private List < TabControlBase > tabs = new List < TabControlBase > ( ) ;
38
36
39
37
private void выходToolStripMenuItem_Click ( object sender , EventArgs e ) =>
40
38
Close ( ) ;
41
39
42
- private void tabPageDBVer_Enter ( object sender , EventArgs e )
40
+ private void arcasMain_Load ( object sender , EventArgs e )
43
41
{
44
- foreach ( var item in refreshTabAction )
42
+ foreach ( var item in tabs )
43
+ {
45
44
try
46
45
{
47
- item . Invoke ( ) ;
46
+ item . RefreshTab ( ) ;
48
47
}
49
48
catch ( Exception ex )
50
49
{
@@ -54,6 +53,7 @@ private void tabPageDBVer_Enter(object sender, EventArgs e)
54
53
55
54
Dialogs . ErrorF ( this , msg ) ;
56
55
}
56
+ }
57
57
}
58
58
59
59
private void savbl_StatusMessages ( string message )
@@ -64,12 +64,14 @@ private void savbl_StatusMessages(string message)
64
64
65
65
private void arcasMainMindow_FormClosing ( object sender , FormClosingEventArgs e )
66
66
{
67
- foreach ( var closeTab in rcloseAppAction )
67
+ foreach ( var item in tabs )
68
+ {
68
69
try
69
70
{
70
- closeTab ( ) ;
71
+ item . CloseApp ( ) ;
71
72
}
72
73
catch { }
74
+ }
73
75
74
76
Config . Instance . Save ( ) ;
75
77
@@ -79,8 +81,5 @@ private void arcasMainMindow_FormClosing(object sender, FormClosingEventArgs e)
79
81
}
80
82
catch { }
81
83
}
82
-
83
- private void arcasMain_Load ( object sender , EventArgs e ) =>
84
- tabPageDBVer_Enter ( null , null ) ;
85
84
}
86
85
}
0 commit comments