Skip to content

Commit

Permalink
Merge remote-tracking branch 'MahApps/master' into some-progressbar-d…
Browse files Browse the repository at this point in the history
…ialog-fixes
  • Loading branch information
bigworld12 committed Oct 2, 2015
2 parents 7aefea3 + 3c90b1e commit 5430fde
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 12 deletions.
4 changes: 2 additions & 2 deletions MahApps.Metro/Controls/Dialogs/DialogCoordinator.cs
Expand Up @@ -18,7 +18,7 @@ public Task<string> ShowInputAsync(object context, string title, string message,
return metroWindow.ShowInputAsync(title, message, metroDialogSettings);
}

public Task<LoginDialogData> ShowLoginAsync(object context, string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative, LoginDialogSettings settings = null)
public Task<LoginDialogData> ShowLoginAsync(object context, string title, string message, LoginDialogSettings settings = null)
{
var metroWindow = GetMetroWindow(context);

Expand Down Expand Up @@ -77,4 +77,4 @@ private static MetroWindow GetMetroWindow(object context)
return metroWindow;
}
}
}
}
4 changes: 2 additions & 2 deletions MahApps.Metro/Controls/Dialogs/IDialogCoordinator.cs
Expand Up @@ -27,7 +27,7 @@ public interface IDialogCoordinator
/// <param name="style"></param>
/// <param name="settings">Optional settings that override the global metro dialog settings.</param>
/// <returns>The text that was entered or null (Nothing in Visual Basic) if the user cancelled the operation.</returns>
Task<LoginDialogData> ShowLoginAsync(object context, string title, string message, MessageDialogStyle style = MessageDialogStyle.Affirmative, LoginDialogSettings settings = null);
Task<LoginDialogData> ShowLoginAsync(object context, string title, string message, LoginDialogSettings settings = null);

/// <summary>
/// Creates a MessageDialog inside of the current window.
Expand Down Expand Up @@ -83,4 +83,4 @@ public interface IDialogCoordinator
/// <param name="context">Typically this should be the view model, which you register in XAML using <see cref="DialogParticipation.SetRegister"/>.</param>
Task<TDialog> GetCurrentDialogAsync<TDialog>(object context) where TDialog : BaseMetroDialog;
}
}
}
40 changes: 32 additions & 8 deletions MahApps.Metro/Controls/GlowWindow.xaml.cs
Expand Up @@ -29,6 +29,8 @@ partial class GlowWindow : Window
private IntPtr handle;
private IntPtr ownerHandle;
private bool closing = false;
private HwndSource hwndSource;
private PropertyChangeNotifier resizeModeChangeNotifier;

public GlowWindow(Window owner, GlowDirection direction)
{
Expand Down Expand Up @@ -184,21 +186,43 @@ protected override void OnSourceInitialized(EventArgs e)
{
base.OnSourceInitialized(e);

var source = (HwndSource)PresentationSource.FromVisual(this);
WS ws = source.Handle.GetWindowLong();
WSEX wsex = source.Handle.GetWindowLongEx();
this.hwndSource = (HwndSource)PresentationSource.FromVisual(this);
if (hwndSource == null) return;

var ws = hwndSource.Handle.GetWindowLong();
var wsex = hwndSource.Handle.GetWindowLongEx();

//ws |= WS.POPUP;
wsex ^= WSEX.APPWINDOW;
wsex |= WSEX.NOACTIVATE;
wsex |= WSEX.TRANSPARENT;
if (this.Owner.ResizeMode == ResizeMode.NoResize || this.Owner.ResizeMode == ResizeMode.CanMinimize)
{
wsex |= WSEX.TRANSPARENT;
}

source.Handle.SetWindowLong(ws);
source.Handle.SetWindowLongEx(wsex);
source.AddHook(WndProc);
hwndSource.Handle.SetWindowLong(ws);
hwndSource.Handle.SetWindowLongEx(wsex);
hwndSource.AddHook(WndProc);

handle = source.Handle;
handle = hwndSource.Handle;
ownerHandle = new WindowInteropHelper(Owner).Handle;

this.resizeModeChangeNotifier = new PropertyChangeNotifier(this.Owner, Window.ResizeModeProperty);
this.resizeModeChangeNotifier.ValueChanged += ResizeModeChanged;
}

private void ResizeModeChanged(object sender, EventArgs e)
{
var wsex = hwndSource.Handle.GetWindowLongEx();
if (this.Owner.ResizeMode == ResizeMode.NoResize || this.Owner.ResizeMode == ResizeMode.CanMinimize)
{
wsex |= WSEX.TRANSPARENT;
}
else
{
wsex ^= WSEX.TRANSPARENT;
}
hwndSource.Handle.SetWindowLongEx(wsex);
}

public void Update()
Expand Down
1 change: 1 addition & 0 deletions docs/release-notes/1.2.0.md
Expand Up @@ -132,3 +132,4 @@ This is a bug fix and feature release of MahApps.Metro v1.2.0.
- Fixed Watermark/Text Alignment of `DatePicker` and `NumericUpDown` controls #1683
- Fixed missing Glow border corners #2143 #2118
- Fixed incorrect restore location after Aero Snap #2144 (@tgjones)
- Removed unneeded MessageDialogStyle param from IDialogCoordinator.ShowLoginAsync method #2146 (@acejordin)

0 comments on commit 5430fde

Please sign in to comment.