Exemplo n.º 1
0
 static void CopyText(MsgBoxVM vm)
 {
     try {
         Clipboard.SetText(vm.Message);
     }
     catch (ExternalException) { }
 }
Exemplo n.º 2
0
        void Create(string message, MsgBoxButton buttons, bool hasDontShowAgain, Window ownerWindow, out MsgBoxDlg win, out MsgBoxVM vm)
        {
            win = new MsgBoxDlg();
            var winTmp = win;

            vm = new MsgBoxVM(message, button => winTmp.Close(button));
            vm.HasDontShowAgain = hasDontShowAgain;
            vm.HasOKButton      = (buttons & MsgBoxButton.OK) != 0;
            vm.HasYesButton     = (buttons & MsgBoxButton.Yes) != 0;
            vm.HasNoButton      = (buttons & MsgBoxButton.No) != 0;
            vm.HasCancelButton  = (buttons & MsgBoxButton.Cancel) != 0;
            win.DataContext     = vm;
            win.Owner           = ownerWindow ?? appWindow.MainWindow;
        }
Exemplo n.º 3
0
        void Create(string message, MsgBoxButton buttons, bool hasDontShowAgain, Window ownerWindow, out MsgBoxDlg win, out MsgBoxVM vm)
        {
            win = new MsgBoxDlg();
            var winTmp = win;

            vm = new MsgBoxVM(message, button => winTmp.Close(button));
            vm.HasDontShowAgain = hasDontShowAgain;
            vm.HasOKButton      = (buttons & MsgBoxButton.OK) != 0;
            vm.HasYesButton     = (buttons & MsgBoxButton.Yes) != 0;
            vm.HasNoButton      = (buttons & MsgBoxButton.No) != 0;
            vm.HasCancelButton  = (buttons & MsgBoxButton.Cancel) != 0;
            win.DataContext     = vm;
            win.Owner           = ownerWindow ?? appWindow.MainWindow;
            var vmTmp = vm;

            win.CommandBindings.Add(new CommandBinding(ApplicationCommands.Copy, (s, e) => CopyText(vmTmp)));
        }