Exemplo n.º 1
0
 public CreatePictureVM(int userId, MainVM main) : base(main)
 {
     Model = new CreatePictureDTO {
         UserId = userId
     };
     LoadData();
 }
Exemplo n.º 2
0
        private async Task LogInProcess()
        {
            var res = await App.ClientService.Account.Token(new LoginDTO { Name = Login, Password = GetPassword() });

            if (res.IsSuccessStatusCode)
            {
                ResetMessages();
                App.LogIn(await res.Content.ReadAsAsync <TokenResponse>());
                MainVM.FlipLoginPlateBack();
            }
            else if (res.StatusCode == HttpStatusCode.BadRequest)
            {
                var responce = await res.Content.ReadAsAsync <BadInputResult>();

                if (responce.Email != null && responce.Email.Length > 0)
                {
                    LoginMessage = "Неверный логин";
                    OnPropertyChanged("LoginMessage");
                    Login = string.Empty;
                }
                if (responce.Password != null && responce.Password.Length > 0)
                {
                    PasswordMessage = "Неверный пароль";
                    OnPropertyChanged("PasswordMessage");
                    CleanPassword();
                }
            }
            else
            {
                await App.ShowErrorMessage("Не удалось войти: " + res.ReasonPhrase);
            }
        }
 public PictureListForTagVM(MainVM mainVM, Tag tag) : base(mainVM)
 {
     Header = tag.Name;
     OnPropertyChanged("Header");
     _tagId = tag.Id;
     LoadData();
 }
 public UserInfoVM(MainVM mainVM, int userId, Roles role) : base(mainVM)
 {
     if (role == Roles.Unauthorized)
     {
         SubscribeVisibility = Visibility.Collapsed;
         AddPicVisibility    = Visibility.Collapsed;
     }
     else if (role == Roles.Authorized)
     {
         if (userId == App.User.UserId)
         {
             SubscribeVisibility = Visibility.Collapsed;
             AddPicVisibility    = Visibility.Visible;
         }
         else
         {
             SubscribeVisibility = Visibility.Visible;
             AddPicVisibility    = Visibility.Collapsed;
         }
     }
     MenuItems = new MenuItem[]
     {
         new MenuItem("Галерея", () => new UserPicturesList(), () => new UserPicturesListVM(userId, mainVM)),
         new MenuItem("Подписчики", () => new UserList(), () => new SubscribersVM(userId, mainVM)),
         new MenuItem("Подписки", () => new UserList(), () => new SubscribesVM(userId, mainVM))
     };
     LoadData(userId, role);
 }
Exemplo n.º 5
0
 public LikedPictureListVM(int userId, MainVM mainVm) : base(mainVm)
 {
     this.userId = userId;
     Header      = "Понравившиеся";
     LoadData();
 }
Exemplo n.º 6
0
 public LoginVM(MainVM mainVM)
 {
     MainVM = mainVM;
 }
 public UserPicturesListVM(int userId, MainVM mainVM) : base(mainVM)
 {
     LoadingVizibility = Visibility.Visible;
     OnPropertyChanged("LoadingVizibility");
     LoadData(userId);
 }
 public BaseWithCommonVM(MainVM mainVM)
 {
     CommonVM = mainVM.CommonVM;
 }
 public SubscribersVM(int userId, MainVM mainVM) : base(mainVM)
 {
     LoadData(userId);
 }
Exemplo n.º 10
0
 public TagListVM(MainVM mainVm) : base(mainVm)
 {
     LoadData();
 }
Exemplo n.º 11
0
 public CommonVM(MainVM mainVM)
 {
     _mainVm = mainVM;
 }
Exemplo n.º 12
0
 public BasePageVM(MainVM mainVM) : base(mainVM)
 {
     MainVM          = mainVM;
     previousContent = MainVM.Content;
     previousContext = previousContent?.DataContext;
 }
 public AllPictureListVM(MainVM mainVM) : base(mainVM)
 {
     Header = "Вся база";
     LoadData();
 }
 public PicturesFromSubscribesVM(int userId, MainVM mainVM) : base(mainVM)
 {
     this.userId = userId;
     LoadData();
 }
 public BasePictureListVM(MainVM mainVM) : base(mainVM)
 {
 }
 public TopPicturesVM(MainVM mainVM) : base(mainVM)
 {
     LoadData();
 }