public StockEventSelectorDlg(string selectedEventMask, StockEvent.EventFilterMode filterMode)
        {
            InitializeComponent();

             //
             this.SelectedEvents = selectedEventMask;
             this.EventFilterMode = filterMode;

             // Initialise event values
             this.eventSelectorCheckedListBox.Items.AddRange(StockEvent.GetSupportedEventTypes());

             // Retrieve last selected settings
             foreach (StockEvent.EventType checkedEvent in StockEvent.EventTypesFromString(SelectedEvents))
             {
            this.eventSelectorCheckedListBox.SetItemChecked(this.eventSelectorCheckedListBox.Items.IndexOf(checkedEvent.ToString()), true);
             }

             // Retrieve filter mode
             if (EventFilterMode.ToString() == "EventAll")
             {
            this.allEventsBtn.Checked = true;
            this.oneEventBtn.Checked = false;
             }
             else
             {
            this.allEventsBtn.Checked = false;
            this.oneEventBtn.Checked = true;
             }
        }
Beispiel #2
0
 public static bool EventsMatch(StockEvent.EventType[] events1, StockEvent.EventType[] events2)
 {
     bool match = true;
      if (events1.Length == events2.Length)
      {
     foreach (StockEvent.EventType event1 in events1)
     {
        if (!events2.Contains(event1))
        {
           match = false;
           break;
        }
     }
      }
      else
      {
     match = false;
      }
      return match;
 }
Beispiel #3
0
 public static string EventTypesToString(StockEvent.EventType[] eventTypes)
 {
     string eventMask = string.Empty;
      foreach (StockEvent.EventType eventType in eventTypes)
      {
     if (!string.IsNullOrEmpty(eventMask))
     {
        eventMask += ";";
     }
     eventMask += eventType.ToString();
      }
      return eventMask;
 }
Beispiel #4
0
 public static bool EventMaskContains(string eventMask, StockEvent.EventType eventType)
 {
     return eventMask.Contains(eventType.ToString());
 }