Skip to content

Commit 3fda972

Browse files
committed
Рефакторинг основного окна.
Вкладка обновления БД - предзагрузка натсроек tfs - в "фоне"
1 parent e78c5c5 commit 3fda972

File tree

6 files changed

+198
-141
lines changed

6 files changed

+198
-141
lines changed

src/Arcas.UI/ArcasMain.Designer.cs

+2-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Arcas.UI/ArcasMain.cs

+15-16
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,37 @@ public partial class ArcasMain : Form
1313
public ArcasMain()
1414
{
1515
InitializeComponent();
16-
#pragma warning disable CS0618 // Тип или член устарел
17-
tsVersion.Text = Updater.CurrentVersion();
18-
#pragma warning restore CS0618 // Тип или член устарел
1916

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)
2122
{
2223
var ts = new TabPage();
2324

2425
ts.Controls.Add(tb);
2526
ts.Name = tb.Name;
2627
ts.Text = tb.Text;
2728
ts.UseVisualStyleBackColor = true;
28-
refreshTabAction.Add(tb.RefreshTab);
29-
rcloseAppAction.Add(tb.CloseApp);
3029
tb.StateProgress += savbl_StatusMessages;
3130
tb.Dock = DockStyle.Fill;
3231
tcTabs.TabPages.Add(ts);
3332
}
3433
}
3534

36-
private List<Action> refreshTabAction = new List<Action>();
37-
private List<Action> rcloseAppAction = new List<Action>();
35+
private List<TabControlBase> tabs = new List<TabControlBase>();
3836

3937
private void выходToolStripMenuItem_Click(object sender, EventArgs e) =>
4038
Close();
4139

42-
private void tabPageDBVer_Enter(object sender, EventArgs e)
40+
private void arcasMain_Load(object sender, EventArgs e)
4341
{
44-
foreach (var item in refreshTabAction)
42+
foreach (var item in tabs)
43+
{
4544
try
4645
{
47-
item.Invoke();
46+
item.RefreshTab();
4847
}
4948
catch (Exception ex)
5049
{
@@ -54,6 +53,7 @@ private void tabPageDBVer_Enter(object sender, EventArgs e)
5453

5554
Dialogs.ErrorF(this, msg);
5655
}
56+
}
5757
}
5858

5959
private void savbl_StatusMessages(string message)
@@ -64,12 +64,14 @@ private void savbl_StatusMessages(string message)
6464

6565
private void arcasMainMindow_FormClosing(object sender, FormClosingEventArgs e)
6666
{
67-
foreach (var closeTab in rcloseAppAction)
67+
foreach (var item in tabs)
68+
{
6869
try
6970
{
70-
closeTab();
71+
item.CloseApp();
7172
}
7273
catch { }
74+
}
7375

7476
Config.Instance.Save();
7577

@@ -79,8 +81,5 @@ private void arcasMainMindow_FormClosing(object sender, FormClosingEventArgs e)
7981
}
8082
catch { }
8183
}
82-
83-
private void arcasMain_Load(object sender, EventArgs e) =>
84-
tabPageDBVer_Enter(null, null);
8584
}
8685
}

0 commit comments

Comments
 (0)