public void InitializeCurrentUnitSystem() { UnitSystemCatalog catalog = UnitSystemService.GetInstance().GetUnitSystemCatalog(); UnitSystem us = catalog.Get(this.currentUnitSystemName); if (us != null) { UnitSystemService.GetInstance().CurrentUnitSystem = us; } else { UnitSystem us2 = catalog.Get("SI-2"); UnitSystemService.GetInstance().CurrentUnitSystem = us2; } }
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 void InitializeCurrentUnitSystem(string name) { UnitSystemCatalog catalog = UnitSystemService.GetInstance().GetUnitSystemCatalog(); UnitSystem us = catalog.Get(name); if (us != null) { UnitSystemService.GetInstance().CurrentUnitSystem = us; } }