public MainWindowController(MainWindow view) { Contract.Requires(view != null); _view = view; _view.Show(); _functionMapping = new Dictionary<MenuItem, ContentController>(); _functionMapping.Add(_view.NormalRegistration, new NormalVoterRegistrationController(new VoterRegistrationView())); _functionMapping.Add(_view.ManualRegistration, new ManualVoterRegistrationController(new VoterRegistrationView())); _functionMapping.Add(_view.ElectionAdministration, new ElectionAdministrationController(new ElectionAdministrationView())); _view.ChangePassword.Click += (s, e) => { var pwdWin = new ChangePasswordWindow(); new ChangeOwnPasswordController(pwdWin); pwdWin.Show(); }; UpdateMenuAccess(); ShowScreen(_functionMapping[_view.NormalRegistration]); _view.Exit.Click += (s, e) => VoterListApp.App.Shutdown(); _view.LogOut.Click += (s, e) => VoterListApp.LogOut(); _view.Closed += (s, e) => { if (VoterListApp.ShutdownAllowed) VoterListApp.App.Shutdown(); }; }
public ChangeOwnPasswordController(ChangePasswordWindow view) { Contract.Requires(view != null); _view = view; _view.SaveBtn.Click += ChangePassword; _view.KeyDown += ChangePassword; }