コード例 #1
0
        public async Task GeneratePassword()
        {
            if (appController.Busy)
            {
                return;
            }
            else
            {
                appController.EnableBusyState();
            }

            var vm = viewModelsController.GetViewModel <CreateViewModel>();

            if (string.IsNullOrEmpty(vm.Login) ||
                string.IsNullOrEmpty(vm.Name))
            {
                appController.DisableBusyState();
                return;
            }

            try
            {
                vm.Password = await Task.Run(() => passwordGenerator.GeneratePassword(vm.UserLower, vm.UseUpper, vm.UseNumber, vm.UseSpecial, vm.UsePolish, vm.PasswordLenght));
            }
            catch (Exception)
            {
                vm.Password = "******";
            }
            finally
            {
                appController.DisableBusyState();
            }
        }
コード例 #2
0
        public void ApplyGeneralPassword()
        {
            var vm         = _viewModelsController.GetViewModel <GetGeneralPasswordViewModel>();
            var mainFormVm = _viewModelsController.GetViewModel <WindowViewModel>();

            try
            {
                if (string.IsNullOrEmpty(vm.Password))
                {
                    return;
                }

                mainFormVm.CurrentPage      = Pages.AppPage.Loading;
                Definitions.GeneralPassword = vm.Password;

                _viewModelsController.CreateViewModel <CreateViewModel>();
                _viewModelsController.CreateViewModel <DashboardViewModel>();
                _viewModelsController.CreateViewModel <DeleteViewModel>();
                _viewModelsController.CreateViewModel <WelcomeViewModel>();
                _viewModelsController.CreateViewModel <ExtractViewModel>();
                _viewModelsController.CreateViewModel <InfoViewModel>();
                _viewModelsController.CreateViewModel <ChangeGeneralPasswordViewModel>();

                mainFormVm.CurrentPage             = Pages.AppPage.Welcome;
                mainFormVm.GeneralPasswordProvided = true;
                vm.Password = "";
            }
            catch (Exception)
            {
                vm.Password = "******";
            }
        }
コード例 #3
0
        public void Dismiss()
        {
            var vm       = viewModelsController.GetViewModel <InfoViewModel>();
            var windowVm = viewModelsController.GetViewModel <WindowViewModel>();

            vm.InfoMessage = "";
            vm.InfoTitle   = "";

            windowVm.CurrentPage = Pages.AppPage.Dashboard;
        }
コード例 #4
0
        public async Task DeletePassword()
        {
            if (appController.Busy)
            {
                return;
            }
            else
            {
                appController.EnableBusyState();
            }

            var vm = viewModelsController.GetViewModel <DeleteViewModel>();

            if (vm.SelectedPassword == null)
            {
                appController.DisableBusyState();
                return;
            }

            try
            {
                await appRepository.DeletePassword(vm.SelectedPassword.Id);

                appController.RefreshViewModels();

                appController.DisableBusyState();
                appController.ShowInfoPage("Success!", "Password Deleted!");
            }
            catch (Exception)
            {
                appController.DisableBusyState();
                appController.ShowInfoPage("Issue!", "Please try again!");
            }
        }