Skip to content

Commit

Permalink
adapt code to C#
Browse files Browse the repository at this point in the history
  • Loading branch information
changbowen committed Dec 17, 2016
1 parent 47dfadb commit 8f4afa5
Show file tree
Hide file tree
Showing 50 changed files with 1,633 additions and 194 deletions.
Binary file modified .vs/DesktopNote/v14/.suo
Binary file not shown.
14 changes: 7 additions & 7 deletions App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ private void RunCheck(object sender1, StartupEventArgs e1)
var desiredAssembly = new System.Reflection.AssemblyName(e.Name).Name;
if (desiredAssembly == "Xceed.Wpf.Toolkit")
{
var ressourceName = "DesktopNote." + desiredAssembly + ".dll";
var ressourceName = "DesktopNote.Resources." + desiredAssembly + ".dll";
using (var stream = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(ressourceName))
{
byte[] assemblyData = new byte[stream.Length];
Expand All @@ -40,12 +40,12 @@ private void RunCheck(object sender1, StartupEventArgs e1)
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;
}
//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();
Expand Down
2 changes: 1 addition & 1 deletion GetCurrentMonitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public Rect GetInfo()
{
var mi = new MonitorInfo();
mi.cbSize = (uint)Marshal.SizeOf(typeof(MonitorInfo));
var hwmon = MonitorFromWindow(new System.Windows.Interop.WindowInteropHelper(App.Current.MainWindow).EnsureHandle(), MONITOR_DEFAULTTOPRIMERTY);
var hwmon = MonitorFromWindow(new System.Windows.Interop.WindowInteropHelper(Application.Current.MainWindow).EnsureHandle(), MONITOR_DEFAULTTOPRIMERTY);
if (GetMonitorInfo(hwmon, ref mi))
{
//convert to device-independent vaues
Expand Down
13 changes: 8 additions & 5 deletions MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,22 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:DesktopNote"
xmlns:wtk="http://schemas.xceed.com/wpf/xaml/toolkit"
Title="Desktop Note" Height="350" Width="300" ShowInTaskbar="False" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}" ResizeMode="CanResizeWithGrip" SnapsToDevicePixels="True" UseLayoutRounding="True" MouseEnter="Win_Main_MouseEnter" MouseLeave="Win_Main_MouseLeave" Loaded="Win_Main_Loaded">
Title="Desktop Note" Height="350" Width="300" ShowInTaskbar="False" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}"
ResizeMode="CanResizeWithGrip" SnapsToDevicePixels="True" UseLayoutRounding="True"
MouseEnter="Win_Main_MouseEnter" MouseLeave="Win_Main_MouseLeave" Loaded="Win_Main_Loaded">
<Grid>
<Rectangle x:Name="Rec_BG" Fill="#FFFFF7C5" Margin="10" RadiusX="12" RadiusY="12"
MouseLeftButtonDown="Rec_BG_MouseLeftButtonDown" MouseLeftButtonUp="Rec_BG_MouseLeftButtonUp" MouseMove="Rec_BG_MouseMove">
MouseLeftButtonDown="Rec_BG_MouseLeftButtonDown" MouseLeftButtonUp="Rec_BG_MouseLeftButtonUp" MouseMove="Rec_BG_MouseMove" Cursor="SizeAll">
<Rectangle.Effect>
<DropShadowEffect ShadowDepth="0" BlurRadius="8"/>
</Rectangle.Effect>
</Rectangle>
<RichTextBox x:Name="RTB_Main" Margin="20" Background="{x:Null}" BorderBrush="{x:Null}" AcceptsTab="True" BorderThickness="0" IsInactiveSelectionHighlightEnabled="True"
TextChanged="RTB_Main_TextChanged" PreviewKeyDown="RTB_Main_PreviewKeyDown" PreviewMouseWheel="RTB_Main_PreviewMouseWheel" LostKeyboardFocus="RTB_Main_LostKeyboardFocus" ContextMenuOpening="RTB_Main_ContextMenuOpening">
<wtk:RichTextBoxFormatBarManager.FormatBar>
TextChanged="RTB_Main_TextChanged" PreviewKeyDown="RTB_Main_PreviewKeyDown" PreviewMouseWheel="RTB_Main_PreviewMouseWheel"
LostKeyboardFocus="RTB_Main_LostKeyboardFocus" ContextMenuOpening="RTB_Main_ContextMenuOpening">
<!--<wtk:RichTextBoxFormatBarManager.FormatBar>
<wtk:RichTextBoxFormatBar/>
</wtk:RichTextBoxFormatBarManager.FormatBar>
</wtk:RichTextBoxFormatBarManager.FormatBar>-->
<RichTextBox.Resources>
<SolidColorBrush x:Key="{x:Static SystemColors.InactiveSelectionHighlightBrushKey}" Color="{StaticResource {x:Static SystemColors.HighlightColorKey}}"/>
<!--<Thickness x:Key="ListPadding" Left="16"/>-->
Expand Down
Loading

0 comments on commit 8f4afa5

Please sign in to comment.