public static KeyValuePair <bool, string> Show(string name, string initialValue) { int result = 0; using (DialogAbilityBits form = new DialogAbilityBits()) { string caption = name; form.Text = caption; int value = Helper.IntTryParse(initialValue) ? Helper.StringToInt(initialValue) : 0; form.cbITMS.Checked = (value & 1) == 1; form.cbITLT.Checked = (value & 2) == 2; form.cbC.Checked = (value & 4) == 4; form.cbHET.Checked = (value & 8) == 8; form.cbW.Checked = (value & 16) == 16; form.cbT.Checked = (value & 32) == 32; form.cbTB.Checked = (value & 64) == 64; form.cbDL.Checked = (value & 128) == 128; form.cbAMB.Checked = (value & 256) == 256; form.cbATB.Checked = (value & 512) == 512; form.cbAS.Checked = (value & 1024) == 1024; if (form.ShowDialog() == DialogResult.Cancel) { return(new KeyValuePair <bool, string>(false, null)); } result += form.cbITMS.Checked ? 1 : 0; result += form.cbITLT.Checked ? 2 : 0; result += form.cbC.Checked ? 4 : 0; result += form.cbHET.Checked ? 8 : 0; result += form.cbW.Checked ? 16 : 0; result += form.cbT.Checked ? 32 : 0; result += form.cbTB.Checked ? 64 : 0; result += form.cbDL.Checked ? 128 : 0; result += form.cbAMB.Checked ? 256 : 0; result += form.cbATB.Checked ? 512 : 0; result += form.cbAS.Checked ? 1024 : 0; } return(new KeyValuePair <bool, string>(true, result.ToString())); }
public static KeyValuePair<bool, string> Show(string name, string initialValue) { int result = 0; using (DialogAbilityBits form = new DialogAbilityBits()) { string caption = name; form.Text = caption; int value = Helper.IntTryParse(initialValue) ? Helper.StringToInt(initialValue) : 0; form.cbITMS.Checked = (value & 1) == 1; form.cbITLT.Checked = (value & 2) == 2; form.cbC.Checked = (value & 4) == 4; form.cbHET.Checked = (value & 8) == 8; form.cbW.Checked = (value & 16) == 16; form.cbT.Checked = (value & 32) == 32; form.cbTB.Checked = (value & 64) == 64; form.cbDL.Checked = (value & 128) == 128; form.cbAMB.Checked = (value & 256) == 256; form.cbATB.Checked = (value & 512) == 512; form.cbAS.Checked = (value & 1024) == 1024; if (form.ShowDialog() == DialogResult.Cancel) return new KeyValuePair<bool, string>(false, null); result += form.cbITMS.Checked ? 1 : 0; result += form.cbITLT.Checked ? 2 : 0; result += form.cbC.Checked ? 4 : 0; result += form.cbHET.Checked ? 8 : 0; result += form.cbW.Checked ? 16 : 0; result += form.cbT.Checked ? 32 : 0; result += form.cbTB.Checked ? 64 : 0; result += form.cbDL.Checked ? 128 : 0; result += form.cbAMB.Checked ? 256 : 0; result += form.cbATB.Checked ? 512 : 0; result += form.cbAS.Checked ? 1024 : 0; } return new KeyValuePair<bool, string>(true, result.ToString()); }