/// <summary> /// Opens the specified object. /// </summary> protected void Open(T obj) { obj.Opening += delegate(object sender, EventArgs e) { Add((T)sender); OnItemOpening(new ItemEventArgs <T>((T)sender)); }; obj.Opened += delegate(object sender, EventArgs e) { OnItemOpened(new ItemEventArgs <T>((T)sender)); }; obj.Closing += delegate(object sender, ClosingEventArgs e) { ClosingItemEventArgs <T> args = new ClosingItemEventArgs <T>((T)sender, e.Reason, e.Interaction, e.Cancel); OnItemClosing(args); e.Cancel = args.Cancel; }; obj.Closed += delegate(object sender, ClosedEventArgs e) { Remove((T)sender); OnItemClosed(new ClosedItemEventArgs <T>((T)sender, e.Reason)); }; obj.VisibleChanged += delegate(object sender, EventArgs e) { OnItemVisibilityChanged(new ItemEventArgs <T>((T)sender)); }; obj.InternalActiveChanged += delegate(object sender, EventArgs e) { OnItemActivationChangedInternal(new ItemEventArgs <T>((T)sender)); }; obj.ActiveChanged += delegate(object sender, EventArgs e) { OnItemActivationChanged(new ItemEventArgs <T>((T)sender)); }; obj.Open(); }
void Workspaces_ItemClosing(object sender, ClosingItemEventArgs <Workspace> e) { LogState(e.Item); }
void Shelves_ItemClosing(object sender, ClosingItemEventArgs <Shelf> e) { LogState(e.Item); }
void Windows_ItemClosing(object sender, ClosingItemEventArgs <DesktopWindow> e) { LogState(e.Item); }
/// <summary> /// Raises the <see cref="ItemClosing"/> event. /// </summary> protected virtual void OnItemClosing(ClosingItemEventArgs <T> args) { EventsHelper.Fire(_itemClosing, this, args); }