optimized demo start-up speed
This commit is contained in:
1 parent
b57e6e8961
commit
aa745e32b1
14 files changed
+116
-69
No files matched your search
@@ -18,22 +18,20 @@
|
||||
<DefineConstants>TRACE;Core</DefineConstants>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<NoWarn>0067;0649</NoWarn>
|
||||
<TreatWarningsAsErrors>false</TreatWarningsAsErrors>
|
||||
<WarningsAsErrors></WarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug-Core31|AnyCPU'">
|
||||
<DefineConstants>TRACE;Core</DefineConstants>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<NoWarn>0067;0649</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Core30|AnyCPU'">
|
||||
<DefineConstants>TRACE;Core</DefineConstants>
|
||||
<TargetFramework>netcoreapp3.0</TargetFramework>
|
||||
<DocumentationFile>C:\Code\GitHub\HandyControl\src\Core_GE30\HandyControl_Core_GE30\HandyControl.xml</DocumentationFile>
|
||||
<NoWarn>0067;0649;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release-Core31|AnyCPU'">
|
||||
<DefineConstants>TRACE;Core</DefineConstants>
|
||||
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||
<DocumentationFile>C:\Code\GitHub\HandyControl\src\Core_GE30\HandyControl_Core_GE30\HandyControl.xml</DocumentationFile>
|
||||
<NoWarn>0067;0649;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
|
||||
<netVersion>netgt40</netVersion>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>0067;0649;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release-Net47|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -99,6 +100,7 @@
|
||||
<TargetFrameworkVersion>v4.7</TargetFrameworkVersion>
|
||||
<netVersion>netgt40</netVersion>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>0067;0649;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release-Net48|AnyCPU'">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -111,6 +113,7 @@
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<netVersion>netgt40</netVersion>
|
||||
<LangVersion>8.0</LangVersion>
|
||||
<NoWarn>0067;0649;1591</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\Shared\HandyControl_Shared\Properties\NetAssemblyInfo.cs">
|
||||
|
||||
@@ -73,6 +73,7 @@ namespace HandyControlDemo
|
||||
UpdateSkin(GlobalData.Config.Skin);
|
||||
}
|
||||
|
||||
ConfigHelper.Instance.SystemVersionInfo = CommonHelper.GetSystemVersionInfo();
|
||||
ConfigHelper.Instance.SetWindowDefaultStyle();
|
||||
ConfigHelper.Instance.SetNavigationWindowDefaultStyle();
|
||||
|
||||
|
||||
@@ -249,6 +249,9 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\BlogsView.xaml.cs">
|
||||
<DependentUpon>BlogsView.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\MainWindowContent.xaml.cs">
|
||||
<DependentUpon>MainWindowContent.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)UserControl\Main\NoUserContent.xaml.cs">
|
||||
<DependentUpon>NoUserContent.xaml</DependentUpon>
|
||||
</Compile>
|
||||
@@ -765,6 +768,10 @@
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\MainWindowContent.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="$(MSBuildThisFileDirectory)UserControl\Main\NoUserContent.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ShowAllFiles>false</ShowAllFiles>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
@@ -4,40 +4,14 @@
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
xmlns:data="clr-namespace:HandyControlDemo.Data"
|
||||
mc:Ignorable="d"
|
||||
Title="HandyControlDemo"
|
||||
ShowTitle="False"
|
||||
Background="{DynamicResource SecondaryRegionBrush}"
|
||||
ResizeMode="CanResizeWithGrip"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
DataContext="{Binding Main,Source={StaticResource Locator}}"
|
||||
hc:GlobalShortcut.Host="True"
|
||||
hc:Dialog.Token="{x:Static data:MessageToken.MainWindow}"
|
||||
hc:WindowAttach.IgnoreAltF4="True"
|
||||
d:DesignHeight="800"
|
||||
d:DesignWidth="1400"
|
||||
Icon="/HandyControlDemo;component/Resources/Img/icon.ico">
|
||||
<hc:GlobalShortcut.KeyBindings>
|
||||
<KeyBinding Modifiers="Control+Alt" Key="I" Command="{Binding Main.GlobalShortcutInfoCmd, Source={StaticResource Locator}}"/>
|
||||
<KeyBinding Modifiers="Control+Alt" Key="E" Command="{Binding Main.GlobalShortcutWarningCmd, Source={StaticResource Locator}}"/>
|
||||
</hc:GlobalShortcut.KeyBindings>
|
||||
<hc:Window.NonClientAreaContent>
|
||||
<userControl:NoUserContent/>
|
||||
</hc:Window.NonClientAreaContent>
|
||||
<Border BorderThickness="0,1,0,0" BorderBrush="{DynamicResource BorderBrush}" Background="{StaticResource CloudDrawingBrush}">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240" MinWidth="240" MaxWidth="400"/>
|
||||
<ColumnDefinition MinWidth="200"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<userControl:LeftMainContent/>
|
||||
<userControl:MainContent Grid.Column="1" d:IsHidden="true"/>
|
||||
<GridSplitter Margin="0,26,10,26" Grid.Column="0" HorizontalAlignment="Right" Width="4" Background="Transparent"/>
|
||||
<hc:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsInertiaEnabled="True" IsPenetrating="True">
|
||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
</hc:ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
<ContentControl Name="ControlMain"/>
|
||||
</hc:Window>
|
||||
@@ -1,25 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Input;
|
||||
using GalaSoft.MvvmLight.Messaging;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Tools;
|
||||
using HandyControlDemo.Data;
|
||||
using HandyControlDemo.Tools;
|
||||
using HandyControlDemo.UserControl;
|
||||
using HandyControlDemo.ViewModel;
|
||||
|
||||
namespace HandyControlDemo
|
||||
{
|
||||
public partial class MainWindow
|
||||
{
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
public MainWindow() => InitializeComponent();
|
||||
|
||||
protected override void OnInitialized(EventArgs e)
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
{
|
||||
base.OnInitialized(e);
|
||||
base.OnContentRendered(e);
|
||||
|
||||
DataContext = ViewModelLocator.Instance.Main;
|
||||
NonClientAreaContent = new NoUserContent();
|
||||
ControlMain.Content = new MainWindowContent();
|
||||
|
||||
GlobalShortcut.Init(new List<KeyBinding>
|
||||
{
|
||||
new KeyBinding(ViewModelLocator.Instance.Main.GlobalShortcutInfoCmd, Key.I, ModifierKeys.Control | ModifierKeys.Alt),
|
||||
new KeyBinding(ViewModelLocator.Instance.Main.GlobalShortcutWarningCmd, Key.E, ModifierKeys.Control | ModifierKeys.Alt)
|
||||
});
|
||||
|
||||
Dialog.SetToken(this, MessageToken.MainWindow);
|
||||
WindowAttach.SetIgnoreAltF4(this, true);
|
||||
|
||||
ConfigHelper.Instance.SetSystemVersionInfo(CommonHelper.GetSystemVersionInfo());
|
||||
Messenger.Default.Send(true, MessageToken.FullSwitch);
|
||||
Messenger.Default.Send(AssemblyHelper.CreateInternalInstance($"UserControl.{MessageToken.PracticalDemo}"), MessageToken.LoadShowContent);
|
||||
}
|
||||
|
||||
@@ -8,9 +8,12 @@ namespace HandyControlDemo.Resources
|
||||
{
|
||||
public class DemoTheme : Theme
|
||||
{
|
||||
public override Uri ThemeUri => new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml");
|
||||
|
||||
public override ResourceDictionary GetSkin(SkinType skinType) =>
|
||||
ResourceHelper.GetSkin(typeof(App).Assembly, "Resources/Themes", skinType);
|
||||
|
||||
public override ResourceDictionary GetTheme() => new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControlDemo;component/Resources/Themes/Theme.xaml")
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<Border xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:hc="https://handyorg.github.io/handycontrol"
|
||||
BorderThickness="0,1,0,0"
|
||||
BorderBrush="{DynamicResource BorderBrush}"
|
||||
Background="{StaticResource CloudDrawingBrush}"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:userControl="clr-namespace:HandyControlDemo.UserControl"
|
||||
x:Class="HandyControlDemo.UserControl.MainWindowContent">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="240" MinWidth="240" MaxWidth="400"/>
|
||||
<ColumnDefinition MinWidth="200"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<userControl:LeftMainContent/>
|
||||
<userControl:MainContent Grid.Column="1"/>
|
||||
<GridSplitter Margin="0,26,10,26" Grid.Column="0" HorizontalAlignment="Right" Width="4" Background="Transparent"/>
|
||||
<hc:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsInertiaEnabled="True" IsPenetrating="True">
|
||||
<StackPanel hc:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
|
||||
</hc:ScrollViewer>
|
||||
</Grid>
|
||||
</Border>
|
||||
@@ -0,0 +1,10 @@
|
||||
namespace HandyControlDemo.UserControl
|
||||
{
|
||||
public partial class MainWindowContent
|
||||
{
|
||||
public MainWindowContent()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -57,12 +57,12 @@ namespace HandyControlDemo.ViewModel
|
||||
ContentTitle = LangProvider.GetLang(DemoItemCurrent.Name);
|
||||
});
|
||||
|
||||
DataList = dataService.GetDemoDataList();
|
||||
DemoInfoCollection = new ObservableCollection<DemoInfoModel>();
|
||||
|
||||
#if netle40
|
||||
Task.Factory.StartNew(() =>
|
||||
{
|
||||
DataList = dataService.GetDemoDataList();
|
||||
foreach (var item in dataService.GetDemoInfo())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
@@ -74,6 +74,7 @@ namespace HandyControlDemo.ViewModel
|
||||
#else
|
||||
Task.Run(() =>
|
||||
{
|
||||
DataList = dataService.GetDemoDataList();
|
||||
foreach (var item in dataService.GetDemoInfo())
|
||||
{
|
||||
Application.Current.Dispatcher.BeginInvoke(new Action(() =>
|
||||
|
||||
@@ -20,12 +20,12 @@ namespace HandyControl.Controls
|
||||
EnableBlur(this);
|
||||
}
|
||||
|
||||
public static SystemVersionInfo SystemVersionInfo { get; set; }
|
||||
|
||||
internal static void EnableBlur(Window window)
|
||||
{
|
||||
if (SystemVersionInfo < SystemVersionInfo.Windows10 ||
|
||||
SystemVersionInfo >= SystemVersionInfo.Windows10_1903)
|
||||
var versionInfo = ConfigHelper.Instance.SystemVersionInfo;
|
||||
|
||||
if (versionInfo < SystemVersionInfo.Windows10 ||
|
||||
versionInfo >= SystemVersionInfo.Windows10_1903)
|
||||
{
|
||||
var colorValue = ResourceHelper.GetResource<uint>(ResourceToken.BlurGradientValue);
|
||||
var color = ColorHelper.ToColor(colorValue);
|
||||
@@ -37,7 +37,7 @@ namespace HandyControl.Controls
|
||||
var accentPolicy = new InteropValues.ACCENTPOLICY();
|
||||
var accentPolicySize = Marshal.SizeOf(accentPolicy);
|
||||
|
||||
accentPolicy.AccentState = SystemVersionInfo < SystemVersionInfo.Windows10_1809
|
||||
accentPolicy.AccentState = versionInfo < SystemVersionInfo.Windows10_1809
|
||||
? InteropValues.ACCENTSTATE.ACCENT_ENABLE_BLURBEHIND
|
||||
: InteropValues.ACCENTSTATE.ACCENT_ENABLE_ACRYLICBLURBEHIND;
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Windows;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Tools;
|
||||
@@ -8,7 +7,32 @@ namespace HandyControl.Themes
|
||||
{
|
||||
public class Theme : ResourceDictionary
|
||||
{
|
||||
public Theme() => UpdateResource();
|
||||
public Theme()
|
||||
{
|
||||
if (DesignerHelper.IsInDesignMode)
|
||||
{
|
||||
MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml")
|
||||
});
|
||||
MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateResource();
|
||||
}
|
||||
}
|
||||
|
||||
private Uri _source;
|
||||
|
||||
public new Uri Source
|
||||
{
|
||||
get => DesignerHelper.IsInDesignMode ? null : _source;
|
||||
set => _source = value;
|
||||
}
|
||||
|
||||
private SkinType _skin;
|
||||
|
||||
@@ -26,20 +50,19 @@ namespace HandyControl.Themes
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public virtual Uri ThemeUri => new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml");
|
||||
|
||||
public virtual ResourceDictionary GetSkin(SkinType skinType) => ResourceHelper.GetSkin(skinType);
|
||||
|
||||
public virtual ResourceDictionary GetTheme() => new ResourceDictionary
|
||||
{
|
||||
Source = new Uri("pack://application:,,,/HandyControl;component/Themes/Theme.xaml")
|
||||
};
|
||||
|
||||
private void UpdateResource()
|
||||
{
|
||||
base.MergedDictionaries.Clear();
|
||||
base.MergedDictionaries.Add(GetSkin(Skin));
|
||||
base.MergedDictionaries.Add(new ResourceDictionary
|
||||
{
|
||||
Source = ThemeUri
|
||||
});
|
||||
if (DesignerHelper.IsInDesignMode) return;
|
||||
MergedDictionaries.Clear();
|
||||
MergedDictionaries.Add(GetSkin(Skin));
|
||||
MergedDictionaries.Add(GetTheme());
|
||||
}
|
||||
|
||||
public new Collection<ResourceDictionary> MergedDictionaries => throw new NotSupportedException();
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,6 @@ using System.Windows;
|
||||
using System.Windows.Markup;
|
||||
using System.Windows.Media.Animation;
|
||||
using System.Windows.Navigation;
|
||||
using HandyControl.Controls;
|
||||
using HandyControl.Data;
|
||||
using HandyControl.Properties.Langs;
|
||||
|
||||
@@ -38,7 +37,7 @@ namespace HandyControl.Tools
|
||||
}
|
||||
}
|
||||
|
||||
public void SetSystemVersionInfo(SystemVersionInfo info) => BlurWindow.SystemVersionInfo = info;
|
||||
public SystemVersionInfo SystemVersionInfo { get; set; }
|
||||
|
||||
public void SetLang(string lang)
|
||||
{
|
||||
@@ -49,7 +48,7 @@ namespace HandyControl.Tools
|
||||
|
||||
public void SetConfig(HandyControlConfig config)
|
||||
{
|
||||
SetSystemVersionInfo(config.SystemVersionInfo);
|
||||
SystemVersionInfo = config.SystemVersionInfo;
|
||||
SetLang(config.Lang);
|
||||
SetTimelineFrameRate(config.TimelineFrameRate);
|
||||
}
|
||||
@@ -60,10 +59,10 @@ namespace HandyControl.Tools
|
||||
public void SetWindowDefaultStyle(object resourceKey = null)
|
||||
{
|
||||
var metadata = resourceKey == null
|
||||
? new FrameworkPropertyMetadata(Application.Current.FindResource(typeof(System.Windows.Window)))
|
||||
? new FrameworkPropertyMetadata(Application.Current.FindResource(typeof(Window)))
|
||||
: new FrameworkPropertyMetadata(Application.Current.FindResource(resourceKey));
|
||||
|
||||
FrameworkElement.StyleProperty.OverrideMetadata(typeof(System.Windows.Window), metadata);
|
||||
FrameworkElement.StyleProperty.OverrideMetadata(typeof(Window), metadata);
|
||||
}
|
||||
|
||||
public void SetNavigationWindowDefaultStyle(object resourceKey = null)
|
||||
|
||||
Reference in new issue
Block a user