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;
        }
Example #3
0
 /// <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)
        {
            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;
            }
        }
Example #5
0
        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)
 {
     return new NullInterpreterConfiguration();
 }
        /// <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;
        }
        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)
        {
            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;
        }