Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 private static void OnInfoCardOpeningEvent(object sender, InfoCardEventArgs e)
 {
     ((InfoCardSite)sender).OnInfoCardOpening(e);
 }
Esempio n. 3
0
 private static void OnInfoCardDeactivatedEvent(object sender, InfoCardEventArgs e)
 {
     ((InfoCardSite)sender).OnInfoCardDeactivated(e);
 }
Esempio n. 4
0
 protected virtual void OnInfoCardOpening(InfoCardEventArgs e)
 {
 }
Esempio n. 5
0
 protected virtual void OnInfoCardDeactivated(InfoCardEventArgs e)
 {
 }
Esempio n. 6
0
 protected virtual void OnInfoCardClosing(InfoCardEventArgs e)
 {
 }