diff --git a/Remontor/.vs/Remontor/FileContentIndex/2e2aaaf7-e920-453f-a5b0-c8a50ccc7c07.vsidx b/Remontor/.vs/Remontor/FileContentIndex/2e2aaaf7-e920-453f-a5b0-c8a50ccc7c07.vsidx new file mode 100644 index 0000000..a92e142 Binary files /dev/null and b/Remontor/.vs/Remontor/FileContentIndex/2e2aaaf7-e920-453f-a5b0-c8a50ccc7c07.vsidx differ diff --git a/Remontor/.vs/Remontor/FileContentIndex/fe8b9727-c6ee-477c-9659-a902f8453f40.vsidx b/Remontor/.vs/Remontor/FileContentIndex/fe8b9727-c6ee-477c-9659-a902f8453f40.vsidx deleted file mode 100644 index 65108c0..0000000 Binary files a/Remontor/.vs/Remontor/FileContentIndex/fe8b9727-c6ee-477c-9659-a902f8453f40.vsidx and /dev/null differ diff --git a/Remontor/.vs/Remontor/v17/.suo b/Remontor/.vs/Remontor/v17/.suo index dfafea5..02a0397 100644 Binary files a/Remontor/.vs/Remontor/v17/.suo and b/Remontor/.vs/Remontor/v17/.suo differ diff --git a/Remontor/BarSessionControl.cs b/Remontor/BarSessionControl.cs index d80d531..51c500b 100644 --- a/Remontor/BarSessionControl.cs +++ b/Remontor/BarSessionControl.cs @@ -22,8 +22,10 @@ namespace Remontor internal partial class BarSessionControl : UserControl { public delegate bool HideBars(BarShow state); - public HideBars hideTab; - + public HideBars hideTabWords; + public HideBars hideTabHistory; + public HideBars hideTabSetting; + private BarShow barShow = BarShow.HideBar; public List buttons; @@ -56,14 +58,33 @@ namespace Remontor public void ShowBarSet(BarShow barShow) { + if (barShow == BarShow.ShowSetting) + { + hideTabSetting(barShow); + ShowSetting.BackColor = SystemColors.ActiveCaption; + } + else + { + if (hideTabSetting(barShow)) + { + barShow = BarShow.ShowSetting; + ShowSetting.BackColor = SystemColors.ActiveCaption; + } + else + { + ShowSetting.BackColor = SystemColors.Control; + } + + } if (barShow == BarShow.ShowWords) { ShowWords.BackColor = SystemColors.ActiveCaption; } else { ShowWords.BackColor = SystemColors.Control; } if (barShow == BarShow.ShowHistory) { ShowBar.BackColor = SystemColors.ActiveCaption; } else { ShowBar.BackColor = SystemColors.Control; } - if (barShow == BarShow.ShowSetting) { ShowSetting.BackColor = SystemColors.ActiveCaption; } - else { ShowSetting.BackColor = SystemColors.Control; } - hideTab(barShow); - + + hideTabWords(barShow); + hideTabHistory(barShow); + + } private void ShowBar_Click(object sender, EventArgs e) diff --git a/Remontor/Connector/Connect.cs b/Remontor/Connector/Connect.cs index 243166e..c3cf3d3 100644 --- a/Remontor/Connector/Connect.cs +++ b/Remontor/Connector/Connect.cs @@ -1,4 +1,5 @@ -using System; +using Remontor.Setting; +using System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -57,17 +58,27 @@ namespace Remontor.Connector public void ConnectSCCM(Control panel) { - View = new Panel(); - View.Dock = DockStyle.Fill; - panel.Controls.Add(View); - ModeMonitor = new OneMon(); - //Proc = Process.Start(@"CmRcViewer.exe", Comp.GetNetNameStr()); - Proc = Process.Start("notepad"); - //Thread.Sleep(500); // Allow the process to open it's window - Proc.WaitForInputIdle(); - SetParent(Proc.MainWindowHandle, View.Handle); - SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE); - ModeMonitor.Resize(Proc, View); + try { + View = new Panel(); + View.Dock = DockStyle.Fill; + panel.Controls.Add(View); + ModeMonitor = new OneMon(); + //Proc = Process.Start(@"CmRcViewer.exe", Comp.GetNetNameStr()); + Proc = Process.Start(SGlobalSetting.settingApp.pathApp); + //Thread.Sleep(500); // Allow the process to open it's window + Proc.WaitForInputIdle(); + SetParent(Proc.MainWindowHandle, View.Handle); + SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE); + ModeMonitor.Resize(Proc, View); + } + catch (Exception) { + MessageBox.Show("Не верно заданно придложение для подключения."); + ModeMonitor = new OffMon(); + SConnector.Panel.Controls.Remove(View); + return; + + } + } public void Activ(bool act) @@ -119,10 +130,10 @@ namespace Remontor.Connector public void Delete() { - Proc.CloseMainWindow(); + if (Proc != null) Proc.CloseMainWindow(); ModeMonitor = new OffMon(); SConnector.Panel.Controls.Remove(View); - Proc.Close(); + if (Proc != null) Proc.Close(); } } } diff --git a/Remontor/Connector/SConnector.cs b/Remontor/Connector/SConnector.cs index 1d2f8d3..58348fc 100644 --- a/Remontor/Connector/SConnector.cs +++ b/Remontor/Connector/SConnector.cs @@ -18,7 +18,7 @@ namespace Remontor.Connector public static event UpdateModeMon UpdateMode; private static List Connects = new List(); public static Control Panel; - public static Form FormMain; + public static Form1 FormMain; public static Connect ActionConnect = null; public static void NewConnect(IComp comp) { diff --git a/Remontor/FlowContainer.Designer.cs b/Remontor/FlowContainer.Designer.cs index 80d2586..3adae9c 100644 --- a/Remontor/FlowContainer.Designer.cs +++ b/Remontor/FlowContainer.Designer.cs @@ -31,6 +31,7 @@ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); this.label2 = new System.Windows.Forms.Label(); this.HistoryPanel = new System.Windows.Forms.FlowLayoutPanel(); + this.BtSave = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // @@ -39,23 +40,25 @@ this.tableLayoutPanel1.BackColor = System.Drawing.SystemColors.Control; this.tableLayoutPanel1.ColumnCount = 1; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.BtSave, 0, 2); this.tableLayoutPanel1.Controls.Add(this.HistoryPanel, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label2, 0, 0); this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.tableLayoutPanel1.GrowStyle = System.Windows.Forms.TableLayoutPanelGrowStyle.FixedSize; this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 2; + this.tableLayoutPanel1.RowCount = 3; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F)); this.tableLayoutPanel1.Size = new System.Drawing.Size(330, 781); this.tableLayoutPanel1.TabIndex = 1; // // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(3, 3); - this.label2.Margin = new System.Windows.Forms.Padding(3); + this.label2.Location = new System.Drawing.Point(6, 3); + this.label2.Margin = new System.Windows.Forms.Padding(6, 3, 3, 3); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(120, 13); this.label2.TabIndex = 3; @@ -68,9 +71,19 @@ this.HistoryPanel.Dock = System.Windows.Forms.DockStyle.Fill; this.HistoryPanel.Location = new System.Drawing.Point(3, 23); this.HistoryPanel.Name = "HistoryPanel"; - this.HistoryPanel.Size = new System.Drawing.Size(324, 755); + this.HistoryPanel.Size = new System.Drawing.Size(324, 725); this.HistoryPanel.TabIndex = 6; // + // BtSave + // + this.BtSave.Location = new System.Drawing.Point(3, 754); + this.BtSave.Name = "BtSave"; + this.BtSave.Size = new System.Drawing.Size(323, 24); + this.BtSave.TabIndex = 7; + this.BtSave.Text = "Очистить историю"; + this.BtSave.UseVisualStyleBackColor = true; + this.BtSave.Click += new System.EventHandler(this.BtSave_Click); + // // FlowContainer // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -91,5 +104,6 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; private System.Windows.Forms.Label label2; private System.Windows.Forms.FlowLayoutPanel HistoryPanel; + private System.Windows.Forms.Button BtSave; } } diff --git a/Remontor/FlowContainer.cs b/Remontor/FlowContainer.cs index 39de831..74f34be 100644 --- a/Remontor/FlowContainer.cs +++ b/Remontor/FlowContainer.cs @@ -46,6 +46,9 @@ namespace Remontor } - + private void BtSave_Click(object sender, EventArgs e) + { + HistoryList.Clear(); + } } } diff --git a/Remontor/FlowConteinerSetting.Designer.cs b/Remontor/FlowConteinerSetting.Designer.cs index 63309cc..44f37f4 100644 --- a/Remontor/FlowConteinerSetting.Designer.cs +++ b/Remontor/FlowConteinerSetting.Designer.cs @@ -29,26 +29,49 @@ private void InitializeComponent() { this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel(); + this.BtSave = new System.Windows.Forms.Button(); + this.BtAbout = new System.Windows.Forms.Button(); this.settingWordsControl1 = new Remontor.Setting.SettingWordsControl(); this.settingSCCMControl1 = new Remontor.Setting.SettingSCCMControl(); this.settingAppControl1 = new Remontor.Setting.settingAppControl(); - this.BtSave = new System.Windows.Forms.Button(); this.flowLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // flowLayoutPanel1 // - this.flowLayoutPanel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.flowLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.flowLayoutPanel1.Controls.Add(this.settingWordsControl1); this.flowLayoutPanel1.Controls.Add(this.settingSCCMControl1); this.flowLayoutPanel1.Controls.Add(this.settingAppControl1); this.flowLayoutPanel1.Controls.Add(this.BtSave); - this.flowLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutPanel1.Location = new System.Drawing.Point(0, 0); this.flowLayoutPanel1.Name = "flowLayoutPanel1"; - this.flowLayoutPanel1.Size = new System.Drawing.Size(330, 781); + this.flowLayoutPanel1.Size = new System.Drawing.Size(330, 592); this.flowLayoutPanel1.TabIndex = 0; // + // BtSave + // + this.BtSave.Location = new System.Drawing.Point(3, 432); + this.BtSave.Name = "BtSave"; + this.BtSave.Size = new System.Drawing.Size(323, 28); + this.BtSave.TabIndex = 3; + this.BtSave.Text = "Сохранить"; + this.BtSave.UseVisualStyleBackColor = true; + this.BtSave.Click += new System.EventHandler(this.BtSave_Click); + // + // BtAbout + // + this.BtAbout.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.BtAbout.Location = new System.Drawing.Point(3, 598); + this.BtAbout.Name = "BtAbout"; + this.BtAbout.Size = new System.Drawing.Size(324, 28); + this.BtAbout.TabIndex = 4; + this.BtAbout.Text = "О программе"; + this.BtAbout.UseVisualStyleBackColor = true; + // // settingWordsControl1 // this.settingWordsControl1.Location = new System.Drawing.Point(3, 3); @@ -70,23 +93,14 @@ this.settingAppControl1.Size = new System.Drawing.Size(325, 130); this.settingAppControl1.TabIndex = 2; // - // BtSave - // - this.BtSave.Location = new System.Drawing.Point(3, 432); - this.BtSave.Name = "BtSave"; - this.BtSave.Size = new System.Drawing.Size(323, 28); - this.BtSave.TabIndex = 3; - this.BtSave.Text = "Сохранить"; - this.BtSave.UseVisualStyleBackColor = true; - this.BtSave.Click += new System.EventHandler(this.BtSave_Click); - // // FlowConteinerSetting // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.Controls.Add(this.flowLayoutPanel1); + this.Controls.Add(this.BtAbout); this.Name = "FlowConteinerSetting"; - this.Size = new System.Drawing.Size(330, 781); + this.Size = new System.Drawing.Size(330, 629); this.flowLayoutPanel1.ResumeLayout(false); this.ResumeLayout(false); @@ -99,5 +113,6 @@ private Setting.SettingSCCMControl settingSCCMControl1; private Setting.settingAppControl settingAppControl1; private System.Windows.Forms.Button BtSave; + private System.Windows.Forms.Button BtAbout; } } diff --git a/Remontor/FlowConteinerSetting.cs b/Remontor/FlowConteinerSetting.cs index 5f0e032..9e709fa 100644 --- a/Remontor/FlowConteinerSetting.cs +++ b/Remontor/FlowConteinerSetting.cs @@ -1,4 +1,5 @@ -using Remontor.Setting; +using Remontor.Connector; +using Remontor.Setting; using Remontor.Words; using System; using System.Collections.Generic; @@ -33,6 +34,7 @@ namespace Remontor { if (barShow == BarShow.ShowSetting) { + unSave = false; this.Visible = true; settingAppControl1.UpdateSetting(); settingSCCMControl1.UpdateSetting(); @@ -40,44 +42,34 @@ namespace Remontor } else { - this.Visible = false; + if (!SConnector.FormMain.CloseOn && !unSave && (settingAppControl1.edited() || + settingSCCMControl1.edited() || + settingWordsControl1.edited())) + { + unSave = true; + DialogResult result = MessageBox.Show("Изменения не сохраненны. Продолжить?", "Изменения не сохраненны.", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); + switch (result) + { + case DialogResult.Cancel: + this.Visible = true; + unSave = false; + break; + case DialogResult.OK: + this.Visible = false; + unSave = true; + break; + } + + } + else + { + this.Visible = false; + } } return this.Visible; } - //private bool NotSave() - //{ - // if (tabControl1.SelectedIndex == 3) - // { - // if (!unSave) - // { - // unSave = true; - // UpdateSetting(); - // } - - // } - // else - // { - // if (unSave && (settingAppControl1.edited() || - // settingSCCMControl1.edited() || - // settingWordsControl1.edited())) - // { - // DialogResult result = MessageBox.Show("Изменения не сохраненны. Продолжить?", "Изменения не сохраненны.", MessageBoxButtons.OKCancel, MessageBoxIcon.Question); - // switch (result) - // { - // case DialogResult.Cancel: - // tabControl1.SelectedIndex = 3; - // break; - // case DialogResult.OK: - // unSave = false; - // break; - // } - // } - - // } - //} - private void BtSave_Click(object sender, EventArgs e) { Save(); diff --git a/Remontor/Form1.Designer.cs b/Remontor/Form1.Designer.cs index c339e5b..17115f3 100644 --- a/Remontor/Form1.Designer.cs +++ b/Remontor/Form1.Designer.cs @@ -43,6 +43,8 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.panel3.Controls.Add(this.flowConteinerSetting1); + this.panel3.Controls.Add(this.flowContainerWords1); + this.panel3.Controls.Add(this.flowContainer1); this.panel3.Controls.Add(this.label1); this.panel3.Location = new System.Drawing.Point(0, 25); this.panel3.Name = "panel3"; @@ -66,7 +68,7 @@ this.flowContainerWords1.BackColor = System.Drawing.SystemColors.Control; this.flowContainerWords1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.flowContainerWords1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.flowContainerWords1.Location = new System.Drawing.Point(763, 40); + this.flowContainerWords1.Location = new System.Drawing.Point(764, 18); this.flowContainerWords1.Margin = new System.Windows.Forms.Padding(0); this.flowContainerWords1.Name = "flowContainerWords1"; this.flowContainerWords1.Size = new System.Drawing.Size(330, 678); @@ -90,7 +92,7 @@ this.flowContainer1.BackColor = System.Drawing.Color.Transparent; this.flowContainer1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.flowContainer1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.flowContainer1.Location = new System.Drawing.Point(763, 40); + this.flowContainer1.Location = new System.Drawing.Point(764, 18); this.flowContainer1.Name = "flowContainer1"; this.flowContainer1.Size = new System.Drawing.Size(330, 675); this.flowContainer1.TabIndex = 1; @@ -100,9 +102,10 @@ // this.flowConteinerSetting1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); - this.flowConteinerSetting1.Location = new System.Drawing.Point(764, 15); + this.flowConteinerSetting1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.flowConteinerSetting1.Location = new System.Drawing.Point(764, 18); this.flowConteinerSetting1.Name = "flowConteinerSetting1"; - this.flowConteinerSetting1.Size = new System.Drawing.Size(330, 781); + this.flowConteinerSetting1.Size = new System.Drawing.Size(330, 675); this.flowConteinerSetting1.TabIndex = 1; this.flowConteinerSetting1.Visible = false; // @@ -111,9 +114,7 @@ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(1094, 718); - this.Controls.Add(this.flowContainerWords1); this.Controls.Add(this.barSessionControl1); - this.Controls.Add(this.flowContainer1); this.Controls.Add(this.panel3); this.Name = "Form1"; this.Text = "Form1"; diff --git a/Remontor/Form1.cs b/Remontor/Form1.cs index 578a418..f9d5561 100644 --- a/Remontor/Form1.cs +++ b/Remontor/Form1.cs @@ -39,15 +39,16 @@ namespace Remontor Process p1; Process p; + public bool CloseOn = false; public Form1() { SGlobalSetting.LoadSetting(); //WordsList.MainCategory = SGlobalSetting.LoadWords(); InitializeComponent(); - barSessionControl1.hideTab += flowContainer1.HideBar; - barSessionControl1.hideTab += flowContainerWords1.HideBar; - barSessionControl1.hideTab += flowConteinerSetting1.HideBar; + barSessionControl1.hideTabHistory += flowContainer1.HideBar; + barSessionControl1.hideTabWords += flowContainerWords1.HideBar; + barSessionControl1.hideTabSetting += flowConteinerSetting1.HideBar; SConnector.Panel = this.panel3; SConnector.FormMain = this; @@ -60,7 +61,7 @@ namespace Remontor this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); - + @@ -111,7 +112,7 @@ namespace Remontor if ((m.Msg == 0x210 && m.WParam.ToInt32() == 513) || m.Msg == 0x201) { Point clickPoint = this.PointToClient(Cursor.Position); - if (!flowContainer1.Bounds.Contains(clickPoint)) + if (!flowContainerWords1.Bounds.Contains(clickPoint)) { barSessionControl1.ShowBarSet(BarShow.HideBar); } @@ -139,6 +140,7 @@ namespace Remontor private void Form1_FormClosing(object sender, FormClosingEventArgs e) { + CloseOn = true; flowContainerWords1.Save(); SGlobalSetting.SaveSettig(); diff --git a/Remontor/History/HistoryList.cs b/Remontor/History/HistoryList.cs index b7eff69..6ac24a9 100644 --- a/Remontor/History/HistoryList.cs +++ b/Remontor/History/HistoryList.cs @@ -38,6 +38,7 @@ namespace Remontor.History static public void Clear() { Hitem.Clear(); + Update(Hitem); } static public void ClearFirst() diff --git a/Remontor/bin/Debug/Remontor.exe b/Remontor/bin/Debug/Remontor.exe index e40b548..9ec396c 100644 Binary files a/Remontor/bin/Debug/Remontor.exe and b/Remontor/bin/Debug/Remontor.exe differ diff --git a/Remontor/bin/Debug/Remontor.pdb b/Remontor/bin/Debug/Remontor.pdb index e173883..dd03de8 100644 Binary files a/Remontor/bin/Debug/Remontor.pdb and b/Remontor/bin/Debug/Remontor.pdb differ diff --git a/Remontor/bin/Debug/res.dat b/Remontor/bin/Debug/res.dat index 91cbee2..519fa9a 100644 Binary files a/Remontor/bin/Debug/res.dat and b/Remontor/bin/Debug/res.dat differ diff --git a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 6049997..da12840 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache index d09e44b..4ae0d03 100644 Binary files a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache and b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache differ diff --git a/Remontor/obj/Debug/Remontor.exe b/Remontor/obj/Debug/Remontor.exe index e40b548..9ec396c 100644 Binary files a/Remontor/obj/Debug/Remontor.exe and b/Remontor/obj/Debug/Remontor.exe differ diff --git a/Remontor/obj/Debug/Remontor.pdb b/Remontor/obj/Debug/Remontor.pdb index e173883..dd03de8 100644 Binary files a/Remontor/obj/Debug/Remontor.pdb and b/Remontor/obj/Debug/Remontor.pdb differ