Exemple #1
0
        public SingleNoteWindowViewModel(Action <object> closeAction, Note note)
        {
            methods = new UserMethod(ConnectionApi.HttpClient);

            methods.PreparedAuthenticationRecord();
            _authenticationRecord = methods.Record;

            Note                = note;
            EditNoteCmd         = new CommandHandler(EditNote);
            SaveNoteCmd         = new CommandHandler(SaveNote);
            IsSaveButtonVisible = Visibility.Hidden;
            IsEditButtonVisible = Visibility.Visible;
            IsReadOnly          = true;
            OnPropertyChanged(nameof(IsReadOnly));
            OnPropertyChanged(nameof(IsSaveButtonVisible));
            OnPropertyChanged(nameof(IsEditButtonVisible));
        }
        public MainWindowViewModel(Action closeAction)
        {
            AddNoteCmd      = new CommandHandler(NewNote);
            DeleteNoteCmd   = new CommandHandler(DelNote);
            RefreshNotesCmd = new CommandHandler(RefNotes);

            _closeAction = closeAction;
            methods      = new UserMethod(ConnectionApi.HttpClient);


            methods.PreparedAuthenticationRecord();
            _authenticationRecord = methods.Record;
            Notes             = new ObservableCollection <Model.Note>();
            singleNoteWindows = new List <SingleNoteWindow>();
            singleNotes       = new List <Note>();
            GetAllNotes(true);
        }
Exemple #3
0
        public async void MakeLoginTask()
        {
            try
            {
                UserMethod methods = new UserMethod(ConnectionApi.HttpClient);
                methods.PreparedAuthenticationRecord();

                await methods.Login(methods.Record.Email, methods.Record.PasswordHash, true);

                MultiNotesMainWindow mainWindow = new MultiNotesMainWindow();
                mainWindow.Show();
            }
            catch (Exception e)
            {
                MultiNotesLoginWindow loginWindow = new MultiNotesLoginWindow();
                loginWindow.Show();
            }
        }