Пример #1
0
        /// <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);
        }
        /// <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;
        }