Beispiel #1
0
 public AddEditINoteWindow(NotePageViewModel viewModel)
 {
     InitializeComponent();
     ViewModel = viewModel;
     NoteFrame.Navigate(new NotePage(ViewModel as NotePageViewModel));
     Messenger.Default.Register(this, new Action <string>(ProcessMessage));
 }
Beispiel #2
0
 public MainWindow(MainWindowViewModel viewModel)
 {
     InitializeComponent();
     ViewModel = viewModel;
     NoteFrame.Navigate(new NotePage(new NotePageViewModel(ViewModel.Service, (ViewModel as MainWindowViewModel).CurrentBook, (ViewModel as MainWindowViewModel).CurrentNote)));
     Messenger.Default.Register(this, new Action <string>(ProcessMessage));
 }
Beispiel #3
0
 public void ProcessMessage(string message)
 {
     if (message.Equals("CreateNote"))
     {
         new AddEditINoteWindow(
             new NotePageViewModel(
                 ViewModel.Service,
                 (ViewModel as MainWindowViewModel).CurrentBook))
         .ShowDialog();
     }
     else if (message.Equals("EditNote"))
     {
         new AddEditINoteWindow(
             new NotePageViewModel(
                 ViewModel.Service,
                 (ViewModel as MainWindowViewModel).CurrentBook,
                 (ViewModel as MainWindowViewModel).CurrentNote)
             ).Show();
     }
     else if (message.Equals("EditCategory"))
     {
         new AddEditBookElement(
             new AddEditBookElementViewModel(
                 ViewModel.Service,
                 (ViewModel as MainWindowViewModel).SelectedCategory
                 )).ShowDialog();
     }
     else if (message.Equals("CreateCategory"))
     {
         new AddEditBookElement(new AddEditBookElementViewModel(ViewModel.Service, new Category(String.Empty))).ShowDialog();
     }
     else if (message.Equals("EditBook"))
     {
         new AddEditBookElement(
             new AddEditBookElementViewModel(
                 ViewModel.Service,
                 (ViewModel as MainWindowViewModel).CurrentBook
                 )).ShowDialog();
     }
     else if (message.Equals("CreateBook"))
     {
         new AddEditBookElement(new AddEditBookElementViewModel(ViewModel.Service, new Book(String.Empty))).ShowDialog();
     }
     else if (message.Equals("AboutPage"))
     {
         MessageBox.Show("Hello! \n I am Ruslan Humeniuk.\n I am KPI student and this is my first WPF project");
     }
     else if (message.Equals("UpdateMain"))
     {
         this.InitializeComponent();
     }
     else if (message.Equals("UpdateNoteFrame"))
     {
         NoteFrame.Navigate(new NotePage(new NotePageViewModel(ViewModel.Service, (ViewModel as MainWindowViewModel).CurrentBook, (ViewModel as MainWindowViewModel).CurrentNote)));
     }
 }
Beispiel #4
0
        public void OpenNote(object parameter)
        {
            UpdateNotePopupSizeAndPosition();
            NoteOpening?.Invoke(this, EventArgs.Empty);
            ShowPopupAnimation.Begin();

            while (NoteFrame.CanGoBack)
            {
                NoteFrame.GoBack();
            }
            NoteFrame.BackStack.Clear();
            NoteFrame.Navigate(typeof(NoteEditPage), parameter);

            NotePopup.IsOpen = true;
            NoteOpened?.Invoke(this, new GenericEventArgs(parameter));
        }