Skip to content

Commit

Permalink
Splitting Minimal to Hamburger
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrynixon committed Jan 29, 2016
1 parent 81f315d commit 51e5a0e
Show file tree
Hide file tree
Showing 32 changed files with 184 additions and 204 deletions.
Binary file modified Template10 (Installer)/Lib/Template10.MSBUILD.dll
Binary file not shown.
17 changes: 17 additions & 0 deletions Template10.sln
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Messaging", "Samples\Messag
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hamburger", "Templates (Project)\Hamburger\Hamburger.csproj", "{6E068955-A693-4E4E-8852-C270447B4053}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{F8B66765-EFAD-45EE-911F-8815B9C9E297}"
ProjectSection(SolutionItems) = preProject
Assets\Blank.png = Assets\Blank.png
Assets\GetStarted.gif = Assets\GetStarted.gif
Assets\Minimal.png = Assets\Minimal.png
Assets\NuGetLogo.png = Assets\NuGetLogo.png
Assets\T10 1024x1024.png = Assets\T10 1024x1024.png
Assets\T10 128x128.png = Assets\T10 128x128.png
Assets\T10 1366x768.png = Assets\T10 1366x768.png
Assets\T10 256x256.png = Assets\T10 256x256.png
Assets\T10 512x512.png = Assets\T10 512x512.png
Assets\T10 56x56.png = Assets\T10 56x56.png
Assets\T10 768x1366.png = Assets\T10 768x1366.png
Assets\Template10.ico = Assets\Template10.ico
Assets\Template10.png = Assets\Template10.png
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down
1 change: 1 addition & 0 deletions Templates (Project)/Blank/Blank.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ViewModels\MainPageViewModel.cs" />
<Compile Include="Views\MainPage.xaml.cs">
<DependentUpon>MainPage.xaml</DependentUpon>
</Compile>
Expand Down
2 changes: 1 addition & 1 deletion Templates (Project)/Blank/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</Resources>
<Applications>
<Application Id="App" Executable="$targetnametoken$.exe" EntryPoint="Blank.App">
<uap:VisualElements DisplayName="Blank" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Blank" BackgroundColor="transparent">
<uap:VisualElements DisplayName="Blank" Square150x150Logo="Assets\Square150x150Logo.png" Square44x44Logo="Assets\Square44x44Logo.png" Description="Sample" BackgroundColor="transparent">
<uap:DefaultTile Wide310x150Logo="Assets\Wide310x150Logo.png">
</uap:DefaultTile>
<uap:SplashScreen Image="Assets\SplashScreen.png" />
Expand Down
4 changes: 2 additions & 2 deletions Templates (Project)/Blank/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Blank")]
[assembly: AssemblyTitle("Sample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Blank")]
[assembly: AssemblyProduct("Sample")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down
53 changes: 53 additions & 0 deletions Templates (Project)/Blank/ViewModels/MainPageViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Template10.Mvvm;
using Template10.Services.NavigationService;
using Windows.UI.Xaml.Navigation;

namespace Sample.ViewModels
{
public class MainPageViewModel : ViewModelBase
{
public MainPageViewModel()
{
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled)
{
// design-time experience
}
else
{
// runtime experience
}
}

public override Task OnNavigatedToAsync(object parameter, NavigationMode mode, IDictionary<string, object> state)
{
if (state.Any())
{
// restore state
state.Clear();
}
else
{
// use parameter
}
return Task.CompletedTask;
}

public override Task OnNavigatedFromAsync(IDictionary<string, object> state, bool suspending)
{
if (suspending)
{
// save state
}
return Task.CompletedTask;
}

public override Task OnNavigatingFromAsync(NavigatingEventArgs args)
{
args.Cancel = false;
return Task.CompletedTask;
}
}
}
6 changes: 5 additions & 1 deletion Templates (Project)/Blank/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Sample.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
xmlns:vm="using:Sample.ViewModels" mc:Ignorable="d">

<Page.DataContext>
<vm:MainPageViewModel x:Name="ViewModel" />
</Page.DataContext>

<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

Expand Down
2 changes: 1 addition & 1 deletion Templates (Project)/Blank/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"Microsoft.Xaml.Behaviors.Uwp.Managed": "1.0.3",
"Newtonsoft.Json": "8.0.1",
"Newtonsoft.Json": "8.0.2",
"Template10": "1.1.*"
},
"frameworks": {
Expand Down
3 changes: 1 addition & 2 deletions Templates (Project)/Hamburger/Hamburger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,8 @@
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
<Compile Include="Mvvm\ViewModelBase.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\SettingsServices\ISettingsService.cs" />
<Compile Include="Services\SettingsServices\SettingsService.Apply.cs" />
<Compile Include="Services\SettingsServices\SettingsService.cs" />
<Compile Include="ViewModels\MainPageViewModel.cs" />
<Compile Include="ViewModels\DetailPageViewModel.cs" />
Expand Down Expand Up @@ -177,6 +175,7 @@
</Page>
</ItemGroup>
<ItemGroup>
<Folder Include="Converters\" />
<Folder Include="Models\" />
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
Expand Down
11 changes: 0 additions & 11 deletions Templates (Project)/Hamburger/Mvvm/ViewModelBase.cs

This file was deleted.

4 changes: 2 additions & 2 deletions Templates (Project)/Hamburger/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("Minimal")]
[assembly: AssemblyTitle("Sample")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Minimal")]
[assembly: AssemblyProduct("Sample")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
using System;
using Template10.Common;
using Template10.Utils;
using Windows.UI.Xaml;

namespace Sample.Services.SettingsServices
{
// DOCS: https://github.com/Windows-XAML/Template10/wiki/Docs-%7C-SettingsService
public partial class SettingsService : ISettingsService
public class SettingsService : ISettingsService
{
public static SettingsService Instance { get; }
static SettingsService()
Expand All @@ -25,7 +26,12 @@ public bool UseShellBackButton
set
{
_helper.Write(nameof(UseShellBackButton), value);
ApplyUseShellBackButton(value);
BootStrapper.Current.NavigationService.Dispatcher.Dispatch(() =>
{
BootStrapper.Current.ShowShellBackButton = value;
BootStrapper.Current.UpdateShellBackButton();
BootStrapper.Current.NavigationService.Refresh();
});
}
}

Expand All @@ -40,7 +46,7 @@ public ApplicationTheme AppTheme
set
{
_helper.Write(nameof(AppTheme), value.ToString());
ApplyAppTheme(value);
BootStrapper.Current.NavigationService.Frame.RequestedTheme = value.ToElementTheme();
}
}

Expand All @@ -50,7 +56,7 @@ public TimeSpan CacheMaxDuration
set
{
_helper.Write(nameof(CacheMaxDuration), value);
ApplyCacheMaxDuration(value);
BootStrapper.Current.CacheMaxDuration = value;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

namespace Sample.ViewModels
{
public class DetailPageViewModel : Sample.Mvvm.ViewModelBase
public class DetailPageViewModel : ViewModelBase
{
public DetailPageViewModel()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Sample.Mvvm;
using Template10.Mvvm;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
using System;
using Template10.Mvvm;
using Windows.UI.Xaml;

namespace Sample.ViewModels
{
public class SettingsPageViewModel : Sample.Mvvm.ViewModelBase
public class SettingsPageViewModel : ViewModelBase
{
public SettingsPartViewModel SettingsPartViewModel { get; } = new SettingsPartViewModel();
public AboutPartViewModel AboutPartViewModel { get; } = new AboutPartViewModel();
Expand Down Expand Up @@ -61,8 +62,8 @@ public string Version
{
get
{
var ver = Windows.ApplicationModel.Package.Current.Id.Version;
return ver.Major.ToString() + "." + ver.Minor.ToString() + "." + ver.Build.ToString() + "." + ver.Revision.ToString();
var v = Windows.ApplicationModel.Package.Current.Id.Version;
return $"{v.Major}.{v.Minor}.{v.Build}.{v.Revision}";
}
}

Expand Down
23 changes: 13 additions & 10 deletions Templates (Project)/Hamburger/Views/Busy.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,18 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300" d:DesignWidth="400" mc:Ignorable="d">

<Grid>
<Viewbox Height="32" HorizontalAlignment="Center" VerticalAlignment="Center">
<StackPanel Orientation="Horizontal">
<ProgressRing Width="16" Height="16" Margin="12,0"
Foreground="White" IsActive="{x:Bind IsBusy, Mode=OneWay, FallbackValue=True}" />
<TextBlock VerticalAlignment="Center" Foreground="White"
Text="{x:Bind BusyText, Mode=OneWay, FallbackValue='BusyText'}" />
</StackPanel>
</Viewbox>
</Grid>
<Viewbox Height="32" HorizontalAlignment="Center" VerticalAlignment="Center">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<ProgressRing Width="16" Height="16" Foreground="White"
IsActive="{x:Bind IsBusy, Mode=OneWay}" />
<TextBlock Grid.Column="1" Margin="12,0,0,0" VerticalAlignment="Center"
Foreground="White"
Text="{x:Bind BusyText, Mode=OneWay, FallbackValue='BusyText'}" />
</Grid>
</Viewbox>

</UserControl>
31 changes: 14 additions & 17 deletions Templates (Project)/Hamburger/Views/Busy.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,32 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;

namespace Sample.Views
{
public sealed partial class Busy : UserControl, INotifyPropertyChanged
public sealed partial class Busy : UserControl
{
public Busy()
{
InitializeComponent();
}

string _BusyText = default(string);
public string BusyText { get { return _BusyText; } set { Set(ref _BusyText, value); } }

bool _IsBusy = default(bool);
public bool IsBusy { get { return _IsBusy; } set { Set(ref _IsBusy, value); } }

public event PropertyChangedEventHandler PropertyChanged;

void Set<T>(ref T storage, T value, [CallerMemberName] string propertyName = null)
public string BusyText
{
if (!Equals(storage, value))
{
storage = value;
RaisePropertyChanged(propertyName);
}
get { return (string)GetValue(BusyTextProperty); }
set { SetValue(BusyTextProperty, value); }
}
public static readonly DependencyProperty BusyTextProperty =
DependencyProperty.Register("BusyText", typeof(string), typeof(Busy), new PropertyMetadata("Please wait..."));

void RaisePropertyChanged([CallerMemberName] string propertyName = null) =>
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
public bool IsBusy
{
get { return (bool)GetValue(IsBusyProperty); }
set { SetValue(IsBusyProperty, value); }
}
public static readonly DependencyProperty IsBusyProperty =
DependencyProperty.Register("IsBusy", typeof(bool), typeof(Busy), new PropertyMetadata(false));
}
}
7 changes: 3 additions & 4 deletions Templates (Project)/Hamburger/Views/Shell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
mc:Ignorable="d">

<Controls:ModalDialog CanBackButtonDismiss="False" DisableBackButtonWhenModal="True"
IsModal="{x:Bind IsBusy, Mode=OneWay}">
<Controls:ModalDialog x:Name="ModalContainer" CanBackButtonDismiss="False"
DisableBackButtonWhenModal="True">
<Controls:ModalDialog.Content>
<Controls:HamburgerMenu x:Name="MyHamburgerMenu">

Expand Down Expand Up @@ -43,8 +43,7 @@
</Controls:ModalDialog.Content>

<Controls:ModalDialog.ModalContent>
<!-- busy visual -->
<views:Busy BusyText="{x:Bind BusyText, Mode=OneWay}" IsBusy="{x:Bind IsBusy, Mode=OneWay}" />
<views:Busy x:Name="BusyView" />
</Controls:ModalDialog.ModalContent>

</Controls:ModalDialog>
Expand Down
Loading

0 comments on commit 51e5a0e

Please sign in to comment.