예제 #1
0
        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;
            }
        }
예제 #2
0
        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);
        }
예제 #3
0
        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;
            }
        }
예제 #4
0
 public MessageBox(MainWindow owner, string message)
     : this(owner, message, "Information", MessageBoxButton.OK)
 {
 }
예제 #5
0
 public MessageBox(MainWindow owner, string message, string title)
     : this(owner, message, title, MessageBoxButton.OK)
 {
 }