Beispiel #1
0
		private void OnHideBackgroundCompleted(object sender, EventArgs e)
		{
		lock (m_Lock)
		{
			if (base.Parent == m_Parent)
			{
				m_Parent.Children.Remove(this);
			}
			else
			if (base.Parent == m_ModelessBackground)
			{
				m_ModelessBackground.Children.Remove(this);
				m_Parent.Children.Remove(m_ModelessBackground);
				m_ModelessBackground = null;
			}
			else
			if (base.Parent == m_ModalBackground)
			{
				m_ModalBackground.Children.Remove(this);
				if (Interlocked.Decrement(ref m_ModalBackgroundCount) == 0)
				{
					m_Parent.Children.Remove(m_ModalBackground);
					m_ModalBackground = null;

					if (m_ModalBackgroundAnimation != null)
					{
						m_ModalBackgroundAnimation.ForwardCompleted -= OnShowBackgroundCompleted;
						m_ModalBackgroundAnimation.ReverseCompleted -= OnHideBackgroundCompleted;
						m_ModalBackgroundAnimation.Dispose();
						m_ModalBackgroundAnimation = null;
					}
				}
			}
			
//j			// Do this in a BackgroundTask so the UI is more responsive
//j			BackgroundTask task = new BackgroundTask(Application.Current.RootVisual as FrameworkElement, 200/*runDelay*/, delegate(object sender1, DoWorkEventArgs e1)
//j			{
				if (Closed != null)
					Closed(this, null);

				DisposeInternal();
//j			});
//j			task.Run(null, false/*bCancelPrevious*/);
		}
		}
Beispiel #2
0
		private void SetupAnimation()
		{
			if (g_WhichAnimation == 0)
				m_Animation = new ScaleAnimation() { SecondsForward = 1.0, SecondsReverse = 1.0 }; // Scale from center
			else
			if (g_WhichAnimation == 1)
				m_Animation = new ScaleAnimation() { SecondsForward = 1.0, SecondsReverse = 1.0, Offset = new Point(0, 0) }; // Scale from UL corner
			else
				return;

			FrameworkElement animationElement = this as FrameworkElement;
			m_Animation.SetTarget(animationElement);
			m_Animation.ForwardCompleted += OnShowCompleted;
			m_Animation.ReverseCompleted += OnHideCompleted;
		}