private void btnAddRecipe_Click(object sender, EventArgs e) { if (tbNewRecipe.Text == "") { AppUtility.ShowKryptonMessageBox("No Recipe Name", "Please input recipe name", "", ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK, MessageBoxIcon.Error, this); return; } if (_allRecipe.ChildExists(tbNewRecipe.Text)) { AppUtility.ShowKryptonMessageBox("Recipe Name Exist", String.Format("Recipe name \"{0}\" already exist.", tbNewRecipe.Text), "", ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK, MessageBoxIcon.Error, this); return; } try { AppProductRecipe newRecipe = new AppProductRecipe(tbNewRecipe.Text); newRecipe.PropertyValChanged += new PropertyChangedEventHandler(AppMachine.Comp.AppMachine.This.RecipePropValue_OnChange); _allRecipe.Add(newRecipe); componentBrowser.Rebuild(_allRecipe); AppUtility.ShowKryptonMessageBox("Add New Product Completed", String.Format("Add New Product \"{0}\" Completed", tbNewRecipe.Text), "", ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK, MessageBoxIcon.Information, this); tbNewRecipe.Clear(); } finally { } }
private void btnCopyRecipe_Click(object sender, EventArgs e) { if (_masterRecipe == null) { return; } DialogResult result = AppUtility.ShowKryptonMessageBox("Confirm copy recipe", "All current recipe data will replace with replace with master copy recipe", "", ComponentFactory.Krypton.Toolkit.TaskDialogButtons.Yes | ComponentFactory.Krypton.Toolkit.TaskDialogButtons.No, MessageBoxIcon.Question, this); if (result != DialogResult.OK) { return; } AppProductRecipe masterCopy = _masterRecipe.ShallowClone(typeof(AppProductRecipe)) as AppProductRecipe; masterCopy.Name = AppMachine.Comp.AppMachine.This.CurrentRecipe.Name; masterCopy.CopyPropertyTo(AppMachine.Comp.AppMachine.This.CurrentRecipe); pgRecipe.BrowsableAttributes = new AttributeCollection(new CategoryAttribute("Product Recipe")); //pgRecipe.BrowsableAttributes = new AttributeCollection(new SubCategoryAttribute("General Recipe")); pgRecipe.SelectedObject = AppMachine.Comp.AppMachine.This.CurrentRecipe; AppMachine.Comp.AppMachine.This.CurrentProdRecipeName = ""; AppMachine.Comp.AppMachine.This.CurrentProdRecipeName = masterCopy.Name; _masterRecipe = null; cbMasterCopyRecipe.Items.Clear(); cbMasterCopyRecipe.Text = ""; }
private void cbCopyRecipe_SelectionChangeCommitted(object sender, EventArgs e) { if (cbMasterCopyRecipe.SelectedItem != null) { _masterRecipe = cbMasterCopyRecipe.SelectedItem as AppProductRecipe; } }
private void cbCopyRecipe_DropDown(object sender, EventArgs e) { cbMasterCopyRecipe.Items.Clear(); cbMasterCopyRecipe.Items.AddRange(_allRecipe.ChildArray); AppProductRecipe refCurrentRecipe = U.GetComponent(AppConstStaticName.REF_CURRENT_RECIPE) as AppProductRecipe; cbMasterCopyRecipe.Items.Remove(refCurrentRecipe); }
public override void RefreshData() { pgRecipe.BrowsableAttributes = new AttributeCollection(new SubCategoryAttribute("Specification Recipe")); AppProductRecipe currentRecipe = AppUtility.GetCurrentRecipe(); if (currentRecipe != null) { pgRecipe.SelectedObject = currentRecipe; } }
private void CurrentRecipeOnChange(string recipeName) { pgRecipe.BrowsableAttributes = new AttributeCollection(new SubCategoryAttribute("Specification Recipe")); AppProductRecipe currentRecipe = U.GetComponent(recipeName) as AppProductRecipe; if (currentRecipe != null) { pgRecipe.SelectedObject = currentRecipe; } }
public override void RefreshData() { _masterRecipe = null; cbMasterCopyRecipe.Items.Clear(); cbMasterCopyRecipe.Text = ""; string currentRecipeNameBackup = AppMachine.Comp.AppMachine.This.CurrentProdRecipeName; AppMachine.Comp.AppMachine.This.CurrentProdRecipeName = ""; AppMachine.Comp.AppMachine.This.CurrentProdRecipeName = currentRecipeNameBackup; }
private void CurrentRecipeOnChange(string recipeName) { cbCurrentRecipe.Text = recipeName; pgRecipe.BrowsableAttributes = new AttributeCollection(new CategoryAttribute("Product Recipe")); //pgRecipe.BrowsableAttributes = new AttributeCollection(new SubCategoryAttribute("Cofiguration")); AppProductRecipe currentRecipe = AppUtility.GetCurrentRecipe(); if (currentRecipe != null) { pgRecipe.SelectedObject = currentRecipe; } }
private void btnExportRecipe_Click(object sender, EventArgs e) { if (cbDelRecipe.SelectedItem != null && _allRecipe.ChildExists(cbDelRecipe.SelectedItem.ToString())) { string recipeDumpPath = AppUtility.AppFullPath + "\\Dump Recipes\\"; U.EnsureDirectory(recipeDumpPath); AppProductRecipe exportRecipe = cbDelRecipe.SelectedItem as AppProductRecipe; string exportFilePath = String.Format("{0}DumpRecipe[ {1} ]_{2}.xml", recipeDumpPath, exportRecipe.Name, DateTime.Now.ToString("yyyy-MM-dd-HHmmss")); CompRoot.ExportSettings(exportFilePath, exportRecipe); AppUtility.ShowKryptonMessageBox("Export Recipe Completed", String.Format("Export Recipe \"{0}\" Completed", exportRecipe.Name), String.Format("Export Recipe {0} to {1}", exportRecipe.Name, exportFilePath), ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK, MessageBoxIcon.Information, this); } }
/// <summary> /// Called after Initialize /// </summary> public override void InitializeIDReferences() { base.InitializeIDReferences(); /*Example Get Component * _redLamp = U.GetComponent(AppConstStaticName.RED_TOWER_LIGHT) as BoolOutput; * _amberLamp = U.GetComponent(AppConstStaticName.AMBER_TOWER_LIGHT) as BoolOutput; * _greenLamp = U.GetComponent(AppConstStaticName.GREEN_TOWER_LIGHT) as BoolOutput; * _buzzer = U.GetComponent(AppConstStaticName.BUZZER) as BoolOutput; */ _allRecipe = U.GetComponent(AppConstStaticName.ALL_RECIPES); _refCurrentRecipe = U.GetComponent(AppConstStaticName.REF_CURRENT_RECIPE) as AppProductRecipe; U.RegisterOnChanged(() => RunStatus, RunStatusOnChange); U.RegisterOnChanged(() => IsAlarm, AlarmOnChange); U.RegisterOnChanged(() => LotId, LotIDOnChanged); U.RegisterOnChanged(() => AppMachine.This.CurrentProdRecipeName, CurrentRecipeOnChange); }
public void RecipePropValue_OnChange(object sender, PropertyChangedEventArgs e) { if (sender == null) { return; } AppProductRecipe recipeChanged = sender as AppProductRecipe; //Clone data to reference recipe if (recipeChanged.Name == this.CurrentRecipe.Name) { AppProductRecipe masterCopy = recipeChanged.ShallowClone(typeof(AppProductRecipe)) as AppProductRecipe; masterCopy.Name = AppConstStaticName.REF_CURRENT_RECIPE; masterCopy.CopyPropertyTo(_refCurrentRecipe); } //Copy to Current Recipe else if (recipeChanged.Name == AppConstStaticName.REF_CURRENT_RECIPE) { AppProductRecipe masterCopy = recipeChanged.ShallowClone(typeof(AppProductRecipe)) as AppProductRecipe; masterCopy.Name = this.CurrentRecipe.Name; masterCopy.CopyPropertyTo(this.CurrentRecipe); } }
private void btnImportRecipe_Click(object sender, EventArgs e) { string recipeDumpPath = AppUtility.AppFullPath + "\\Dump Recipes\\"; U.EnsureDirectory(recipeDumpPath); OpenFileDialog od = new OpenFileDialog(); od.DefaultExt = ".xml"; od.Filter = "Product File|*.xml"; od.InitialDirectory = recipeDumpPath; od.CheckFileExists = true; od.Multiselect = false; od.ShowDialog(); if (String.IsNullOrEmpty(od.FileName)) { return; } string importFilePath = od.FileName; AppProductRecipe importRecipe = null; try { importRecipe = CompRoot.ImportFile(typeof(AppProductRecipe), importFilePath) as AppProductRecipe; } catch (Exception ex) { AppUtility.ShowKryptonMessageBox("Import Recipe Error", String.Format("Import Recipe Error"), ex.ToString(), ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK, MessageBoxIcon.Error, this); return; } if (_allRecipe.ChildExists(importRecipe.Name)) { DialogResult result = AppUtility.ShowKryptonMessageBox("Recipe Name Exist", String.Format("Recipe name \"{0}\" already exist.", importRecipe.Name), "Do you want to auto generate unique name?", ComponentFactory.Krypton.Toolkit.TaskDialogButtons.Yes | ComponentFactory.Krypton.Toolkit.TaskDialogButtons.No, MessageBoxIcon.Question, this); if (result != DialogResult.Yes) { return; } int count = 1; string autoGenRecipeName = ""; do { autoGenRecipeName = importRecipe.Name + count.ToString("_00#"); } while (_allRecipe.ChildExists(autoGenRecipeName)); importRecipe.Name = autoGenRecipeName; } try { importRecipe.PropertyValChanged += new PropertyChangedEventHandler(AppMachine.Comp.AppMachine.This.RecipePropValue_OnChange); _allRecipe.Add(importRecipe); componentBrowser.Rebuild(_allRecipe); AppUtility.ShowKryptonMessageBox("Import Recipe Completed", String.Format("Import Recipe \"{0}\" Completed", importRecipe.Name), "", ComponentFactory.Krypton.Toolkit.TaskDialogButtons.OK, MessageBoxIcon.Information, this); tbNewRecipe.Clear(); } finally { } }