Skip to content

Commit 85270d5

Browse files
添加项目文件。
1 parent 464cd1f commit 85270d5

46 files changed

Lines changed: 5008 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

RoslynSyntaxTool.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 16
4+
VisualStudioVersion = 16.0.30711.63
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "RoslynSyntaxTool", "RoslynSyntaxTool\RoslynSyntaxTool.csproj", "{E47C5908-E1AC-49D8-9B04-451D329CEEFE}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{E47C5908-E1AC-49D8-9B04-451D329CEEFE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{E47C5908-E1AC-49D8-9B04-451D329CEEFE}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{E47C5908-E1AC-49D8-9B04-451D329CEEFE}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{E47C5908-E1AC-49D8-9B04-451D329CEEFE}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {0FC982EB-09A1-48B2-9CDE-D2CEB397B0D8}
24+
EndGlobalSection
25+
EndGlobal

RoslynSyntaxTool/App.xaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Application x:Class="Workshop.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:Workshop"
5+
StartupUri="MainWindow.xaml"
6+
xmlns:vm="clr-namespace:Workshop.ViewModel"
7+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
8+
d1p1:Ignorable="d"
9+
xmlns:d1p1="http://schemas.openxmlformats.org/markup-compatibility/2006">
10+
<Application.Resources>
11+
<ResourceDictionary>
12+
<vm:ViewModelLocator x:Key="Locator" d:IsDataSource="True" />
13+
14+
<ResourceDictionary.MergedDictionaries>
15+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Controls.xaml" />
16+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Fonts.xaml" />
17+
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Themes/Light.Blue.xaml" />
18+
<ResourceDictionary Source="Style/DefaultDictionary.xaml" />
19+
<ResourceDictionary Source="Style/ConvertersDictionary.xaml" />
20+
</ResourceDictionary.MergedDictionaries>
21+
</ResourceDictionary>
22+
</Application.Resources>
23+
</Application>

RoslynSyntaxTool/App.xaml.cs

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
using Newtonsoft.Json;
2+
using System;
3+
using System.Collections.Generic;
4+
using System.Configuration;
5+
using System.Data;
6+
using System.Windows;
7+
using System.Windows.Threading;
8+
using GalaSoft.MvvmLight.Messaging;
9+
using GalaSoft.MvvmLight.Threading;
10+
using Workshop.Common;
11+
using Workshop.Helper;
12+
13+
14+
namespace Workshop
15+
{
16+
/// <summary>
17+
/// App.xaml 的交互逻辑
18+
/// </summary>
19+
public partial class App : Application
20+
{
21+
public static string Session;
22+
public App()
23+
{
24+
App.Current.Startup += Current_Startup;
25+
App.Current.Exit += Current_Exit;
26+
27+
}
28+
29+
private void Current_Exit(object sender, ExitEventArgs e)
30+
{
31+
LogHelper.ExitThread();
32+
33+
}
34+
35+
/// <summary>
36+
/// UI线程抛出全局异常事件处理
37+
/// </summary>
38+
/// <param name="sender"></param>
39+
/// <param name="e"></param>
40+
private void App_OnDispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
41+
{
42+
try
43+
{
44+
Messenger.Default.Send("", MessengerToken.CLOSEPROGRESS);
45+
46+
LogHelper.LogError("UI线程全局异常" + e.Exception);
47+
MessageBox.Show("An unhandled exception just occurred: " + e.Exception.Message, "UI线程全局异常", MessageBoxButton.OK, MessageBoxImage.Error);
48+
e.Handled = true;
49+
}
50+
catch (Exception ex)
51+
{
52+
LogHelper.LogError("不可恢复的UI线程全局异常" + ex);
53+
MessageBox.Show("An unhandled exception just occurred: " + e.Exception.Message, "不可恢复的UI线程全局异常", MessageBoxButton.OK, MessageBoxImage.Error);
54+
}
55+
}
56+
57+
/// <summary>
58+
/// 非UI线程抛出全局异常事件处理
59+
/// </summary>
60+
/// <param name="sender"></param>
61+
/// <param name="e"></param>
62+
private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
63+
{
64+
try
65+
{
66+
Messenger.Default.Send("", MessengerToken.CLOSEPROGRESS);
67+
68+
var exception = e.ExceptionObject as Exception;
69+
if (exception != null)
70+
{
71+
LogHelper.LogError("非UI线程全局异常" + exception);
72+
MessageBox.Show("An unhandled exception just occurred: " + exception.Message, "非UI线程全局异常", MessageBoxButton.OK, MessageBoxImage.Error);
73+
74+
}
75+
}
76+
catch (Exception ex)
77+
{
78+
LogHelper.LogError("不可恢复的非UI线程全局异常" + ex);
79+
MessageBox.Show("An unhandled exception just occurred: " + ex.Message, "不可恢复的非UI线程全局异常", MessageBoxButton.OK, MessageBoxImage.Error);
80+
81+
}
82+
}
83+
private void Current_Startup(object sender, StartupEventArgs e)
84+
{
85+
Current.DispatcherUnhandledException += App_OnDispatcherUnhandledException;
86+
AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException;
87+
LogHelper.LogFlag = true;
88+
DispatcherHelper.Initialize();
89+
90+
}
91+
}
92+
}

RoslynSyntaxTool/AssemblyInfo.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
using System.Windows;
2+
3+
[assembly: ThemeInfo(
4+
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
5+
//(used if a resource is not found in the page,
6+
// or application resource dictionaries)
7+
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
8+
//(used if a resource is not found in the page,
9+
// app, or any theme specific resource dictionaries)
10+
)]

RoslynSyntaxTool/Assets/1.png

43.4 KB
Loading

RoslynSyntaxTool/Assets/2.png

44.6 KB
Loading
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Windows.Markup;
6+
7+
namespace Workshop.Common
8+
{
9+
[MarkupExtensionReturnType(typeof(object[]))]
10+
public class EnumValuesExtension : MarkupExtension
11+
{
12+
public EnumValuesExtension()
13+
{
14+
}
15+
16+
public EnumValuesExtension(Type enumType)
17+
{
18+
this.EnumType = enumType;
19+
}
20+
21+
[ConstructorArgument("enumType")]
22+
public Type EnumType { get; set; }
23+
24+
public override object ProvideValue(IServiceProvider serviceProvider)
25+
{
26+
if (this.EnumType == null)
27+
throw new ArgumentException("The enum type is not set");
28+
return Enum.GetValues(this.EnumType);
29+
}
30+
}
31+
32+
33+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace Workshop.Common
7+
{
8+
public class MessengerToken
9+
{
10+
public static string CLOSEWINDOW = "CLOSEWINDOW";
11+
public static string UPDATEPROGRESS = "UPDATEPROGRESS";
12+
public static string CLOSEPROGRESS = "CLOSEPROGRESS";
13+
}
14+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
6+
namespace Workshop.Common
7+
{
8+
public class ProgressOncanceledEventArgs : EventArgs
9+
{
10+
public double CurrentVal { get; set; }
11+
public double TotalVal { get; set; }
12+
}
13+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<mah:MetroWindow
2+
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
3+
x:Class="Workshop.Control.ProgressWindow"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
xmlns:local="clr-namespace:Workshop.Control"
9+
WindowStartupLocation="CenterScreen"
10+
ResizeMode="NoResize"
11+
IsMaxRestoreButtonEnabled="False"
12+
IsCloseButtonEnabled="False"
13+
IsMinButtonEnabled="False"
14+
15+
ShowTitleBar="False"
16+
mc:Ignorable="d"
17+
Title="" Height="250" Width="350">
18+
<Grid>
19+
<Grid.RowDefinitions>
20+
<RowDefinition></RowDefinition>
21+
<RowDefinition></RowDefinition>
22+
<RowDefinition Height="0.5*"></RowDefinition>
23+
<RowDefinition Height="0.5*"></RowDefinition>
24+
</Grid.RowDefinitions>
25+
<ProgressBar Width="300" Grid.Row="1" x:Name="MainProgress" IsIndeterminate="True"
26+
Height="15"
27+
Margin="4"
28+
Maximum="100"
29+
Minimum="0"
30+
Value="50"/>
31+
<StackPanel Orientation="Vertical" HorizontalAlignment="Center">
32+
33+
<TextBlock x:Name="TitleLabel"
34+
Margin="20 15"
35+
Padding="0"
36+
FontFamily="{DynamicResource HeaderFontFamily}"
37+
FontSize="{DynamicResource HeaderFontSize}"
38+
Text="准备中" />
39+
40+
</StackPanel>
41+
<StackPanel Orientation="Horizontal"
42+
x:Name="ProgressTextLayout"
43+
Visibility="Collapsed"
44+
Grid.Row="2"
45+
HorizontalAlignment="Center">
46+
<Label Content="已完成"></Label>
47+
<Label x:Name="CurrentValueLabel" Content="0"></Label>
48+
<Label Content=""></Label>
49+
<Label Content="(共"></Label>
50+
<Label x:Name="TotalValueLabel" Content="0"></Label>
51+
<Label Content="项)"></Label>
52+
</StackPanel>
53+
<Button Grid.Row="3" Visibility="Collapsed" x:Name="CancelButton" Content="取消" Width="80" Click="CancelButton_Click"></Button>
54+
</Grid>
55+
</mah:MetroWindow>

0 commit comments

Comments
 (0)