public static void Prot_Event_Closed(object sender) { try { ProtocolBase Prot = (ProtocolBase)sender; MessageCollector.AddMessage(MessageClass.InformationMsg, Language.strConnenctionCloseEvent, true); MessageCollector.AddMessage(MessageClass.ReportMsg, string.Format(Language.strConnenctionClosedByUser, Prot.InterfaceControl.Info.Hostname, Prot.InterfaceControl.Info.Protocol.ToString(), Environment.UserName)); Prot.InterfaceControl.Info.OpenConnections.Remove(Prot); if (Prot.InterfaceControl.Info.OpenConnections.Count < 1 && Prot.InterfaceControl.Info.IsQuickConnect == false) { ConnectionTreeNode.SetNodeImage(Prot.InterfaceControl.Info.TreeNode, TreeImageType.ConnectionClosed); } if (Prot.InterfaceControl.Info.PostExtApp != "") { ExternalTool extA = GetExtAppByName(Prot.InterfaceControl.Info.PostExtApp); if (extA != null) { extA.Start(Prot.InterfaceControl.Info); } } } catch (Exception ex) { MessageCollector.AddMessage(MessageClass.ErrorMsg, Language.strConnenctionCloseEventFailed + Environment.NewLine + ex.Message, true); } }
private static void StartPreConnectionExternalApp(ConnectionInfo ConnectionInfo) { if (ConnectionInfo.PreExtApp != "") { ExternalTool extA = GetExtAppByName(ConnectionInfo.PreExtApp); extA?.Start(ConnectionInfo); } }
public override bool Connect() { try { if (_externalTool.TryIntegrate == false) { _externalTool.Start(InterfaceControl.Info); Close(); return(false); } ExternalToolArgumentParser argParser = new ExternalToolArgumentParser(_externalTool.ConnectionInfo); _process = new Process(); _process.StartInfo.UseShellExecute = true; _process.StartInfo.FileName = argParser.ParseArguments(_externalTool.FileName); _process.StartInfo.Arguments = argParser.ParseArguments(_externalTool.Arguments); _process.EnableRaisingEvents = true; _process.Exited += ProcessExited; _process.Start(); _process.WaitForInputIdle(Convert.ToInt32(Settings.Default.MaxPuttyWaitTime * 1000)); int startTicks = Environment.TickCount; while (_handle.ToInt32() == 0 & Environment.TickCount < startTicks + (Settings.Default.MaxPuttyWaitTime * 1000)) { _process.Refresh(); if (_process.MainWindowTitle != "Default IME") { _handle = _process.MainWindowHandle; } if (_handle.ToInt32() == 0) { Thread.Sleep(0); } } NativeMethods.SetParent(_handle, InterfaceControl.Handle); Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, Language.strIntAppStuff, true); Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle.ToString()), true); Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true); Runtime.MessageCollector.AddMessage(Messages.MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle.ToString()), true); Resize(this, new EventArgs()); base.Connect(); return(true); } catch (Exception ex) { Runtime.MessageCollector.AddExceptionMessage(Language.strIntAppConnectionFailed, ex); return(false); } }
private void StartExternalApp(ExternalTool externalTool) { try { var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; externalTool.Start(interfaceControl?.Info); } catch (Exception ex) { Runtime.MessageCollector.AddMessage(MessageClass.ErrorMsg, "cmenTabExternalAppsEntry_Click failed (UI.Window.ConnectionWindow)" + Environment.NewLine + ex.Message, true); } }
private void StartExternalApp(ExternalTool externalTool) { try { var interfaceControl = TabController.SelectedTab?.Tag as InterfaceControl; externalTool.Start(interfaceControl?.Info); } catch (Exception ex) { Runtime.MessageCollector.AddExceptionMessage("cmenTabExternalAppsEntry_Click failed (UI.Window.ConnectionWindow)", ex); } }
private void StartExternalApp(ExternalTool externalTool) { try { if (SelectedNode.GetTreeNodeType() == TreeNodeType.Connection | SelectedNode.GetTreeNodeType() == TreeNodeType.PuttySession) { externalTool.Start(SelectedNode); } } catch (Exception ex) { Runtime.MessageCollector.AddExceptionStackTrace("cMenTreeToolsExternalAppsEntry_Click failed (UI.Window.ConnectionTreeWindow)", ex); } }
public override bool Connect() { try { Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Attempting to start: {_externalTool.DisplayName}", true); if (_externalTool.TryIntegrate == false) { _externalTool.Start(InterfaceControl.Info); /* Don't call close here... There's nothing for the override to do in this case since * _process is not created in this scenario. When returning false, ProtocolBase.Close() * will be called - which is just going to call IntegratedProgram.Close() again anyway... * Close(); */ Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, $"Assuming no other errors/exceptions occurred immediately before this message regarding {_externalTool.DisplayName}, the next \"closed by user\" message can be ignored", true); return(false); } var argParser = new ExternalToolArgumentParser(_externalTool.ConnectionInfo); _process = new Process { StartInfo = { UseShellExecute = true, FileName = argParser.ParseArguments(_externalTool.FileName), Arguments = argParser.ParseArguments(_externalTool.Arguments) }, EnableRaisingEvents = true }; _process.Exited += ProcessExited; _process.Start(); _process.WaitForInputIdle(Settings.Default.MaxPuttyWaitTime * 1000); var startTicks = Environment.TickCount; while (_handle.ToInt32() == 0 & Environment.TickCount < startTicks + Settings.Default.MaxPuttyWaitTime * 1000) { _process.Refresh(); if (_process.MainWindowTitle != "Default IME") { _handle = _process.MainWindowHandle; } if (_handle.ToInt32() == 0) { Thread.Sleep(0); } } NativeMethods.SetParent(_handle, InterfaceControl.Handle); Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, Language.strIntAppStuff, true); Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppHandle, _handle), true); Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppTitle, _process.MainWindowTitle), true); Runtime.MessageCollector?.AddMessage(MessageClass.InformationMsg, string.Format(Language.strIntAppParentHandle, InterfaceControl.Parent.Handle), true); Resize(this, new EventArgs()); base.Connect(); return(true); } catch (Exception ex) { Runtime.MessageCollector?.AddExceptionMessage(Language.strIntAppConnectionFailed, ex); return(false); } }