Сделал задержку закрытия ремоутера
This commit is contained in:
parent
fcbc5c5b7d
commit
3ae22202b9
Binary file not shown.
|
|
@ -54,7 +54,7 @@ namespace Remontor
|
||||||
|
|
||||||
private void CloseBtn_Click(object sender, EventArgs e)
|
private void CloseBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SConnector.DeleteConnect(connect);
|
|
||||||
connect.Delete();
|
connect.Delete();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -161,9 +161,9 @@ namespace Remontor
|
||||||
|
|
||||||
if (SConnector.ActionConnect != null)
|
if (SConnector.ActionConnect != null)
|
||||||
{
|
{
|
||||||
SConnector.DeleteConnect(SConnector.ActionConnect);
|
// SConnector.DeleteConnect(SConnector.ActionConnect);
|
||||||
SConnector.ActionConnect.Delete();
|
SConnector.ActionConnect.Reconnect();
|
||||||
SConnector.NewConnect(SConnector.ActionConnect.GetComp);
|
// SConnector.NewConnect(SConnector.ActionConnect.GetComp);
|
||||||
}
|
}
|
||||||
}else if (e.Button == MouseButtons.Right)
|
}else if (e.Button == MouseButtons.Right)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,12 @@ using System.Drawing;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Runtime.Remoting.Contexts;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
using static System.Windows.Forms.VisualStyles.VisualStyleElement;
|
||||||
|
|
||||||
namespace Remontor.Connector
|
namespace Remontor.Connector
|
||||||
{
|
{
|
||||||
|
|
@ -69,6 +71,9 @@ namespace Remontor.Connector
|
||||||
public event UpdateConnect Update;
|
public event UpdateConnect Update;
|
||||||
public Control View;
|
public Control View;
|
||||||
public IntPtr hwnd;
|
public IntPtr hwnd;
|
||||||
|
private bool RecconectFlag, RecconectFlagIp;
|
||||||
|
|
||||||
|
|
||||||
public Connect(IComp comp)
|
public Connect(IComp comp)
|
||||||
{
|
{
|
||||||
Comp = comp;
|
Comp = comp;
|
||||||
|
|
@ -92,11 +97,14 @@ namespace Remontor.Connector
|
||||||
Proc = Process.Start(SGlobalSetting.settingApp.pathApp, ConnectStr);
|
Proc = Process.Start(SGlobalSetting.settingApp.pathApp, ConnectStr);
|
||||||
//Proc = Process.Start(SGlobalSetting.settingApp.pathApp);
|
//Proc = Process.Start(SGlobalSetting.settingApp.pathApp);
|
||||||
Proc.WaitForInputIdle();
|
Proc.WaitForInputIdle();
|
||||||
|
Proc.EnableRaisingEvents = true;
|
||||||
|
Proc.Exited += Proc_Exited;
|
||||||
SetParent(Proc.MainWindowHandle, View.Handle);
|
SetParent(Proc.MainWindowHandle, View.Handle);
|
||||||
SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
|
SetWindowLong(Proc.MainWindowHandle, GWL_STYLE, WS_VISIBLE);
|
||||||
ModeMonitor.Resize(Proc, View);
|
ModeMonitor.Resize(Proc, View);
|
||||||
//Thread.Sleep(500);
|
//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 CenterView = new Point(View.Bounds.Width/2, View.Bounds.Height/2);
|
||||||
Point CenterDraw = View.PointToScreen(CenterView);
|
Point CenterDraw = View.PointToScreen(CenterView);
|
||||||
MoveWindow(hwnd, CenterDraw.X- 325, CenterDraw.Y - 125 ,650,250,true);
|
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)
|
public void Activ(bool act)
|
||||||
{
|
{
|
||||||
this.Active = act;
|
this.Active = act;
|
||||||
|
|
@ -154,9 +195,7 @@ namespace Remontor.Connector
|
||||||
}
|
}
|
||||||
|
|
||||||
public IModeMon SetModeMon(IModeMon Mode)
|
public IModeMon SetModeMon(IModeMon Mode)
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
ModeMonitor = ModeMonitor.Change(Mode);
|
ModeMonitor = ModeMonitor.Change(Mode);
|
||||||
ModeMonitor.Resize(Proc, View);
|
ModeMonitor.Resize(Proc, View);
|
||||||
return ModeMonitor;
|
return ModeMonitor;
|
||||||
|
|
@ -175,14 +214,53 @@ namespace Remontor.Connector
|
||||||
return Comp.GetName() + "(" + Comp.GetNetNameStr() + ")";
|
return Comp.GetName() + "(" + Comp.GetNetNameStr() + ")";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Delete()
|
|
||||||
|
public async void DelBar()
|
||||||
{
|
{
|
||||||
if (Proc != null) Proc.CloseMainWindow();
|
SConnector.DeleteConnect(this);
|
||||||
ModeMonitor = new OffMon();
|
ModeMonitor = new OffMon();
|
||||||
SConnector.Panel.Controls.Remove(View);
|
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();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,11 +25,11 @@ namespace Remontor
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
NormalSize = this.Size;
|
NormalSize = this.Size;
|
||||||
|
this.Visible = true;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//WordsList.MainCategory = SGlobalSetting.LoadWords();
|
//WordsList.MainCategory = SGlobalSetting.LoadWords();
|
||||||
|
|
||||||
WordsTree.Nodes.AddRange(WordsList.ListNodes());
|
WordsTree.Nodes.AddRange(WordsList.ListNodes());
|
||||||
SGlobalSetting.settingExpand.ExpendAll(WordsTree.Nodes);
|
SGlobalSetting.settingExpand.ExpendAll(WordsTree.Nodes);
|
||||||
|
|
||||||
|
|
@ -52,14 +52,16 @@ namespace Remontor
|
||||||
{
|
{
|
||||||
if(barShow == BarShow.ShowWords)
|
if(barShow == BarShow.ShowWords)
|
||||||
{
|
{
|
||||||
this.Visible = true;
|
this.Height = NormalSize.Height;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.Visible = false;
|
this.Height = 0;
|
||||||
|
//this.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.Visible;
|
return (this.Height != 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,6 @@
|
||||||
this.flowContainerWords1.Name = "flowContainerWords1";
|
this.flowContainerWords1.Name = "flowContainerWords1";
|
||||||
this.flowContainerWords1.Size = new System.Drawing.Size(330, 678);
|
this.flowContainerWords1.Size = new System.Drawing.Size(330, 678);
|
||||||
this.flowContainerWords1.TabIndex = 1;
|
this.flowContainerWords1.TabIndex = 1;
|
||||||
this.flowContainerWords1.Visible = false;
|
|
||||||
//
|
//
|
||||||
// flowConteinerSetting1
|
// flowConteinerSetting1
|
||||||
//
|
//
|
||||||
|
|
|
||||||
|
|
@ -70,22 +70,28 @@ namespace Remontor
|
||||||
{
|
{
|
||||||
if (NowConnect != null)
|
if (NowConnect != null)
|
||||||
{
|
{
|
||||||
SConnector.DeleteConnect(NowConnect);
|
SConnector.ActionConnect.Reconnect();
|
||||||
NowConnect.Delete();
|
|
||||||
}
|
}
|
||||||
if (actForm != null) actForm.Close();
|
else
|
||||||
SConnector.NewConnect(Comp);
|
{
|
||||||
|
if (actForm != null) actForm.Close();
|
||||||
|
SConnector.NewConnect(Comp);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CommandConnecIP_Click(object sender, EventArgs e)
|
private void CommandConnecIP_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (NowConnect != null)
|
if (NowConnect != null)
|
||||||
{
|
{
|
||||||
SConnector.DeleteConnect(NowConnect);
|
SConnector.ActionConnect.ReconnectIP();
|
||||||
NowConnect.Delete();
|
|
||||||
}
|
}
|
||||||
if (actForm != null) actForm.Close();
|
else
|
||||||
if (Comp.GetIP() != null)SConnector.NewConnectIP(Comp);
|
{
|
||||||
|
if (actForm != null) actForm.Close();
|
||||||
|
if (Comp.GetIP() != null) SConnector.NewConnectIP(Comp);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CommandConnectRDP_Click(object sender, EventArgs e)
|
private void CommandConnectRDP_Click(object sender, EventArgs e)
|
||||||
|
|
@ -97,7 +103,7 @@ namespace Remontor
|
||||||
private void CommandOpenFS_Click(object sender, EventArgs e)
|
private void CommandOpenFS_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (actForm != null) actForm.Close();
|
if (actForm != null) actForm.Close();
|
||||||
Process.Start("explorer", @"\\" + Comp.GetNetNameStr());
|
Process.Start("explorer", @"\\" + Comp.GetNetNameStr() + @"\c$");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CommandOpenRegEdit_Click(object sender, EventArgs e)
|
private void CommandOpenRegEdit_Click(object sender, EventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ namespace Remontor.Picter
|
||||||
};
|
};
|
||||||
public static Image GetImageMax(int index)
|
public static Image GetImageMax(int index)
|
||||||
{
|
{
|
||||||
|
|
||||||
return CollectImgMax[index];
|
return CollectImgMax[index];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ namespace Remontor.Picter
|
||||||
IComp Comp = WordsList.FindCompName(comp.GetNetName());
|
IComp Comp = WordsList.FindCompName(comp.GetNetName());
|
||||||
if(Comp != null)
|
if(Comp != null)
|
||||||
{
|
{
|
||||||
image.Image = PicBaseWords.GetImageMax(comp.GetImage());
|
image.Image = PicBaseWords.GetImageMax(Comp.GetImage());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -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.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.MenuStripCommand.resources
|
||||||
C:\Users\klavi\source\repos\Remontor\Remontor\obj\Debug\Remontor.Words.AboutForm.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
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue