private void btnBillNo_Click(object sender, EventArgs e) { DataTable dt = bll.FillDataTable("WMS.SelectBillMaster", new DataParameter[] { new DataParameter("{0}", string.Format("TaskType='11' and AreaCode='{0}'",AreaCode)) }); SelectDialog selectDialog = new SelectDialog(dt, BillFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtBillNo.Text = selectDialog["BillID"]; } }
private void btnProductCode_Click(object sender, EventArgs e) { if (this.txtBillNo.Text.Trim().Length <= 0) { MessageBox.Show("请先选择入库单据号", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); this.txtBillNo.Focus(); return; } DataTable dt = bll.FillDataTable("CMD.SelectProduct", new DataParameter[] { new DataParameter("{0}", string.Format("AreaCode='{0}'",AreaCode))}); SelectDialog selectDialog = new SelectDialog(dt, ProductFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtProductCode.Text = selectDialog["ProductCode"]; } }
private void btnTaskID_Click(object sender, EventArgs e) { DataTable dt = bll.FillDataTable("WCS.SelectTask", new DataParameter[] { new DataParameter("{0}", string.Format("WCS_TASK.TaskType='11' and WCS_TASK.CellCode='{0}'",CellCode)) }); SelectDialog selectDialog = new SelectDialog(dt, TaskFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtTaskNo.Text = selectDialog["TaskNo"]; } }
private void OnSelectDialogExit(SelectDialog<string> dialog) { if (!dialog.EscPressed) { switch (dialog.GetSelectionIndex ()) { case 0: var startDialog = new ExecuteProgramDialog (this.programInformation, false, useEscToStop); startDialog.Start (Parent); break; case 1: if (!programInformation.IsAOTCompiled) { compileBeforeExecution.SetFocus (Parent, OnCompileInfoDialogExit); } else { var start = new ExecuteProgramDialog (this.programInformation, true, useEscToStop); start.Start (Parent); } break; case 2: if (programInformation.IsAOTCompiled) { aotQuestionDialog.SetFocus (Parent,OnCompileDialogExit); } else { compileDialog.SetFocus (Parent); } break; case 3: deleteQuestionDialog.SetFocus (Parent,OnDeleteDialogExit); break; } } }
protected void OnProgressDialogResponse(object o, EventArgs args) { if (list != null && list.Count > 0) { SelectDialog listDialog = new SelectDialog (list, searchCategory); int selection = listDialog.Run(); if (selection != -1) { results = (SearchResults)list[selection]; FillDialogFromSearch (results); } } else { string message = (Mono.Posix.Catalog.GetString ("No matches for your query")); MessageDialog dialog = new MessageDialog (null, DialogFlags.Modal | DialogFlags.DestroyWithParent, MessageType.Warning, ButtonsType.Close, message); dialog.Run (); dialog.Destroy (); } }
private void CreateMissingClassMenuItem_Click(object sender, EventArgs e) { if (this.SystemImplementation == null) return; List<Definitions.Description.Global> globals = new List<Definitions.Description.Global>(); foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols) globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalClass))); SelectDialog<Definitions.Description.Global> dlg = new SelectDialog<Definitions.Description.Global>(); dlg.CheckBoxes = true; dlg.Items = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name); dlg.Columns = new SelectDialogColumn<Definitions.Description.Global>[] { new SelectDialogColumn<Definitions.Description.Global>("Global", 200, (g => g.Name)), new SelectDialogColumn<Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name)) }; if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK) return; foreach(var g in dlg.SelectedItems) { Class cls = new Class(this.SystemImplementation); cls.Name = g.Name; cls.SuperclassName = "Object"; cls.Description = g.Description; cls.ImplementedClassProtocols.Add(g.Protocol.Name); cls.Initializer.Source = g.Initializer; cls.InstanceState = InstanceStateEnum.NamedObjectVariables; cls.DefiningProtocol = g.Protocol.Name; if (!this.SystemImplementation.GlobalItems.Contains(cls)) this.SystemImplementation.GlobalItems.Add(cls); } this.SystemImplementation.GlobalItems.TriggerChanged(); }
static bool ShowProgramOptions(string programFolder) { string fileName = ""; try { fileName = Directory.EnumerateFiles (programFolder, "*.exe").First (); } catch { var info = new InfoDialog (programFolder + "is not executable", true, "Program"); info.Show (); Directory.Delete (programFolder, true); updateProgramList = true; return true; } var dialog = new SelectDialog<string> (new string[] { "Run Program", "Debug Program", "Run In AOT", "AOT Compile", "Delete Program", }, "Options", true); dialog.Show (); if (!dialog.EscPressed) { Action programAction = null; switch (dialog.GetSelectionIndex ()) { case 0: Lcd.Instance.Clear (); Lcd.Instance.DrawBitmap (monoLogo, new Point ((int)(Lcd.Width - monoLogo.Width) / 2, 5)); Rectangle textRect = new Rectangle (new Point (0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point (Lcd.Width, Lcd.Height - 2)); Lcd.Instance.WriteTextBox (Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center); Lcd.Instance.Update (); programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.Normal); break; case 1: programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.Debug); break; case 2: if (!AOTHelper.IsFileCompiled (fileName)) { if (AOTCompileAndShowDialog (programFolder)) { programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.AOT); } } else { programAction = () => RunAndWaitForProgram (fileName, ExecutionMode.AOT); } break; case 3: if (AOTHelper.IsFileCompiled (fileName)) { var questionDialog = new QuestionDialog ("Progran already compiled. Recompile?", "AOT recompile"); if (questionDialog.Show ()) { AOTCompileAndShowDialog (programFolder); } } else { AOTCompileAndShowDialog (programFolder); } break; case 4: var question = new QuestionDialog ("Are you sure?", "Delete"); if (question.Show ()) { var step = new StepContainer (() => { Directory.Delete (programFolder, true); return true; }, "Deleting ", "Error deleting program"); var progressDialog = new ProgressDialog ("Program", step); progressDialog.Show (); updateProgramList = true; } break; } if (programAction != null) { Console.WriteLine("Starting application"); programAction(); Console.WriteLine ("Done running application"); } return updateProgramList; } return false; }
static bool ShowProgramOptions (ProgramInformation program) { var dialog = new SelectDialog<string> (new string[] { "Run Program", "Run In AOT", "AOT Compile", "Delete Program", }, "Options", true); dialog.Show (); if (!dialog.EscPressed) { Action programAction = null; switch (dialog.GetSelectionIndex ()) { case 0: Lcd.Instance.Clear (); Lcd.Instance.DrawBitmap (monoLogo, new Point ((int)(Lcd.Width - monoLogo.Width) / 2, 5)); Rectangle textRect = new Rectangle (new Point (0, Lcd.Height - (int)Font.SmallFont.maxHeight - 2), new Point (Lcd.Width, Lcd.Height - 2)); Lcd.Instance.WriteTextBox (Font.SmallFont, textRect, "Running...", true, Lcd.Alignment.Center); Lcd.Instance.Update (); programAction = () => ProgramManager.Instance.StartProgram(program,false); break; case 1: if (!program.IsAOTCompiled) { if (AOTCompileAndShowDialog (program)) { programAction = () => ProgramManager.Instance.StartProgram(program,true); } } else { programAction = () => ProgramManager.Instance.StartProgram(program, true); } break; case 3: if (program.IsAOTCompiled) { var questionDialog = new QuestionDialog ("Progran already compiled. Recompile?", "AOT recompile"); if (questionDialog.Show ()) { AOTCompileAndShowDialog (program); } } else { AOTCompileAndShowDialog (program); } break; case 4: var question = new QuestionDialog ("Are you sure?", "Delete"); if (question.Show ()) { var step = new StepContainer (() => {ProgramManager.Instance.DeleteProgram(program); return true;}, "Deleting ", "Error deleting program"); var progressDialog = new ProgressDialog ("Program", step); progressDialog.Show (); updateProgramList = true; } break; } if (programAction != null) { Console.WriteLine("Starting application"); programAction(); Console.WriteLine ("Done running application"); } return updateProgramList; } return false; }
private void btnState_Click(object sender, EventArgs e) { DataTable dt = bll.FillDataTable("CMD.SelectProductState"); SelectDialog selectDialog = new SelectDialog(dt, StateFields, false); if (selectDialog.ShowDialog() == DialogResult.OK) { this.txtStateNo.Text = selectDialog["StateNo"]; } }
private void CreateMissingGlobalMenuItem_Click(object sender, EventArgs e) { if (this.SystemImplementation == null) return; List<Definitions.Description.Global> globals = new List<Definitions.Description.Global>(); foreach (var prot in this.SystemImplementation.SmalltalkSystem.SystemDescription.Protocols) globals.AddRange(prot.StandardGlobals.Where(g => (g.Definition == null) || (g.Definition is Definitions.Description.GlobalVariable) || (g.Definition is Definitions.Description.GlobalConstant))); SelectDialog<Definitions.Description.Global> dlg = new SelectDialog<Definitions.Description.Global>(); dlg.CheckBoxes = true; dlg.Items = globals.Where(g => !this.SystemImplementation.GlobalItems.Any(x => x.Name == g.Name)).OrderBy(g => g.Name); dlg.Columns = new SelectDialogColumn<Definitions.Description.Global>[] { new SelectDialogColumn<Definitions.Description.Global>("Global", 200, (g => g.Name)), new SelectDialogColumn<Definitions.Description.Global>("Protocol", 200, (g => g.Protocol.Name)) }; if (dlg.ShowDialog(this.TopLevelControl) != DialogResult.OK) return; foreach (var g in dlg.SelectedItems) { Global global = new Global(this.SystemImplementation); global.Name = g.Name; global.GlobalType = (g.Definition is Definitions.Description.GlobalConstant) ? GlobalTypeEnum.Constant : GlobalTypeEnum.Variable; global.Description = g.Description; global.ImplementedProtocols.Add(g.Protocol.Name); global.Initializer.Source = g.Initializer; global.DefiningProtocol = g.Protocol.Name; global.Description = g.Description; if (!this.SystemImplementation.GlobalItems.Contains(global)) this.SystemImplementation.GlobalItems.Add(global); } this.SystemImplementation.GlobalItems.TriggerChanged(); }