/// <summary> /// Clears the <see cref="panel" /> by removing event handlers and setting the <see cref="panel" /> field to null. /// </summary> private void ClearPanel() { if (this.panel != null) { this.panel.ButtonClicked -= this.panel_ButtonClicked; this.panel = null; } }
/// <summary> /// Creates and returns a new Window to use as the prompt window. /// </summary> /// <returns>Window.</returns> private Window GetNewWindow() { var newWindow = new Window(); object contentContext = null; newWindow.WindowStyle = this.WindowStyle; newWindow.SizeToContent = SizeToContent.WidthAndHeight; newWindow.ResizeMode = ResizeMode.NoResize; newWindow.ShowInTaskbar = false; newWindow.Title = this.Title ?? string.Empty; this.panel = new MessagePanel(); if (this.Content != null) { var content = this.Content; contentContext = (content is FrameworkElement) ? ((FrameworkElement)content).DataContext : null; this.RemoveLogicalChild(content); this.panel.InnerContent = content; } this.panel.Buttons = this.GetButtons(); this.panel.ButtonClicked += this.panel_ButtonClicked; if (this.ButtonBorderBackground != null) { this.panel.ButtonPanelBorder.Background = this.ButtonBorderBackground; } newWindow.Content = this.panel; newWindow.DataContext = contentContext; newWindow.Closing += this.window_Closing; if (this.WindowStyle == WindowStyle.None) { newWindow.AllowsTransparency = true; } if (this.Parent != null) { newWindow.Owner = Window.GetWindow(this.Parent); newWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { newWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; } return(newWindow); }
/// <summary> /// Creates and returns a new Window to use as the prompt window. /// </summary> /// <returns>Window.</returns> private Window GetNewWindow() { var newWindow = new Window(); object contentContext = null; newWindow.WindowStyle = this.WindowStyle; newWindow.SizeToContent = SizeToContent.WidthAndHeight; newWindow.ResizeMode = ResizeMode.NoResize; newWindow.ShowInTaskbar = false; newWindow.Title = this.Title ?? string.Empty; this.panel = new MessagePanel(); if (this.Content != null) { var content = this.Content; contentContext = (content is FrameworkElement) ? ((FrameworkElement)content).DataContext : null; this.RemoveLogicalChild(content); this.panel.InnerContent = content; } this.panel.Buttons = this.GetButtons(); this.panel.ButtonClicked += this.panel_ButtonClicked; if (this.ButtonBorderBackground != null) { this.panel.ButtonPanelBorder.Background = this.ButtonBorderBackground; } newWindow.Content = this.panel; newWindow.DataContext = contentContext; newWindow.Closing += this.window_Closing; if (this.WindowStyle == WindowStyle.None) { newWindow.AllowsTransparency = true; } if (this.Parent != null) { newWindow.Owner = Window.GetWindow(this.Parent); newWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; } else { newWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen; } return newWindow; }
/// <summary> /// Clears the <see cref="panel" /> by removing event handlers and setting the <see cref="panel" /> field to null. /// </summary> private void ClearPanel() { if (this.panel != null) { this.panel.ButtonClicked -= this.panel_ButtonClicked; this.panel = null; } }