예제 #1
0
        public static KeyValuePair <bool, string> Show(string name, string initialValue)
        {
            string result = "";

            using (DialogConsoleList form = new DialogConsoleList())
            {
                string caption = name;
                form.Text = caption;

                string value = (initialValue ?? "").ToLower();

                form.cbM.Checked = value.Contains('m');
                form.cbH.Checked = value.Contains('h');
                form.cbW.Checked = value.Contains('w');
                form.cbE.Checked = value.Contains('e');
                form.cbS.Checked = value.Contains('s');
                form.cbC.Checked = value.Contains('c');
                form.cbO.Checked = value.Contains('o');

                if (form.ShowDialog() == DialogResult.Cancel)
                {
                    return(new KeyValuePair <bool, string>(false, null));
                }


                result += form.cbM.Checked ? "M" : "";
                result += form.cbH.Checked ? "H" : "";
                result += form.cbW.Checked ? "W" : "";
                result += form.cbE.Checked ? "E" : "";
                result += form.cbS.Checked ? "S" : "";
                result += form.cbC.Checked ? "C" : "";
                result += form.cbO.Checked ? "O" : "";
            }
            return(new KeyValuePair <bool, string>(true, result));
        }
        public static KeyValuePair<bool, string> Show(string name, string initialValue)
        {
            string result = "";
            using (DialogConsoleList form = new DialogConsoleList())
            {
                string caption = name;
                form.Text = caption;

                string value = (initialValue ?? "").ToLower();

                form.cbM.Checked = value.Contains('m');
                form.cbH.Checked = value.Contains('h');
                form.cbW.Checked = value.Contains('w');
                form.cbE.Checked = value.Contains('e');
                form.cbS.Checked = value.Contains('s');
                form.cbC.Checked = value.Contains('c');
                form.cbO.Checked = value.Contains('o');

                if (form.ShowDialog() == DialogResult.Cancel)
                    return new KeyValuePair<bool, string>(false, null);

                result += form.cbM.Checked ? "M" : "";
                result += form.cbH.Checked ? "H" : "";
                result += form.cbW.Checked ? "W" : "";
                result += form.cbE.Checked ? "E" : "";
                result += form.cbS.Checked ? "S" : "";
                result += form.cbC.Checked ? "C" : "";
                result += form.cbO.Checked ? "O" : "";
            }
            return new KeyValuePair<bool, string>(true, result);
        }