Interaction logic for EventsScreen.xaml
Inheritance: System.Windows.Controls.Page
        private void ExecuteSave(object sender, ExecutedRoutedEventArgs e)
        {
            if (!this._vm.CanSave)
            {
                this.statusMessage.Content = "Please ensure that all event and programme information has been entered correctly.";
                Storyboard sb = (Storyboard)this.FindResource("StatusMessageFadeIn");
                this.statusMessage.BeginStoryboard(sb);
            }
            else
            {
                if (this._vm.Save())
                {
                    // Redirect back to Event Main screen with notify box showing that it has been saved.
                    SessionModel.GetInstance().StatusCode = SessionModel.STATUS_NOTICE;
                    if (this._vm.IsNewEvent)
                    {
                        SessionModel.GetInstance().StatusMessage = "Your event has been successfully created.";
                    }
                    else
                    {
                        SessionModel.GetInstance().StatusMessage = "Your event has been successfully edited.";
                    }

                    EventsView eventsScreen = new EventsView();
                    eventsScreen.SetupNavigationHandler(this.NavigationService);
                    this.NavigationService.Navigate(eventsScreen);
                }
            }
        }
        private void cancelButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure you wish to cancel? Any unsaved changes will be lost!", "Cancel", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                // Redirect back to Event Main screen with notify box showing that it is cancelled.
                EventsView eventsScreen = new EventsView();
                eventsScreen.SetupNavigationHandler(this.NavigationService);
                this.NavigationService.Navigate(eventsScreen);
            }
        }
        private void LoginButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this._vm.Login.Password = this.passwordText.Password;

            if (this._vm.ValidateUser())
            {
                SessionModel.GetInstance().StatusCode = SessionModel.STATUS_NOTICE;
                SessionModel.GetInstance().StatusMessage = "You have successfully logged in. Welcome!";

                EventsView eventsScreen = new EventsView();
                eventsScreen.SetupNavigationHandler(this.NavigationService);
                this.NavigationService.Navigate(eventsScreen);
            }
            else
            {
                MessageBox.Show(
                    "Your matriculation number and password were not recognized. Please check and try again.",
                    "Authentication Failed",
                    MessageBoxButton.OK,
                    MessageBoxImage.Exclamation
                );
            }
        }
Esempio n. 4
0
        private void LoginButton_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            this._vm.Login.Password = this.passwordText.Password;

            if (this._vm.ValidateUser())
            {
                SessionModel.GetInstance().StatusCode    = SessionModel.STATUS_NOTICE;
                SessionModel.GetInstance().StatusMessage = "You have successfully logged in. Welcome!";

                EventsView eventsScreen = new EventsView();
                eventsScreen.SetupNavigationHandler(this.NavigationService);
                this.NavigationService.Navigate(eventsScreen);
            }
            else
            {
                MessageBox.Show(
                    "Your matriculation number and password were not recognized. Please check and try again.",
                    "Authentication Failed",
                    MessageBoxButton.OK,
                    MessageBoxImage.Exclamation
                    );
            }
        }
        private void cancelButton_Click(object sender, RoutedEventArgs e)
        {
            MessageBoxResult result = MessageBox.Show("Are you sure you wish to cancel? Any unsaved changes will be lost!", "Cancel", MessageBoxButton.YesNo, MessageBoxImage.Question);

            if (result == MessageBoxResult.Yes)
            {
                // Redirect back to Event Main screen with notify box showing that it is cancelled.
                EventsView eventsScreen = new EventsView();
                eventsScreen.SetupNavigationHandler(this.NavigationService);
                this.NavigationService.Navigate(eventsScreen);
            }
        }
        private void ExecuteSave(object sender, ExecutedRoutedEventArgs e)
        {
            if (!this._vm.CanSave)
            {
                this.statusMessage.Content = "Please ensure that all event and programme information has been entered correctly.";
                Storyboard sb = (Storyboard)this.FindResource("StatusMessageFadeIn");
                this.statusMessage.BeginStoryboard(sb);
            }
            else
            {
                if (this._vm.Save())
                {
                    // Redirect back to Event Main screen with notify box showing that it has been saved.
                    SessionModel.GetInstance().StatusCode = SessionModel.STATUS_NOTICE;
                    if (this._vm.IsNewEvent)
                    {
                        SessionModel.GetInstance().StatusMessage = "Your event has been successfully created.";
                    }
                    else
                    {
                        SessionModel.GetInstance().StatusMessage = "Your event has been successfully edited.";
                    }

                    EventsView eventsScreen = new EventsView();
                    eventsScreen.SetupNavigationHandler(this.NavigationService);
                    this.NavigationService.Navigate(eventsScreen);
                }
            }
        }
 public void SetEventsScreen(EventsView p)
 {
     this._eventsView = p;
 }