/// <summary> /// Add items to channel. /// The items added may be with no assiged Id, or a duplication of other items. /// </summary> public virtual void AddItems(IEnumerable <EventBase> items) { SystemMonitor.CheckError(_source != null, "Source not assigned."); if (this.Enabled == false) { SystemMonitor.OperationWarning("Will not add items to disabled channel."); return; } List <EventBase> itemsAdded = new List <EventBase>(); foreach (EventBase item in items) { if (item.DateTime.HasValue == false) { SystemMonitor.OperationError("Event with no date time assigned can not be processed."); continue; } lock (this) { if (_items.ContainsKey(item) && _itemsUpdateEnabled == false) {// Already an item with this Id is known. continue; } if (_enableLatestEventTitleDuplicationProtection && ((DateTime.Now - item.DateTime) < _latestEventsFilterPeriod)) { if (_latestEvents.ContainsKey(item.Title) == false) {// Gather items from the last X days. _latestEvents.Add(item.Title, item); } else {// Item wit this title already known. continue; } } _items[item] = item; } if (ItemsAddedEvent != null) { itemsAdded.Add(item); } } if (ItemsAddedEvent != null) { ItemsAddedEvent(_source, this, itemsAdded); } }
/// <summary> /// Helper. /// </summary> void SetControlToDragControl(CommonBaseControl control, DragControl dragControl, Point location) { SystemMonitor.CheckError(dragControl.ControlContained == null, "Drag control already has a contained control."); dragControl.ControlContained = control; dragControl.Name = control.Name; dragControl.Location = location; dragControl.Image = GetControlImage(control); dragControl.dragStrip.DoubleClick += new EventHandler(dragStrip_DoubleClick); UpdateUI(); }
/// <summary> /// Resets the user interface placement of controls, by sending them all to the tab control. /// </summary> public void ResetControlPlacement() { foreach (CombinedHostingForm form in GeneralHelper.EnumerableToList <CombinedHostingForm>(_floatingFormsControls.Keys)) { CommonBaseControl control = form.ContainedControl; control.Parent = null; // This makes sure no ask dialogs are shown or closing the forms. form.ContainedControl = null; DoRemoveControl(control); AddTabbedControl(control); } SystemMonitor.CheckError(_floatingFormsControls.Count == 0, "Not all floating forms were replaced with tabbed controls."); foreach (DragControl drag in GeneralHelper.EnumerableToList <DragControl>(dragContainerControl.DragControls)) { if (drag == _checkedControlContainer) { continue; } CommonBaseControl control = (CommonBaseControl)drag.ControlContained; control.Parent = null; // This makes sure no ask dialogs are shown or closing the forms. drag.ControlContained = null; dragContainerControl.RemoveDragControl(drag); AddTabbedControl(control); } //SystemMonitor.CheckError(dragContainerControl.DragControls.Count == 1, "Not all docked forms were replaced with tabbed controls."); }
/// <summary> /// Initialize this channel with the source it belongs to. /// </summary> public bool Initialize(EventSource source) { SystemMonitor.CheckError(_source == null, "Source already assigned."); _source = source; return(true); }