提交记录修改UI/App.xaml.cs+3 −0看文件
修改UI/Controls/PageContainer.cs+7 −4看文件
修改UI/Themes/Generic.xaml+1 −0看文件
新增UI/Themes/PageContainer.xaml+34 −0看文件
修改UI/UI.csproj+11 −0看文件
修改UI/ViewModels/MainViewModel.cs+7 −6看文件
新增UI/Views/IndexPage.xaml+14 −0看文件
新增UI/Views/IndexPage.xaml.cs+28 −0看文件
| @@ -13,6 +13,7 @@ using System.Windows.Controls; | ||
| 13 | 13 | using System.Windows.Resources; |
| 14 | 14 | using UI.Controls.Window; |
| 15 | 15 | using UI.ViewModels; |
| 16 | 新增:using UI.Views; | |
| 16 | 17 | |
| 17 | 18 | namespace UI |
| 18 | 19 | { |
| @@ -105,6 +106,8 @@ namespace UI | ||
| 105 | 106 | |
| 106 | 107 | services.AddSingleton<MainViewModel>(); |
| 107 | 108 | services.AddTransient<MainWindow>(); |
| 109 | 新增: | |
| 110 | 新增: services.AddTransient<IndexPage>(); | |
| 108 | 111 | } |
| 109 | 112 | |
| 110 | 113 | private void OnStartup(object sender, StartupEventArgs e) |
| @@ -102,7 +102,7 @@ namespace UI.Controls | ||
| 102 | 102 | public PageContainer() |
| 103 | 103 | { |
| 104 | 104 | DefaultStyleKey = typeof(PageContainer); |
| 105 | 删除: ProjectName = App.Current.GetType().Assembly.GetName().Name; | |
| 105 | 新增: ProjectName = "UI"; | |
| 106 | 106 | Historys = new List<string>(); |
| 107 | 107 | BackCommand = new Command(new Action<object>(OnBackCommand)); |
| 108 | 108 | NavigationCommands.BrowseBack.InputGestures.Clear(); |
| @@ -132,10 +132,13 @@ namespace UI.Controls | ||
| 132 | 132 | var page = ServiceProvider.GetService(pageType) as Page; |
| 133 | 133 | if (page != null) |
| 134 | 134 | { |
| 135 | 删除: var pageVM = ServiceProvider.GetService(pageVMType); | |
| 136 | 删除: if (pageVM != null) | |
| 135 | 新增: if (pageVMType != null) | |
| 137 | 136 | { |
| 138 | 删除: page.DataContext = pageVM; | |
| 137 | 新增: var pageVM = ServiceProvider.GetService(pageVMType); | |
| 138 | 新增: if (pageVM != null) | |
| 139 | 新增: { | |
| 140 | 新增: page.DataContext = pageVM; | |
| 141 | 新增: } | |
| 139 | 142 | } |
| 140 | 143 | Content = page; |
| 141 | 144 | //处理历史记录 |
| @@ -6,6 +6,7 @@ | ||
| 6 | 6 | <ResourceDictionary Source="/Tai;component/Themes/Navigation/NavigationItem.xaml"/> |
| 7 | 7 | <ResourceDictionary Source="/Tai;component/Themes/Navigation/Navigation.xaml"/> |
| 8 | 8 | <ResourceDictionary Source="/Tai;component/Themes/Base/Icon.xaml"/> |
| 9 | 新增: <ResourceDictionary Source="/Tai;component/Themes/PageContainer.xaml"/> | |
| 9 | 10 | |
| 10 | 11 | </ResourceDictionary.MergedDictionaries> |
| 11 | 12 | </ResourceDictionary> |
| 文件末尾没有换行 | ||
| @@ -0,0 +1,34 @@ | ||
| 1 | 新增:<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| 2 | 新增: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| 3 | 新增: xmlns:local="clr-namespace:UI.Controls" | |
| 4 | 新增: xmlns:base="clr-namespace:UI.Controls.Base"> | |
| 5 | 新增: <Style TargetType="{x:Type local:PageContainer}"> | |
| 6 | 新增: <Setter Property="SnapsToDevicePixels" Value="True"/> | |
| 7 | 新增: <Setter Property="Template"> | |
| 8 | 新增: <Setter.Value> | |
| 9 | 新增: <ControlTemplate TargetType="{x:Type local:PageContainer}"> | |
| 10 | 新增: <Border Background="{TemplateBinding Background}" | |
| 11 | 新增: BorderBrush="{TemplateBinding BorderBrush}" | |
| 12 | 新增: BorderThickness="{TemplateBinding BorderThickness}"> | |
| 13 | 新增: <Grid> | |
| 14 | 新增: <!--<StackPanel Height="44" Orientation="Horizontal" Panel.ZIndex="1" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,32,0,0" Visibility="{TemplateBinding TitleBarVisibility}"> | |
| 15 | 新增: <Button Style="{DynamicResource Icon}" | |
| 16 | 新增: Width="35" | |
| 17 | 新增: Height="35" | |
| 18 | 新增: Command="{TemplateBinding BackCommand}" | |
| 19 | 新增: VerticalAlignment="Center" | |
| 20 | 新增: > | |
| 21 | 新增: <base:Icon IconType="Back" | |
| 22 | 新增: VerticalAlignment="Center" | |
| 23 | 新增: FontSize="15" /> | |
| 24 | 新增: </Button> | |
| 25 | 新增: <TextBlock Text="{TemplateBinding Title}" VerticalAlignment="Center" FontSize="16" Margin="10,0,0,0"/> | |
| 26 | 新增: </StackPanel>--> | |
| 27 | 新增: <Frame Grid.Row="1" Content="{TemplateBinding Content}" NavigationUIVisibility="Hidden"/> | |
| 28 | 新增: </Grid> | |
| 29 | 新增: </Border> | |
| 30 | 新增: </ControlTemplate> | |
| 31 | 新增: </Setter.Value> | |
| 32 | 新增: </Setter> | |
| 33 | 新增: </Style> | |
| 34 | 新增:</ResourceDictionary> | |
| 文件末尾没有换行 | ||
| @@ -89,6 +89,9 @@ | ||
| 89 | 89 | <Compile Include="Models\MainWindowModel.cs" /> |
| 90 | 90 | <Compile Include="Models\UINotifyPropertyChanged.cs" /> |
| 91 | 91 | <Compile Include="ViewModels\MainViewModel.cs" /> |
| 92 | 新增: <Compile Include="Views\IndexPage.xaml.cs"> | |
| 93 | 新增: <DependentUpon>IndexPage.xaml</DependentUpon> | |
| 94 | 新增: </Compile> | |
| 92 | 95 | <Page Include="MainWindow.xaml"> |
| 93 | 96 | <Generator>MSBuild:Compile</Generator> |
| 94 | 97 | <SubType>Designer</SubType> |
| @@ -122,6 +125,10 @@ | ||
| 122 | 125 | <Generator>MSBuild:Compile</Generator> |
| 123 | 126 | <SubType>Designer</SubType> |
| 124 | 127 | </Page> |
| 128 | 新增: <Page Include="Themes\PageContainer.xaml"> | |
| 129 | 新增: <Generator>MSBuild:Compile</Generator> | |
| 130 | 新增: <SubType>Designer</SubType> | |
| 131 | 新增: </Page> | |
| 125 | 132 | <Page Include="Themes\Window\DefaultWindow.xaml"> |
| 126 | 133 | <SubType>Designer</SubType> |
| 127 | 134 | <Generator>MSBuild:Compile</Generator> |
| @@ -130,6 +137,10 @@ | ||
| 130 | 137 | <SubType>Designer</SubType> |
| 131 | 138 | <Generator>MSBuild:Compile</Generator> |
| 132 | 139 | </Page> |
| 140 | 新增: <Page Include="Views\IndexPage.xaml"> | |
| 141 | 新增: <SubType>Designer</SubType> | |
| 142 | 新增: <Generator>MSBuild:Compile</Generator> | |
| 143 | 新增: </Page> | |
| 133 | 144 | </ItemGroup> |
| 134 | 145 | <ItemGroup> |
| 135 | 146 | <Compile Include="Properties\AssemblyInfo.cs"> |
| @@ -6,6 +6,7 @@ using System.Threading.Tasks; | ||
| 6 | 6 | using UI.Controls; |
| 7 | 7 | using UI.Controls.Navigation.Models; |
| 8 | 8 | using UI.Models; |
| 9 | 新增:using UI.Views; | |
| 9 | 10 | |
| 10 | 11 | namespace UI.ViewModels |
| 11 | 12 | { |
| @@ -23,8 +24,7 @@ namespace UI.ViewModels | ||
| 23 | 24 | this.serviceProvider = serviceProvider; |
| 24 | 25 | |
| 25 | 26 | ServiceProvider = serviceProvider; |
| 26 | 删除: Uri = "IndexPage"; | |
| 27 | 删除: Title = "Project Event"; | |
| 27 | 新增: Uri = nameof(IndexPage); | |
| 28 | 28 | OnSelectedCommand = new Command(new Action<object>(OnSelectedCommandHandle)); |
| 29 | 29 | GotoPageCommand = new Command(new Action<object>(OnGotoPageCommand)); |
| 30 | 30 | |
| @@ -40,10 +40,10 @@ namespace UI.ViewModels | ||
| 40 | 40 | { |
| 41 | 41 | if (e.PropertyName == nameof(Uri)) |
| 42 | 42 | { |
| 43 | 删除: //if (Uri == nameof(IndexPage)) | |
| 44 | 删除: //{ | |
| 45 | 删除: // Data = null; | |
| 46 | 删除: //} | |
| 43 | 新增: if (Uri == nameof(IndexPage)) | |
| 44 | 新增: { | |
| 45 | 新增: Data = null; | |
| 46 | 新增: } | |
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
| @@ -72,6 +72,7 @@ namespace UI.ViewModels | ||
| 72 | 72 | { |
| 73 | 73 | Icon = Controls.Base.IconTypes.AppIconDefaultList, |
| 74 | 74 | Title = "概览", |
| 75 | 新增: Uri = nameof(IndexPage), | |
| 75 | 76 | ID = -1 |
| 76 | 77 | |
| 77 | 78 | }); |
| @@ -0,0 +1,14 @@ | ||
| 1 | 新增:<Page x:Class="UI.Views.IndexPage" | |
| 2 | 新增: xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | |
| 3 | 新增: xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | |
| 4 | 新增: xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | |
| 5 | 新增: xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | |
| 6 | 新增: xmlns:local="clr-namespace:UI.Views" | |
| 7 | 新增: mc:Ignorable="d" | |
| 8 | 新增: d:DesignHeight="450" d:DesignWidth="800" | |
| 9 | 新增: Title="IndexPage"> | |
| 10 | 新增: | |
| 11 | 新增: <Grid> | |
| 12 | 新增: | |
| 13 | 新增: </Grid> | |
| 14 | 新增:</Page> | |
| @@ -0,0 +1,28 @@ | ||
| 1 | 新增:using System; | |
| 2 | 新增:using System.Collections.Generic; | |
| 3 | 新增:using System.Linq; | |
| 4 | 新增:using System.Text; | |
| 5 | 新增:using System.Threading.Tasks; | |
| 6 | 新增:using System.Windows; | |
| 7 | 新增:using System.Windows.Controls; | |
| 8 | 新增:using System.Windows.Data; | |
| 9 | 新增:using System.Windows.Documents; | |
| 10 | 新增:using System.Windows.Input; | |
| 11 | 新增:using System.Windows.Media; | |
| 12 | 新增:using System.Windows.Media.Imaging; | |
| 13 | 新增:using System.Windows.Navigation; | |
| 14 | 新增:using System.Windows.Shapes; | |
| 15 | 新增: | |
| 16 | 新增:namespace UI.Views | |
| 17 | 新增:{ | |
| 18 | 新增: /// <summary> | |
| 19 | 新增: /// IndexPage.xaml 的交互逻辑 | |
| 20 | 新增: /// </summary> | |
| 21 | 新增: public partial class IndexPage : Page | |
| 22 | 新增: { | |
| 23 | 新增: public IndexPage() | |
| 24 | 新增: { | |
| 25 | 新增: InitializeComponent(); | |
| 26 | 新增: } | |
| 27 | 新增: } | |
| 28 | 新增:} | |

