/// <summary> /// Shows a form for the user to select/change settings through a GUI. All interactive /// GUI operations MUST happen within this function scope. /// </summary> /// <param name="preConfig">Result of PreConfig</param> /// <param name="previousConfig">Previous configuration to initialize the GUI.</param> /// <returns>Null if operation is cancelled by the user. Otherwise returns with a new /// configuration object.</returns> public IInterpreterConfiguration DoGUIConfiguration( IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { #pragma warning disable 0219 DialogResult ok = DialogResult.Cancel; #pragma warning restore 0219 var settings = previousConfig as CyPhy2Simulink_Settings; if (settings == null) { settings = new CyPhy2Simulink_Settings(); } //using (MainForm mf = new MainForm(settings, (preConfig as CyPhy2Simulink_v2PreConfiguration).ProjectDirectory)) //{ // show main form // ok = mf.ShowDialog(); //} //if (ok == DialogResult.OK) { return(settings); } //return null; }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { if (previousConfig != null) { settings = (CyPhy2CADSettings)previousConfig; } // show main form //FetchSettings(); bool prepIFab = false; using (MainForm mf = new MainForm(settings, true, prepIFab)) { mf.ShowDialog(); DialogResult ok = mf.DialogResult; if (ok == DialogResult.OK) { settings = mf.ConfigOptions; return(settings); } else { return(null); } } }
/// <summary> /// Shows a form for the user to select/change settings through a GUI. All interactive /// GUI operations MUST happen within this function scope. /// </summary> /// <param name="preConfig">Result of PreConfig</param> /// <param name="previousConfig">Previous configuration to initialize the GUI.</param> /// <returns>Null if operation is canceled by the user. Otherwise returns with a new /// configuration object.</returns> public IInterpreterConfiguration DoGUIConfiguration( IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { CyPhy2Schematic_Settings settings = (previousConfig as CyPhy2Schematic_Settings); // If none found, we should do GUI. // If available, seed the GUI with the previous settings. if (settings == null || settings.skipGUI == null) { // Do GUI var gui = new CyPhy2Schematic.GUI.CyPhy2Schematic_GUI(); gui.settings = settings; var result = gui.ShowDialog(); if (result == DialogResult.OK) { return(gui.settings); } else { // USER CANCELED. return(null); } } return(settings); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { var settings = previousConfig as CyPhySoT.CyPhySoTSettings; if (settings == null) { settings = new CyPhySoT.CyPhySoTSettings(); } return(settings); }
public bool DoGUIConfiguration(string projectDir, bool showGUI = true) { if (MgaComponent == null) { throw new ApplicationException(Error); } bool success = false; if (MgaComponent is ICyPhyInterpreter) { PreConfigArgs preConfigArgs = new PreConfigArgs(); preConfigArgs.ProjectDirectory = projectDir; // FIXME: fill in other preConfigArgs IInterpreterPreConfiguration preConfig = (MgaComponent as ICyPhyInterpreter).PreConfig(preConfigArgs); if (InterpreterConfig != null) { this.InterpreterConfig = META.ComComponent.DeserializeConfiguration(projectDir, InterpreterConfig.GetType(), ProgId); // Set configuration based on Workflow Parameters. This will override all [WorkflowConfigItem] members. this.SetWorkflowParameterValues(); } else { success = true; return(success); } if (showGUI == false) { return(true); } var newConfig = (MgaComponent as ICyPhyInterpreter).DoGUIConfiguration(preConfig, this.InterpreterConfig); if (newConfig != null) { success = true; InterpreterConfig = newConfig; // save the updated configuration that we got if they hit OK META.ComComponent.SerializeConfiguration(projectDir, InterpreterConfig, ProgId); } } else { success = true; if (showGUI) { MgaComponent.ComponentParameter["do_config_now"] = projectDir; } this.SetWorkflowParameterValues(); } return(success); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { var config = (PrepareIFabConfig)preConfig; ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp"); cyPhy2CAD.DoGUIConfiguration(config.ProjectDirectory); // TODO: when CyPhy2CAD implements ICyPhyInterpreter, save its config in ours CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)(cyPhy2CAD.InterpreterConfig); config.AuxiliaryDirectory = cadSettings.AuxiliaryDirectory; config.StepFormats = cadSettings.StepFormats; return(config); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { var config = (CADAnalysisConfig)preConfig; ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp"); bool cyPhy2CADConfigWasSuccessful = cyPhy2CAD.DoGUIConfiguration(config.ProjectDirectory); if (cyPhy2CADConfigWasSuccessful == false) { return(null); } // TODO: when CyPhy2CAD implements ICyPhyInterpreter, save its config in ours CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)(cyPhy2CAD.InterpreterConfig); config.AuxiliaryDirectory = cadSettings.AuxiliaryDirectory; config.StepFormats = cadSettings.StepFormats; return(config); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preconfig, IInterpreterConfiguration previousConfig) { CyPhy2CADPCB_Settings settings = (previousConfig as CyPhy2CADPCB_Settings); if (settings.runLayout == "false" || String.IsNullOrWhiteSpace(settings.runLayout)) { if (String.IsNullOrWhiteSpace(settings.layoutFilePath) && (settings.useSavedLayout == "false" || String.IsNullOrWhiteSpace(settings.useSavedLayout))) { // Prompt the user for what layout JSON file they want to use. DialogResult dr; using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.CheckFileExists = true; ofd.DefaultExt = "*.json"; ofd.Multiselect = false; ofd.Filter = "JSON file (*.json)|*.json"; dr = ofd.ShowDialog(); if (dr == DialogResult.OK) { settings.layoutFilePath = ofd.FileName; } else { // User cancelled return(null); } } if (String.IsNullOrWhiteSpace(settings.visualizerType)) { settings.visualizerType = "STEP"; } } } return(settings); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { DialogResult ok = DialogResult.Cancel; var settings = previousConfig as CyPhyReliabilityAnalysisSettings; if (settings == null) { settings = new CyPhyReliabilityAnalysisSettings(); } using (MainForm mf = new MainForm(settings)) { // show main form ok = mf.ShowDialog(); } if (ok == DialogResult.OK) { return(settings); } return(null); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { var settings = previousConfig as CyPhyPET.CyPhyPETSettings; if (settings == null) { settings = new CyPhyPET.CyPhyPETSettings(); } return settings; }
/// <summary> /// Shows a form for the user to select/change settings through a GUI. All interactive /// GUI operations MUST happen within this function scope. /// </summary> /// <param name="preConfig">Result of PreConfig</param> /// <param name="previousConfig">Previous configuration to initialize the GUI.</param> /// <returns>Null if operation is canceled by the user. Otherwise returns with a new /// configuration object.</returns> public IInterpreterConfiguration DoGUIConfiguration( IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { CyPhy2Schematic_Settings settings = (previousConfig as CyPhy2Schematic_Settings); // If none found, we should do GUI. // If available, seed the GUI with the previous settings. if (settings == null || settings.skipGUI == null) { // Do GUI var gui = new CyPhy2Schematic.GUI.CyPhy2Schematic_GUI(); gui.settings = settings; var result = gui.ShowDialog(); if (result == DialogResult.OK) { return gui.settings; } else { // USER CANCELED. return null; } } return settings; }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { var config = (CADAnalysisConfig)preConfig; ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp"); bool cyPhy2CADConfigWasSuccessful = cyPhy2CAD.DoGUIConfiguration(config.ProjectDirectory); if (cyPhy2CADConfigWasSuccessful == false) { return null; } // TODO: when CyPhy2CAD implements ICyPhyInterpreter, save its config in ours CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)(cyPhy2CAD.InterpreterConfig); config.AuxiliaryDirectory = cadSettings.AuxiliaryDirectory; config.StepFormats = cadSettings.StepFormats; return config; }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { var config = (PrepareIFabConfig)preConfig; ComComponent cyPhy2CAD = new ComComponent("MGA.Interpreter.CyPhy2CAD_CSharp"); cyPhy2CAD.DoGUIConfiguration(config.ProjectDirectory); // TODO: when CyPhy2CAD implements ICyPhyInterpreter, save its config in ours CyPhy2CAD_CSharp.CyPhy2CADSettings cadSettings = (CyPhy2CAD_CSharp.CyPhy2CADSettings)(cyPhy2CAD.InterpreterConfig); config.AuxiliaryDirectory = cadSettings.AuxiliaryDirectory; config.StepFormats = cadSettings.StepFormats; return config; }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { if (previousConfig != null) { settings = (CyPhy2CADSettings)previousConfig; } // show main form //FetchSettings(); bool prepIFab = false; using (MainForm mf = new MainForm(settings, true, prepIFab)) { mf.ShowDialog(); DialogResult ok = mf.DialogResult; if (ok == DialogResult.OK) { settings = mf.ConfigOptions; return settings; } else return null; } }
/// <summary> /// Called once only if running in interactive (non-automated) mode. Interpreters should not access the model during this method. /// </summary> /// <returns>null iff the user selects Cancel in the dialog</returns> public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { return new CyPhyCarSettings(); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preconfig, IInterpreterConfiguration previousConfig) { CyPhy2CADPCB_Settings settings = (previousConfig as CyPhy2CADPCB_Settings); if (String.IsNullOrWhiteSpace(settings.LayoutFilePath)) { // string outd = preconfig.ProjectDirectory; // Prompt the user for what layout JSON file they want to use. // Open file dialog box DialogResult dr; using (OpenFileDialog ofd = new OpenFileDialog()) { ofd.CheckFileExists = true; ofd.DefaultExt = "*.json"; ofd.Multiselect = false; ofd.Filter = "JSON file (*.json)|*.json"; dr = ofd.ShowDialog(); if (dr == DialogResult.OK) { settings.SavedLayoutFilePath = ofd.FileName; } else { Logger.WriteError("No file was selected. CAD PCB generation will not complete.", CyPhyGUIs.SmartLogger.MessageType_enum.Error); return null; } } } return settings; }
/// <summary> /// Shows a form for the user to select/change settings through a GUI. All interactive /// GUI operations MUST happen within this function scope. /// </summary> /// <param name="preConfig">Result of PreConfig</param> /// <param name="previousConfig">Previous configuration to initialize the GUI.</param> /// <returns>Null if operation is canceled by the user. Otherwise returns with a new /// configuration object.</returns> public IInterpreterConfiguration DoGUIConfiguration( IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { return new NullInterpreterConfiguration(); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { return(new CyPhyGUIs.NullInterpreterConfiguration()); }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { return(null); }
/// <summary> /// Called once only if running in interactive (non-automated) mode. Interpreters should not access the model during this method. /// </summary> /// <returns>null iff the user selects Cancel in the dialog</returns> public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { return(new CyPhyCarSettings()); }
/// <summary> /// Shows a form for the user to select/change settings through a GUI. All interactive /// GUI operations MUST happen within this function scope. /// </summary> /// <param name="preConfig">Result of PreConfig</param> /// <param name="previousConfig">Previous configuration to initialize the GUI.</param> /// <returns>Null if operation is cancelled by the user. Otherwise returns with a new /// configuration object.</returns> public IInterpreterConfiguration DoGUIConfiguration( IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { #pragma warning disable 0219 DialogResult ok = DialogResult.Cancel; #pragma warning restore 0219 var settings = previousConfig as CyPhy2RF_Settings; if (settings == null) { settings = new CyPhy2RF_Settings(); } //using (MainForm mf = new MainForm(settings, (preConfig as CyPhy2RF_v2PreConfiguration).ProjectDirectory)) //{ // show main form // ok = mf.ShowDialog(); //} //if (ok == DialogResult.OK) { return settings; } //return null; }
/// <summary> /// Shows a form for the user to select/change settings through a GUI. All interactive /// GUI operations MUST happen within this function scope. /// </summary> /// <param name="preConfig">Result of PreConfig</param> /// <param name="previousConfig">Previous configuration to initialize the GUI.</param> /// <returns>Null if operation is cancelled by the user. Otherwise returns with a new /// configuration object.</returns> public IInterpreterConfiguration DoGUIConfiguration( IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { DialogResult ok = DialogResult.Cancel; var settings = previousConfig as CyPhy2Modelica_v2Settings; if (settings == null) { settings = new CyPhy2Modelica_v2Settings(); } using (MainForm mf = new MainForm(settings, (preConfig as CyPhy2Modelica_v2PreConfiguration).ProjectDirectory)) { // show main form ok = mf.ShowDialog(); } if (ok == DialogResult.OK) { return settings; } return null; }
public IInterpreterConfiguration DoGUIConfiguration(IInterpreterPreConfiguration preConfig, IInterpreterConfiguration previousConfig) { DialogResult ok = DialogResult.Cancel; var settings = previousConfig as CyPhyReliabilityAnalysisSettings; if (settings == null) { settings = new CyPhyReliabilityAnalysisSettings(); } using (MainForm mf = new MainForm(settings)) { // show main form ok = mf.ShowDialog(); } if (ok == DialogResult.OK) { return settings; } return null; }