/// <summary> /// Command execution /// </summary> public override CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { PipeTerminalParameter paramInit = null; PipeTerminalSettings settingsInit = null; IExtensionPoint ext = PipePlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint("org.poderosa.terminalsessions.loginDialogUISupport"); if (ext != null && ext.ExtensionInterface == typeof(ILoginDialogUISupport)) { foreach (ILoginDialogUISupport sup in ext.GetExtensions()) { ITerminalParameter terminalParam; ITerminalSettings terminalSettings; sup.FillTopDestination(typeof(PipeTerminalParameter), out terminalParam, out terminalSettings); PipeTerminalParameter paramTemp = terminalParam as PipeTerminalParameter; PipeTerminalSettings settingsTemp = terminalSettings as PipeTerminalSettings; if (paramInit == null) { paramInit = paramTemp; } if (settingsInit == null) { settingsInit = settingsTemp; } } } if (paramInit == null) { paramInit = new PipeTerminalParameter(); } if (settingsInit == null) { settingsInit = new PipeTerminalSettings(); } IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow)); CommandResult commandResult = CommandResult.Failed; using (OpenPipeDialog dialog = new OpenPipeDialog()) { dialog.OpenPipe = delegate(PipeTerminalParameter param, PipeTerminalSettings settings) { PipeTerminalConnection connection = PipeCreator.CreateNewPipeTerminalConnection(param, settings); commandResult = PipePlugin.Instance.CommandManager.Execute( PipePlugin.Instance.TerminalSessionsService.TerminalSessionStartCommand, window, connection, settings); return(commandResult == CommandResult.Succeeded); }; dialog.ApplyParams(paramInit, settingsInit); DialogResult dialogResult = dialog.ShowDialog(window != null ? window.AsForm() : null); if (dialogResult == DialogResult.Cancel) { commandResult = CommandResult.Cancelled; } } return(commandResult); }
/// <summary> /// Command execution /// </summary> public override CommandResult InternalExecute(ICommandTarget target, params IAdaptable[] args) { PipeTerminalParameter paramInit = null; PipeTerminalSettings settingsInit = null; IExtensionPoint ext = PipePlugin.Instance.PoderosaWorld.PluginManager.FindExtensionPoint("org.poderosa.terminalsessions.loginDialogUISupport"); if (ext != null && ext.ExtensionInterface == typeof(ILoginDialogUISupport)) { foreach (ILoginDialogUISupport sup in ext.GetExtensions()) { ITerminalParameter terminalParam; ITerminalSettings terminalSettings; sup.FillTopDestination(typeof(PipeTerminalParameter), out terminalParam, out terminalSettings); PipeTerminalParameter paramTemp = terminalParam as PipeTerminalParameter; PipeTerminalSettings settingsTemp = terminalSettings as PipeTerminalSettings; if (paramInit == null) paramInit = paramTemp; if (settingsInit == null) settingsInit = settingsTemp; } } if (paramInit == null) paramInit = new PipeTerminalParameter(); if (settingsInit == null) settingsInit = new PipeTerminalSettings(); IPoderosaMainWindow window = (IPoderosaMainWindow)target.GetAdapter(typeof(IPoderosaMainWindow)); CommandResult commandResult = CommandResult.Failed; using (OpenPipeDialog dialog = new OpenPipeDialog()) { dialog.OpenPipe = delegate(PipeTerminalParameter param, PipeTerminalSettings settings) { PipeTerminalConnection connection = PipeCreator.CreateNewPipeTerminalConnection(param, settings); commandResult = PipePlugin.Instance.CommandManager.Execute( PipePlugin.Instance.TerminalSessionsService.TerminalSessionStartCommand, window, connection, settings); return (commandResult == CommandResult.Succeeded); }; dialog.ApplyParams(paramInit, settingsInit); DialogResult dialogResult = dialog.ShowDialog(window != null ? window.AsForm() : null); if (dialogResult == DialogResult.Cancel) commandResult = CommandResult.Cancelled; } return commandResult; }