public LoginViewModel(IDinkeyDongleService _dongleService, ISettingsService _settingsService) { dongleService = _dongleService; settingsService = _settingsService; try { authService = SimpleIoc.Default.GetInstance <IAuthenticationService>(); } catch { const string message = "No Server Settings Were found in the System \r\n Do you want to Create These Settings Now?"; const string caption = "Attention"; var result = MessageBox.Show(message, caption, MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { OpenServerSettings(); } else { Application.Current.Shutdown(); } } LoadSettings(); // CheckPCValidity(); Toaster.Refresh(); LoginCommand = new RelayCommand <object>(async(object obj) => await Login(obj), (obj) => CanLogin); NextPageCommand = new RelayCommand <object>(OpenNextPage); toastManager = Toaster.Instance; MessengerInstance.Register <UIElement>(this, ChangeModal); MessengerInstance.Register <ApplicationSettings>(this, UpdateServerSettings); }
public MainWindowVM(ISettingsService _settingsService, IDinkeyDongleService _dongleService) { settingsService = _settingsService; dongleService = _dongleService; Toaster.Refresh(); if (Application.Current?.Properties?["loggedInUser"] != null) { loggedInUser = Application.Current.Properties["loggedInUser"] as User; } MessengerInstance.Register <UIElement>(this, ChangeModal); MessengerInstance.Register <CardholderDetails>(this, OpenCardholderDetails); LogOutCommand = new RelayCommand(LogOut); NavigationCommand = new RelayCommand <object>(Navigate); ChangePasswordCommand = new RelayCommand(ChangePassword); OpenServerSettingsCommand = new RelayCommand(OpenServerSettings); toastManager = Toaster.Instance; }