/// <summary> /// Change of the indicator ban state. /// </summary> private void ChbxIndicatorCheckedChanged(object sender, EventArgs e) { var chbxIndicator = (CheckBox)sender; bool isBanned = !chbxIndicator.Checked; string indicatorName = chbxIndicator.Text; switch (_currentSlotType) { case SlotTypes.Open: if (isBanned) { if (!BannedEntryIndicators.Contains(indicatorName)) { BannedEntryIndicators.Add(indicatorName); } } else { if (BannedEntryIndicators.Contains(indicatorName)) { BannedEntryIndicators.Remove(indicatorName); } } break; case SlotTypes.OpenFilter: if (isBanned) { if (!BannedEntryFilterIndicators.Contains(indicatorName)) { BannedEntryFilterIndicators.Add(indicatorName); } } else { if (BannedEntryFilterIndicators.Contains(indicatorName)) { BannedEntryFilterIndicators.Remove(indicatorName); } } break; case SlotTypes.Close: if (isBanned) { if (!BannedExitIndicators.Contains(indicatorName)) { BannedExitIndicators.Add(indicatorName); } } else { if (BannedExitIndicators.Contains(indicatorName)) { BannedExitIndicators.Remove(indicatorName); } } break; case SlotTypes.CloseFilter: if (isBanned) { if (!BannedExitFilterIndicators.Contains(indicatorName)) { BannedExitFilterIndicators.Add(indicatorName); } } else { if (BannedExitFilterIndicators.Contains(indicatorName)) { BannedExitFilterIndicators.Remove(indicatorName); } } break; } SetStatusButton(); VScrollBar.Select(); }
/// <summary> /// Reads config file record and arranges lists. /// </summary> private void InitBannedIndicators() { string config = Configs.BannedIndicators; const string nl = ";"; if (config == "") { // Preparing config string after reset. config = "__OpenPoint__" + nl + "__OpenFilters__" + nl + "__ClosePoint__" + nl + "__CloseFilters__" + nl; Configs.BannedIndicators = config; return; } string[] banned = config.Split(new[] { nl }, StringSplitOptions.RemoveEmptyEntries); SlotTypes indSlot = SlotTypes.NotDefined; foreach (string ind in banned) { if (ind == "__OpenPoint__") { indSlot = SlotTypes.Open; continue; } if (ind == "__OpenFilters__") { indSlot = SlotTypes.OpenFilter; continue; } if (ind == "__ClosePoint__") { indSlot = SlotTypes.Close; continue; } if (ind == "__CloseFilters__") { indSlot = SlotTypes.CloseFilter; continue; } if (indSlot == SlotTypes.Open && ind != "") { if (!BannedEntryIndicators.Contains(ind)) { BannedEntryIndicators.Add(ind); } } if (indSlot == SlotTypes.OpenFilter && ind != "") { if (!BannedEntryFilterIndicators.Contains(ind)) { BannedEntryFilterIndicators.Add(ind); } } if (indSlot == SlotTypes.Close && ind != "") { if (!BannedExitIndicators.Contains(ind)) { BannedExitIndicators.Add(ind); } } if (indSlot == SlotTypes.CloseFilter && ind != "") { if (!BannedExitFilterIndicators.Contains(ind)) { BannedExitFilterIndicators.Add(ind); } } } }