public void DialogPanelInit(FrameworkElement thisElement, bool bModal, EventHandler closeHandler) { m_CloseHandler = closeHandler; m_this = thisElement; m_this.SizeChanged += SizeChanged; m_this.Visibility = Visibility.Collapsed; m_this.SetZIndex(99); m_this.MouseLeftButtonDown += MouseLeftButtonDown; m_this.MouseLeftButtonUp += MouseLeftButtonUp; m_this.MouseMove += MouseMove; if (bModal) { m_BackgroundElement = new Canvas(); m_BackgroundElement.Visibility = Visibility.Collapsed; m_BackgroundElement.SetZIndex(99); m_BackgroundElement.Background = new SolidColorBrush("#AAFFFFFF".ToColor()); m_BackgroundElement.Width = BrowserScreenInformation.ScreenWidth; m_BackgroundElement.Height = BrowserScreenInformation.ScreenHeight; m_BackgroundElement.Children.Add(m_this); m_RootDialogElement = m_BackgroundElement; } else { m_BackgroundElement = null; m_RootDialogElement = m_this; } ApplicationEx.RootPanel.Children.Add(m_RootDialogElement); DialogPanelShow(true); }
internal void InitializeDialogPanel(bool modal, Control focusControl, Panel parent) { lock (m_Lock) { m_Parent = parent; m_FocusControl = focusControl; base.Loaded += OnLoaded; base.SizeChanged += OnSizeChanged; // Sent when the dialog is first created base.Visibility = Visibility.Collapsed; this.SetZIndex((int)Interlocked.Increment(ref m_RunningZIndex)); if (modal) { if (m_ModalBackground == null) { m_ModalBackground = new Canvas(); m_ModalBackground.SetZIndex(m_BackgroundZIndex); m_ModalBackground.Visibility = Visibility.Collapsed; m_ModalBackground.Background = new SolidColorBrush(Color.FromArgb(0xAA, 0xFF, 0xFF, 0xFF/*#AAFFFFFF*/)); m_ModalBackground.Width = BrowserScreenInformation.ScreenWidth; m_ModalBackground.Height = BrowserScreenInformation.ScreenHeight; parent.Children.Add(m_ModalBackground); } m_ModalBackground.Children.Add(this); Interlocked.Increment(ref m_ModalBackgroundCount); } else { // Modeless if (parent is Canvas) parent.Children.Add(this); else { m_ModelessBackground = new Canvas(); m_ModelessBackground.SetZIndex(m_BackgroundZIndex); parent.Children.Add(m_ModelessBackground); m_ModelessBackground.Children.Add(this); } } SetupAnimation(); } }