Skip to content

Commit

Permalink
reset position when opening a second instance.
Browse files Browse the repository at this point in the history
  • Loading branch information
changbw001 committed Jan 5, 2017
1 parent e3e8a8c commit ee167f9
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:sys="clr-namespace:System;assembly=mscorlib"
xmlns:local="clr-namespace:DesktopNote"
Title="Desktop Note" Height="350" Width="300" ShowInTaskbar="False" AllowsTransparency="True" WindowStyle="None" Background="{x:Null}"
ResizeMode="CanResizeWithGrip" UseLayoutRounding="True"
ResizeMode="CanResizeWithGrip" UseLayoutRounding="True"
MouseEnter="Win_Main_MouseEnter" MouseLeave="Win_Main_MouseLeave" Loaded="Win_Main_Loaded">
<Window.CacheMode>
<BitmapCache/>
Expand Down
4 changes: 3 additions & 1 deletion MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private void UnDock()
private void Win_Main_MouseEnter(object sender, MouseEventArgs e)
{
//undocking
if (Properties.Settings.Default.AutoDock) UnDock();
if (Properties.Settings.Default.AutoDock && DockedTo != DockStatus.None) UnDock();
}

private void Win_Main_MouseLeave(object sender, MouseEventArgs e)
Expand Down Expand Up @@ -519,6 +519,8 @@ private IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref b
//in case of resolution changes etc that might cause the main window to be "lost".
Activate();
currScrnRect = new GetCurrentMonitor().GetInfo();
BeginAnimation(DockedToProperty, null); //required to modify the DockedTo property.
Top = currScrnRect.Top; //in case it was docked to bottom or top.
lastdockstatus = DockStatus.Left;
DockedTo = DockStatus.Left;
UnDock();
Expand Down
Binary file modified bin/Release/DesktopNote.exe
Binary file not shown.

0 comments on commit ee167f9

Please sign in to comment.