public MessageBox(MainWindow owner, string message, string title, MessageBoxButton button) { InitializeComponent(); Margin = (owner.WindowState == WindowState.Maximized) ? new Thickness(0, 10, 0, 10) : new Thickness(10); this.Width = owner.ActualWidth; this.Height = 196; this.Left = owner.Location.X; this.Top = owner.Location.Y + (owner.ActualHeight - Height) / 2; Title.Text = title; Message.Text = message; Result = MessageBoxResult.None; switch (button) { case MessageBoxButton.OK: ButtonGroup.Children.Remove(Yes); ButtonGroup.Children.Remove(No); ButtonGroup.Children.Remove(Cancel); break; case MessageBoxButton.OKCancel: ButtonGroup.Children.Remove(Yes); ButtonGroup.Children.Remove(No); break; case MessageBoxButton.YesNo: ButtonGroup.Children.Remove(Okay); ButtonGroup.Children.Remove(Cancel); break; case MessageBoxButton.YesNoCancel: ButtonGroup.Children.Remove(Okay); break; } }
public BalloonBox(MainWindow owner, string message) { InitializeComponent(); //Margin = new Thickness(10); double msgLength = MeasureString(message); Message.Text = message; Message.TextWrapping = TextWrapping.Wrap; Width = GetWidth(msgLength); Height = GetHeight(msgLength); Point p = GetPosition(); Left = p.X;//Forms.Screen.PrimaryScreen.WorkingArea.Width - Width; Top = p.Y; timer = new Timer(10 * 1000); timer.Elapsed += new ElapsedEventHandler(timer_Elapsed); timer.Enabled = true; timer.Start(); BoxStart = this.Resources["PopupShow"] as Storyboard; BoxEnd = this.Resources["PopupHide"] as Storyboard; BoxEnd.Completed += new EventHandler(BoxEnd_Completed); }
public LinuxConnBox(MainWindow owner) { InitializeComponent(); Margin = (owner.WindowState == WindowState.Maximized) ? new Thickness(0, 10, 0, 10) : new Thickness(10); this.Width = owner.ActualWidth; this.Height = 274; this.Left = owner.Location.X; this.Top = owner.Location.Y + (owner.ActualHeight - this.Height) / 2; if (owner.MiSettings.MinimizedClose) { MinToTray.IsChecked = true; } else { ExitApp.IsChecked = true; } }
public MessageBox(MainWindow owner, string message) : this(owner, message, "Information", MessageBoxButton.OK) { }
public MessageBox(MainWindow owner, string message, string title) : this(owner, message, title, MessageBoxButton.OK) { }