public void ShowAlert() { try { DataTable dtTB=GetThongBao(); foreach (DataRow rowtb in dtTB.Rows) { AlertForm alert = new AlertForm(controlBroadCast); alert.Name = "lert " + rowtb["ID"].ToString(); alert.Text = rowtb["CHU_DE"].ToString(); alert.MouseDown += new MouseEventHandler(control_MouseDown); lblthongbao = new LabelControl(); lblthongbao.Location = new System.Drawing.Point(10, 23); lblthongbao.AutoSizeMode = LabelAutoSizeMode.None; lblthongbao.Size = new System.Drawing.Size(230, 52); lblthongbao.ImageAlignToText = ImageAlignToText.LeftCenter; lblthongbao.AllowHtmlString = true; lblthongbao.Appearance.TextOptions.WordWrap = WordWrap.Wrap; lblthongbao.Appearance.Image = HelpImage.getImage4848("broadcast.png"); lblthongbao.ForeColor = Color.Blue; lblthongbao.Cursor = Cursors.Hand; lblthongbao.Text = rowtb["CHU_DE"].ToString(); lblthongbao.MouseDown += new MouseEventHandler(control_MouseDown); lblthongbao.Tag = rowtb; alert.Controls.Add(lblthongbao); alert.Tag = rowtb; alert.ShowForm(formMain); } } catch { } }
protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == WM_DRAWCLIPBOARD) { var iData = Clipboard.GetDataObject(); if (iData.GetDataPresent(DataFormats.Text)) { var data = (string) iData.GetData(DataFormats.Text); if (data == lastData) return; lastData = data; logTextBox.Text = data; var text = itemParser.Parse(data); outputTextBox.Text = text; if (alert != null) { alert.Close(); } alert = new AlertForm(); alert.Closed += (sender, args) => lastData = null; alert.ShowMessage(text); } } }
public void submitAlert(Alarm alarm) { this.alarm = alarm; AlertForm form = new AlertForm(this); form.ShowDialog(); }
private void Button2_Click(object sender, EventArgs e) { try { if (this._markId == int.MinValue) { MessageBox.Show("Выбирите марку"); return; } AlertForm alertForm = new AlertForm(); if (alertForm.ShowDialog() == DialogResult.OK) { OpenDocument($@"{_pathToDocumentDirectory}\продажа.docx"); Mark mark = dB_OwnersCarsDataSet.Mark.FindById(_markId); ReplaceText("<FIO>", alertForm.FullName); ReplaceText("<Description>", alertForm.Description); ReplaceText("<DateCreation>", alertForm.DateCreation); ReplaceText("<MarkName>", mark.MarkName); ReplaceText("<StateAccurary>", alertForm.StateAccurary); _wordApplication.Visible = true; } else { MessageBox.Show("Error!"); } } catch (Exception) { } }
public static bool AlertUser(string msg) { var alert = new AlertForm(msg); alert.ShowDialog(); return(true); }
// do closing the script private void closeScript() { // has unsaved changes in the current working-on script if (ModelManager.getScriptModelByIndex(mTabControl.SelectedIndex).HaveUnsavedChanges) { AlertForm alertForm = new AlertForm("Alert", "The script has been modified and it's unsaved. Do you want to save it?", true, true, true); DialogResult result = alertForm.ShowDialog(); bool doesSaveSuccessfully = true; // don't do closing if (result == DialogResult.Cancel) { return; } // yes, do saving, then closing else if (result == DialogResult.Yes) { doesSaveSuccessfully = Program.form.saveCertainScript(mTabControl.SelectedIndex); } // not actually saving if (!doesSaveSuccessfully) { return; } } // close the script ModelManager.closeScript(); mTabControl.TabPages.RemoveAt(mTabControl.SelectedIndex); }
private void btnExit_Click(object sender, EventArgs e) { AlertForm af = new AlertForm(); af.setAlert("Your program has been minimized to system tray", AlertForm.alertTypeEnum.Info); this.Hide(); notifyIcon1.Visible = true; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); templateNameTextField.Text = template.TemplateName; var panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); var guiMethod = template.Creature.GetType().GetMethod("GUI_Edit"); var isReadyFunc = (Func <bool>)guiMethod.Invoke(template.Creature, new object[] { panel }); panel.Width = builder.FieldWidth; Wrap(); var okButton = new ResizableButton(); okButton.Initialize(); AddDrawBox(okButton); okButton.Title = "OK"; okButton.FitToText(); okButton.X = builder.FieldWidth - okButton.Width; okButton.Y = Height + 5; okButton.Click += delegate(object sender) { if (isReadyFunc()) { template.TemplateName = templateNameTextField.Text; Close(); } else { AlertForm.ShowDialogue(Parent, null, "All fields have not been filled out."); } }; builder.BuildSessionEnd(); okButton.Alignment = DrawBoxAlignment.GetRightBottom(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = true; }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); var entityTypesComboBox = builder.AddComboBoxField("Entity Type: "); var entityTypeList = Globals.GetAllTypesDeriving(typeof(IEntity), Assembly.GetExecutingAssembly()); //Remove all creature-types var creatureType = typeof(ICreature); foreach (var t in new List <Type>(entityTypeList)) { if (creatureType.IsAssignableFrom(t)) { entityTypeList.Remove(t); } } entityTypesComboBox.Items.AddRange(entityTypeList.Select(s => s.Name)); entityTypesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { if (entityTypesComboBox.Index == -1) { AlertForm.ShowDialogue(Parent, null, "Select a entity type."); } else { Result = new EntityTemplate(); Result.TemplateName = templateNameTextField.Text; Result.Entity = (IEntity)Activator.CreateInstance(entityTypeList[entityTypesComboBox.Index]); EditEntityTemplateForm.ShowDialogue(Parent, Result); Close(); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
private void btn_login_Click(object sender, EventArgs e) { AlertForm alert = new AlertForm(this); if (tb_username.Text == String.Empty) { alert.Show("Username missing!", AlertForm.COLOR_WARNING); return; } if (tb_password.Text == String.Empty) { alert.Show("Password missing!", AlertForm.COLOR_WARNING); return; } }
private void timer1_Tick(object sender, EventArgs e) { using (var dbContext = new TODOContext()) { Noti = dbContext.UserSettings.Find(1).Noti; } if (Noti) { int num = CheckTask.checkOutOfDatelineCard(); if (num > 0) { AlertForm af = new AlertForm(); af.setAlert(String.Format("You have {0} unfinished cards !", num), AlertForm.alertTypeEnum.Warning); } } }
private void CreateLOEP(int pageSize) { if (!isActiveAddin()) { return; } Doc = Globals.ThisAddIn.Application.ActiveDocument; if (!settings.check_if_edoc(Doc)) { MessageBox.Show("eDoc Only"); return; } settings.trackChange(Doc, false); alert = new AlertForm(Doc, 4, null, pageSize); alert.Show(); }
//Help void setUpHelpMenuItem() { var menuItem = new MenuBar.MenuItem("Help"); MenuBar.MenuItems.Add(menuItem); menuItem.Elements.Add(new MenuBar.MenuItem.MenuElement("About EvoSim", delegate(object sender) { Version v = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version; AlertForm.ShowDialogue(Parent, "About", "EvoSim" + "\n" + "Version: " + v.ToString() + "\n" + "Created by: Lukas Kikuchi" + "\n" + "\n" + "Copyright 2011 Lukas Kikuchi"); })); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); var worldTypesComboBox = builder.AddComboBoxField("World Type: "); var worldTypeList = Globals.GetAllTypesDeriving(typeof(IWorld), Assembly.GetExecutingAssembly()); worldTypesComboBox.Items.AddRange(worldTypeList.Select(s => s.Name)); worldTypesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { if (worldTypesComboBox.Index == -1) { AlertForm.ShowDialogue(Parent, null, "Select a world type."); } else { Result = new WorldTemplate(); Result.TemplateName = templateNameTextField.Text; Result.World = (IWorld)Activator.CreateInstance(worldTypeList[worldTypesComboBox.Index]); EditWorldTemplateForm.ShowDialogue(Parent, Result); Close(); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); var templateNameTextField = builder.AddTextField("Template Name: "); templateNameTextField.Text = template.TemplateName; Panel panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); var isReadyFunc = (Func <bool>)template.World.GetType().InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { panel, template.World }); builder.AddResizableButtonField("OK", delegate(object sender) { if (isReadyFunc()) { template.TemplateName = templateNameTextField.Text; Close(); } else { AlertForm.ShowDialogue(Parent, null, "All fields have not been filled out."); } }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public void OnExportChagnes(Office.IRibbonControl control) { if (settings.monitorDoc) { MessageBox.Show("Auto Rivision on, Please Turn off"); return; } if (!isActiveAddin()) { return; } Doc = Globals.ThisAddIn.Application.ActiveDocument; if (!settings.check_if_edoc(Doc)) { MessageBox.Show("eDoc Only"); return; } alert = new AlertForm(Doc, 3, null, 0); alert.Show(); }
public override void AddedToContainer() { base.AddedToContainer(); var builder = new FieldBuilder(); builder.BuildSessionStart(this); var fileNameTextField = builder.AddBrowseField(FileForm.FileFormTypes.File, FileForm.OperationTypes.Save, "File Directory: ").DrawBox1; var worldTemplatesComboBox = builder.AddComboBoxField("World: "); worldTemplatesComboBox.Items.AddRange(EditorData.WorldTemplates.Select(s => s.TemplateName)); worldTemplatesComboBox.Index = 0; builder.AddResizableButtonField("OK", delegate(object sender) { if (worldTemplatesComboBox.Index == -1) { AlertForm.ShowDialogue(Parent, null, "Choose a world-template"); } else { Result = new Simulation(); Result.World = EditorData.WorldTemplates[worldTemplatesComboBox.Index].World.Clone(); Result.FileName = fileNameTextField.Text; AddDefaultEntityPainters(Result); Close(); } }); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public string Execute(string regexText, FindParams findParams, string directory, string filter, string ignoreDirs) { if (string.IsNullOrEmpty(regexText)) { return(null); } Regex regex = null; string pattern = null; if (findParams.regex) { string error; regex = DialogManager.ParseRegex(regexText, out error); if (regex == null || error != null) { return("Error: " + error); } } else { pattern = regexText; } alert = new AlertForm(mainForm, OnCanceled); tabSize = mainForm.Settings.tabSize.GetValue(null); thread = new Thread( new ThreadStart(delegate() { Search(directory, regex, pattern, findParams.ignoreCase, filter, ignoreDirs); }) ); thread.Start(); alert.ShowDialog(mainForm); if (finishBuffer != null) { mainForm.ShowConsoleBuffer(MainForm.FindResultsId, finishBuffer); } return(null); }
private void button2_Click(object sender, EventArgs e) { DialogResult dialogResult = MessageBox.Show("Please Save current Doc before proceeding, to countinue?", "Create LOEP?", MessageBoxButtons.YesNo); if (dialogResult == DialogResult.Yes) { List <loepDocument> loepDocumentArray = new List <loepDocument>(); foreach (ListViewItem listItem in pageView.Items) { loepDocument item = new loepDocument(listItem.SubItems[1].Text, listItem.SubItems[2].Text); loepDocumentArray.Add(item); } alert = new AlertForm(Doc, 7, loepDocumentArray, 0); alert.Show(); this.Close(); this.Dispose(); } else { this.Close(); this.Dispose(); } }
public void makeAllSameAsPrevious(Office.IRibbonControl control) { if (!isActiveAddin()) { return; } if (settings.monitorDoc) { MessageBox.Show("Auto Rivision on, Please Turn off"); return; } Doc = Globals.ThisAddIn.Application.ActiveDocument; if (settings.check_if_edoc(Doc)) { settings.trackChange(Doc, false); alert = new AlertForm(Doc, 6, null, 0); alert.Show(); } else { MessageBox.Show("eDoc Only"); } }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; var builder = new FieldBuilder(); builder.BuildSessionStart(this); Panel panel = new Panel(); panel.Initialize(); builder.AddDrawBoxAsField(panel, DrawBoxAlignment.GetFull()); var guiMethod = ann.GetType().GetMethod("GUI_Edit"); var isReadyFunc = (Func <bool>)guiMethod.Invoke(ann, new object[] { panel }); builder.AddResizableButtonField("OK", delegate(object sender) { if (isReadyFunc()) { Close(); } else { AlertForm.ShowDialogue(Parent, null, "All fields have not been filled out."); } }, FieldBuilder.ResizableButtonOrientation.Left); builder.BuildSessionEnd(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); CanResizeFormVertically = false; }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; columnListBox = new ColumnListBox(); columnListBox.Initialize(1); AddDrawBox(columnListBox); columnListBox.SetIntOrStringSort(false); columnListBox.SetColumnName(0, "Name"); columnListBox.Width = 200; columnListBox.Height = 200; columnListBox.ItemDoubleClicked += delegate(object sender, ColumnListBox.ListBoxRow item, int index) { GenomeTemplate template = null; foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == (string)item.Values[0]) { template = g; } } string oldName = template.TemplateName; EditGenomeTemplateForm.ShowDialogue(Parent, template, delegate(object _sender) { foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == template.TemplateName && g != template) { AlertForm.ShowDialogue(Parent, null, "There is a template with that name already."); template.TemplateName = oldName; } } ReloadListBox(); }); }; ReloadListBox(); var createTemplateButton = new ResizableButton(); createTemplateButton.Initialize(); AddDrawBox(createTemplateButton); createTemplateButton.Title = "Create New Template"; createTemplateButton.FitToText(); Push.ToTheBottomSideOf(createTemplateButton, columnListBox, 3, Push.VerticalAlign.Left); createTemplateButton.Width = 200; createTemplateButton.Click += delegate(object sender) { var newTemplate = new GenomeTemplate(); newTemplate.Genome = new EvoSim.Genes.Genome(); EditGenomeTemplateForm.ShowDialogue(Parent, newTemplate, delegate(object _sender) { bool alreadyExists = false; foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == newTemplate.TemplateName) { AlertForm.ShowDialogue(Parent, null, "There is a template with that name already."); alreadyExists = true; } } if (!alreadyExists) { EditorData.GenomeTemplates.Add(newTemplate); } ReloadListBox(); }); }; var deleteTemplateButton = new ResizableButton(); deleteTemplateButton.Initialize(); AddDrawBox(deleteTemplateButton); deleteTemplateButton.Title = "Delete Template"; deleteTemplateButton.FitToText(); Push.ToTheBottomSideOf(deleteTemplateButton, createTemplateButton, 3, Push.VerticalAlign.Left); deleteTemplateButton.Width = 200; deleteTemplateButton.Click += delegate(object sender) { if (columnListBox.SelectedRow != null) { var findName = (string)columnListBox.SelectedRow.Values[0]; foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == findName) { EditorData.GenomeTemplates.Remove(g); ReloadListBox(); break; } } } }; var editTemplateButton = new ResizableButton(); editTemplateButton.Initialize(); AddDrawBox(editTemplateButton); editTemplateButton.Title = "Edit Template"; editTemplateButton.FitToText(); Push.ToTheBottomSideOf(editTemplateButton, deleteTemplateButton, 3, Push.VerticalAlign.Left); editTemplateButton.Width = 200; editTemplateButton.Click += delegate(object sender) { if (columnListBox.SelectedRow == null) { return; } GenomeTemplate template = null; foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == (string)columnListBox.SelectedRow.Values[0]) { template = g; } } string oldName = template.TemplateName; EditGenomeTemplateForm.ShowDialogue(Parent, template, delegate(object _sender) { foreach (var g in EditorData.GenomeTemplates) { if (g.TemplateName == template.TemplateName && g != template) { AlertForm.ShowDialogue(Parent, null, "There is a template with that name already."); template.TemplateName = oldName; } } ReloadListBox(); }); }; var okButton = new ResizableButton(); okButton.Initialize(); AddDrawBox(okButton); okButton.Title = "OK"; okButton.FitToText(); Push.ToTheBottomSideOf(okButton, editTemplateButton, 3, Push.VerticalAlign.Left); okButton.Width = 200; okButton.Click += delegate(object sender) { EditorData.Save(Globals.EditorDataSaveDir); Close(); }; Wrap(); columnListBox.Alignment = DrawBoxAlignment.GetFull(); createTemplateButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); deleteTemplateButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); editTemplateButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); okButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); }
public static void GUI_Edit(Window parent, BarebonesSigmoid sigmoid) { AlertForm.ShowDialogue(parent, "Alert", "No parameters to change."); }
private void btnAlerts_Click(object sender, EventArgs e) { DefineAlert.AlertForm al = new AlertForm(); al.ShowDialog(); }
public void Alert(Notes note) { // 弹窗 AlertForm.Show(note.Title, note.Content); }
public static void moveToNewVersion(Word.Document Doc) { alert = new AlertForm(Doc, 9, null, 0); alert.Show(); }
public static void changeStyles(Word.Document Doc) { alert = new AlertForm(Doc, 5, null, 0); alert.Show(); }
public static void GUI_Edit(Window parent, SinglePointCrossover func) { AlertForm.ShowDialogue(parent, "Alert", "No parameters to change."); }
public override void AddedToContainer() { base.AddedToContainer(); CloseButtonOn = false; columnListBox = new ColumnListBox(); columnListBox.Initialize(1); AddDrawBox(columnListBox); columnListBox.SetIntOrStringSort(false); columnListBox.SetColumnName(0, "Name"); columnListBox.Width = 200; columnListBox.Height = 200; columnListBox.ItemDoubleClicked += delegate(object sender, ColumnListBox.ListBoxRow item, int index) { SpawnPoint spawnPoint = null; foreach (var sp in spawnPointList) { if (sp.Name == (string)item.Values[0]) { spawnPoint = sp; } } string oldName = spawnPoint.Name; EditSpawnPointForm.ShowDialogue(Parent, spawnPoint, delegate(object _sender) { foreach (var sp in spawnPointList) { if (sp.Name == spawnPoint.Name && spawnPoint != sp) { AlertForm.ShowDialogue(Parent, null, "There is a spawnpoint with that name already."); spawnPoint.Name = oldName; } } ReloadListBox(); }); }; ReloadListBox(); var createTemplateButton = new ResizableButton(); createTemplateButton.Initialize(); AddDrawBox(createTemplateButton); createTemplateButton.Title = "Create New Spawnpoint"; createTemplateButton.FitToText(); Push.ToTheBottomSideOf(createTemplateButton, columnListBox, 3, Push.VerticalAlign.Left); createTemplateButton.Width = 200; createTemplateButton.Click += delegate(object sender) { var spawnPoint = new SpawnPoint(world); EditSpawnPointForm.ShowDialogue(Parent, spawnPoint, delegate(object _sender) { bool alreadyExists = false; foreach (var sp in spawnPointList) { if (sp.Name == spawnPoint.Name && spawnPoint != sp) { alreadyExists = true; } } if (alreadyExists) { AlertForm.ShowDialogue(Parent, null, "There is a spawnpoint with that name already."); } else { spawnPointList.Add(spawnPoint); } ReloadListBox(); }); }; var deleteTemplateButton = new ResizableButton(); deleteTemplateButton.Initialize(); AddDrawBox(deleteTemplateButton); deleteTemplateButton.Title = "Delete Spawnpoint"; deleteTemplateButton.FitToText(); Push.ToTheBottomSideOf(deleteTemplateButton, createTemplateButton, 3, Push.VerticalAlign.Left); deleteTemplateButton.Width = 200; deleteTemplateButton.Click += delegate(object sender) { if (columnListBox.SelectedRow != null) { var findName = (string)columnListBox.SelectedRow.Values[0]; foreach (var t in EditorData.EntityTemplates) { if (t.TemplateName == findName) { EditorData.EntityTemplates.Remove(t); ReloadListBox(); break; } } } }; var editTemplateButton = new ResizableButton(); editTemplateButton.Initialize(); AddDrawBox(editTemplateButton); editTemplateButton.Title = "Edit Spawnpoint"; editTemplateButton.FitToText(); Push.ToTheBottomSideOf(editTemplateButton, deleteTemplateButton, 3, Push.VerticalAlign.Left); editTemplateButton.Width = 200; editTemplateButton.Click += delegate(object sender) { if (columnListBox.SelectedRow == null) { return; } SpawnPoint spawnPoint = null; foreach (var sp in spawnPointList) { if (sp.Name == (string)columnListBox.SelectedRow.Values[0]) { spawnPoint = sp; } } string oldName = spawnPoint.Name; EditSpawnPointForm.ShowDialogue(Parent, spawnPoint, delegate(object _sender) { foreach (var sp in spawnPointList) { if (sp.Name == spawnPoint.Name && spawnPoint != sp) { AlertForm.ShowDialogue(Parent, null, "There is a spawnpoint with that name already."); spawnPoint.Name = oldName; } } ReloadListBox(); }); }; var okButton = new ResizableButton(); okButton.Initialize(); AddDrawBox(okButton); okButton.Title = "OK"; okButton.FitToText(); Push.ToTheBottomSideOf(okButton, editTemplateButton, 3, Push.VerticalAlign.Left); okButton.Width = 200; okButton.Click += delegate(object sender) { Close(); }; Wrap(); columnListBox.Alignment = DrawBoxAlignment.GetFull(); createTemplateButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); deleteTemplateButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); editTemplateButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); okButton.Alignment = DrawBoxAlignment.GetLeftRightBottom(); X = (Parent.Width / 2) - (Width / 2); Y = (Parent.Height / 2) - (Height / 2); IsClosing += delegate(object sender) { EditorData.Save(Globals.EditorDataSaveDir); }; }
private void btnDelete_Click(object sender, EventArgs e) { AlertForm alert = new AlertForm(); alert.MessageBoxButtons = MessageBoxButtons.YesNo; alert.Message = "是否刪除該保養?"; if (alert.ShowDialog() == DialogResult.Yes) { MaintainRecordView record = this.GetSelectMaintainRecordView(); m_RecordState = RecordState.Delete; ReturnValueInfo returnValue = this.m_AbstractMachineMaintain.MaintainRecordDelete(record); if (returnValue != null) { if (!returnValue.boolValue) { this.ShowWarningMessage(returnValue.messageText); } } } }
public static void AlertUser(string msg) { var alert = new AlertForm(msg); alert.ShowDialog(); }
public static void Alert(string msg, AlertForm.enmType type) { AlertForm frm = new AlertForm(); frm.showAlert(msg, type); }
public static Func <bool> GUI_Edit(SingleSlotBox container, RMP_Chromosome chromosome) { var builder = new FieldBuilder(); builder.BuildSessionStart(container); Dictionary <string, object> valueHolder = new Dictionary <string, object>(); valueHolder.Add("RMP_Chromosome", chromosome); var inhibitoryConnectionChance = builder.AddDoubleField("Inhibitory Connection-Chance: "); inhibitoryConnectionChance.Value = chromosome.InhibitoryConnectionChance; var connectionChance = builder.AddDoubleField("Connection-Chance: "); connectionChance.Value = chromosome.ConnectionChance; var newConnectionsCanForm = builder.AddCheckBoxField("NewConnectionsCanForm: "); newConnectionsCanForm.Checked = chromosome.NewConnectionsCanForm; var connectionsCanDie = builder.AddCheckBoxField("ConnectionsCanDie: "); connectionsCanDie.Checked = chromosome.ConnectionsCanDie; var newNeuronsCanForm = builder.AddCheckBoxField("NewNeuronsCanForm: "); newNeuronsCanForm.Checked = chromosome.NewNeuronsCanForm; var neuronsCanDie = builder.AddCheckBoxField("NeuronsCanDie: "); neuronsCanDie.Checked = chromosome.NeuronsCanDie; Action reloadChromosome = delegate() { chromosome.InhibitoryConnectionChance = inhibitoryConnectionChance.Value; chromosome.ConnectionChance = connectionChance.Value; chromosome.NewConnectionsCanForm = newConnectionsCanForm.Checked; chromosome.ConnectionsCanDie = connectionsCanDie.Checked; chromosome.NewNeuronsCanForm = newNeuronsCanForm.Checked; chromosome.NeuronsCanDie = neuronsCanDie.Checked; }; if (chromosome.MutationGenes.Count == 0) { //Mutation Genes chromosome.MutationGenes.Add(new DoubleGene("NeuronAddChance", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("NeuronRemoveChance", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("MaxNeuronRemoving", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("MaxNeuronAdding", 0, 1, 0.1)); chromosome.MutationGenes.Add(new DoubleGene("ConnectionAddChance", 0, 1, 0.05)); chromosome.MutationGenes.Add(new DoubleGene("ConnectionRemoveChance", 0, 1, 0.05)); } builder.AddResizableButtonField("Edit Mutation Genes", delegate(object sender) { EditDoubleGeneListForm.ShowDialogue(container.Parent, chromosome.MutationGenes); }); var sigmoidTypes = Globals.GetAllTypesDeriving(typeof(SigmoidFunction), Assembly.GetExecutingAssembly()); var sigmoidNames = new List <string>(sigmoidTypes.Select(s => s.Name)); var globalSigmoidComboBox = builder.AddComboBoxField("GlobalSigmoid: ", sigmoidNames); if (chromosome.GlobalSigmoidFunction != null) { var globalSigmoidType = chromosome.GlobalSigmoidFunction.GetType(); foreach (var type in sigmoidTypes) { if (type.IsEquivalentTo(globalSigmoidType)) { globalSigmoidComboBox.Index = sigmoidTypes.IndexOf(type); } } } globalSigmoidComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { chromosome.GlobalSigmoidFunction = (SigmoidFunction)Activator.CreateInstance(sigmoidTypes[newItemIndex]); }; var globalSigmoidEditButton = builder.AddResizableButtonField("Edit GlobalSigmoid", delegate(object sender) { if (chromosome.GlobalSigmoidFunction == null) { return; } var sigmoid = chromosome.GlobalSigmoidFunction; sigmoidTypes[globalSigmoidComboBox.Index].InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { container.Parent, sigmoid }); }); var globalOutputSigmoidComboBox = builder.AddComboBoxField("GlobalOutputSigmoid: ", sigmoidNames); if (chromosome.GlobalOutputSigmoidFunction != null) { var globalOutputSigmoidType = chromosome.GlobalOutputSigmoidFunction.GetType(); foreach (var type in sigmoidTypes) { if (type.IsEquivalentTo(globalOutputSigmoidType)) { globalOutputSigmoidComboBox.Index = sigmoidTypes.IndexOf(type); } } } globalOutputSigmoidComboBox.SelectedItemChanged += delegate(object sender, int newItemIndex, int oldItemIndex) { chromosome.GlobalOutputSigmoidFunction = (SigmoidFunction)Activator.CreateInstance(sigmoidTypes[newItemIndex]); }; var globalOutputSigmoidEditButton = builder.AddResizableButtonField("Edit GlobalOutputSigmoid", delegate(object sender) { if (chromosome.GlobalOutputSigmoidFunction == null) { return; } var sigmoid = chromosome.GlobalOutputSigmoidFunction; sigmoidTypes[globalOutputSigmoidComboBox.Index].InvokeMember("GUI_Edit", BindingFlags.Default | BindingFlags.InvokeMethod, null, null, new object[] { container.Parent, sigmoid }); }); builder.AddResizableButtonField("Randomize", delegate(object sender) { reloadChromosome(); if (chromosome.GlobalSigmoidFunction == null || chromosome.GlobalOutputSigmoidFunction == null) { AlertForm.ShowDialogue(container.Parent, null, "Can't randomize before choosing a sigmoid function."); } else { RandomizeForm.ShowDialogue(container.Parent, chromosome); } }); builder.AddResizableButtonField("Edit Neuron-genes", delegate(object sender) { reloadChromosome(); EditChromosomeNeuronsForm.ShowDialogue(container.Parent, valueHolder); }); container.IsClosing += delegate(object sender) { reloadChromosome(); }; builder.BuildSessionEnd(); return(delegate() { return chromosome.GlobalSigmoidFunction != null && chromosome.GlobalOutputSigmoidFunction != null; }); }