diff --git a/Remontor/.vs/Remontor/v17/.suo b/Remontor/.vs/Remontor/v17/.suo index 32ed854..2ea3e3a 100644 Binary files a/Remontor/.vs/Remontor/v17/.suo and b/Remontor/.vs/Remontor/v17/.suo differ diff --git a/Remontor/BarButtonControl.cs b/Remontor/BarButtonControl.cs index eaa728f..91ac2c9 100644 --- a/Remontor/BarButtonControl.cs +++ b/Remontor/BarButtonControl.cs @@ -54,7 +54,7 @@ namespace Remontor private void CloseBtn_Click(object sender, EventArgs e) { - SConnector.DeleteConnect(connect); + connect.Delete(); } } diff --git a/Remontor/BarSessionControl.cs b/Remontor/BarSessionControl.cs index 4feacc3..47b45a2 100644 --- a/Remontor/BarSessionControl.cs +++ b/Remontor/BarSessionControl.cs @@ -161,9 +161,9 @@ namespace Remontor if (SConnector.ActionConnect != null) { - SConnector.DeleteConnect(SConnector.ActionConnect); - SConnector.ActionConnect.Delete(); - SConnector.NewConnect(SConnector.ActionConnect.GetComp); + // SConnector.DeleteConnect(SConnector.ActionConnect); + SConnector.ActionConnect.Reconnect(); + // SConnector.NewConnect(SConnector.ActionConnect.GetComp); } }else if (e.Button == MouseButtons.Right) { diff --git a/Remontor/Connector/Connect.cs b/Remontor/Connector/Connect.cs index c8464fb..38c774f 100644 --- a/Remontor/Connector/Connect.cs +++ b/Remontor/Connector/Connect.cs @@ -6,10 +6,12 @@ using System.Drawing; using System.Linq; using System.Net; using System.Runtime.InteropServices; +using System.Runtime.Remoting.Contexts; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using static System.Windows.Forms.VisualStyles.VisualStyleElement; namespace Remontor.Connector { @@ -69,6 +71,9 @@ namespace Remontor.Connector public event UpdateConnect Update; public Control View; public IntPtr hwnd; + private bool RecconectFlag, RecconectFlagIp; + + public Connect(IComp comp) { Comp = comp; @@ -92,11 +97,14 @@ namespace Remontor.Connector Proc = Process.Start(SGlobalSetting.settingApp.pathApp, ConnectStr); //Proc = Process.Start(SGlobalSetting.settingApp.pathApp); Proc.WaitForInputIdle(); + Proc.EnableRaisingEvents = true; + Proc.Exited += Proc_Exited; SetParent(Proc.MainWindowHandle, View.Handle); SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE); ModeMonitor.Resize(Proc, View); //Thread.Sleep(500); - hwnd = GetWindowHandleByTitle("Contacting Remote Control Agent on client " + ConnectStr); + hwnd = GetWindowHandleByTitle("Устанавливается контакт с агентом удаленного управления на клиенте " + ConnectStr); + // hwnd = GetWindowHandleByTitle("Contacting Remote Control Agent on client " + ConnectStr); Point CenterView = new Point(View.Bounds.Width/2, View.Bounds.Height/2); Point CenterDraw = View.PointToScreen(CenterView); MoveWindow(hwnd, CenterDraw.X- 325, CenterDraw.Y - 125 ,650,250,true); @@ -112,6 +120,39 @@ namespace Remontor.Connector } + private void Proc_Exited(object sender, EventArgs e) + { + + SConnector.FormMain.Invoke(new MethodInvoker(delegate + { + DelBar(); + })); + + if (RecconectFlag) + { + if (RecconectFlagIp) + { + SConnector.FormMain.Invoke(new MethodInvoker(delegate + { + ReconnectBarIp(); + })); + } + else + { + SConnector.FormMain.Invoke(new MethodInvoker(delegate + { + ReconnectBar(); + })); + } + + } + RecconectFlag = false; + RecconectFlagIp = false; + + Proc.Dispose(); + Proc = null; + } + public void Activ(bool act) { this.Active = act; @@ -154,9 +195,7 @@ namespace Remontor.Connector } public IModeMon SetModeMon(IModeMon Mode) - { - ModeMonitor = ModeMonitor.Change(Mode); ModeMonitor.Resize(Proc, View); return ModeMonitor; @@ -175,14 +214,53 @@ namespace Remontor.Connector return Comp.GetName() + "(" + Comp.GetNetNameStr() + ")"; } - public void Delete() + + public async void DelBar() { - if (Proc != null) Proc.CloseMainWindow(); + SConnector.DeleteConnect(this); ModeMonitor = new OffMon(); SConnector.Panel.Controls.Remove(View); - if (Proc != null) Proc.Close(); - if (Proc != null) Proc.Dispose(); - Proc = null; + + } + + public async void ReconnectBar() + { + SConnector.NewConnect(Comp); + } + + public async void ReconnectBarIp() + { + SConnector.NewConnectIP(Comp); + } + + public void Delete() + { + if (Proc != null) + { + Proc.CloseMainWindow(); + } + } + + public void Reconnect() + { + RecconectFlag = true; + RecconectFlagIp = false; + if (Proc != null) + { + + Proc.CloseMainWindow(); + } + } + + public void ReconnectIP() + { + RecconectFlag = true; + RecconectFlagIp = true; + if (Proc != null) + { + + Proc.CloseMainWindow(); + } } } } diff --git a/Remontor/FlowContainerWords.cs b/Remontor/FlowContainerWords.cs index 8b58b1c..648d55b 100644 --- a/Remontor/FlowContainerWords.cs +++ b/Remontor/FlowContainerWords.cs @@ -25,11 +25,11 @@ namespace Remontor { InitializeComponent(); NormalSize = this.Size; - + this.Visible = true; + - //WordsList.MainCategory = SGlobalSetting.LoadWords(); - + WordsTree.Nodes.AddRange(WordsList.ListNodes()); SGlobalSetting.settingExpand.ExpendAll(WordsTree.Nodes); @@ -52,14 +52,16 @@ namespace Remontor { if(barShow == BarShow.ShowWords) { - this.Visible = true; + this.Height = NormalSize.Height; + } else { - this.Visible = false; + this.Height = 0; + //this.Visible = false; } - return this.Visible; + return (this.Height != 0); } diff --git a/Remontor/Form1.Designer.cs b/Remontor/Form1.Designer.cs index 8ffa86a..27962ac 100644 --- a/Remontor/Form1.Designer.cs +++ b/Remontor/Form1.Designer.cs @@ -93,7 +93,6 @@ this.flowContainerWords1.Name = "flowContainerWords1"; this.flowContainerWords1.Size = new System.Drawing.Size(330, 678); this.flowContainerWords1.TabIndex = 1; - this.flowContainerWords1.Visible = false; // // flowConteinerSetting1 // diff --git a/Remontor/MenuStripCommand.cs b/Remontor/MenuStripCommand.cs index c435383..e53e7f9 100644 --- a/Remontor/MenuStripCommand.cs +++ b/Remontor/MenuStripCommand.cs @@ -70,22 +70,28 @@ namespace Remontor { if (NowConnect != null) { - SConnector.DeleteConnect(NowConnect); - NowConnect.Delete(); + SConnector.ActionConnect.Reconnect(); } - if (actForm != null) actForm.Close(); - SConnector.NewConnect(Comp); + else + { + if (actForm != null) actForm.Close(); + SConnector.NewConnect(Comp); + } + } private void CommandConnecIP_Click(object sender, EventArgs e) { if (NowConnect != null) { - SConnector.DeleteConnect(NowConnect); - NowConnect.Delete(); + SConnector.ActionConnect.ReconnectIP(); } - if (actForm != null) actForm.Close(); - if (Comp.GetIP() != null)SConnector.NewConnectIP(Comp); + else + { + if (actForm != null) actForm.Close(); + if (Comp.GetIP() != null) SConnector.NewConnectIP(Comp); + } + } private void CommandConnectRDP_Click(object sender, EventArgs e) @@ -97,7 +103,7 @@ namespace Remontor private void CommandOpenFS_Click(object sender, EventArgs e) { if (actForm != null) actForm.Close(); - Process.Start("explorer", @"\\" + Comp.GetNetNameStr()); + Process.Start("explorer", @"\\" + Comp.GetNetNameStr() + @"\c$"); } private void CommandOpenRegEdit_Click(object sender, EventArgs e) diff --git a/Remontor/Picter/PicBaseWords.cs b/Remontor/Picter/PicBaseWords.cs index 70ecc0f..58d1ad2 100644 --- a/Remontor/Picter/PicBaseWords.cs +++ b/Remontor/Picter/PicBaseWords.cs @@ -21,6 +21,7 @@ namespace Remontor.Picter }; public static Image GetImageMax(int index) { + return CollectImgMax[index]; } } diff --git a/Remontor/Picter/SPicManager.cs b/Remontor/Picter/SPicManager.cs index 4cfe773..fa7a1d4 100644 --- a/Remontor/Picter/SPicManager.cs +++ b/Remontor/Picter/SPicManager.cs @@ -18,7 +18,7 @@ namespace Remontor.Picter IComp Comp = WordsList.FindCompName(comp.GetNetName()); if(Comp != null) { - image.Image = PicBaseWords.GetImageMax(comp.GetImage()); + image.Image = PicBaseWords.GetImageMax(Comp.GetImage()); return; } else diff --git a/Remontor/bin/Debug/Remontor.exe b/Remontor/bin/Debug/Remontor.exe index 3d96d87..75ce7e8 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 31e7a98..c537213 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 8e6ddd5..c3af0fb 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 430becc..7f8c9de 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index de8a43a..674cc3d 100644 Binary files a/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache and b/Remontor/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt b/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt index 7813c23..77bea2a 100644 --- a/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt +++ b/Remontor/obj/Debug/Remontor.csproj.FileListAbsolute.txt @@ -54,3 +54,5 @@ C:\Users\klavi\source\repos\Remontor\Remontor\obj\Debug\Remontor.FlowConteinerSe C:\Users\klavi\source\repos\Remontor\Remontor\obj\Debug\Remontor.Setting.settingAppControl.resources C:\Users\klavi\source\repos\Remontor\Remontor\obj\Debug\Remontor.MenuStripCommand.resources C:\Users\klavi\source\repos\Remontor\Remontor\obj\Debug\Remontor.Words.AboutForm.resources +C:\Users\Владимир\source\repos\Remontor\Remontor\obj\Debug\Remontor.MenuStripCommand.resources +C:\Users\Владимир\source\repos\Remontor\Remontor\obj\Debug\Remontor.Words.AboutForm.resources diff --git a/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache b/Remontor/obj/Debug/Remontor.csproj.GenerateResource.cache index aeafc33..6972694 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 3d96d87..75ce7e8 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 31e7a98..c537213 100644 Binary files a/Remontor/obj/Debug/Remontor.pdb and b/Remontor/obj/Debug/Remontor.pdb differ