Skip to content

Commit

Permalink
Dev merge for 0.9.3 (#582)
Browse files Browse the repository at this point in the history
* Updated Greek Translation (#495)

* Updated Greek Translation

* Fixed Num Lock Flyout Out of Margins

* Flyout animation toggle (#511)

* widget animation toggle

* translation added

* Flyout animation toggle - done

* minor changes

* typo in ru translation

* Update Russian translation (#510)

* Update ModernFlyouts.ru.xlf

* Update README.md

* Update README.md

* Update ModernFlyouts/MultilingualResources/ModernFlyouts.ru.xlf

* Update ModernFlyouts/MultilingualResources/ModernFlyouts.ru.xlf

* Apply suggestions from code review

* - Updated Nuget Packages

* Localized Manifest

* Remove redundant playground

* .wapproj simplification
remove redundant windows.universal target

* .

* Update nuget packages

* Update Nuget Packages

* Minor cleanup

* Finally!

Fixed #4 - Bug: Audio flyout is not shown when the volume is changed through means other than media keys
Fixed #470 - Bug: Flyouts doesn't appear while holding any mousebutton

* fix null crash

* Revert "fix null crash"

This reverts commit 4ef6985.

* Minor fixes

* Translated all strings to danish (#516)

* Fix issue template syntax error (#509)

* Add some translators into the list in README (#505)

* Updated translators list on README

* Translated all strings to danish

Co-authored-by: Myuki <myuki@outlook.ie>
Co-authored-by: imgradeone <30969327+imgradeone@users.noreply.github.com>

* Temp enable both zh-hans and zh-cn

* Update Ukrainian translation (#545)

* Fix issue template syntax error (#509)

* Add some translators into the list in README (#505)

* Updated translators list on README

* Update ModernFlyouts.uk.xlf

* Update ModernFlyouts.uk.xlf

* Update ModernFlyouts.uk.xlf

very important commit)

Co-authored-by: Myuki <myuki@outlook.ie>
Co-authored-by: imgradeone <30969327+imgradeone@users.noreply.github.com>
Co-authored-by: Sam <35312698+Samuel12321@users.noreply.github.com>

* Re-Updated Turkish Translation (#562)

* Fix issue template syntax error (#509)

* Add some translators into the list in README (#505)

* Updated translators list on README

* Re-Updated Turkish Translation

* Re-Updated Turkish Translation v2

Co-authored-by: Myuki <myuki@outlook.ie>
Co-authored-by: imgradeone <30969327+imgradeone@users.noreply.github.com>

* Fix syntax error for settings.off

* updates

Co-authored-by: Vasilis Patelis <65589110+VasilisPat@users.noreply.github.com>
Co-authored-by: karpovv-boris <78983523+karpovv-boris@users.noreply.github.com>
Co-authored-by: Tony <ANT0x1@users.noreply.github.com>
Co-authored-by: sam <sam>
Co-authored-by: Sam <samuelgilliessmith@hotmail.com>
Co-authored-by: Shankar <shankarbus04082001@hotmail.com>
Co-authored-by: Emil Nymann Sølyst <emilnymann96@gmail.com>
Co-authored-by: Myuki <myuki@outlook.ie>
Co-authored-by: imgradeone <30969327+imgradeone@users.noreply.github.com>
Co-authored-by: PlayDay <18056374+playday3008@users.noreply.github.com>
Co-authored-by: Eren <75967441+ErenAKGUN2007@users.noreply.github.com>
  • Loading branch information
11 people authored Apr 22, 2021
1 parent 6ed9187 commit 024c7d6
Show file tree
Hide file tree
Showing 77 changed files with 3,484 additions and 694 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
<PropertyGroup>
<Authors>ModernFlyouts Community</Authors>
<LangVersion>latest</LangVersion>
<Version>0.9.1</Version>
<Version>0.9.3</Version>
</PropertyGroup>
</Project>
2 changes: 0 additions & 2 deletions ModernFlyouts.Core/Interop/BandWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,6 @@ public void CreateWindow()

hookManager.OnHwndCreated(hWnd);

//WindowCompositionHelper.MakeWindowTransparent(hWnd);

HwndSourceParameters param = new()
{
WindowStyle = (int)(WindowStyles.WS_VISIBLE | WindowStyles.WS_CHILD),
Expand Down
69 changes: 0 additions & 69 deletions ModernFlyouts.Core/Interop/WindowCompositionHelper.cs

This file was deleted.

2 changes: 1 addition & 1 deletion ModernFlyouts.Core/Media/Control/GSMTCMediaSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ private async void UpdateSessionInfo(GlobalSystemMediaTransportControlsSession s
{
> 0 => MediaPlaybackTrackChangeDirection.Forward,
< 0 => MediaPlaybackTrackChangeDirection.Backward,
_ => throw new NotImplementedException()
_ => MediaPlaybackTrackChangeDirection.Unknown
};
}

Expand Down
2 changes: 1 addition & 1 deletion ModernFlyouts.Core/Media/Control/NowPlayingMediaSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ private void UpdateSessionInfo()
{
> 0 => MediaPlaybackTrackChangeDirection.Forward,
< 0 => MediaPlaybackTrackChangeDirection.Backward,
_ => throw new NotImplementedException()
_ => MediaPlaybackTrackChangeDirection.Unknown
};
}

Expand Down
31 changes: 22 additions & 9 deletions ModernFlyouts.Core/Media/Control/NowPlayingMediaSessionManager.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
using ModernFlyouts.Core.Helpers;
using ModernFlyouts.Core.Threading;
using ModernFlyouts.Core.Utilities;
using NPSMLib;
using System;
using System.Linq;
using System.Threading.Tasks;

namespace ModernFlyouts.Core.Media.Control
{
Expand All @@ -12,30 +13,36 @@ public class NowPlayingMediaSessionManager : MediaSessionManager

public override async void OnEnabled()
{
NpsmServiceStart.NpsmServiceStarted += NpsmServiceStart_NpsmServiceStarted;
NpsmServiceStart_NpsmServiceStarted(null, null);
NpsmService.Started += NpsmService_Started;
await OnNpsmServiceStarted();
}

private async void NpsmServiceStart_NpsmServiceStarted(object sender, EventArgs e)
private async void NpsmService_Started(object sender, EventArgs e)
{
await OnNpsmServiceStarted();
}

private async Task OnNpsmServiceStarted()
{
//Example: explorer.exe crashes, the NPSMLib still holds the "link"
//THEN explorer.exe restarts and NPSM restarts too, reloading all NPSM sessions

//Now recreate NPSessionManager.

try
{
await CleanupNPSM();

NPSessionManager = new();
NPSessionManager.SessionListChanged += NPSessionsChanged;

await LoadSessions();
}
catch (Exception)
catch
{
//This is in case NPSM dies immediately after sending a wnf notification
await ClearSessions();
if (NPSessionManager != null)
NPSessionManager.SessionListChanged -= NPSessionsChanged;
NPSessionManager = null;

await CleanupNPSM();
}
}

Expand Down Expand Up @@ -132,6 +139,12 @@ private async UiTask LoadSessions()
}

public override async void OnDisabled()
{
NpsmService.Started -= NpsmService_Started;
await CleanupNPSM();
}

private async Task CleanupNPSM()
{
if (NPSessionManager != null)
{
Expand Down
6 changes: 3 additions & 3 deletions ModernFlyouts.Core/ModernFlyouts.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="7.0.0-preview5" />
<PackageReference Include="Microsoft.Toolkit.Mvvm" Version="8.0.0-preview5" />
<PackageReference Include="NAudio" Version="2.0.0" />
<PackageReference Include="NPSMLib" Version="0.9.14" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-preview.1.21102.12" />
<PackageReference Include="System.Management" Version="6.0.0-preview.1.21102.12" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0-preview.5.21221.8" />
<PackageReference Include="System.Management" Version="6.0.0-preview.5.21221.8" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
using System.Windows;
using System.Windows.Threading;

namespace ModernFlyouts.Core.Helpers
namespace ModernFlyouts.Core.Threading
{
//Taken from here!
//https://medium.com/criteo-engineering/switching-back-to-the-ui-thread-in-wpf-uwp-in-modern-c-5dc1cc8efa5e
Expand Down
31 changes: 28 additions & 3 deletions ModernFlyouts.Core/UI/FlyoutWindow/FlyoutWindow.Animations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,21 @@ private void OpenFlyout()
RoutedEventArgs args = new(OpenedEvent);
RaiseEvent(args);

PlayOpenAnimation();

if (FlyoutAnimationEnabled)
{
c_translation = 40;
PlayOpenAnimation();
}
else
{
c_translation = 0;
RenderTransform = new TranslateTransform();
BeginAnimation(VisibilityProperty, null);
BeginAnimation(OpacityProperty, null);
Visibility = Visibility.Visible;
Opacity = 1.0;
}

timer?.Start();
}
Expand All @@ -28,7 +42,15 @@ private void CloseFlyout()
RoutedEventArgs args = new(ClosingEvent);
RaiseEvent(args);

PlayCloseAnimation();
if (FlyoutAnimationEnabled)
{
PlayCloseAnimation();
}
else
{
Opacity = 0.0;
Visibility = Visibility.Hidden;
}
}

#region Close Timer
Expand Down Expand Up @@ -105,7 +127,7 @@ public void UpdateCloseTimerInterval(double timeout)
private DoubleKeyFrame fromHorizontalOffsetKeyFrameClosing;
private DoubleKeyFrame fromVerticalOffsetKeyFrameClosing;

private const double c_translation = 40;
private double c_translation = 40;
private static readonly TimeSpan translateDuration = TimeSpan.FromMilliseconds(367);

private static readonly PropertyPath opacityPath = new(OpacityProperty);
Expand All @@ -115,6 +137,7 @@ public void UpdateCloseTimerInterval(double timeout)
private static readonly KeySpline decelerateKeySplineOpening = new(0.1, 0.9, 0.2, 1);
private static readonly KeySpline decelerateKeySplineClosing = new(1, 0.2, 0.9, 0.1);


private void PrepareAnimations()
{
EnsureClosingStoryboard();
Expand All @@ -141,9 +164,11 @@ private void EnsureOpeningStoryboard()
{
new DiscreteObjectKeyFrame(Visibility.Visible, TimeSpan.Zero)
}

};
Storyboard.SetTarget(visibilityAnim, this);
Storyboard.SetTargetProperty(visibilityAnim, visibilityPath);


DoubleAnimationUsingKeyFrames opacityAnim = new()
{
Expand Down
17 changes: 17 additions & 0 deletions ModernFlyouts.Core/UI/FlyoutWindow/FlyoutWindow.Properties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,5 +345,22 @@ private static void OnIsOpenPropertyChanged(DependencyObject d, DependencyProper
}

#endregion

#region FlyoutAnimationEnabled

public static readonly DependencyProperty FlyoutAnimationEnabledProperty =
DependencyProperty.Register(
nameof(FlyoutAnimationEnabled),
typeof(bool),
typeof(FlyoutWindow),
new PropertyMetadata(false));

public bool FlyoutAnimationEnabled
{
get => (bool)GetValue(FlyoutAnimationEnabledProperty);
set => SetValue(FlyoutAnimationEnabledProperty, value);
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,51 @@

namespace ModernFlyouts.Core.Utilities
{
public static class NpsmServiceStart
public static class NpsmService
{
private static readonly ulong WNF_NPSM_SERVICE_STARTED = 0xC951E23A3BC0875;
private static readonly ulong WNF_SHEL_SESSION_LOGON_COMPLETE = 0xD83063EA3BE3835;

private static readonly object _subscriptionLock = new object();
private static IntPtr _subId;

private static event EventHandler _npsmServiceStarted;
private static event EventHandler _started;

//This prevents from being GC'd
private static readonly Wnf.WnfUserCallback wnfSubHandler = new Wnf.WnfUserCallback(WnfSubHandler);

private static IntPtr WnfSubHandler(ulong stateName, uint changeStamp, IntPtr typeId, IntPtr callbackContext, IntPtr bufferPtr, uint bufferSize)
{
_npsmServiceStarted?.Invoke(null, new EventArgs());
_started?.Invoke(null, EventArgs.Empty);
return IntPtr.Zero;
}

/// <summary>
/// Occurs when the NPSM service is started or restarted
/// Of course this runs on a different thread.
/// </summary>
public static event EventHandler NpsmServiceStarted
public static event EventHandler Started
{
add
{
lock (_subscriptionLock)
{
if (_npsmServiceStarted == null)
if (_started == null)
{
var wnfData = Wnf.QueryWnf(WNF_SHEL_SESSION_LOGON_COMPLETE);
Wnf.SubscribeWnf(WNF_SHEL_SESSION_LOGON_COMPLETE, wnfData.Changestamp, wnfSubHandler, out _subId);
}

_npsmServiceStarted += value;
_started += value;
}
}
remove
{
lock (_subscriptionLock)
{
_npsmServiceStarted -= value;
_started -= value;

if (_npsmServiceStarted == null)
if (_started == null)
{
Wnf.UnsubscribeWnf(_subId);
_subId = IntPtr.Zero;
Expand All @@ -56,7 +56,4 @@ public static event EventHandler NpsmServiceStarted
}
}
}

public class NpsmServiceStartedEventArgs : EventArgs
{ }
}
8 changes: 4 additions & 4 deletions ModernFlyouts.Package/ModernFlyouts.Package.wapproj
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
<GenerateAppInstallerFile>False</GenerateAppInstallerFile>
<AppxPackageSigningTimestampDigestAlgorithm>SHA256</AppxPackageSigningTimestampDigestAlgorithm>
<AppxAutoIncrementPackageRevision>False</AppxAutoIncrementPackageRevision>
<GenerateTestArtifacts>False</GenerateTestArtifacts>
<GenerateTestArtifacts>True</GenerateTestArtifacts>
<AppxBundlePlatforms>x86|x64</AppxBundlePlatforms>
<HoursBetweenUpdateChecks>0</HoursBetweenUpdateChecks>
<AppInstallerUri>https://github.com/ModernFlyouts-Community/ModernFlyouts/tree/main/ModernFlyouts.Package/Package.appinstaller</AppInstallerUri>
Expand All @@ -51,7 +51,7 @@
</PropertyGroup>
<PropertyGroup>
<AppxBundle>Always</AppxBundle>
<PackageCertificateKeyFile>ModernFlyouts.Package_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>1763E89B1A6D02D8D3CCF794ADFF6130472AC7B5</PackageCertificateThumbprint>
</PropertyGroup>
<ItemGroup>
<AppxManifest Include="Package.appxmanifest">
Expand Down Expand Up @@ -111,6 +111,7 @@
<Content Include="Images\Wide310x150Logo.scale-150.png" />
<Content Include="Images\Wide310x150Logo.scale-200.png" />
<Content Include="Images\Wide310x150Logo.scale-400.png" />
<PRIResource Include="Strings\en-us\Resources.resw" />
<None Include="ModernFlyouts.Package_TemporaryKey.pfx" />
<Content Include="Package.appinstaller" />
<Content Include="priconfig.default.xml" />
Expand All @@ -120,8 +121,7 @@
<ProjectReference Include="..\ModernFlyoutsHost\ModernFlyoutsHost.vcxproj" />
<ProjectReference Include="..\ModernFlyouts\ModernFlyouts.csproj">
<SkipGetTargetFrameworkProperties>True</SkipGetTargetFrameworkProperties>
<PublishProfile Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Properties\PublishProfiles\FolderProfile-x64.pubxml</PublishProfile>
<PublishProfile Condition="'$(Configuration)|$(Platform)'=='Release|x86'">Properties\PublishProfiles\FolderProfile-x86.pubxml</PublishProfile>
<PublishProfile>Properties\PublishProfiles\win10-$(Platform).pubxml</PublishProfile>
</ProjectReference>
<ProjectReference Include="..\ModernFlyoutsBridge\ModernFlyoutsBridge.vcxproj" />
</ItemGroup>
Expand Down
Loading

0 comments on commit 024c7d6

Please sign in to comment.