public Flowsheet(NewProcessSettings newProcessSettings, FlowsheetPreferences flowsheetPrefs, ApplicationPreferences appPrefs) { // // Required for Windows Form Designer support // InitializeComponent(); this.flowsheetPrefs = flowsheetPrefs; this.appPrefs = appPrefs; DryingGas dg = DryingGasCatalog.GetInstance().GetDryingGas(newProcessSettings.DryingGasName); if (dg == null) { //string message = "You need to set a drying gas in Materials / New Process Settings first!"; //MessageBox.Show(message, "New Flowsheet Error", MessageBoxButtons.OK, MessageBoxIcon.Error); dg = DryingGasCatalog.GetInstance().GetDryingGas("Air"); } DryingMaterial dm = DryingMaterialCatalog.GetInstance().GetDryingMaterial(newProcessSettings.DryingMaterialName); if (dm == null) { string message = "You need to choose a drying material for the new flowsheet to be created first! (go to Materials / New Flowsheet Settings)"; MessageBox.Show(message, "New Flowsheet Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.evapAndDryingSystem = new EvaporationAndDryingSystem(UI.NEW_SYSTEM, dm, dg); this.connectionManager = new ConnectionManager(this); this.customEditor = new ProsimoUI.CustomEditor.CustomEditor(this); Init(); }
public Flowsheet(NewSystemPreferences newSystemPrefs, EvaporationAndDryingSystem system) { // // Required for Windows Form Designer support // InitializeComponent(); this.newSystemPrefs = newSystemPrefs; UnitSystemCatalog catalog = UnitSystemService.GetInstance().GetUnitSystemCatalog(); UnitSystem us = catalog.Get("SI-2"); UnitSystemService.GetInstance().CurrentUnitSystem = us; this.currentUnitSystemName = us.Name; this.MultipleSelection = false; this.Activity = FlowsheetActivity.Default; if (system == null) { DryingGas dg = DryingGasCatalog.GetInstance().GetDryingGas(newSystemPrefs.DryingGasName); if (dg == null) { dg = DryingGasCatalog.GetInstance().GetDryingGas("Air"); } DryingMaterial dm = DryingMaterialCatalog.GetInstance().GetDryingMaterial(newSystemPrefs.DryingMaterialName); if (dm == null) { dm = DryingMaterialCatalog.GetInstance().GetDryingMaterial("Generic Material"); } this.evapAndDryingSystem = new EvaporationAndDryingSystem("New System", dm, dg); } else { this.evapAndDryingSystem = system; } this.evapAndDryingSystem.SystemChanged += new SystemChangedEventHandler(evapAndDryingSystem_SystemChanged); this.evapAndDryingSystem.CalculationStarted += new CalculationStartedEventHandler(evapAndDryingSystem_CalculationStarted); this.evapAndDryingSystem.CalculationEnded += new CalculationEndedEventHandler(evapAndDryingSystem_CalculationEnded); this.connectionManager = new ConnectionManager(this); this.customEditor = new ProsimoUI.CustomEditor.CustomEditor(this); this.streamManager = new StreamManager(this); this.unitOpManager = new UnitOpManager(this); UI ui = new UI(); this.BackColor = ui.FLOWSHEET_COLOR; this.NumericFormat = NumericFormat.FixedPoint; this.DecimalPlaces = "3"; this.Version = new FlowsheetVersion(); this.KeyDown += new KeyEventHandler(Flowsheet_KeyDown); this.KeyUp += new KeyEventHandler(Flowsheet_KeyUp); UnitSystemService.GetInstance().CurrentUnitSystemChanged += new CurrentUnitSystemChangedEventHandler(Flowsheet_CurrentUnitSystemChanged); this.IsDirty = false; }
public DryingGas GetSelectedDryingGas() { DryingGas dg = null; if (this.listViewGases.SelectedItems.Count > 0) { ListViewItem lvi = (ListViewItem)this.listViewGases.SelectedItems[0]; ListViewItem.ListViewSubItem lvsi = (ListViewItem.ListViewSubItem)lvi.SubItems[0]; dg = DryingGasCatalog.GetInstance().GetDryingGas(lvsi.Text); } return(dg); }
fs.Close(); } } } public void UnpersistAppPreferences(MainForm mainForm) { string fileName = mainForm.ExePathName + MainForm.APP_PREFS; Stream stream = null; try { stream = new FileStream(fileName, FileMode.Open); SoapFormatter serializer = new SoapFormatter(); serializer.AssemblyFormat = FormatterAssemblyStyle.Simple; ArrayList items = (ArrayList)serializer.Deserialize(stream); IEnumerator e = items.GetEnumerator(); while (e.MoveNext()) { object obj = e.Current; if (obj is UIPreferences) { UIPreferences uiPrefs = (UIPreferences)obj; uiPrefs.SetObjectData(uiPrefs.SerializationInfo, uiPrefs.StreamingContext); mainForm.Location = uiPrefs.MainFormLocation; mainForm.Size = uiPrefs.MainFormSize; mainForm.WindowState = uiPrefs.MainFormWindowState; mainForm.ToolboxVisible = uiPrefs.ToolboxVisible; mainForm.ToolboxLocation = uiPrefs.ToolboxLocation; } else if (obj is NewSystemPreferences) { NewSystemPreferences newSysPrefs = (NewSystemPreferences)obj; newSysPrefs.SetObjectData(newSysPrefs.SerializationInfo, newSysPrefs.StreamingContext); if (!DryingGasCatalog.GetInstance().IsInCatalog(newSysPrefs.DryingGasName)) { newSysPrefs.DryingGasName = DryingGasCatalog.GetInstance().GetDefaultDryingGas().Name; } if (!DryingMaterialCatalog.GetInstance().IsInCatalog(newSysPrefs.DryingMaterialName)) { newSysPrefs.DryingMaterialName = DryingMaterialCatalog.GetInstance().GetDefaultDryingMaterial().Name; } mainForm.NewSystemPrefs = newSysPrefs; } } } catch (Exception) { NewSystemPreferences newSysPrefs = new NewSystemPreferences(); mainForm.NewSystemPrefs = newSysPrefs; } finally
public Flowsheet(NewProcessSettings newProcessSettings, ApplicationPreferences appPrefs, EvaporationAndDryingSystem system) { // // Required for Windows Form Designer support // InitializeComponent(); this.newProcessSettings = newProcessSettings; this.appPrefs = appPrefs; this.MultipleSelection = false; SetFlowsheetActivity(FlowsheetActivity.Default); if (system == null) { DryingGas dg = DryingGasCatalog.GetInstance().GetDryingGas(newProcessSettings.DryingGasName); if (dg == null) { // string message = "You need to set a drying gas in Materials / New Process Settings first!"; // MessageBox.Show(message, "New Flowsheet Error", MessageBoxButtons.OK, MessageBoxIcon.Error); dg = DryingGasCatalog.GetInstance().GetDryingGas("Air"); } DryingMaterial dm = DryingMaterialCatalog.GetInstance().GetDryingMaterial(newProcessSettings.DryingMaterialName); if (dm == null) { string message = "You need to choose a drying material for the new flowsheet to be created first! (go to Materials / New Flowsheet Settings)"; MessageBox.Show(message, "New Flowsheet Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } this.evapAndDryingSystem = new EvaporationAndDryingSystem(UI.NEW_SYSTEM, dm, dg); } else { this.evapAndDryingSystem = system; } this.evapAndDryingSystem.SystemChanged += new SystemChangedEventHandler(evapAndDryingSystem_SystemChanged); this.evapAndDryingSystem.CalculationStarted += new CalculationStartedEventHandler(evapAndDryingSystem_CalculationStarted); this.evapAndDryingSystem.CalculationEnded += new CalculationEndedEventHandler(evapAndDryingSystem_CalculationEnded); this.evapAndDryingSystem.NameChanged += new NameChangedEventHandler(evapAndDryingSystem_NameChanged); this.connectionManager = new ConnectionManager(this); this.customEditor = new ProsimoUI.CustomEditor.CustomEditor(this); this.streamManager = new StreamManager(this); this.unitOpManager = new UnitOpManager(this); this.BackColor = Color.White; this.Version = new FlowsheetVersion(); this.IsDirty = false; }
/// <summary> /// Clean up any resources being used. /// </summary> protected override void Dispose(bool disposing) { DryingGasCatalog.GetInstance().DryingGasAdded -= new DryingGasAddedEventHandler(DryingGasesControl_DryingGasAdded); DryingGasCatalog.GetInstance().DryingGasChanged -= new DryingGasChangedEventHandler(DryingGasesControl_DryingGasChanged); DryingGasCatalog.GetInstance().DryingGasDeleted -= new DryingGasDeletedEventHandler(DryingGasesControl_DryingGasDeleted); if (disposing) { if (components != null) { components.Dispose(); } } base.Dispose(disposing); }
private void PopulateDryingGasList() { this.listViewGases.Items.Clear(); string userDefFilterStr = this.comboBoxUserDef.SelectedItem.ToString(); if (userDefFilterStr.Equals(UI.STR_ALL)) { this.PopulateIt(DryingGasCatalog.GetInstance().GetDryingGasList()); } else { bool userDef = UI.GetUserDefinedAsBool(userDefFilterStr); this.PopulateIt(DryingGasCatalog.GetInstance().GetDryingGasList(userDef)); } }
public DryingGasesControl() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); this.inConstruction = true; this.comboBoxUserDef.Items.Add(UI.STR_ALL); this.comboBoxUserDef.Items.Add(UI.STR_USER_DEF_USER_DEF); this.comboBoxUserDef.Items.Add(UI.STR_USER_DEF_NOT_USER_DEF); this.comboBoxUserDef.SelectedIndex = 0; this.PopulateDryingGasList(); DryingGasCatalog.GetInstance().DryingGasAdded += new DryingGasAddedEventHandler(DryingGasesControl_DryingGasAdded); DryingGasCatalog.GetInstance().DryingGasChanged += new DryingGasChangedEventHandler(DryingGasesControl_DryingGasChanged); DryingGasCatalog.GetInstance().DryingGasDeleted += new DryingGasDeletedEventHandler(DryingGasesControl_DryingGasDeleted); this.inConstruction = false; }