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; }
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))); }