Task ShowPinAsync(ShowPinUiMessage message) { lock (pinDialogLock) { if (pinView == null) { UIDispatcher.Invoke(() => { if (MainWindow is MetroWindow metroWindow) { var vm = _viewModelLocator.PinViewModel; vm.Initialize(message.DeviceId); pinView = new PinDialog(vm); pinView.Closed += PinView_Closed; OnActivateMainWindow(); metroWindow.ShowMetroDialogAsync(pinView); } }); } if (pinView != null) { UIDispatcher.Invoke(() => { ((PinViewModel)pinView.DataContext).UpdateViewModel(message.DeviceId, false, message.OldPin, message.ConfirmPin); }); } } return(Task.CompletedTask); }
//Abre el diálogo para introducir el pin de seguridad. internal bool PidePIN() { PinDialog pinDialog = new PinDialog(PinConfig.Insert_Pin) { WindowStartupLocation = System.Windows.WindowStartupLocation.CenterScreen }; return(pinDialog.ShowDialog() == true); }
//Muestra el diálogo para cambiar el pin actual. public void CambiaPINSeguridad() { PinDialog dialogoPin = new PinDialog(PinConfig.Update_Pin) { WindowStartupLocation = WindowStartupLocation.CenterScreen, ShowInTaskbar = false }; dialogoPin.ShowDialog(); }
void PinView_Closed(object sender, EventArgs e) { lock (pinDialogLock) { if (pinView != null) { pinView.Closed -= PinView_Closed; pinView = null; } } }
Task HidePinAsync(HidePinUiMessage message) { try { UIDispatcher.Invoke(() => { try { pinView?.Close(); pinView = null; } catch { } }); } catch { } return(Task.CompletedTask); }
void MouseEvents_Click(object sender, MouseEventArgs e) { if (dialogOpen) return; dialogOpen = true; currentPin = new Pin(); TransformWindowToImage(e.X, e.Y, out currentPin.X, out currentPin.Y); PinDialog dialog = new PinDialog(); dialog.FormClosed += new FormClosedEventHandler(dialog_FormClosed); dialog.ShowDialog(); }