示例#1
0
        // Static functions ----------------------------------------------------------------------
        /// <summary>
        /// Get the Command from a string
        /// </summary>
        /// <param name="CmdString">String that contains the expected command</param>
        /// <returns>An EnumCmd object</returns>
        public static EnumCmd GetCmdFromString(String CmdString)
        {
            foreach (EnumCmd ECmd in Enum.GetValues(typeof(EnumCmd)))
            {
                if (ECmd.ToString().ToUpper() == CmdString.ToUpper())
                {
                    return(ECmd);
                }
            }

            return(EnumCmd.NotSet);
        }
示例#2
0
        /// <summary>
        /// Get the Command into String
        /// </summary>
        /// <param name="Cmd">Command we have to export into a string</param>
        /// <returns>A string that contains the command into a string</returns>
        public static String GetCmdToString(EnumCmd Cmd)
        {
            foreach (EnumCmd ECmd in Enum.GetValues(typeof(EnumCmd)))
            {
                if (Cmd == ECmd)
                {
                    return(ECmd.ToString());
                }
            }

            return(EnumCmd.NotSet.ToString());
        }
示例#3
0
        public AskNewCmdInfo()
        {
            InitializeComponent();

            if (comboBox_Cmd.Items.Count == 0)
            {
                foreach (EnumCmd ECmd in Enum.GetValues(typeof(EnumCmd)))
                {
                    if (ECmd.ToString() != "NotSet")
                    {
                        comboBox_Cmd.Items.Add(ECmd.ToString());
                    }
                }

                if (comboBox_Cmd.Items.Count > 0)
                {
                    comboBox_Cmd.SelectedIndex = 0;
                }

                _NewCmd = comboBox_Cmd.SelectedItem.ToString();
            }
        }