Shuffle window (only visual)
This commit is contained in:
		@@ -135,12 +135,12 @@
 | 
			
		||||
                <TextBlock x:Name="Connection" HorizontalAlignment="Center" Text="Not connected" TextWrapping="Wrap" VerticalAlignment="Top" TextAlignment="Center" Foreground="{DynamicResource {x:Static SystemColors.ControlDarkDarkBrushKey}}" Margin="5,0,0,0" />
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
            <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" VerticalAlignment="Center" Margin="0,0,10,0">
 | 
			
		||||
                <!--<Button x:Name="Shuffle" Padding="5, 2" HorizontalAlignment="Right" Margin="0,0,10,0" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
 | 
			
		||||
                <Button x:Name="Shuffle" Padding="5, 2" Click="Shuffle_Clicked" Margin="0,0,10,0" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" FocusVisualStyle="{x:Null}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <emoji:TextBlock Text="🔁" Padding="0,0,0,2"/>
 | 
			
		||||
                        <TextBlock Text="Shuffle" Margin="5, 0, 0, 0"/>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </Button>-->
 | 
			
		||||
                </Button>
 | 
			
		||||
                <Button x:Name="Settings" Padding="5, 2" Click="Settings_Clicked" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}" FocusVisualStyle="{x:Null}">
 | 
			
		||||
                    <StackPanel Orientation="Horizontal">
 | 
			
		||||
                        <emoji:TextBlock Text="🛠️"  Padding="0,0,0,2"/>
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,7 @@ namespace unison
 | 
			
		||||
    {
 | 
			
		||||
        private readonly Settings _settingsWin;
 | 
			
		||||
        private readonly Radios _radiosWin;
 | 
			
		||||
        private readonly Shuffle _shuffleWin;
 | 
			
		||||
        private readonly DispatcherTimer _timer;
 | 
			
		||||
        private readonly MPDHandler _mpd;
 | 
			
		||||
 | 
			
		||||
@@ -25,6 +26,7 @@ namespace unison
 | 
			
		||||
 | 
			
		||||
            _settingsWin = new Settings();
 | 
			
		||||
            _radiosWin = new Radios();
 | 
			
		||||
            _shuffleWin = new Shuffle();
 | 
			
		||||
            _timer = new DispatcherTimer();
 | 
			
		||||
            _mpd = (MPDHandler)Application.Current.Properties["mpd"];
 | 
			
		||||
 | 
			
		||||
@@ -226,6 +228,15 @@ namespace unison
 | 
			
		||||
                _radiosWin.WindowState = WindowState.Normal;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Shuffle_Clicked(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            _shuffleWin.Show();
 | 
			
		||||
            _shuffleWin.Activate();
 | 
			
		||||
 | 
			
		||||
            if (_shuffleWin.WindowState == WindowState.Minimized)
 | 
			
		||||
                _shuffleWin.WindowState = WindowState.Normal;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void Settings_Clicked(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            _settingsWin.Show();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								Views/Shuffle.xaml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								Views/Shuffle.xaml
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,64 @@
 | 
			
		||||
<Window x:Class="unison.Shuffle"
 | 
			
		||||
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 | 
			
		||||
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 | 
			
		||||
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
 | 
			
		||||
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
 | 
			
		||||
        xmlns:emoji="clr-namespace:Emoji.Wpf;assembly=Emoji.Wpf"
 | 
			
		||||
        xmlns:local="clr-namespace:unison"
 | 
			
		||||
        mc:Ignorable="d"
 | 
			
		||||
        Title="Shuffle" Closing="Window_Closing" SizeToContent="WidthAndHeight" ResizeMode="NoResize">
 | 
			
		||||
 | 
			
		||||
    <Grid>
 | 
			
		||||
        <StackPanel>
 | 
			
		||||
            <StackPanel HorizontalAlignment="Left" Orientation="Vertical" Margin="5,0,5,5">
 | 
			
		||||
                <GroupBox DockPanel.Dock="Top" Padding="0,4,0,0">
 | 
			
		||||
                    <GroupBox.Header>
 | 
			
		||||
                        <TextBlock>
 | 
			
		||||
                            <emoji:EmojiInline Text="🔁"/>
 | 
			
		||||
                            <Run Text="Shuffle"/>
 | 
			
		||||
                        </TextBlock>
 | 
			
		||||
                    </GroupBox.Header>
 | 
			
		||||
                    <StackPanel Orientation="Vertical" Margin="5,0,5,0">
 | 
			
		||||
                        <StackPanel Orientation="Horizontal">
 | 
			
		||||
                            <StackPanel Orientation="Vertical">
 | 
			
		||||
                                <TextBlock Text="Song" Margin="0,0,0,2"/>
 | 
			
		||||
                                <TextBox x:Name="Song" Width="240"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
 | 
			
		||||
                            <StackPanel Orientation="Vertical" Margin="20,0,0,0">
 | 
			
		||||
                                <TextBlock Text="Artist" Margin="0,0,0,2"/>
 | 
			
		||||
                                <TextBox x:Name="Artist" Width="240"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </StackPanel>
 | 
			
		||||
                        <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
 | 
			
		||||
                            <StackPanel Orientation="Vertical">
 | 
			
		||||
                                <TextBlock Text="Album" Margin="0,0,0,2"/>
 | 
			
		||||
                                <TextBox x:Name="Album" Width="240"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
 | 
			
		||||
                            <StackPanel Orientation="Vertical" Margin="20,0,0,0">
 | 
			
		||||
                                <TextBlock Text="Year" Margin="0,0,0,2"/>
 | 
			
		||||
                                <TextBox x:Name="Year" Width="240"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </StackPanel>
 | 
			
		||||
                        <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
 | 
			
		||||
                            <StackPanel Orientation="Vertical">
 | 
			
		||||
                                <TextBlock Text="Genre" Margin="0,0,0,2"/>
 | 
			
		||||
                                <ComboBox x:Name="Genre" SelectedIndex="0" Width="240" ScrollViewer.CanContentScroll="False"/>
 | 
			
		||||
                            </StackPanel>
 | 
			
		||||
                        </StackPanel>
 | 
			
		||||
 | 
			
		||||
                        <StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="0,8,0,0">
 | 
			
		||||
                            <TextBlock Text="Number of songs to add" Margin="0,0,0,5"/>
 | 
			
		||||
                            <TextBox x:Name="SongNumber" Text="100" Width="45" Margin="5,0,0,0"/>
 | 
			
		||||
                        </StackPanel>
 | 
			
		||||
 | 
			
		||||
                        <StackPanel Orientation="Horizontal" Margin="0,5,0,0">
 | 
			
		||||
                            <Button Content="Add to queue" Click="AddToQueue_Clicked" Padding="5, 2"/>
 | 
			
		||||
                        </StackPanel>
 | 
			
		||||
                    </StackPanel>
 | 
			
		||||
                </GroupBox>
 | 
			
		||||
            </StackPanel>
 | 
			
		||||
        </StackPanel>
 | 
			
		||||
    </Grid>
 | 
			
		||||
</Window>
 | 
			
		||||
							
								
								
									
										34
									
								
								Views/Shuffle.xaml.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Views/Shuffle.xaml.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
using System.ComponentModel;
 | 
			
		||||
using System.Windows;
 | 
			
		||||
using System.Windows.Interop;
 | 
			
		||||
 | 
			
		||||
namespace unison
 | 
			
		||||
{
 | 
			
		||||
    public partial class Shuffle : Window
 | 
			
		||||
    {
 | 
			
		||||
        //private MPDHandler _mpd;
 | 
			
		||||
 | 
			
		||||
        public Shuffle()
 | 
			
		||||
        {
 | 
			
		||||
            InitializeComponent();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void Window_Closing(object sender, CancelEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
            e.Cancel = true;
 | 
			
		||||
            WindowState = WindowState.Minimized;
 | 
			
		||||
            Hide();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public void InitHwnd()
 | 
			
		||||
        {
 | 
			
		||||
            WindowInteropHelper helper = new(this);
 | 
			
		||||
            helper.EnsureHandle();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private void AddToQueue_Clicked(object sender, RoutedEventArgs e)
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -30,11 +30,11 @@
 | 
			
		||||
                <Image Width="16" Height="16" emoji:Image.Source="📻" />
 | 
			
		||||
            </MenuItem.Icon>
 | 
			
		||||
        </MenuItem>
 | 
			
		||||
        <!--<MenuItem Header="Shuffle" Command="{Binding Shuffle}">
 | 
			
		||||
        <MenuItem Header="Shuffle" Command="{Binding Shuffle}">
 | 
			
		||||
            <MenuItem.Icon>
 | 
			
		||||
                <Image Width="16" Height="16" emoji:Image.Source="🔀" />
 | 
			
		||||
            </MenuItem.Icon>
 | 
			
		||||
        </MenuItem>-->
 | 
			
		||||
        </MenuItem>
 | 
			
		||||
        <MenuItem Header="{x:Static properties:Resources.Settings}" Command="{Binding Settings}">
 | 
			
		||||
            <MenuItem.Icon>
 | 
			
		||||
                <Image Width="16" Height="16" emoji:Image.Source="🛠️" />
 | 
			
		||||
 
 | 
			
		||||
@@ -71,6 +71,18 @@ namespace unison
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public ICommand Shuffle
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
            {
 | 
			
		||||
                return new DelegateCommand
 | 
			
		||||
                {
 | 
			
		||||
                    CommandAction = () => ((MainWindow)Application.Current.MainWindow).Shuffle_Clicked(null, null),
 | 
			
		||||
                    CanExecuteFunc = () => true
 | 
			
		||||
                };
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public ICommand Settings
 | 
			
		||||
        {
 | 
			
		||||
            get
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@
 | 
			
		||||
    <ApplicationIcon>Resources\icon-full.ico</ApplicationIcon>
 | 
			
		||||
    <Win32Resource></Win32Resource>
 | 
			
		||||
    <StartupObject>unison.App</StartupObject>
 | 
			
		||||
    <Version>1.1</Version>
 | 
			
		||||
    <Version>1.2</Version>
 | 
			
		||||
    <Company />
 | 
			
		||||
    <Authors>Théo Marchal</Authors>
 | 
			
		||||
    <PackageLicenseFile>LICENSE</PackageLicenseFile>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user