diff options
-rw-r--r-- | EventMaker/EventMaker/App.xaml.cs | 44 | ||||
-rw-r--r-- | EventMaker/EventMaker/Handler/EventHandler.cs | 1 | ||||
-rw-r--r-- | EventMaker/EventMaker/View/CreateEventPage.xaml | 8 | ||||
-rw-r--r-- | EventMaker/EventMaker/View/CreateEventPage.xaml.cs | 22 |
4 files changed, 34 insertions, 41 deletions
diff --git a/EventMaker/EventMaker/App.xaml.cs b/EventMaker/EventMaker/App.xaml.cs index 9dbb3d6..9e69362 100644 --- a/EventMaker/EventMaker/App.xaml.cs +++ b/EventMaker/EventMaker/App.xaml.cs @@ -41,7 +41,7 @@ namespace EventMaker ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar; if (titleBar != null) { - titleBar.BackgroundColor = Color.FromArgb(255,16,110,190); + titleBar.BackgroundColor = Color.FromArgb(255, 16, 110, 190); titleBar.ButtonBackgroundColor = Color.FromArgb(255, 16, 110, 190); } #endif @@ -55,7 +55,6 @@ namespace EventMaker rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; - rootFrame.Navigated += OnNavigated; if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) @@ -66,28 +65,18 @@ namespace EventMaker // Place the frame in the current Window Window.Current.Content = rootFrame; - // Register a handler for BackRequested events and set the - // visibility of the Back button - SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested; - - SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = - rootFrame.CanGoBack ? - AppViewBackButtonVisibility.Visible : - AppViewBackButtonVisibility.Collapsed; - - } - - if (e.PrelaunchActivated == false) - { - if (rootFrame.Content == null) + if (e.PrelaunchActivated == false) { - // When the navigation stack isn't restored navigate to the first page, - // configuring the new page by passing required information as a navigation - // parameter - rootFrame.Navigate(typeof(View.EventPage), e.Arguments); + if (rootFrame.Content == null) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(typeof(View.EventPage), e.Arguments); + } + // Ensure the current window is active + Window.Current.Activate(); } - // Ensure the current window is active - Window.Current.Activate(); } } @@ -125,16 +114,5 @@ namespace EventMaker deferral.Complete(); } - private void OnBackRequested(object sender, BackRequestedEventArgs e) - { - Frame rootFrame = Window.Current.Content as Frame; - - if (rootFrame.CanGoBack) - { - e.Handled = true; - rootFrame.GoBack(); - } - } - } } diff --git a/EventMaker/EventMaker/Handler/EventHandler.cs b/EventMaker/EventMaker/Handler/EventHandler.cs index ab1e2a3..448e007 100644 --- a/EventMaker/EventMaker/Handler/EventHandler.cs +++ b/EventMaker/EventMaker/Handler/EventHandler.cs @@ -26,6 +26,7 @@ namespace EventMaker.Handler public void DeleteEvent() { EventViewModel.EventCatalogSingleton.Remove(EventViewModel.EventCatalogSingleton.Events[EventViewModel.SelectedEventIndex]); + EventViewModel.SelectedEventIndex = 0; } } } diff --git a/EventMaker/EventMaker/View/CreateEventPage.xaml b/EventMaker/EventMaker/View/CreateEventPage.xaml index a4e453e..a6bf30b 100644 --- a/EventMaker/EventMaker/View/CreateEventPage.xaml +++ b/EventMaker/EventMaker/View/CreateEventPage.xaml @@ -165,13 +165,7 @@ <TimePicker Time="{Binding Time,Mode=TwoWay}" Margin="10,0,10,10" Style="{StaticResource TimePickerStyle1}"/> </StackPanel> <TextBox PlaceholderText="Place" Text="{Binding Place,Mode=TwoWay}"/> - <Button Height="32" Width="84" Content="Add" Command="{Binding CreateEventCommand}" HorizontalAlignment="Right" Margin="0,0,10,0" Background="#FF106EBE" Foreground="White"> - <interactivity:Interaction.Behaviors> - <core:EventTriggerBehavior EventName="Click"> - <core:NavigateToPageAction TargetPage="EventMaker.View.EventPage"/> - </core:EventTriggerBehavior> - </interactivity:Interaction.Behaviors> - </Button> + <Button Height="32" Width="84" Content="Add" Command="{Binding CreateEventCommand}" HorizontalAlignment="Right" Margin="0,0,10,0" Background="#FF106EBE" Foreground="White" Click="GoToEventPage"/> </StackPanel> </Grid> diff --git a/EventMaker/EventMaker/View/CreateEventPage.xaml.cs b/EventMaker/EventMaker/View/CreateEventPage.xaml.cs index 3e5dd29..8bdcf5c 100644 --- a/EventMaker/EventMaker/View/CreateEventPage.xaml.cs +++ b/EventMaker/EventMaker/View/CreateEventPage.xaml.cs @@ -1,10 +1,30 @@ -namespace EventMaker.View +using Windows.UI.Core; + +namespace EventMaker.View { public sealed partial class CreateEventPage { + SystemNavigationManager currentView = SystemNavigationManager.GetForCurrentView(); public CreateEventPage() { InitializeComponent(); + currentView.BackRequested += OnBackRequested; + currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible; + } + private void OnBackRequested(object sender, BackRequestedEventArgs e) + { + if (Frame.CanGoBack) + { + Frame.GoBack(); + e.Handled = true; + currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; + } + } + + private void GoToEventPage(object sender, Windows.UI.Xaml.RoutedEventArgs e) + { + Frame.Navigate(typeof(EventPage)); + currentView.AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed; } } } |