예제 #1
0
        private void ButtonApply_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.OK;
            REXCommand Cmd = new REXCommand(REXCommandType.OK);

            ThisExtension.Command(ref Cmd);
        }
예제 #2
0
        private void ButtonClose_Click(object sender, RoutedEventArgs e)
        {
            REXCommand Cmd = new REXCommand(REXCommandType.Close);

            Cmd.CommandObject = false;
            ThisExtension.Command(ref Cmd);
        }
예제 #3
0
        /// <summary>
        /// Commands the specified command struct.
        /// </summary>
        /// <param name="CommandStruct">The command struct.</param>
        /// <returns>Returns result of event operation.</returns>
        public override object OnCommand(ref REXCommand CommandStruct)
        {
            //Step 7.1.: Data exchange
            Dictionary <string, object> dictionary = CommandStruct.CommandObject as Dictionary <string, object>;

            if (dictionary != null)
            {
                try
                {
                    Data.H            = Convert.ToDouble(dictionary["H"]);
                    Data.B            = Convert.ToDouble(dictionary["B"]);
                    Data.FamilySymbol = dictionary["FamilySymbol"].ToString();
                    ExtensionRef.OnRun();
                    return(true);
                }
                catch
                {
                    return(false);
                }
            }
            else
            {
                return(base.OnCommand(ref CommandStruct));
            }
        }
예제 #4
0
        public override object OnCommand(ref REXCommand CommandStruct)
        {
            // insert code here.

            if (CommandStruct.Command == REXCommandType.Query)
            {
                if (CommandStruct.CommandObject.GetType().Equals(typeof(string)))
                {
                    if ((string)CommandStruct.CommandObject == REXConst.RunContext.QueryUserInterface)
                    {
                        if (ThisApplication.Context2.Product.Type == REXInterfaceType.RCAD)
                        {
                            if (ThisExtension.ExtensionContext.Control.RunContext == REXConst.RunContext.RCadCreate ||
                                ThisExtension.ExtensionContext.Control.RunContext == REXConst.RunContext.RCadModify)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }

                        return(null); // for standard run, for non standard must returns bool type.
                    }
                }
            }

            return(null);
        }
예제 #5
0
        private void ButtonClose_Click(object sender, EventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            REXCommand Cmd = new REXCommand(REXCommandType.Close);

            Cmd.CommandObject = false;
            ThisExtension.Command(ref Cmd);
        }
예제 #6
0
        private void REXExtensionWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
        {
            REXCommand Cmd = new REXCommand(REXCommandType.Close);

            Cmd.CommandObject = true;
            if (((bool)ThisExtension.Command(ref Cmd)) == true)
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
예제 #7
0
        private void RunCommand(string Name)
        {
            REXCommand Cmd = null;

            switch (Name)
            {
            case "MenuItemOpen":
            case "ToolStripButtonOpen":
            case "ToolStripMenuItemOpen":
                ThisExtension.System.LoadFromFile(true);
                return;

            case "MenuItemSave":
            case "ToolStripButtonSave":
            case "ToolStripMenuItemSave":
                ThisExtension.System.SaveToFile(false, true);
                return;

            case "MenuItemSaveAs":
            case "ToolStripMenuItemSaveAs":
                ThisExtension.System.SaveToFile(true);
                return;

            case "MenuItemCalc":
            case "ToolStripButtonCalc":
            case "ToolStripMenuItemCalc":
                Cmd = new REXCommand(REXCommandType.Run);
                break;

            case "MenuItemHelpIndex":
            case "ToolStripButtonHelp":
            case "ToolStripMenuItemHelp":
                Cmd = new REXCommand(REXCommandType.Help);
                break;

            case "MenuItemClose":
            case "ToolStripMenuItemClose":
                Cmd = new REXCommand(REXCommandType.Close);
                break;

            case "MenuItemAbout":
            case "ToolStripMenuItemAbout":
                Cmd = new REXCommand(REXCommandType.About);
                break;
            }
            if (Cmd != null)
            {
                ThisExtension.Command(ref Cmd);
            }
        }
예제 #8
0
        private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
        {
            this.DialogResult = DialogResult.Cancel;
            REXCommand Cmd = new REXCommand(REXCommandType.Close);

            Cmd.CommandObject = true;
            if (((bool)ThisExtension.Command(ref Cmd)) == true)
            {
                e.Cancel = false;
            }
            else
            {
                e.Cancel = true;
            }
        }
예제 #9
0
        private void RunCommand(string Name)
        {
            REXCommand Cmd = null;

            switch (Name)
            {
            case "Open":
                ThisExtension.System.LoadFromFile(true);
                return;

            case "Save":
                ThisExtension.System.SaveToFile(false, true);
                return;

            case "SaveAs":
                ThisExtension.System.SaveToFile(true);
                return;

            case "Calculate":
                Cmd = new REXCommand(REXCommandType.Run);
                break;

            case "Help":
                Cmd = new REXCommand(REXCommandType.Help);
                break;

            case "Close":
                Cmd = new REXCommand(REXCommandType.Close);
                break;

            case "About":
                Cmd = new REXCommand(REXCommandType.About);
                break;

            case "Preferences":
                ThisExtension.ShowPreferencesDialog();
                break;
            }
            if (Cmd != null)
            {
                ThisExtension.Command(ref Cmd);
            }
        }
예제 #10
0
        /// <summary>
        /// Commands the specified command struct.
        /// </summary>
        /// <param name="CommandStruct">The command struct.</param>
        /// <returns>Returns result of event operation.</returns>
        public override object OnCommand(ref REXCommand CommandStruct)
        {
            object result = null;

            if (ExtensionRef != null)
            {
                result = ExtensionRef.OnCommand(ref CommandStruct);
            }

            // insert code here.

            if (result == null)
            {
                return(base.OnCommand(ref CommandStruct));
            }
            else
            {
                return(result);
            }
        }
예제 #11
0
 public object Command(ref REXCommand CommandStruct)
 {
     return(this.ApplicationRef.Command(ref CommandStruct));
 }
예제 #12
0
        private void About_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            REXCommand Cmd = new REXCommand(REXCommandType.About);

            ThisExtension.Command(ref Cmd);
        }
예제 #13
0
        private void ButtonApply_Click(object sender, RoutedEventArgs e)
        {
            REXCommand Cmd = new REXCommand(REXCommandType.OK);

            ThisExtension.Command(ref Cmd);
        }
예제 #14
0
        private void HyperlinkAbout_Click(object sender, RoutedEventArgs e)
        {
            REXCommand Cmd = new REXCommand(REXCommandType.About);

            ThisExtension.Command(ref Cmd);
        }
예제 #15
0
        public override object OnCommand(ref REXCommand CommandStruct)
        {
            // insert code here.

            return(null);
        }
예제 #16
0
 //******************************************************************************************
 /// <summary>
 /// Command handler
 /// </summary>
 public override object Command(ref REXCommand CommandStruct)
 {
     return(base.Command(ref CommandStruct));
 }
예제 #17
0
        /// <summary>
        /// Commands the specified command struct.
        /// </summary>
        /// <param name="CommandStruct">The command struct.</param>
        /// <returns>Returns result of event operation.</returns>
        public override object Command(ref REXCommand CommandStruct)
        {
            // insert code here.

            return(base.Command(ref CommandStruct));
        }