internal bool Close(InfoCard infoCard, InfoCardCloseReason closeReason, bool force) { if ((infoCard == null) || (!infoCard.IsOpen)) { return(false); } // Raise closing event var closingEventArgs = new InfoCardEventArgs(infoCard, InfoCardClosingEvent, this); RaiseEvent(closingEventArgs); infoCard.RaiseClosingEvent(); if (!force && closingEventArgs.Cancel) { return(false); } var notifier = new EventNotifier(); notifier.Subscribe(infoCard); infoCard.Measure(new Size(0, 0)); infoCard.ClearValue(Expander.IsExpandedProperty); infoCard.ClearValue(InfoCard.IsPinnedProperty); var infoCardHost = InfoCardHost.GetInfoCardHost(infoCard); if (infoCardHost != null) { infoCardHost.Content = null; } notifier.RaiseEvents(); if (InfoCardService.GetUnregisterInfoCardOnClose(infoCard)) { InfoCards.Remove(infoCard); } RaiseEvent(new InfoCardEventArgs(infoCard, InfoCardClosedEvent, this)); infoCard.RaiseClosedEvent(); infoCard.LastCloseReason = closeReason; return(true); }
private static void OnInfoCardOpeningEvent(object sender, InfoCardEventArgs e) { ((InfoCardSite)sender).OnInfoCardOpening(e); }
private static void OnInfoCardDeactivatedEvent(object sender, InfoCardEventArgs e) { ((InfoCardSite)sender).OnInfoCardDeactivated(e); }
protected virtual void OnInfoCardOpening(InfoCardEventArgs e) { }
protected virtual void OnInfoCardDeactivated(InfoCardEventArgs e) { }
protected virtual void OnInfoCardClosing(InfoCardEventArgs e) { }