Skip to content

Commit

Permalink
adapt code in C#
Browse files Browse the repository at this point in the history
  • Loading branch information
changbowen committed Dec 10, 2016
1 parent 2f9f8b2 commit 0f3a37f
Show file tree
Hide file tree
Showing 44 changed files with 695 additions and 21 deletions.
Binary file added .vs/DesktopNote/v14/.suo
Binary file not shown.
3 changes: 2 additions & 1 deletion App.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<Application x:Class="DesktopNote.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml">
Startup="RunCheck"
ShutdownMode="OnExplicitShutdown">
<Application.Resources>

</Application.Resources>
Expand Down
43 changes: 40 additions & 3 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,47 @@

namespace DesktopNote
{
/// <summary>
/// App.xaml 的交互逻辑
/// </summary>
public partial class App : Application
{
//Private Declare Unicode Function PathIsNetworkPath Lib "shlwapi" Alias "" (ByVal pszPath As String) As Boolean
[System.Runtime.InteropServices.DllImport("shlwapi.dll")]
private static extern bool PathIsNetworkPathW(string pszPath);

private void RunCheck(object sender1, StartupEventArgs e1)
{
AppDomain.CurrentDomain.AssemblyResolve += (object sender, ResolveEventArgs e) =>
{
var desiredAssembly = new System.Reflection.AssemblyName(e.Name).Name;
if (desiredAssembly == "Xceed.Wpf.Toolkit")
{
var ressourceName = "DesktopNote." + desiredAssembly + ".dll";
using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(ressourceName))
{
byte[] assemblyData = new byte[stream.Length];
stream.Read(assemblyData, 0, assemblyData.Length);
return System.Reflection.Assembly.Load(assemblyData);
}
}
else
return null;
};

if (PathIsNetworkPathW(System.AppDomain.CurrentDomain.BaseDirectory))
{
MessageBox.Show("Please do not run this program from a network location. Copy to a local drive first./r/n Program will exit now.", "", MessageBoxButton.OK, MessageBoxImage.Exclamation);
Current.Shutdown();
return;
}

if (System.Diagnostics.Process.GetProcessesByName(System.Diagnostics.Process.GetCurrentProcess().ProcessName).Length > 1)
{
MessageBox.Show("Only one instance of DesktopNote can be running.", "", MessageBoxButton.OK, MessageBoxImage.Exclamation);
Current.Shutdown();
return;
}

var mainwin = new MainWindow();
mainwin.Show();
}
}
}
36 changes: 36 additions & 0 deletions DesktopNote.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Resources\stickynote.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
Expand All @@ -49,6 +52,10 @@
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="Xceed.Wpf.Toolkit">
<HintPath>Resources\Xceed.Wpf.Toolkit.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
Expand Down Expand Up @@ -95,6 +102,35 @@
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\stickynote.ico" />
</ItemGroup>
<ItemGroup>
<Resource Include="Resources\AlignCenter.ico" />
<Resource Include="Resources\AlignJustify.ico" />
<Resource Include="Resources\AlignLeft.ico" />
<Resource Include="Resources\AlignRight.ico" />
<Resource Include="Resources\Bold.ico" />
<Resource Include="Resources\Bullets.ico" />
<Resource Include="Resources\Copy.ico" />
<Resource Include="Resources\Cut.ico" />
<Resource Include="Resources\FindText.ico" />
<Resource Include="Resources\FontColor.ico" />
<Resource Include="Resources\IndentDecrease.ico" />
<Resource Include="Resources\IndentIncrease.ico" />
<Resource Include="Resources\Italic.ico" />
<Resource Include="Resources\Numbering.ico" />
<Resource Include="Resources\Paste.ico" />
<Resource Include="Resources\PasteTextOnly.ico" />
<Resource Include="Resources\Redo.ico" />
<Resource Include="Resources\SizeDecrease.ico" />
<Resource Include="Resources\SizeIncrease.ico" />
<Resource Include="Resources\Strikethrough.ico" />
<Resource Include="Resources\TextHighlightColorPicker.ico" />
<Resource Include="Resources\Underline.ico" />
<Resource Include="Resources\Undo.ico" />
<EmbeddedResource Include="Resources\Xceed.Wpf.Toolkit.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
8 changes: 4 additions & 4 deletions Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
[assembly: AssemblyTitle("DesktopNote")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
[assembly: AssemblyCompany("Carl Chang")]
[assembly: AssemblyProduct("DesktopNote")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2016")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

Expand Down Expand Up @@ -51,5 +51,5 @@
// 可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值,
// 方法是按如下所示使用“*”:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
Binary file added Resources/AlignCenter.ico
Binary file not shown.
Binary file added Resources/AlignJustify.ico
Binary file not shown.
Binary file added Resources/AlignLeft.ico
Binary file not shown.
Binary file added Resources/AlignRight.ico
Binary file not shown.
Binary file added Resources/Bold.ico
Binary file not shown.
Binary file added Resources/Bullets.ico
Binary file not shown.
Binary file added Resources/Copy.ico
Binary file not shown.
Binary file added Resources/Cut.ico
Binary file not shown.
Binary file added Resources/FindText.ico
Binary file not shown.
Binary file added Resources/FontColor.ico
Binary file not shown.
Binary file added Resources/IndentDecrease.ico
Binary file not shown.
Binary file added Resources/IndentIncrease.ico
Binary file not shown.
Binary file added Resources/Italic.ico
Binary file not shown.
Binary file added Resources/Numbering.ico
Binary file not shown.
Binary file added Resources/Paste.ico
Binary file not shown.
Binary file added Resources/PasteTextOnly.ico
Binary file not shown.
Binary file added Resources/Redo.ico
Binary file not shown.
Binary file added Resources/SizeDecrease.ico
Binary file not shown.
Binary file added Resources/SizeIncrease.ico
Binary file not shown.
Binary file added Resources/Strikethrough.ico
Binary file not shown.
Binary file added Resources/TextHighlightColorPicker.ico
Binary file not shown.
Binary file added Resources/Underline.ico
Binary file not shown.
Binary file added Resources/Undo.ico
Binary file not shown.
Binary file added Resources/Xceed.Wpf.Toolkit.dll
Binary file not shown.
Binary file added Resources/stickynote.ico
Binary file not shown.
Binary file added obj/Debug/App.baml
Binary file not shown.
25 changes: 19 additions & 6 deletions obj/Debug/App.g.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C87AB793C5EB49B3281A740F0D4C40B2"
#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "F46057008CB3A35555D7F7754FEEE16F"
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本:4.0.30319.18408
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

Expand Down Expand Up @@ -39,15 +39,28 @@ namespace DesktopNote {
/// </summary>
public partial class App : System.Windows.Application {

private bool _contentLoaded;

/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;

#line 4 "..\..\App.xaml"
this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
this.Startup += new System.Windows.StartupEventHandler(this.RunCheck);

#line default
#line hidden
System.Uri resourceLocater = new System.Uri("/DesktopNote;component/app.xaml", System.UriKind.Relative);

#line 1 "..\..\App.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

#line default
#line hidden
Expand Down
17 changes: 15 additions & 2 deletions obj/Debug/App.g.i.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "C87AB793C5EB49B3281A740F0D4C40B2"
#pragma checksum "..\..\App.xaml" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "F46057008CB3A35555D7F7754FEEE16F"
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
Expand Down Expand Up @@ -39,15 +39,28 @@ namespace DesktopNote {
/// </summary>
public partial class App : System.Windows.Application {

private bool _contentLoaded;

/// <summary>
/// InitializeComponent
/// </summary>
[System.Diagnostics.DebuggerNonUserCodeAttribute()]
[System.CodeDom.Compiler.GeneratedCodeAttribute("PresentationBuildTasks", "4.0.0.0")]
public void InitializeComponent() {
if (_contentLoaded) {
return;
}
_contentLoaded = true;

#line 4 "..\..\App.xaml"
this.StartupUri = new System.Uri("MainWindow.xaml", System.UriKind.Relative);
this.Startup += new System.Windows.StartupEventHandler(this.RunCheck);

#line default
#line hidden
System.Uri resourceLocater = new System.Uri("/DesktopNote;component/app.xaml", System.UriKind.Relative);

#line 1 "..\..\App.xaml"
System.Windows.Application.LoadComponent(this, resourceLocater);

#line default
#line hidden
Expand Down
Binary file modified obj/Debug/DesignTimeResolveAssemblyReferences.cache
Binary file not shown.
Binary file modified obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
Binary file not shown.
7 changes: 7 additions & 0 deletions obj/Debug/DesktopNote.csproj.FileListAbsolute.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,10 @@ C:\Users\Carl Chang\Downloads\新建文件夹\DesktopNote\bin\Debug\DesktopNote.
C:\Users\Carl Chang\Downloads\新建文件夹\DesktopNote\obj\Debug\DesktopNote.csprojResolveAssemblyReference.cache
C:\Users\Carl Chang\Downloads\新建文件夹\DesktopNote\obj\Debug\App.g.cs
C:\Users\Carl Chang\Downloads\新建文件夹\DesktopNote\obj\Debug\DesktopNote_MarkupCompile.cache
F:\GitHub Repos\DesktopNote\bin\Debug\DesktopNote.exe.config
F:\GitHub Repos\DesktopNote\obj\Debug\DesktopNote.csprojResolveAssemblyReference.cache
F:\GitHub Repos\DesktopNote\obj\Debug\App.baml
F:\GitHub Repos\DesktopNote\obj\Debug\MainWindow.g.cs
F:\GitHub Repos\DesktopNote\obj\Debug\App.g.cs
F:\GitHub Repos\DesktopNote\obj\Debug\DesktopNote_MarkupCompile.cache
F:\GitHub Repos\DesktopNote\obj\Debug\DesktopNote_MarkupCompile.lref
Binary file modified obj/Debug/DesktopNote.csprojResolveAssemblyReference.cache
Binary file not shown.
13 changes: 13 additions & 0 deletions obj/Debug/DesktopNote_Content.g.i.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

[assembly: System.Windows.Resources.AssemblyAssociatedContentFileAttribute("resources/xceed.wpf.toolkit.dll")]


20 changes: 20 additions & 0 deletions obj/Debug/DesktopNote_MarkupCompile.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
DesktopNote


winexe
C#
.cs
F:\GitHub Repos\DesktopNote\obj\Debug\
DesktopNote
none
false
DEBUG;TRACE
F:\GitHub Repos\DesktopNote\App.xaml
11151548125

5-2017746502
14-53673721
MainWindow.xaml;

True

20 changes: 20 additions & 0 deletions obj/Debug/DesktopNote_MarkupCompile.i.cache
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
DesktopNote


winexe
C#
.cs
F:\GitHub Repos\DesktopNote\obj\Debug\
DesktopNote
none
false
DEBUG;TRACE
F:\GitHub Repos\DesktopNote\App.xaml
11151548125

9588776438
14-53673721
MainWindow.xaml;

True

4 changes: 4 additions & 0 deletions obj/Debug/DesktopNote_MarkupCompile.i.lref
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


FF:\GitHub Repos\DesktopNote\MainWindow.xaml;;

4 changes: 4 additions & 0 deletions obj/Debug/DesktopNote_MarkupCompile.lref
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


FF:\GitHub Repos\DesktopNote\MainWindow.xaml;;

Loading

0 comments on commit 0f3a37f

Please sign in to comment.