Skip to content

Commit 2dd9139

Browse files
committed
v0.8.0
- Fixed #12 - Settings UI bugging out - Resolved #53 - Option to change the duration of flyout being visible - Resolved #62 - Reorganize settings so that each module get their own page - Resolved #75 - Feature Request: Option to set dark theme / light theme / system default - Resolved #72 - Feature: Ability to Disable tray icon - Resolved #65 - Ability to completely hide the top bar - Resolved #49 - Move cover art to left of media flyout - Resolved #144 - Feature Request: ability to toggle flyout on a per lock-key basis - Resolved #150 - Bug: Missing settings spacer. [Settings UI]
1 parent b8c02c0 commit 2dd9139

File tree

68 files changed

+1776
-1308
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+1776
-1308
lines changed

ModernFlyouts.Package/Package.appxmanifest

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
<Identity
1111
Name="32669SamG.ModernFlyouts"
1212
Publisher="CN=E3B4A0F6-E459-414C-8DFB-ABEAB07C9242"
13-
Version="0.7.8.0" />
13+
Version="0.8.0.0" />
1414

1515
<Properties>
16-
<DisplayName>ModernFlyouts</DisplayName>
16+
<DisplayName>ModernFlyouts (Preview)</DisplayName>
1717
<PublisherDisplayName>Sam G</PublisherDisplayName>
1818
<Logo>Images\StoreLogo.png</Logo>
1919
</Properties>
@@ -32,7 +32,7 @@
3232
Executable="$targetnametoken$.exe"
3333
EntryPoint="$targetentrypoint$">
3434
<uap:VisualElements
35-
DisplayName="ModernFlyouts"
35+
DisplayName="ModernFlyouts (Preview)"
3636
Description="ModernFlyouts"
3737
BackgroundColor="transparent"
3838
Square150x150Logo="Images\Square150x150Logo.png"

ModernFlyouts.sln

+5-5
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ Global
2121
Release|x86 = Release|x86
2222
EndGlobalSection
2323
GlobalSection(ProjectConfigurationPlatforms) = postSolution
24-
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|Any CPU.ActiveCfg = Release|Any CPU
25-
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|Any CPU.Build.0 = Release|Any CPU
24+
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
25+
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|Any CPU.Build.0 = Debug|Any CPU
2626
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|ARM.ActiveCfg = Debug|Any CPU
2727
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|ARM.Build.0 = Debug|Any CPU
2828
{BC335805-3121-430D-8CE6-38334C0CC365}.Debug|ARM64.ActiveCfg = Debug|Any CPU
@@ -41,9 +41,9 @@ Global
4141
{BC335805-3121-430D-8CE6-38334C0CC365}.Release|x64.Build.0 = Release|Any CPU
4242
{BC335805-3121-430D-8CE6-38334C0CC365}.Release|x86.ActiveCfg = Release|Any CPU
4343
{BC335805-3121-430D-8CE6-38334C0CC365}.Release|x86.Build.0 = Release|Any CPU
44-
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|Any CPU.ActiveCfg = Release|Any CPU
45-
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|Any CPU.Build.0 = Release|Any CPU
46-
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|Any CPU.Deploy.0 = Release|Any CPU
44+
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
45+
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|Any CPU.Build.0 = Debug|Any CPU
46+
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
4747
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|ARM.ActiveCfg = Debug|ARM
4848
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|ARM.Build.0 = Debug|ARM
4949
{E918A18D-953D-4B4A-AC18-B74303995AEE}.Debug|ARM.Deploy.0 = Debug|ARM

ModernFlyouts/App.xaml

+10-9
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
44
xmlns:ui="http://schemas.modernwpf.com/2019" xmlns:system="clr-namespace:System;assembly=System.Runtime"
5-
xmlns:local="clr-namespace:ModernFlyouts"
5+
xmlns:local="clr-namespace:ModernFlyouts" xmlns:localui="clr-namespace:ModernFlyouts.UI"
66
xmlns:util="clr-namespace:ModernFlyouts.Utilities"
7+
xmlns:converters="clr-namespace:ModernFlyouts.Converters"
78
ShutdownMode="OnExplicitShutdown">
89
<Application.Resources>
910
<ResourceDictionary>
@@ -26,17 +27,17 @@
2627
<ui:XamlControlsResources />
2728
</ResourceDictionary.MergedDictionaries>
2829

29-
<util:EnumValuesConverter x:Key="EnumValuesConverter" />
30-
<util:IndexToVisibilityConverter x:Key="IndexToVisibilityConverter" />
31-
<util:TextToTooltipEnabledConverter x:Key="TextToTooltipEnabledConverter" />
32-
<util:ScrollButtonVisibilityConverter x:Key="ScrollButtonVisibilityConverter" />
33-
<util:PointToStringConverter x:Key="PointToStringConverter" />
34-
<util:ValidationErrorsToStringConverter x:Key="ValidationErrorsToStringConverter" />
35-
<util:EnumToLocalizedStringConverter x:Key="EnumToLocalizedStringConverter" />
30+
<converters:EnumValuesConverter x:Key="EnumValuesConverter" />
31+
<converters:IndexToVisibilityConverter x:Key="IndexToVisibilityConverter" />
32+
<converters:TextToTooltipEnabledConverter x:Key="TextToTooltipEnabledConverter" />
33+
<converters:ScrollButtonVisibilityConverter x:Key="ScrollButtonVisibilityConverter" />
34+
<converters:PointToStringConverter x:Key="PointToStringConverter" />
35+
<converters:ValidationErrorsToStringConverter x:Key="ValidationErrorsToStringConverter" />
36+
<converters:EnumToLocalizedStringConverter x:Key="EnumToLocalizedStringConverter" />
3637
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
3738

3839
<CornerRadius x:Key="FlyoutCornerRadius">8</CornerRadius>
39-
<x:Static x:Key="FlyoutWidth" Member="local:UIManager.FlyoutWidth" />
40+
<x:Static x:Key="FlyoutWidth" Member="localui:UIManager.FlyoutWidth" />
4041

4142
<Style x:Key="HighlightedMediaButtonStyle" TargetType="Button" BasedOn="{StaticResource DefaultButtonStyle}">
4243
<Setter Property="Width" Value="40" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using ModernFlyouts.Helpers;
2+
using Windows.Storage;
3+
4+
namespace ModernFlyouts.AppLifecycle
5+
{
6+
public class AppDataMigration
7+
{
8+
/// <summary>
9+
/// Migrates unused application data into their new alternatives if they exists.
10+
/// </summary>
11+
public static void Perform()
12+
{
13+
try
14+
{
15+
string topBarEnabled = "TopBarEnabled";
16+
if (ApplicationData.Current.LocalSettings.Values.ContainsKey(topBarEnabled))
17+
{
18+
AppDataHelper.TopBarVisibility = AppDataHelper.GetBool(true, topBarEnabled) ? UI.TopBarVisibility.Visible : UI.TopBarVisibility.AutoHide;
19+
ApplicationData.Current.LocalSettings.Values.Remove(topBarEnabled);
20+
}
21+
}
22+
catch { }
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.IO;
4+
using System.IO.Pipes;
5+
using System.Threading;
6+
7+
namespace ModernFlyouts.AppLifecycle
8+
{
9+
public class AppLifecycleManager
10+
{
11+
/// <summary>
12+
/// This constant allows us to distinguish between beta and stable releases and will helps us to enable/disable features for a certain build.<br/>
13+
/// This value could be changed by adding or removing '-beta' suffix to the app version in the *.csproj.<br/>
14+
/// <strong>For example:</strong> 'x.y.z.i-beta' would make this value <see langword="true" /> and removing '-beta' would make this <see langword="false"/>.
15+
/// </summary>
16+
public const bool IsBuildBetaChannel =
17+
#if BETA
18+
true;
19+
#else
20+
false;
21+
#endif
22+
23+
#region App activation & Single instancing
24+
25+
private static Mutex mutex = new Mutex(true, Program.AppName);
26+
27+
/// <summary>
28+
/// Starts the application as single instance and redirects the command line arguments from subsequent instances to the first instance.
29+
/// </summary>
30+
/// <param name="args">Commandline arguments to process or pass to the first instance.</param>
31+
/// <param name="action">The action to perform after the first instance has been intialized.</param>
32+
public static void StartApplication(string[] args, Action action)
33+
{
34+
if (mutex.WaitOne(TimeSpan.Zero, true))
35+
{
36+
ProcessCommandLineArgs(args);
37+
38+
CreateRemoteService(Program.AppName);
39+
40+
action();
41+
}
42+
else
43+
{
44+
SignalFirstInstance(Program.AppName, args);
45+
}
46+
}
47+
48+
private static async void CreateRemoteService(string channelName)
49+
{
50+
using NamedPipeServerStream pipeServer = new NamedPipeServerStream(channelName, PipeDirection.In);
51+
while (true)
52+
{
53+
await pipeServer.WaitForConnectionAsync().ConfigureAwait(false);
54+
StreamReader reader = new StreamReader(pipeServer);
55+
var rawArgs = await reader.ReadToEndAsync();
56+
57+
IList<string> args = rawArgs.Split(JumpListHelper.arg_delimiter);
58+
59+
ProcessCommandLineArgs(args, false);
60+
61+
pipeServer.Disconnect();
62+
}
63+
}
64+
65+
public static void ProcessCommandLineArgs(IList<string> args, bool isFirstInstance = true)
66+
{
67+
string arg = string.Empty;
68+
69+
if (args?.Count > 0)
70+
{
71+
arg = args[0];
72+
}
73+
74+
if (arg == string.Empty)
75+
{
76+
if (!isFirstInstance)
77+
{
78+
Program.RunCommand(RunCommandType.ShowSettings);
79+
}
80+
}
81+
else if (arg.ToLowerInvariant() == JumpListHelper.arg_settings)
82+
{
83+
Program.RunCommand(RunCommandType.ShowSettings);
84+
}
85+
else if (arg.ToLowerInvariant() == JumpListHelper.arg_restore)
86+
{
87+
Program.RunCommand(RunCommandType.RestoreDefault);
88+
}
89+
else if (arg.ToLowerInvariant() == JumpListHelper.arg_exit)
90+
{
91+
Program.RunCommand(RunCommandType.SafeExit);
92+
}
93+
}
94+
95+
private static void SignalFirstInstance(string channelName, string[] args)
96+
{
97+
string rawArgs = string.Empty;
98+
foreach (var arg in args)
99+
{
100+
rawArgs += arg + JumpListHelper.arg_delimiter;
101+
}
102+
103+
using NamedPipeClientStream pipeClient = new NamedPipeClientStream(".", channelName, PipeDirection.Out);
104+
pipeClient.Connect(0);
105+
106+
StreamWriter writer = new StreamWriter(pipeClient) { AutoFlush = true };
107+
writer.Write(rawArgs);
108+
writer.Flush();
109+
writer.Close();
110+
pipeClient.Dispose();
111+
112+
Environment.Exit(0);
113+
}
114+
115+
#endregion
116+
}
117+
}

ModernFlyouts/Controls/ScrollViewerEx.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using ModernFlyouts.Utilities;
1+
using ModernFlyouts.Helpers;
22
using System;
33
using System.Windows;
44
using System.Windows.Controls;

ModernFlyouts/Controls/SessionControl.xaml

+10-9
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@
99
mc:Ignorable="d"
1010
Width="{DynamicResource FlyoutWidth}" VerticalAlignment="Top">
1111
<Border CornerRadius="{DynamicResource FlyoutCornerRadius}">
12-
<Grid>
12+
<Grid x:Name="ContentGrid">
1313
<Grid.ColumnDefinitions>
14+
<ColumnDefinition Width="15"/>
1415
<ColumnDefinition Width="*" />
1516
<ColumnDefinition Width="Auto" />
1617
</Grid.ColumnDefinitions>
@@ -19,9 +20,9 @@
1920
<RowDefinition Height="Auto" />
2021
</Grid.RowDefinitions>
2122

22-
<Border Grid.ColumnSpan="2" Grid.RowSpan="2" Opacity="0.5" CornerRadius="{DynamicResource FlyoutCornerRadius}" ClipToBounds="True">
23+
<Border Grid.ColumnSpan="3" Grid.RowSpan="2" Opacity="0.5" CornerRadius="{DynamicResource FlyoutCornerRadius}" ClipToBounds="True">
2324
<Border.OpacityMask>
24-
<RadialGradientBrush GradientOrigin="1,0.5" RadiusX="1" RadiusY="1" Center="1,0.5">
25+
<RadialGradientBrush x:Name="thumbnailBGOpacityBrush" x:FieldModifier="private" GradientOrigin="1,0.5" RadiusX="1" RadiusY="1" Center="1,0.5">
2526
<GradientStop Color="White" Offset="0" />
2627
<GradientStop Color="Transparent" Offset="1" />
2728
</RadialGradientBrush>
@@ -33,7 +34,7 @@
3334
</Border.Background>
3435
</Border>
3536

36-
<Grid x:Name="TextBlockGrid" Grid.Column="0" VerticalAlignment="Center" Margin="15,25,0,0" Cursor="Hand">
37+
<Grid x:Name="TextBlockGrid" Grid.Column="1" VerticalAlignment="Center" Margin="0,25,0,0" Cursor="Hand">
3738
<Grid.RowDefinitions>
3839
<RowDefinition Height="Auto" />
3940
<RowDefinition Height="Auto" />
@@ -58,7 +59,7 @@
5859
</TextBlock>
5960
</Grid>
6061

61-
<Grid Grid.Column="1">
62+
<Grid x:Name="TGParent" x:FieldModifier="private" Grid.Column="2">
6263
<Grid Height="64" Width="64" Margin="16,16,16,6" x:Name="ThumbnailGrid" Cursor="Hand">
6364
<Border CornerRadius="{DynamicResource FlyoutCornerRadius}" Background="#333333" />
6465
<Border CornerRadius="{DynamicResource FlyoutCornerRadius}">
@@ -69,15 +70,15 @@
6970
</Grid>
7071
</Grid>
7172

72-
<StackPanel x:Name="AppInfoPanel" Margin="15,15,0,0" Grid.RowSpan="2" Grid.Column="0"
73+
<StackPanel x:Name="AppInfoPanel" Margin="0,15,0,0" Grid.RowSpan="2" Grid.Column="1"
7374
VerticalAlignment="Top" Orientation="Horizontal" Cursor="Hand">
7475
<Image x:Name="AppImage" Source="/Assets/Logo.ico" Width="16" Height="16" RenderOptions.BitmapScalingMode="Fant" />
7576
<TextBlock x:Name="AppNameBlock" Text="ModernFlyouts" VerticalAlignment="Center"
7677
Margin="5,0,0,0" TextTrimming="CharacterEllipsis" TextWrapping="NoWrap"
7778
Style="{DynamicResource CaptionTextBlockStyle}" Foreground="{DynamicResource SystemControlForegroundBaseHighBrush}" />
7879
</StackPanel>
7980

80-
<ui:SplitView x:Name="ControlsSplitView" Grid.ColumnSpan="2" Grid.Row="1"
81+
<ui:SplitView x:Name="ControlsSplitView" Grid.ColumnSpan="3" Grid.Row="1"
8182
Margin="0,0,0,12" VerticalAlignment="Center" OpenPaneLength="{DynamicResource FlyoutWidth}"
8283
PaneBackground="Transparent" DisplayMode="Inline" IsPaneOpen="False">
8384
<ui:SplitView.Pane>
@@ -110,13 +111,13 @@
110111
</StackPanel>
111112
</ui:SplitView>
112113

113-
<ToggleButton x:Name="MoreControlsButton" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Left" VerticalAlignment="Center"
114+
<ToggleButton x:Name="MoreControlsButton" Grid.Row="1" Grid.ColumnSpan="3" HorizontalAlignment="Left" VerticalAlignment="Center"
114115
ToolTip="{x:Static resx:Strings.SessionControl_MoreControls}" Margin="16,0,0,12"
115116
IsChecked="{Binding ElementName=ControlsSplitView, Path=IsPaneOpen}">
116117
<ui:FontIcon Glyph="{x:Static utils:CommonGlyphs.More}" FontSize="16" />
117118
</ToggleButton>
118119

119-
<Button x:Name="TimelineInfoButton" Grid.Row="1" Grid.ColumnSpan="2" HorizontalAlignment="Right" VerticalAlignment="Center"
120+
<Button x:Name="TimelineInfoButton" Grid.Row="1" Grid.ColumnSpan="3" HorizontalAlignment="Right" VerticalAlignment="Center"
120121
ToolTip="{x:Static resx:Strings.SessionControl_TimelineInfo}" Margin="0,0,16,12">
121122
<ui:FontIcon Glyph="{x:Static utils:CommonGlyphs.TimelineInfo}" FontSize="16" />
122123
<ui:FlyoutService.Flyout>

ModernFlyouts/Controls/SessionControl.xaml.cs

+42
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.Threading.Tasks;
77
using System.Windows;
88
using System.Windows.Controls;
9+
using System.Windows.Data;
910
using System.Windows.Media;
1011
using System.Windows.Media.Animation;
1112
using System.Windows.Media.Imaging;
@@ -46,6 +47,19 @@ public GlobalSystemMediaTransportControlsSession SMTCSession
4647
}
4748
}
4849

50+
public static readonly DependencyProperty AlignThumbnailToRightProperty =
51+
DependencyProperty.Register(
52+
nameof(AlignThumbnailToRight),
53+
typeof(bool),
54+
typeof(SessionControl),
55+
new PropertyMetadata(true, OnAlignThumbnailToRightChanged));
56+
57+
public bool AlignThumbnailToRight
58+
{
59+
get => (bool)GetValue(AlignThumbnailToRightProperty);
60+
set => SetValue(AlignThumbnailToRightProperty, value);
61+
}
62+
4963
#endregion
5064

5165
public SessionControl()
@@ -62,6 +76,10 @@ public SessionControl()
6276

6377
Loaded += SessionControl_Loaded;
6478
Unloaded += SessionControl_Unloaded;
79+
80+
AlignThumbnailToRight = FlyoutHandler.Instance.UIManager.AlignGSMTCThumbnailToRight;
81+
BindingOperations.SetBinding(this, AlignThumbnailToRightProperty,
82+
new Binding(nameof(UI.UIManager.AlignGSMTCThumbnailToRight)) { Source = FlyoutHandler.Instance.UIManager });
6583
}
6684

6785
public SessionControl(GlobalSystemMediaTransportControlsSession session) : this()
@@ -538,6 +556,30 @@ private void EndTrackTransition()
538556

539557
#endregion
540558

559+
private static void OnAlignThumbnailToRightChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
560+
{
561+
var sessionControl = d as SessionControl;
562+
var alignThumbnailToRight = (bool)e.NewValue;
563+
564+
var C0 = sessionControl.ContentGrid.ColumnDefinitions[0];
565+
var C2 = sessionControl.ContentGrid.ColumnDefinitions[2];
566+
567+
if (alignThumbnailToRight)
568+
{
569+
C0.Width = new GridLength(15, GridUnitType.Pixel);
570+
C2.Width = new GridLength(0, GridUnitType.Auto);
571+
sessionControl.TGParent.SetValue(Grid.ColumnProperty, 2);
572+
sessionControl.thumbnailBGOpacityBrush.GradientOrigin = sessionControl.thumbnailBGOpacityBrush.Center = new Point(1, 0.5);
573+
}
574+
else
575+
{
576+
C0.Width = new GridLength(0, GridUnitType.Auto);
577+
C2.Width = new GridLength(15, GridUnitType.Pixel);
578+
sessionControl.TGParent.SetValue(Grid.ColumnProperty, 0);
579+
sessionControl.thumbnailBGOpacityBrush.GradientOrigin = sessionControl.thumbnailBGOpacityBrush.Center = new Point(0, 0.5);
580+
}
581+
}
582+
541583
public void DisposeSession()
542584
{
543585
if (_SMTCSession != null)

0 commit comments

Comments
 (0)