thexamlguy / NotificationFlyout

MIT License
0 stars 0 forks source link

Request: Add main window to sample. #4

Closed Noemata closed 3 years ago

Noemata commented 3 years ago

This is probably related to your Todo context item, but in case it's not, could you please add a main window to the sample that is toggled on and off either through the context menu or an action on the flyout window.

Given how well everything else is structured, I'd like to be sure I'm adding in my bits correctly. The main window placement should retain its last position as placed by the user.

My app will need the current flyout on a task bar left click, a context menu on a task bar right click, and the ability to toggle a main window on and off through one or the other. I'm also assuming that the main window should come up on the monitor that the taskbar toggle occurs on (is this a best practice)?

My main window will be used to display running stats when needed (toggled on/off) by the user. Would be cool if the main window also hosted some UWP bits, though I'm mostly going to have conventional WPF there.

Thanks in advance.

P.S.

NotificationFlyout.Wpf.UI.csproj isn't set to use MSBuild extras yet.

thexamlguy commented 3 years ago

Added ContextMenu support in https://github.com/TheXamlGuy/NotificationFlyout/commit/c01af45f7f23ac8929d53bdcb77d1566e8d271b1 and added the ability to close the app from the flyout in https://github.com/TheXamlGuy/NotificationFlyout/commit/fd46a449880a50bac1b52b846e8be53b361a61ae.

I am currently looking in for a way to handle windowing from the flyout. I'd thought AppWindow appWindow = await AppWindow.TryCreateAsync() would have done it but it results in an access denied exception, unless I have completely missed something somewhere otherwise I will continue to investigate options in this area.

Noemata commented 3 years ago

Perhaps looking at what I did in -> https://github.com/Noemata/AppxInstaller.Core will help. I wasn't using XAML Islands, but I did have to change the way UWP windows were anchored in order to get things working.

I didn't think this was needed -> https://github.com/Noemata/AppxInstaller.Core/blob/master/AppxInstaller.Core/InitializeWithWindow.cs in a XAML Islands hosted UWP element, but maybe it's required in certain instances.

I'm still coming up to speed with XAML Islands, so take my considerations with a grain a salt.

thexamlguy commented 3 years ago

I am thinking of using a WPF window to display the UWP content in keeping with everything using UWP/WinUI with very minimal WPF other than to host and display the contents of the UWP app.

A ShowAsWindow<TUwpUIElement> method will be introduced to INotificationFlyoutApplication interface in which it can be called from within the UWP app as such

var app = NotificationFlyout.GetApplication(); app.ShowAsWindow<UwpUserControl>();

Potentially, I will introduce a WindowOptions class allowing you to configure the WPF window and can be passed as a parameter to ShowAsWindow.

Noemata commented 3 years ago

Sounds great. What you've done is very cool. You can close this issue.

thexamlguy commented 3 years ago

Closed as per https://github.com/TheXamlGuy/NotificationFlyout/commit/4a6c6ca4a5c63866d77ff11f7658edee1b80513c.