private void btnCommands_Click(object sender, EventArgs e) { CommandForm cf = new CommandForm(); cf.Show(); Hide(); }
private void CommandMainForm_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Escape) { CommandForm.Close(); } }
public LockShipButton(int flid, CommandForm par) { fleetid = flid; form = par; Click += new EventHandler(CommandButtonClick); }
public commandEditor(CommandForm argControl, CommandLoaders.Command argCommand, MainWindow argMainWindow) { mainWindow = argMainWindow; parentControl = argControl; command = argCommand; InitializeComponent(); }
public async Task <IActionResult> Execute(CommandForm form) { var command = new Command { OperatorId = form.OperatorId, Ip = form.Ip, Content = form.Command }; string content; await using (var stream = new MemoryStream()) { command.WriteTo(stream); content = Encoding.UTF8.GetString(stream.ToArray()); } var pipelineFilter = new CommandLinePipelineFilter { Decoder = new PackageDecoder() }; var client = new EasyClient <PackageInfo>(pipelineFilter).AsClient(); var address = IPAddress.Parse(_serverIp); if (!await client.ConnectAsync(new IPEndPoint(address, _serverPort))) { return(StatusCode((int)HttpStatusCode.InternalServerError, "Failed to connect to the server.")); } await client.SendAsync(Encoding.UTF8.GetBytes($"{CommandKey.Connect} {ClientType.Short.ToString()}{Package.Terminator}")); await client.SendAsync(Encoding.UTF8.GetBytes($"{CommandKey.Execute} {content}{Package.Terminator}")); while (true) { var p = await client.ReceiveAsync(); if (p == null) { return(StatusCode((int)HttpStatusCode.InternalServerError, "Connection dropped.")); } if (!string.IsNullOrWhiteSpace(p.Content) && p.Content.Equals("Started", StringComparison.OrdinalIgnoreCase)) { await client.CloseAsync(); return(Ok(form.OperatorId)); } } }
protected virtual void Terminate() { _bIsRunning = false; _controlDef.Pressed = false; if (CommandForm != null) { CommandForm.Close(); } CommandForm = null; InteractionManager.Terminate(); }
public override void Run() { // MessageBox.Show("" + Plugin.FuncItems.Items[this.ScriptId]._cmdID); if (form == null) { form = new CommandForm { BackColor = Color.Aqua }; } if (form.Visible) { form.setFocus(); } else { form.Show(); form.setFocus(); } }
protected override bool RunDialog(IntPtr hwndOwner) { using (CommandForm frm = new CommandForm()) { frm.Command = this.Command; frm.Arguments = this.Arguments; bool flag = frm.ShowDialog() == DialogResult.OK; if (flag) { this.Command = frm.Command; this.Arguments = frm.Arguments; } return(flag); } }
private void DisplayForm() { if (CommandForm != null) { if (CommandForm.Visible) { CommandForm.Focus(); } else { if (DisplayFormModal) { CommandForm.ShowDialog(new WindowWrapper((IntPtr)Application.MainFrameHWND)); } else { CommandForm.Show(new WindowWrapper((IntPtr)Application.MainFrameHWND)); } } } }
public Result Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements) { application = commandData.Application.Application; doc = commandData.Application.ActiveUIDocument.Document; StoreOriginalVisibility(doc.ActiveView); CommandForm commandForm = new CommandForm(); if (DialogResult.OK == commandForm.ShowDialog()) { analysisCat = commandForm.SelectedAnalysisCategory; commandForm.Close(); mainForm = new MainForm(doc, analysisCat); if (mainForm.FoundStyles) { if (DialogResult.OK == mainForm.ShowDialog()) { DisplayManinForm(); } } } return(Result.Succeeded); }
Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements) { try { m_app = commandData.Application; m_doc = m_app.ActiveUIDocument.Document; iniDataManager = new INIDataManager(m_app); if (iniDataManager.FindINI()) { TaskDialog taskdialog = new TaskDialog("BCF Reader"); taskdialog.MainInstruction = "Open a BCF file."; taskdialog.MainContent = "Some bcf files have ever saved in this Revit project.\n You can open a new BCF file or choose a linked file on the file lists."; taskdialog.AllowCancellation = true; taskdialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink1, "Open a new BCF file."); taskdialog.AddCommandLink(TaskDialogCommandLinkId.CommandLink2, "Select a linked BCF file."); iniDataManager.ReadINI();//collect reference data into referencedictionary TaskDialogResult tResult = taskdialog.Show(); if (TaskDialogResult.CommandLink1 == tResult) { bcfFile = OpenBCF(iniDataManager.MasterFilePath); } else if (TaskDialogResult.CommandLink2 == tResult) { BcfListForm bcfForm = new BcfListForm(); bcfForm.RefDictionary = iniDataManager.RefDictionary; bcfForm.DisplayBcfFiles(); if (DialogResult.OK == bcfForm.ShowDialog()) { bcfFile = bcfForm.BCFPath; } } iniDataManager.SelectedFilePath = bcfFile; if (File.Exists(bcfFile)) { commandForm = new CommandForm(m_app, bcfFile, iniDataManager); commandForm.ShowDialog(); } else if (bcfFile == null) { } else { MessageBox.Show("BCF file dose not exist.\n" + bcfFile, "File Not Found", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else if (null != iniDataManager.MasterFilePath) { bcfFile = OpenBCF(iniDataManager.MasterFilePath); iniDataManager.SelectedFilePath = bcfFile; if (null != bcfFile) { commandForm = new CommandForm(m_app, bcfFile, iniDataManager); commandForm.ShowDialog(); } } } catch (Exception ex) { MessageBox.Show("This tool Cannot open the BCF file. Please select an appropriate file. \n" + ex.Message, "Failure: Opening BCF file", MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(Result.Succeeded); }