diff options
-rw-r--r-- | EventMaker/EventMaker.sln | 22 | ||||
-rw-r--r-- | EventMaker/EventMaker/App.xaml | 1 | ||||
-rw-r--r-- | EventMaker/EventMaker/App.xaml.cs | 45 | ||||
-rw-r--r-- | EventMaker/EventMaker/Converter/DateTimeConverter.cs | 4 | ||||
-rw-r--r-- | EventMaker/EventMaker/EventMaker.csproj | 1 | ||||
-rw-r--r-- | EventMaker/EventMaker/Handler/EventHandler.cs | 3 | ||||
-rw-r--r-- | EventMaker/EventMaker/Model/EventCatalogSingleton.cs | 19 | ||||
-rw-r--r-- | EventMaker/EventMaker/Persistency/PersistencyService.cs | 20 | ||||
-rw-r--r-- | EventMaker/EventMaker/View/CreateEventPage.xaml | 188 | ||||
-rw-r--r-- | EventMaker/EventMaker/View/CreateEventPage.xaml.cs | 31 | ||||
-rw-r--r-- | EventMaker/EventMaker/View/EventPage.xaml | 24 | ||||
-rw-r--r-- | EventMaker/EventMaker/View/EventPage.xaml.cs | 31 | ||||
-rw-r--r-- | EventMaker/EventMaker/ViewModel/EventViewModel.cs | 28 | ||||
-rw-r--r-- | EventMaker/EventMaker/project.json | 1 |
14 files changed, 265 insertions, 153 deletions
diff --git a/EventMaker/EventMaker.sln b/EventMaker/EventMaker.sln index b59177a..d08ee73 100644 --- a/EventMaker/EventMaker.sln +++ b/EventMaker/EventMaker.sln @@ -5,16 +5,21 @@ VisualStudioVersion = 14.0.25420.1 MinimumVisualStudioVersion = 10.0.40219.1 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EventMaker", "EventMaker\EventMaker.csproj", "{9E8CD427-C53A-444D-A1EE-946AC995E288}" EndProject +Project("{F088123C-0E9E-452A-89E6-6BA2F21D5CAC}") = "SSD for Feb 14", "\\VBOXSVR\Shared\SSD-for-Feb-14\SSD for Feb 14\SSD for Feb 14\SSD for Feb 14.modelproj", "{C76081FA-571F-4781-9CE4-A60A0470CBE4}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU Debug|ARM = Debug|ARM Debug|x64 = Debug|x64 Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU Release|ARM = Release|ARM Release|x64 = Release|x64 Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|Any CPU.ActiveCfg = Debug|x86 {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|ARM.ActiveCfg = Debug|ARM {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|ARM.Build.0 = Debug|ARM {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|ARM.Deploy.0 = Debug|ARM @@ -24,6 +29,7 @@ Global {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|x86.ActiveCfg = Debug|x86 {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|x86.Build.0 = Debug|x86 {9E8CD427-C53A-444D-A1EE-946AC995E288}.Debug|x86.Deploy.0 = Debug|x86 + {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|Any CPU.ActiveCfg = Release|x86 {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|ARM.ActiveCfg = Release|ARM {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|ARM.Build.0 = Release|ARM {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|ARM.Deploy.0 = Release|ARM @@ -33,6 +39,22 @@ Global {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|x86.ActiveCfg = Release|x86 {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|x86.Build.0 = Release|x86 {9E8CD427-C53A-444D-A1EE-946AC995E288}.Release|x86.Deploy.0 = Release|x86 + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|ARM.ActiveCfg = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|ARM.Build.0 = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|x64.ActiveCfg = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|x64.Build.0 = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|x86.ActiveCfg = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Debug|x86.Build.0 = Debug|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|Any CPU.Build.0 = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|ARM.ActiveCfg = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|ARM.Build.0 = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|x64.ActiveCfg = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|x64.Build.0 = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|x86.ActiveCfg = Release|Any CPU + {C76081FA-571F-4781-9CE4-A60A0470CBE4}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/EventMaker/EventMaker/App.xaml b/EventMaker/EventMaker/App.xaml index 14e9c2e..5b48429 100644 --- a/EventMaker/EventMaker/App.xaml +++ b/EventMaker/EventMaker/App.xaml @@ -2,7 +2,6 @@ x:Class="EventMaker.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:EventMaker" RequestedTheme="Light"> </Application> diff --git a/EventMaker/EventMaker/App.xaml.cs b/EventMaker/EventMaker/App.xaml.cs index 175a092..70e9070 100644 --- a/EventMaker/EventMaker/App.xaml.cs +++ b/EventMaker/EventMaker/App.xaml.cs @@ -1,6 +1,7 @@ using System; using Windows.ApplicationModel; using Windows.ApplicationModel.Activation; +using Windows.UI.Core; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Navigation; @@ -10,7 +11,7 @@ namespace EventMaker /// <summary> /// Provides application-specific behavior to supplement the default Application class. /// </summary> - sealed partial class App : Application + sealed partial class App { /// <summary> /// Initializes the singleton application object. This is the first line of authored code @@ -18,8 +19,8 @@ namespace EventMaker /// </summary> public App() { - this.InitializeComponent(); - this.Suspending += OnSuspending; + InitializeComponent(); + Suspending += OnSuspending; } /// <summary> @@ -32,7 +33,7 @@ namespace EventMaker #if DEBUG if (System.Diagnostics.Debugger.IsAttached) { - this.DebugSettings.EnableFrameRateCounter = true; + DebugSettings.EnableFrameRateCounter = true; } #endif Frame rootFrame = Window.Current.Content as Frame; @@ -45,6 +46,8 @@ namespace EventMaker rootFrame = new Frame(); rootFrame.NavigationFailed += OnNavigationFailed; + rootFrame.Navigated += OnNavigated; + if (e.PreviousExecutionState == ApplicationExecutionState.Terminated) { @@ -53,6 +56,16 @@ 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) @@ -62,7 +75,7 @@ namespace EventMaker // 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(EventPage), e.Arguments); + rootFrame.Navigate(typeof(View.EventPage), e.Arguments); } // Ensure the current window is active Window.Current.Activate(); @@ -79,6 +92,16 @@ namespace EventMaker throw new Exception("Failed to load Page " + e.SourcePageType.FullName); } + private void OnNavigated(object sender, NavigationEventArgs e) + { + // Each time a navigation event occurs, update the Back button's visibility + SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = + ((Frame)sender).CanGoBack ? + AppViewBackButtonVisibility.Visible : + AppViewBackButtonVisibility.Collapsed; + } + + /// <summary> /// Invoked when application execution is being suspended. Application state is saved /// without knowing whether the application will be terminated or resumed with the contents @@ -92,5 +115,17 @@ namespace EventMaker //TODO: Save application state and stop any background activity 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/Converter/DateTimeConverter.cs b/EventMaker/EventMaker/Converter/DateTimeConverter.cs index e6990e0..9ee35ef 100644 --- a/EventMaker/EventMaker/Converter/DateTimeConverter.cs +++ b/EventMaker/EventMaker/Converter/DateTimeConverter.cs @@ -1,8 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; namespace EventMaker.Converter { diff --git a/EventMaker/EventMaker/EventMaker.csproj b/EventMaker/EventMaker/EventMaker.csproj index c69fcc8..422fe79 100644 --- a/EventMaker/EventMaker/EventMaker.csproj +++ b/EventMaker/EventMaker/EventMaker.csproj @@ -142,7 +142,6 @@ <Generator>MSBuild:Compile</Generator> </Page> </ItemGroup> - <ItemGroup /> <PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' "> <VisualStudioVersion>14.0</VisualStudioVersion> </PropertyGroup> diff --git a/EventMaker/EventMaker/Handler/EventHandler.cs b/EventMaker/EventMaker/Handler/EventHandler.cs index 7050bcd..ab1e2a3 100644 --- a/EventMaker/EventMaker/Handler/EventHandler.cs +++ b/EventMaker/EventMaker/Handler/EventHandler.cs @@ -1,5 +1,4 @@ -using EventMaker.Annotations; -using EventMaker.Model; +using EventMaker.Model; using EventMaker.ViewModel; namespace EventMaker.Handler diff --git a/EventMaker/EventMaker/Model/EventCatalogSingleton.cs b/EventMaker/EventMaker/Model/EventCatalogSingleton.cs index feeeea9..ffce7a4 100644 --- a/EventMaker/EventMaker/Model/EventCatalogSingleton.cs +++ b/EventMaker/EventMaker/Model/EventCatalogSingleton.cs @@ -1,26 +1,25 @@ using System.Collections.ObjectModel; -using System; namespace EventMaker.Model { public class EventCatalogSingleton { - private static EventCatalogSingleton instance; - private ObservableCollection<Event> _events; + private static EventCatalogSingleton _instance; + private EventCatalogSingleton() { - _events = new ObservableCollection<Event>(); + Events = new ObservableCollection<Event>(); LoadEventsAsync(); } public static EventCatalogSingleton Instance { get { - if (instance == null) + if (_instance == null) { - instance = new EventCatalogSingleton(); + _instance = new EventCatalogSingleton(); } - return instance; + return _instance; } } public void Add(Event newEvent) @@ -37,10 +36,6 @@ namespace EventMaker.Model Events.Remove(eventToBeRemoved); Persistency.PersistencyService.SaveEventsAsJsonAsync(Events); } - public ObservableCollection<Event> Events - { - get { return _events; } - set { _events = value; } - } + public ObservableCollection<Event> Events { get; set; } } } diff --git a/EventMaker/EventMaker/Persistency/PersistencyService.cs b/EventMaker/EventMaker/Persistency/PersistencyService.cs index 4c78911..a3b7808 100644 --- a/EventMaker/EventMaker/Persistency/PersistencyService.cs +++ b/EventMaker/EventMaker/Persistency/PersistencyService.cs @@ -1,39 +1,33 @@ using EventMaker.Model; using Newtonsoft.Json; using System; -using System.Collections.Generic; using System.Collections.ObjectModel; using System.IO; -using System.Linq; -using System.Text; using System.Threading.Tasks; using Windows.Storage; -using Windows.Storage.Pickers; -using Windows.Storage.Streams; -using Windows.UI.Xaml.Controls; namespace EventMaker.Persistency { class PersistencyService { - private static StorageFolder localFolder = ApplicationData.Current.LocalFolder; - private static StorageFile eventsFile; + private static readonly StorageFolder LocalFolder = ApplicationData.Current.LocalFolder; + private static StorageFile _eventsFile; public static async void SaveEventsAsJsonAsync(ObservableCollection<Event> events) { - eventsFile = await localFolder.CreateFileAsync("events.json",CreationCollisionOption.OpenIfExists); - File.WriteAllText(eventsFile.Path, JsonConvert.SerializeObject(events)); + _eventsFile = await LocalFolder.CreateFileAsync("events.json",CreationCollisionOption.OpenIfExists); + File.WriteAllText(_eventsFile.Path, JsonConvert.SerializeObject(events)); } public static async Task<ObservableCollection<Event>> LoadEventsFromJsonAsync() { try { - eventsFile = await localFolder.GetFileAsync("events.json"); + _eventsFile = await LocalFolder.GetFileAsync("events.json"); } catch(FileNotFoundException) { - eventsFile = await localFolder.CreateFileAsync("events.json", CreationCollisionOption.OpenIfExists); + _eventsFile = await LocalFolder.CreateFileAsync("events.json", CreationCollisionOption.OpenIfExists); } - return JsonConvert.DeserializeObject<ObservableCollection<Event>>(File.ReadAllText(eventsFile.Path)); + return JsonConvert.DeserializeObject<ObservableCollection<Event>>(File.ReadAllText(_eventsFile.Path)); } } diff --git a/EventMaker/EventMaker/View/CreateEventPage.xaml b/EventMaker/EventMaker/View/CreateEventPage.xaml index 9cd3cef..a4e453e 100644 --- a/EventMaker/EventMaker/View/CreateEventPage.xaml +++ b/EventMaker/EventMaker/View/CreateEventPage.xaml @@ -1,45 +1,177 @@ <Page - x:Class="EventMaker.CreateEventPage" + x:Class="EventMaker.View.CreateEventPage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:EventMaker" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:viewModel="using:EventMaker.ViewModel" + xmlns:interactivity="using:Microsoft.Xaml.Interactivity" + xmlns:core="using:Microsoft.Xaml.Interactions.Core" mc:Ignorable="d"> <Page.DataContext> <viewModel:EventViewModel/> </Page.DataContext> - + + <Page.Resources> + <Style x:Key="TextBoxStyle" TargetType="TextBox"> + <Setter Property="Margin" Value="10,0,10,10"/> + <Setter Property="BorderThickness" Value="1"/> + </Style> + <Style x:Key="TimePickerStyle1" TargetType="TimePicker"> + <Setter Property="IsTabStop" Value="False"/> + <Setter Property="MinWidth" Value="200"/> + <Setter Property="MaxWidth" Value="456"/> + <Setter Property="FontFamily" Value="{ThemeResource ContentControlThemeFontFamily}"/> + <Setter Property="FontSize" Value="{ThemeResource ControlContentThemeFontSize}"/> + <Setter Property="Foreground" Value="{ThemeResource TimePickerButtonForeground}"/> + <Setter Property="HorizontalAlignment" Value="Left"/> + <Setter Property="VerticalAlignment" Value="Center"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="TimePicker"> + <StackPanel x:Name="LayoutRoot" Margin="{TemplateBinding Padding}"> + <StackPanel.Resources> + <Style x:Key="TimePickerFlyoutButtonStyle" TargetType="Button"> + <Setter Property="UseSystemFocusVisuals" Value="False"/> + <Setter Property="ElementSoundMode" Value="FocusOnly"/> + <Setter Property="Template"> + <Setter.Value> + <ControlTemplate TargetType="Button"> + <Grid Background="{TemplateBinding Background}"> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="PointerOver"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBorderBrushPointerOver}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBackgroundPointerOver}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonForegroundPointerOver}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Pressed"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBackgroundPressed}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBorderBrushPressed}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonForegroundPressed}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBackgroundDisabled}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="BorderBrush" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBorderBrushDisabled}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonForegroundDisabled}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + <VisualStateGroup x:Name="FocusStates"> + <VisualState x:Name="Focused"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Background" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonBackgroundFocused}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="ContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerButtonForegroundFocused}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + <VisualState x:Name="Unfocused"/> + <VisualState x:Name="PointerFocused"/> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <ContentPresenter x:Name="ContentPresenter" AutomationProperties.AccessibilityView="Raw" BorderBrush="{ThemeResource TimePickerButtonBorderBrush}" BorderThickness="1" Background="{ThemeResource TimePickerButtonBackground}" Content="{TemplateBinding Content}" Foreground="{TemplateBinding Foreground}" HorizontalContentAlignment="Stretch" VerticalContentAlignment="Stretch"/> + </Grid> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </StackPanel.Resources> + <VisualStateManager.VisualStateGroups> + <VisualStateGroup x:Name="CommonStates"> + <VisualState x:Name="Normal"/> + <VisualState x:Name="Disabled"> + <Storyboard> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Foreground" Storyboard.TargetName="HeaderContentPresenter"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerHeaderForegroundDisabled}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="FirstColumnDivider"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerSpacerFillDisabled}"/> + </ObjectAnimationUsingKeyFrames> + <ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="Fill" Storyboard.TargetName="SecondColumnDivider"> + <DiscreteObjectKeyFrame KeyTime="0" Value="{ThemeResource TimePickerSpacerFillDisabled}"/> + </ObjectAnimationUsingKeyFrames> + </Storyboard> + </VisualState> + </VisualStateGroup> + </VisualStateManager.VisualStateGroups> + <ContentPresenter x:Name="HeaderContentPresenter" AutomationProperties.AccessibilityView="Raw" ContentTemplate="{TemplateBinding HeaderTemplate}" Content="{TemplateBinding Header}" Foreground="{ThemeResource TimePickerHeaderForeground}" Margin="0,0,0,8" Visibility="Collapsed" x:DeferLoadStrategy="Lazy"/> + <Button x:Name="FlyoutButton" Background="{TemplateBinding Background}" Foreground="{TemplateBinding Foreground}" HorizontalAlignment="Stretch" HorizontalContentAlignment="Stretch" IsEnabled="{TemplateBinding IsEnabled}" Style="{StaticResource TimePickerFlyoutButtonStyle}"> + <Grid x:Name="FlyoutButtonContentGrid"> + <Grid.ColumnDefinitions> + <ColumnDefinition x:Name="FirstTextBlockColumn" Width="*"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition x:Name="SecondTextBlockColumn" Width="*"/> + <ColumnDefinition Width="Auto"/> + <ColumnDefinition x:Name="ThirdTextBlockColumn" Width="*"/> + </Grid.ColumnDefinitions> + <Border x:Name="FirstPickerHost" Grid.Column="0"> + <TextBlock x:Name="HourTextBlock" AutomationProperties.AccessibilityView="Raw" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" Padding="0,3,0,5" TextAlignment="Center"/> + </Border> + <Rectangle x:Name="FirstColumnDivider" Grid.Column="1" Fill="{ThemeResource TimePickerSpacerFill}" HorizontalAlignment="Center" Width="2"/> + <Border x:Name="SecondPickerHost" Grid.Column="2"> + <TextBlock x:Name="MinuteTextBlock" AutomationProperties.AccessibilityView="Raw" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" Padding="0,3,0,5" TextAlignment="Center"/> + </Border> + <Rectangle x:Name="SecondColumnDivider" Grid.Column="3" Fill="{ThemeResource TimePickerSpacerFill}" HorizontalAlignment="Center" Width="2"/> + <Border x:Name="ThirdPickerHost" Grid.Column="4"> + <TextBlock x:Name="PeriodTextBlock" AutomationProperties.AccessibilityView="Raw" FontWeight="{TemplateBinding FontWeight}" FontSize="{TemplateBinding FontSize}" FontFamily="{TemplateBinding FontFamily}" Padding="0,3,0,5" TextAlignment="Center"/> + </Border> + </Grid> + </Button> + </StackPanel> + </ControlTemplate> + </Setter.Value> + </Setter> + </Style> + </Page.Resources> + <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - <Grid.ColumnDefinitions> - <ColumnDefinition/> - <ColumnDefinition Width="4*"/> - </Grid.ColumnDefinitions> - <Grid.RowDefinitions> - <RowDefinition/> - <RowDefinition Height="4*"/> - </Grid.RowDefinitions> - <TextBlock Grid.Column="1" FontSize="90" Text="Add Event" VerticalAlignment="Center" HorizontalAlignment="Center"/> - - <StackPanel Grid.Row="1" Grid.Column="0"> - <TextBlock Height="32" TextAlignment="Right" Text="Id" FontWeight="Bold" /> - <TextBlock Height="32" TextAlignment="Right" Text="Name" FontWeight="Bold" /> - <TextBlock Height="32" TextAlignment="Right" Text="Description" FontWeight="Bold" /> - <TextBlock Height="32" TextAlignment="Right" Text="Place" FontWeight="Bold" /> - <TextBlock Height="32" TextAlignment="Right" Text="Date" FontWeight="Bold" /> - <TextBlock Height="32" TextAlignment="Right" Text="Time" FontWeight="Bold" /> + <StackPanel MaxWidth="600"> + <StackPanel.Resources> + <Style BasedOn="{ StaticResource TextBoxStyle}" TargetType="TextBox"/> + </StackPanel.Resources> + <TextBlock FontSize="50" Text="Add Event" VerticalAlignment="Center" Margin="10,0,0,0"/> + <TextBox PlaceholderText="Name" Text="{Binding Name,Mode=TwoWay}" /> + <TextBox PlaceholderText="Description" Text="{Binding Description,Mode=TwoWay}" MinHeight="64" MaxHeight="320" TextWrapping="Wrap"/> + <StackPanel Orientation="Horizontal"> + <CalendarDatePicker Date="{Binding Date,Mode=TwoWay}" Margin="10,0,10,10" BorderThickness="1"/> + <TimePicker Time="{Binding Time,Mode=TwoWay}" Margin="10,0,10,10" Style="{StaticResource TimePickerStyle1}"/> </StackPanel> - - <StackPanel Grid.Row="1" Grid.Column="1" > - <TextBox PlaceholderText="0" Text="{Binding Id, Mode=TwoWay}"/> - <TextBox PlaceholderText="Jeppe" Text="{Binding Name,Mode=TwoWay}" /> - <TextBox PlaceholderText="Event Description" Text="{Binding Description,Mode=TwoWay}"/> <TextBox PlaceholderText="Place" Text="{Binding Place,Mode=TwoWay}"/> - <CalendarDatePicker Date="{Binding Date,Mode=TwoWay}"/> - <TimePicker Time="{Binding Time,Mode=TwoWay}"/> - <Button Height="32" Width="60" Content="Add" Command="{Binding CreateEventCommand}" Click="Button_Click"/> + <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> </StackPanel> </Grid> diff --git a/EventMaker/EventMaker/View/CreateEventPage.xaml.cs b/EventMaker/EventMaker/View/CreateEventPage.xaml.cs index a4e533c..3e5dd29 100644 --- a/EventMaker/EventMaker/View/CreateEventPage.xaml.cs +++ b/EventMaker/EventMaker/View/CreateEventPage.xaml.cs @@ -1,35 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 - -namespace EventMaker +namespace EventMaker.View { - /// <summary> - /// An empty page that can be used on its own or navigated to within a Frame. - /// </summary> - public sealed partial class CreateEventPage : Page + public sealed partial class CreateEventPage { public CreateEventPage() { - this.InitializeComponent(); - } - - private void Button_Click(object sender, RoutedEventArgs e) - { - Frame.Navigate(typeof(EventPage)); + InitializeComponent(); } } } diff --git a/EventMaker/EventMaker/View/EventPage.xaml b/EventMaker/EventMaker/View/EventPage.xaml index 13527ca..fa8762a 100644 --- a/EventMaker/EventMaker/View/EventPage.xaml +++ b/EventMaker/EventMaker/View/EventPage.xaml @@ -1,34 +1,40 @@ <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:local="using:EventMaker" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - xmlns:ViewModel="using:EventMaker.ViewModel" - x:Class="EventMaker.EventPage" + xmlns:viewModel="using:EventMaker.ViewModel" + xmlns:interactivity="using:Microsoft.Xaml.Interactivity" + xmlns:core="using:Microsoft.Xaml.Interactions.Core" + x:Class="EventMaker.View.EventPage" mc:Ignorable="d"> <Page.BottomAppBar> <CommandBar> <CommandBar.Content> <Grid/> </CommandBar.Content> - <AppBarButton Icon="Add" Label="Add Event" Click="AppBarButton_Click"/> + <AppBarButton Icon="Add" Label="Add Event"> + <interactivity:Interaction.Behaviors> + <core:EventTriggerBehavior EventName="Click"> + <core:NavigateToPageAction TargetPage="EventMaker.View.CreateEventPage"/> + </core:EventTriggerBehavior> + </interactivity:Interaction.Behaviors> + </AppBarButton> <AppBarButton Icon="Delete" Label="Delete Event" Command="{Binding DeleteEventCommand}"/> </CommandBar> </Page.BottomAppBar> <Page.DataContext> - <ViewModel:EventViewModel/> + <viewModel:EventViewModel/> </Page.DataContext> <Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"> - <ListView ItemsSource="{Binding EventCatalogSingleton.Events}" SelectedIndex="{Binding SelectedEventIndex,Mode=TwoWay}"> + <ListView x:Name="EventsList" ItemsSource="{Binding EventCatalogSingleton.Events}" SelectedIndex="{Binding SelectedEventIndex, Mode=TwoWay}"> <ListView.ItemTemplate> <DataTemplate> <StackPanel> - <TextBlock Text="{Binding Id}"/> - <TextBlock Text="{Binding Name}"/> - <TextBlock Text="{Binding Description}"/> + <TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="18"/> + <TextBlock Text="{Binding Description}" FontStyle="Italic"/> <TextBlock Text="{Binding DateTime}"/> <TextBlock Text="{Binding Place}"/> </StackPanel> diff --git a/EventMaker/EventMaker/View/EventPage.xaml.cs b/EventMaker/EventMaker/View/EventPage.xaml.cs index 4883553..f36b083 100644 --- a/EventMaker/EventMaker/View/EventPage.xaml.cs +++ b/EventMaker/EventMaker/View/EventPage.xaml.cs @@ -1,35 +1,10 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Runtime.InteropServices.WindowsRuntime; -using Windows.Foundation; -using Windows.Foundation.Collections; -using Windows.UI.Xaml; -using Windows.UI.Xaml.Controls; -using Windows.UI.Xaml.Controls.Primitives; -using Windows.UI.Xaml.Data; -using Windows.UI.Xaml.Input; -using Windows.UI.Xaml.Media; -using Windows.UI.Xaml.Navigation; - -// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=234238 - -namespace EventMaker +namespace EventMaker.View { - /// <summary> - /// An empty page that can be used on its own or navigated to within a Frame. - /// </summary> - public sealed partial class EventPage : Page + public sealed partial class EventPage { public EventPage() { - this.InitializeComponent(); - } - - private void AppBarButton_Click(object sender, RoutedEventArgs e) - { - Frame.Navigate(typeof(CreateEventPage)); + InitializeComponent(); } } } diff --git a/EventMaker/EventMaker/ViewModel/EventViewModel.cs b/EventMaker/EventMaker/ViewModel/EventViewModel.cs index 73f7851..0638fd1 100644 --- a/EventMaker/EventMaker/ViewModel/EventViewModel.cs +++ b/EventMaker/EventMaker/ViewModel/EventViewModel.cs @@ -10,32 +10,16 @@ namespace EventMaker.ViewModel { public class EventViewModel : INotifyPropertyChanged { - private EventCatalogSingleton _eventCatalogSingleton; public Handler.EventHandler EventHandler { get; set; } - private ICommand _createEventCommand; - private ICommand _deleteEventCommand; public static int SelectedEventIndex { get; set; } private int _id; private string _name, _place, _description; private DateTimeOffset _date; private TimeSpan _time; - public EventCatalogSingleton EventCatalogSingleton - { - get { return _eventCatalogSingleton; } - set { _eventCatalogSingleton = value; } - } + public EventCatalogSingleton EventCatalogSingleton { get; set; } + public ICommand CreateEventCommand { get; set; } + public ICommand DeleteEventCommand { get; set; } - public ICommand CreateEventCommand - { - get { return _createEventCommand; } - set { _createEventCommand = value; } - } - - public ICommand DeleteEventCommand - { - get { return _deleteEventCommand; } - set { _deleteEventCommand = value; } - } public int Id { get { return _id; } @@ -82,10 +66,10 @@ namespace EventMaker.ViewModel } public EventViewModel() { - _eventCatalogSingleton = EventCatalogSingleton.Instance; + EventCatalogSingleton = EventCatalogSingleton.Instance; EventHandler = new Handler.EventHandler(this); - _createEventCommand=new RelayCommand(EventHandler.CreateEvent); - _deleteEventCommand = new RelayCommand(EventHandler.DeleteEvent); + CreateEventCommand = + DeleteEventCommand = new RelayCommand(EventHandler.DeleteEvent); DateTime dt = DateTime.Now; _date = new DateTimeOffset(dt.Year, dt.Month, dt.Day, 0, 0, 0, 0, new TimeSpan()); _time = new TimeSpan(dt.Hour, dt.Minute, dt.Second); diff --git a/EventMaker/EventMaker/project.json b/EventMaker/EventMaker/project.json index 21494af..67510b2 100644 --- a/EventMaker/EventMaker/project.json +++ b/EventMaker/EventMaker/project.json @@ -1,6 +1,7 @@ { "dependencies": { "Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2", + "Microsoft.Xaml.Behaviors.Uwp.Managed": "2.0.0", "Newtonsoft.Json": "9.0.1" }, "frameworks": { |