private void OnOK(object sender, EventArgs args) { this.DialogResult = DialogResult.None; if (_homeDirectoryBox.Text.Length == 0) { GUtil.Warning(this, GApp.Strings.GetString("Message.CygwinLoginDialog.EmptyHomeDirectory")); } else if (_shellBox.Text.Length == 0) { GUtil.Warning(this, GApp.Strings.GetString("Message.CygwinLoginDialog.EmptyShell")); } _param.LogType = (LogType)EnumDescAttributeT.For(typeof(LogType)).FromDescription(_logTypeBox.Text, LogType.None); if (_param.LogType != LogType.None) { _param.LogPath = _logFileBox.Text; LogFileCheckResult r = GCUtil.CheckLogFileName(_param.LogPath, this); if (r == LogFileCheckResult.Cancel || r == LogFileCheckResult.Error) { return; } _param.LogAppend = (r == LogFileCheckResult.Append); } _param.Home = _homeDirectoryBox.Text; _param.Shell = _shellBox.Text; _okButton.Enabled = false; _cancelButton.Enabled = false; this.Cursor = Cursors.WaitCursor; _savedHWND = this.Handle; if (_param is CygwinTerminalParam) { this.Text = GApp.Strings.GetString("Caption.CygwinLoginDialog.ConnectingCygwin"); } else { this.Text = GApp.Strings.GetString("Caption.CygwinLoginDialog.ConnectingSFU"); } _connector = CygwinUtil.AsyncPrepareSocket(this, _param); if (_connector == null) { ClearConnectingState(); } }
public CommandResult NewCygwinConnectionWithDialog(CygwinTerminalParam param) { if (!CheckPaneCount()) { return(CommandResult.Denied); } if (CygwinUtil.GuessRootDirectory().Length == 0) { return(CommandResult.Failed); } LocalShellLoginDialog dlg = new LocalShellLoginDialog(); if (param != null) { dlg.ApplyParam(param); } else { dlg.ApplyParam(GApp.ConnectionHistory.TopCygwinParam); } CommandResult res = CommandResult.Cancelled; if (GCUtil.ShowModalDialog(_frame, dlg) == DialogResult.OK) { ConnectionTag con = dlg.Result; if (con != null) { AddNewTerminal(con); res = CommandResult.Success; } } dlg.Dispose(); return(res); }
public static void Terminate() { CygwinUtil.Terminate(); }