コード例 #1
0
 public ProfileVM(MainVM mainVM)
 {
     MainVM = mainVM;
     ChangePasswordCommand = new Command(arg => ChangePassword(arg));
     ChangePasswordEnabled = true;
     ErrorColor            = "Red";
 }
コード例 #2
0
        private async void ChangePassword(object arg)
        {
            MainVM.Loading        = true;
            ChangePasswordEnabled = false;
            ErrorColor            = "Red";
            DialogContent         = "Czy na pewno chcesz zmienić hasło?";
            string result = (string)await DialogHost.Show(new OkCancelDialog(), "ChangePassDialog");

            if (result == "Accept")
            {
                if (((IEnumerable)arg).Cast <object>()
                    .Select(x => (PasswordBox)x)
                    .ToArray() is PasswordBox[] arr)
                {
                    if (arr[0].Password != string.Empty && arr[1].Password != string.Empty && arr[2].Password != string.Empty)
                    {
                        if (arr[1].Password == arr[2].Password)
                        {
#if !DEBUG
                            var valid = new Regex(@"^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[^\da-zA-Z]).{8,15}$");
                            if (valid.IsMatch(arr[1].Password))
                            {
#endif
                            if (await Client.ChangePassword(arr[0].Password, arr[1].Password))
                            {
                                ChangePasswordError = "Hasło zmienione pomyślnie, za chwilę nastąpi wylogowanie...";
                                ErrorColor          = "Green";
                                await Task.Delay(4000);

                                MainVM.NavigateTo("Logout");
                            }
                            else
                            {
                                ChangePasswordError = "Nie udało się zmienić hasła!";
                            }
#if !DEBUG
                        }
                        else
                        {
                            ChangePasswordError = "Hasło powinno składać się z 8-15 znaków, zawierać duże i małe litery, cyfry oraz znaki specjalne.";
                        }
#endif
                        }
                        else
                        {
                            ChangePasswordError = "Hasła muszą być takie same!";
                        }
                    }
                    else
                    {
                        ChangePasswordError = "Wszystkie pola muszą być wypełnione!";
                    }
                }
            }


            ChangePasswordEnabled = true;
            MainVM.Loading        = false;
        }
コード例 #3
0
 public LoginVM(MainVM mainVM_)
 {
     mainVM               = mainVM_;
     LoginClickCommand    = new Command(arg => LoginAction(arg));
     RegisterClickCommand = new Command(arg => Register());
     ServerAddress        = "127.0.0.1";
     ServerPort           = "2048";
     Login           = "******";
     loginEnabled    = true;
     registerEnabled = true;
 }
コード例 #4
0
ファイル: RegisterVM.cs プロジェクト: ppawlinski/GPSTCPServer
 public RegisterVM(MainVM mainVM_)
 {
     mainVM = mainVM_;
     RegisterClickCommand = new Command(arg => RegisterAction(arg));
     ReturnClickCommand   = new Command(arg => ReturnAction());
     ServerAddress        = "127.0.0.1";
     ServerPort           = "2048";
     Login           = string.Empty;
     registerEnabled = true;
     returnEnabled   = true;
     ErrorColor      = "Red";
 }
コード例 #5
0
 public FavouritesVM(MainVM mainVM_)
 {
     MainVM                      = mainVM_;
     FavMap                      = new MapVM();
     Locations                   = new ObservableCollection <UserLocation>();
     FavAddressSearch            = new AddressesSearch();
     DeleteCommand               = new Command(arg => DeleteLocation(arg));
     EditCommand                 = new Command(arg => EditLocation(arg));
     MapDoubleClickCommand       = new Command(arg => MapDoubleClick(arg));
     CenterOnUserLocationCommand = new Command(arg => CenterOnUserLocation(arg));
     AddLocationCommand          = new Command(arg => AddLocation());
     ClearAddingCommand          = new Command(arg => ClearAdding());
     Pins = new ObservableCollection <Pushpin>();
     FavAddressSearch.OnSelectedAction += FavAddressSearch_OnSelectedAction;
     LoadData();
 }