Skip to content

Commit 73bceaf

Browse files
committed
take MahApps.Metro back
1 parent 34df33c commit 73bceaf

21 files changed

+710
-24
lines changed

ChromeUpdater.MahAppsUI/App.config

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>

ChromeUpdater.MahAppsUI/App.xaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<Application x:Class="ChromeUpdater.MahAppsUI.App"
2+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4+
xmlns:local="clr-namespace:ChromeUpdater.MahAppsUI"
5+
StartupUri="MainWindow.xaml">
6+
<Application.Resources>
7+
<ResourceDictionary>
8+
<ResourceDictionary.MergedDictionaries>
9+
<!-- MahApps.Metro resource dictionaries. Make sure that all file names are Case Sensitive! -->
10+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
11+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
12+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Colors.xaml" />
13+
<!-- Accent and AppTheme setting -->
14+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/Blue.xaml" />
15+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseLight.xaml" />
16+
</ResourceDictionary.MergedDictionaries>
17+
<Canvas x:Key="appbar_github" Width="76" Height="76" Clip="F1 M 0,0L 76,0L 76,76L 0,76L 0,0">
18+
<Path Width="68.7695" Height="54.9797" Canvas.Left="3.27222" Canvas.Top="14.3263" Stretch="Fill" Fill="{DynamicResource BlackBrush}" Data="F1 M 32.415,38.1721C 32.415,39.9319 31.4232,41.3581 30.2009,41.3581C 28.9778,41.3581 27.9872,39.9319 27.9872,38.1721C 27.9872,36.4115 28.9778,34.9845 30.2009,34.9845C 31.4232,34.9845 32.415,36.4115 32.415,38.1721 Z M 50.2302,38.1721C 50.2302,39.9319 49.2388,41.3581 48.0161,41.3581C 46.7938,41.3581 45.8024,39.9319 45.8024,38.1721C 45.8024,36.4115 46.7938,34.9845 48.0161,34.9845C 49.2388,34.9845 50.2302,36.4115 50.2302,38.1721 Z M 39.6652,42.3574C 39.6652,42.816 39.2933,43.1879 38.8346,43.1879C 38.3756,43.1879 38.0041,42.816 38.0041,42.3574C 38.0041,41.8987 38.3756,41.5268 38.8346,41.5268C 39.2933,41.5268 39.6652,41.8987 39.6652,42.3574 Z M 36.8997,44.457C 36.8507,44.3176 36.924,44.1655 37.0625,44.1166C 37.2015,44.0672 37.3544,44.1404 37.4034,44.279C 37.6168,44.8822 38.1889,45.2875 38.8276,45.2875C 39.4662,45.2875 40.0383,44.8822 40.2521,44.279C 40.3011,44.1397 40.4536,44.0672 40.593,44.1166C 40.7319,44.1655 40.8044,44.3176 40.7554,44.457C 40.4667,45.2728 39.6915,45.8211 38.8276,45.8211C 37.9636,45.8211 37.1892,45.2728 36.8997,44.457 Z M 71.9887,40.9911C 66.0857,39.8105 62.6635,39.8089 59.0383,39.9638C 58.9069,40.4022 58.7592,40.8286 58.5896,41.2383C 62.1674,41.3426 65.8607,42.8405 71.9234,44.5506L 71.851,44.8074C 65.7536,43.087 62.0181,41.5998 58.4761,41.5027C 56.6876,45.5599 52.8072,48.171 44.7207,48.9728C 46.1079,49.9145 47.5265,51.6986 47.5265,55.0674L 47.5265,63.7061C 47.5265,63.7061 47.7045,65.8438 49.6642,66.5561C 49.6642,66.5561 50.8212,67.3579 49.5746,67.8027C 49.5746,67.8027 44.1422,68.2482 44.1422,63.7953L 44.1422,57.205C 44.1422,57.205 44.3568,54.7755 43.0736,53.7761L 43.0736,64.5076C 43.0736,64.5076 43.1624,67.0904 44.4982,68.0702C 44.4982,68.0702 45.3884,69.6728 43.4299,69.2281C 43.4299,69.2281 39.6893,68.6937 39.5113,64.3296L 39.4257,53.3752L 38.5271,53.3752L 38.4419,64.3296C 38.2635,68.6937 34.5232,69.2281 34.5232,69.2281C 32.5639,69.6728 33.4546,68.0702 33.4546,68.0702C 34.7908,67.0904 34.8792,64.5076 34.8792,64.5076L 34.8792,53.683C 33.5959,54.5912 33.8109,57.205 33.8109,57.205L 33.8109,63.7953C 33.8109,68.2482 28.3782,67.8027 28.3782,67.8027C 27.1311,67.3579 28.289,66.5561 28.289,66.5561C 30.2487,65.8438 30.4266,63.7061 30.4266,63.7061L 30.4266,57.6621C 22.0125,59.5394 20.269,53.6886 20.269,53.6886C 18.9328,50.2581 16.995,49.3451 16.995,49.3451C 14.3003,47.4969 17.1952,47.5411 17.1952,47.5411C 20.1798,47.7644 21.739,50.6152 21.739,50.6152C 24.5244,55.4062 29.1669,53.6937 30.6333,52.9926C 31.0788,50.9122 32.1761,49.6827 33.2527,48.9597C 25.6699,48.1423 21.4077,45.5396 19.2457,41.5099C 15.6623,41.6193 9.43005,43.6522 3.46254,45.3352L 3.39007,45.0784C 9.31101,43.4081 15.4887,41.3637 19.1072,41.2471C 18.8957,40.8286 18.707,40.3954 18.5378,39.9491C 14.8784,39.8105 9.02832,39.3226 3.32478,40.4633L 3.27222,40.2013C 8.94192,39.0674 14.7557,39.5438 18.4375,39.6776C 17.6682,37.5212 17.3529,35.0403 17.3529,32.2743C 17.3529,28.6109 18.6772,25.6228 20.8463,23.282C 20.4995,22.4335 19.3584,19.017 21.2042,14.4024C 21.2042,14.4024 24.0311,13.5074 30.4358,17.8771C 33.1225,17.1401 36.0032,16.777 38.854,16.777C 41.4451,16.777 44.0323,17.0768 46.4635,17.6844C 52.6691,13.5312 55.4123,14.4024 55.4123,14.4024C 56.9679,18.2912 56.4017,21.3295 55.9777,22.6971C 58.4029,25.1175 59.8967,28.2983 59.8967,32.2743C 59.8967,35.0466 59.7164,37.5327 59.1168,39.6931C 62.767,39.5414 66.1618,39.5533 72.0417,40.7291L 71.9887,40.9911 Z M 51.9869,32.0871C 49.1134,29.4859 44.2751,30.8866 38.7877,30.8866C 33.2785,30.8866 28.4218,29.4999 25.5527,32.1189C 23.8323,33.6904 22.8274,35.584 22.8274,37.6234C 22.8274,46.1414 29.9726,47.4689 38.7877,47.4689C 47.6017,47.4689 54.7477,47.2089 54.7477,37.6234C 54.7477,35.5705 53.7288,33.6649 51.9869,32.0871 Z "/>
19+
</Canvas>
20+
<Style x:Key="DescriptionHeaderStyle"
21+
TargetType="Label">
22+
<Setter Property="FontSize"
23+
Value="15" />
24+
<Setter Property="HorizontalAlignment"
25+
Value="Center" />
26+
</Style>
27+
</ResourceDictionary>
28+
</Application.Resources>
29+
</Application>

ChromeUpdater.MahAppsUI/App.xaml.cs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Configuration;
4+
using System.Data;
5+
using System.Linq;
6+
using System.Threading.Tasks;
7+
using System.Windows;
8+
using MahApps.Metro.Controls;
9+
using MahApps.Metro.Controls.Dialogs;
10+
11+
namespace ChromeUpdater.MahAppsUI
12+
{
13+
/// <summary>
14+
/// App.xaml の相互作用ロジック
15+
/// </summary>
16+
public partial class App : Application
17+
{
18+
public App()
19+
{
20+
Dispatcher.UnhandledException += OnDispatcherUnhandledException;
21+
}
22+
23+
async void OnDispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
24+
{
25+
var errorMessage = $"出错啦: {e.Exception.Message},请问是否要复制出错详情?";
26+
if (Current.MainWindow == null)
27+
{
28+
if (MessageBox.Show(errorMessage, "Error", MessageBoxButton.YesNo, MessageBoxImage.Error) == MessageBoxResult.Yes)
29+
Clipboard.SetText(e.Exception.StackTrace);
30+
}
31+
else
32+
{
33+
var wnd = (MetroWindow) Current.MainWindow;
34+
if (await wnd.ShowMessageAsync("Error",errorMessage,MessageDialogStyle.AffirmativeAndNegative) == MessageDialogResult.Affirmative)
35+
Clipboard.SetText(e.Exception.StackTrace);
36+
}
37+
e.Handled = true;
38+
}
39+
}
40+
}
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{7D101867-6051-4DD6-9C25-1C9A05A76935}</ProjectGuid>
8+
<OutputType>WinExe</OutputType>
9+
<RootNamespace>ChromeUpdater.MahAppsUI</RootNamespace>
10+
<AssemblyName>ChromeUpdater.MahAppsUI</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
14+
<WarningLevel>4</WarningLevel>
15+
</PropertyGroup>
16+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
17+
<PlatformTarget>AnyCPU</PlatformTarget>
18+
<DebugSymbols>true</DebugSymbols>
19+
<DebugType>full</DebugType>
20+
<Optimize>false</Optimize>
21+
<OutputPath>bin\Debug\</OutputPath>
22+
<DefineConstants>DEBUG;TRACE</DefineConstants>
23+
<ErrorReport>prompt</ErrorReport>
24+
<WarningLevel>4</WarningLevel>
25+
</PropertyGroup>
26+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
27+
<PlatformTarget>AnyCPU</PlatformTarget>
28+
<DebugType>pdbonly</DebugType>
29+
<Optimize>true</Optimize>
30+
<OutputPath>bin\Release\</OutputPath>
31+
<DefineConstants>TRACE</DefineConstants>
32+
<ErrorReport>prompt</ErrorReport>
33+
<WarningLevel>4</WarningLevel>
34+
</PropertyGroup>
35+
<ItemGroup>
36+
<Reference Include="MahApps.Metro, Version=1.4.3.0, Culture=neutral, PublicKeyToken=f4fb5a3c4d1e5b4f, processorArchitecture=MSIL">
37+
<HintPath>..\packages\MahApps.Metro.1.4.3\lib\net45\MahApps.Metro.dll</HintPath>
38+
</Reference>
39+
<Reference Include="System" />
40+
<Reference Include="System.Data" />
41+
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
42+
<HintPath>..\packages\MahApps.Metro.1.4.3\lib\net45\System.Windows.Interactivity.dll</HintPath>
43+
<Private>True</Private>
44+
</Reference>
45+
<Reference Include="System.Xml" />
46+
<Reference Include="Microsoft.CSharp" />
47+
<Reference Include="System.Core" />
48+
<Reference Include="System.Xml.Linq" />
49+
<Reference Include="System.Data.DataSetExtensions" />
50+
<Reference Include="System.Net.Http" />
51+
<Reference Include="System.Xaml">
52+
<RequiredTargetFramework>4.0</RequiredTargetFramework>
53+
</Reference>
54+
<Reference Include="WindowsBase" />
55+
<Reference Include="PresentationCore" />
56+
<Reference Include="PresentationFramework" />
57+
</ItemGroup>
58+
<ItemGroup>
59+
<ApplicationDefinition Include="App.xaml">
60+
<Generator>MSBuild:Compile</Generator>
61+
<SubType>Designer</SubType>
62+
</ApplicationDefinition>
63+
<Page Include="MainWindow.xaml">
64+
<Generator>MSBuild:Compile</Generator>
65+
<SubType>Designer</SubType>
66+
</Page>
67+
<Compile Include="App.xaml.cs">
68+
<DependentUpon>App.xaml</DependentUpon>
69+
<SubType>Code</SubType>
70+
</Compile>
71+
<Compile Include="Converters\InvertBoolConverter.cs" />
72+
<Compile Include="MainWindow.xaml.cs">
73+
<DependentUpon>MainWindow.xaml</DependentUpon>
74+
<SubType>Code</SubType>
75+
</Compile>
76+
</ItemGroup>
77+
<ItemGroup>
78+
<Compile Include="Properties\AssemblyInfo.cs">
79+
<SubType>Code</SubType>
80+
</Compile>
81+
<Compile Include="Properties\Resources.Designer.cs">
82+
<AutoGen>True</AutoGen>
83+
<DesignTime>True</DesignTime>
84+
<DependentUpon>Resources.resx</DependentUpon>
85+
</Compile>
86+
<Compile Include="Properties\Settings.Designer.cs">
87+
<AutoGen>True</AutoGen>
88+
<DependentUpon>Settings.settings</DependentUpon>
89+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
90+
</Compile>
91+
<EmbeddedResource Include="Properties\Resources.resx">
92+
<Generator>ResXFileCodeGenerator</Generator>
93+
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
94+
</EmbeddedResource>
95+
<None Include="packages.config" />
96+
<None Include="Properties\Settings.settings">
97+
<Generator>SettingsSingleFileGenerator</Generator>
98+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
99+
</None>
100+
</ItemGroup>
101+
<ItemGroup>
102+
<None Include="App.config" />
103+
</ItemGroup>
104+
<ItemGroup>
105+
<Resource Include="gu.ico" />
106+
<Resource Include="icon-alpha.png" />
107+
</ItemGroup>
108+
<ItemGroup>
109+
<ProjectReference Include="..\ChromeUpdaterCore\ChromeUpdaterCore.csproj">
110+
<Project>{f51105dc-8b81-46ac-bd83-dd1139e398f7}</Project>
111+
<Name>ChromeUpdaterCore</Name>
112+
</ProjectReference>
113+
</ItemGroup>
114+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
115+
</Project>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Globalization;
4+
using System.Linq;
5+
using System.Text;
6+
using System.Threading.Tasks;
7+
using System.Windows.Data;
8+
9+
namespace ChromeUpdater.MahAppsUI.Converters
10+
{
11+
[ValueConversion(typeof(bool), typeof(bool))]
12+
public class InvertBoolConverter : IValueConverter
13+
{
14+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
15+
{
16+
return !(bool)value;
17+
}
18+
19+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
20+
{
21+
return !(bool)value;
22+
}
23+
}
24+
}

0 commit comments

Comments
 (0)