Skip to content

Commit aa745e3

Browse files
committed
optimized demo start-up speed
1 parent b57e6e8 commit aa745e3

File tree

14 files changed

+116
-69
lines changed

14 files changed

+116
-69
lines changed

src/Core_GE30/HandyControl_Core_GE30/HandyControl_Core_GE30.csproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,22 +18,20 @@
1818
<DefineConstants>TRACE;Core</DefineConstants>
1919
<TargetFramework>netcoreapp3.0</TargetFramework>
2020
<NoWarn>0067;0649</NoWarn>
21-
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
22-
<WarningsAsErrors></WarningsAsErrors>
2321
</PropertyGroup>
2422
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Core31|AnyCPU'">
2523
<DefineConstants>TRACE;Core</DefineConstants>
2624
<TargetFramework>netcoreapp3.1</TargetFramework>
25+
<NoWarn>0067;0649</NoWarn>
2726
</PropertyGroup>
2827
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Core30|AnyCPU'">
2928
<DefineConstants>TRACE;Core</DefineConstants>
3029
<TargetFramework>netcoreapp3.0</TargetFramework>
31-
<DocumentationFile>C:\Code\GitHub\HandyControl\src\Core_GE30\HandyControl_Core_GE30\HandyControl.xml</DocumentationFile>
30+
<NoWarn>0067;0649;1591</NoWarn>
3231
</PropertyGroup>
3332
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Core31|AnyCPU'">
3433
<DefineConstants>TRACE;Core</DefineConstants>
3534
<TargetFramework>netcoreapp3.1</TargetFramework>
36-
<DocumentationFile>C:\Code\GitHub\HandyControl\src\Core_GE30\HandyControl_Core_GE30\HandyControl.xml</DocumentationFile>
3735
<NoWarn>0067;0649;1591</NoWarn>
3836
</PropertyGroup>
3937
<ItemGroup>

src/Net_GE45/HandyControl_Net_GE45/HandyControl_Net_GE45.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@
8787
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
8888
<netVersion>netgt40</netVersion>
8989
<LangVersion>8.0</LangVersion>
90+
<NoWarn>0067;0649;1591</NoWarn>
9091
</PropertyGroup>
9192
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net47|AnyCPU' ">
9293
<DebugType>pdbonly</DebugType>
@@ -99,6 +100,7 @@
99100
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
100101
<netVersion>netgt40</netVersion>
101102
<LangVersion>8.0</LangVersion>
103+
<NoWarn>0067;0649;1591</NoWarn>
102104
</PropertyGroup>
103105
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Net48|AnyCPU'">
104106
<DebugType>pdbonly</DebugType>
@@ -111,6 +113,7 @@
111113
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
112114
<netVersion>netgt40</netVersion>
113115
<LangVersion>8.0</LangVersion>
116+
<NoWarn>0067;0649;1591</NoWarn>
114117
</PropertyGroup>
115118
<ItemGroup>
116119
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\NetAssemblyInfo.cs">

src/Shared/HandyControlDemo_Shared/App.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ protected override void OnStartup(StartupEventArgs e)
7373
UpdateSkin(GlobalData.Config.Skin);
7474
}
7575

76+
ConfigHelper.Instance.SystemVersionInfo = CommonHelper.GetSystemVersionInfo();
7677
ConfigHelper.Instance.SetWindowDefaultStyle();
7778
ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
7879

src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.projitems

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,9 @@
249249
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\BlogsView.xaml.cs">
250250
<DependentUpon>BlogsView.xaml</DependentUpon>
251251
</Compile>
252+
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\MainWindowContent.xaml.cs">
253+
<DependentUpon>MainWindowContent.xaml</DependentUpon>
254+
</Compile>
252255
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\NoUserContent.xaml.cs">
253256
<DependentUpon>NoUserContent.xaml</DependentUpon>
254257
</Compile>
@@ -765,6 +768,10 @@
765768
<SubType>Designer</SubType>
766769
<Generator>MSBuild:Compile</Generator>
767770
</Page>
771+
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\MainWindowContent.xaml">
772+
<SubType>Designer</SubType>
773+
<Generator>MSBuild:Compile</Generator>
774+
</Page>
768775
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\NoUserContent.xaml">
769776
<SubType>Designer</SubType>
770777
<Generator>MSBuild:Compile</Generator>

src/Shared/HandyControlDemo_Shared/HandyControlDemo_Shared.shproj.user

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/Shared/HandyControlDemo_Shared/MainWindow.xaml

Lines changed: 1 addition & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,14 @@
44
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
55
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
66
xmlns:hc="https://handyorg.github.io/handycontrol"
7-
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
8-
xmlns:data="clr-namespace:HandyControlDemo.Data"
97
mc:Ignorable="d"
108
Title="HandyControlDemo"
119
ShowTitle="False"
1210
Background="{DynamicResource SecondaryRegionBrush}"
1311
ResizeMode="CanResizeWithGrip"
1412
WindowStartupLocation="CenterScreen"
15-
DataContext="{Binding Main,Source={StaticResource Locator}}"
16-
hc:GlobalShortcut.Host="True"
17-
hc:Dialog.Token="{x:Static data:MessageToken.MainWindow}"
18-
hc:WindowAttach.IgnoreAltF4="True"
1913
d:DesignHeight="800"
2014
d:DesignWidth="1400"
2115
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
22-
<hc:GlobalShortcut.KeyBindings>
23-
<KeyBinding Modifiers="Control+Alt" Key="I" Command="{Binding Main.GlobalShortcutInfoCmd, Source={StaticResource Locator}}"/>
24-
<KeyBinding Modifiers="Control+Alt" Key="E" Command="{Binding Main.GlobalShortcutWarningCmd, Source={StaticResource Locator}}"/>
25-
</hc:GlobalShortcut.KeyBindings>
26-
<hc:Window.NonClientAreaContent>
27-
<userControl:NoUserContent/>
28-
</hc:Window.NonClientAreaContent>
29-
<Border BorderThickness="0,1,0,0" BorderBrush="{DynamicResource BorderBrush}" Background="{StaticResource CloudDrawingBrush}">
30-
<Grid>
31-
<Grid.ColumnDefinitions>
32-
<ColumnDefinition Width="240" MinWidth="240" MaxWidth="400"/>
33-
<ColumnDefinition MinWidth="200"/>
34-
</Grid.ColumnDefinitions>
35-
<userControl:LeftMainContent/>
36-
<userControl:MainContent Grid.Column="1" d:IsHidden="true"/>
37-
<GridSplitter Margin="0,26,10,26" Grid.Column="0" HorizontalAlignment="Right" Width="4" Background="Transparent"/>
38-
<hc:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsInertiaEnabled="True" IsPenetrating="True">
39-
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
40-
</hc:ScrollViewer>
41-
</Grid>
42-
</Border>
16+
<ContentControl Name="ControlMain"/>
4317
</hc:Window>

src/Shared/HandyControlDemo_Shared/MainWindow.xaml.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,38 @@
11
using System;
2+
using System.Collections.Generic;
23
using System.ComponentModel;
4+
using System.Windows.Input;
35
using GalaSoft.MvvmLight.Messaging;
46
using HandyControl.Controls;
57
using HandyControl.Tools;
68
using HandyControlDemo.Data;
79
using HandyControlDemo.Tools;
10+
using HandyControlDemo.UserControl;
11+
using HandyControlDemo.ViewModel;
812

913
namespace HandyControlDemo
1014
{
1115
public partial class MainWindow
1216
{
13-
public MainWindow()
14-
{
15-
InitializeComponent();
16-
}
17+
public MainWindow() => InitializeComponent();
1718

18-
protected override void OnInitialized(EventArgs e)
19+
protected override void OnContentRendered(EventArgs e)
1920
{
20-
base.OnInitialized(e);
21+
base.OnContentRendered(e);
22+
23+
DataContext = ViewModelLocator.Instance.Main;
24+
NonClientAreaContent = new NoUserContent();
25+
ControlMain.Content = new MainWindowContent();
26+
27+
GlobalShortcut.Init(new List<KeyBinding>
28+
{
29+
new KeyBinding(ViewModelLocator.Instance.Main.GlobalShortcutInfoCmd, Key.I, ModifierKeys.Control | ModifierKeys.Alt),
30+
new KeyBinding(ViewModelLocator.Instance.Main.GlobalShortcutWarningCmd, Key.E, ModifierKeys.Control | ModifierKeys.Alt)
31+
});
32+
33+
Dialog.SetToken(this, MessageToken.MainWindow);
34+
WindowAttach.SetIgnoreAltF4(this, true);
2135

22-
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
2336
Messenger.Default.Send(true, MessageToken.FullSwitch);
2437
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
2538
}

src/Shared/HandyControlDemo_Shared/Resources/DemoTheme.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ namespace HandyControlDemo.Resources
88
{
99
public class DemoTheme : Theme
1010
{
11-
public override Uri ThemeUri => new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml");
12-
1311
public override ResourceDictionary GetSkin(SkinType skinType) =>
1412
ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skinType);
13+
14+
public override ResourceDictionary GetTheme() => new ResourceDictionary
15+
{
16+
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
17+
};
1518
}
1619
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<Border xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
2+
xmlns:hc="https://handyorg.github.io/handycontrol"
3+
BorderThickness="0,1,0,0"
4+
BorderBrush="{DynamicResource BorderBrush}"
5+
Background="{StaticResource CloudDrawingBrush}"
6+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
7+
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
8+
x:Class="HandyControlDemo.UserControl.MainWindowContent">
9+
<Grid>
10+
<Grid.ColumnDefinitions>
11+
<ColumnDefinition Width="240" MinWidth="240" MaxWidth="400"/>
12+
<ColumnDefinition MinWidth="200"/>
13+
</Grid.ColumnDefinitions>
14+
<userControl:LeftMainContent/>
15+
<userControl:MainContent Grid.Column="1"/>
16+
<GridSplitter Margin="0,26,10,26" Grid.Column="0" HorizontalAlignment="Right" Width="4" Background="Transparent"/>
17+
<hc:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsInertiaEnabled="True" IsPenetrating="True">
18+
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
19+
</hc:ScrollViewer>
20+
</Grid>
21+
</Border>
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
namespace HandyControlDemo.UserControl
2+
{
3+
public partial class MainWindowContent
4+
{
5+
public MainWindowContent()
6+
{
7+
InitializeComponent();
8+
}
9+
}
10+
}

0 commit comments

Comments
 (0)