Skip to content

Commit

Permalink
WPF: Added most of the UI for ResumePlayback and Preferences.
Browse files Browse the repository at this point in the history
  • Loading branch information
ycastonguay committed Oct 24, 2013
1 parent 4964774 commit 3afc265
Show file tree
Hide file tree
Showing 14 changed files with 247 additions and 63 deletions.
4 changes: 3 additions & 1 deletion MPfm/MPfm.Library/MPfm.Library.csproj
Expand Up @@ -171,6 +171,8 @@
<Compile Include="Database\Interfaces\IDatabaseFacade.cs" />
<Compile Include="Database\Interfaces\ISQLiteGateway.cs" />
<Compile Include="Database\DatabaseFacade.cs" />
<Compile Include="Objects\CloudDeviceInfo.cs" />
<Compile Include="Objects\CloudPlaylist.cs" />
<Compile Include="Objects\PlaylistAudioFile.cs" />
<Compile Include="Objects\NetworkState.cs" />
<Compile Include="Objects\PlaylistFile.cs" />
Expand All @@ -180,7 +182,7 @@
<Compile Include="Objects\Folder.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Services\DropboxCoreService.cs" />
<Compile Include="Services\Interfaces\IDropboxService.cs" />
<Compile Include="Services\Interfaces\ICloudLibraryService.cs" />
<Compile Include="UpdateLibrary\UpdateLibraryProgressDataSong.cs" />
<Compile Include="UpdateLibrary\UpdateLibraryFinishedData.cs" />
<Compile Include="UpdateLibrary\UpdateLibraryArgument.cs" />
Expand Down
41 changes: 40 additions & 1 deletion MPfm/MPfm.Library/Services/DropboxCoreService.cs
Expand Up @@ -15,6 +15,8 @@
// You should have received a copy of the GNU General Public License
// along with MPfm. If not, see <http://www.gnu.org/licenses/>.

using MPfm.Library.Objects;
using MPfm.Sound.Playlists;
#if !IOS && !ANDROID && !WINDOWS_PHONE
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -223,7 +225,11 @@ public void UnlinkApp()
public void InitializeAppFolder()
{
}


public void PushHello()
{
}

public void PushStuff()
{
}
Expand All @@ -237,6 +243,16 @@ public void DeleteStuff()
{
}

public string PushDeviceInfo(AudioFile audioFile, long positionBytes, string position)
{
return string.Empty;
}

public IEnumerable<CloudDeviceInfo> PullDeviceInfos()
{
return new List<CloudDeviceInfo>();
}

public string PushNowPlaying(AudioFile audioFile, long positionBytes, string position)
{
return string.Empty;
Expand All @@ -250,6 +266,29 @@ public string PullNowPlaying()
public void DeleteNowPlaying()
{
}

public string PushPlaylist(Playlist playlist)
{
return string.Empty;
}

public Playlist PullPlaylist(Guid playlistId)
{
return new Playlist();
}

public IEnumerable<Playlist> PullPlaylists()
{
return new List<Playlist>();
}

public void DeletePlaylist(Guid playlistId)
{
}

public void DeletePlaylists()
{
}
}
}
#endif
3 changes: 1 addition & 2 deletions MPfm/MPfm.MVP/Presenters/ResumePlaybackPresenter.cs
Expand Up @@ -104,10 +104,9 @@ private void ResumePlayback(CloudDeviceInfo device)
FilePath = audioFile != null ? audioFile.FilePath : string.Empty
});

// Only need to create the Player view on mobile devices
#if IOS || ANDROID || WINDOWS_PHONE || WINDOWSSTORE
_mobileNavigationManager.CreatePlayerView(MobileNavigationTabType.More, onViewBindedToPresenter);
#else
_navigationManager.CreateSyncMenuView(device);
#endif
}
}
Expand Down
40 changes: 40 additions & 0 deletions MPfm/MPfm.WPF/Classes/App.xaml
Expand Up @@ -81,6 +81,46 @@
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="TabButton">
<!--Set to true to not get any properties from the themes.-->
<Setter Property="OverridesDefaultStyle" Value="True"/>
<Setter Property="Foreground" Value="White" />
<Setter Property="FontSize" Value="12" />
<Setter Property="FontFamily" Value="/Resources/Fonts/#TitilliumText22L Lt" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0" To="#FF687985" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="borderButton" />
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimation Duration="0" To="#FF687985" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="borderButton" />
</Storyboard>
</VisualState>
<VisualState x:Name="Disabled">
<Storyboard>
<ColorAnimation Duration="0" To="#FF455865" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" Storyboard.TargetName="borderButton" />
</Storyboard>
</VisualState>
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<StackPanel Background="#FF455865">
<Border x:Name="borderButton" Background="#FF455865" Padding="4">
<ContentPresenter HorizontalAlignment="Center" VerticalAlignment="Center" />
</Border>
</StackPanel>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
<Style TargetType="Button" x:Key="HeaderImageButton">
<!--Set to true to not get any properties from the themes.-->
<Setter Property="OverridesDefaultStyle" Value="True"/>
Expand Down
2 changes: 1 addition & 1 deletion MPfm/MPfm.WPF/Classes/App.xaml.cs
Expand Up @@ -73,7 +73,7 @@ private void RegisterIoC()
{
// Finish IoC registration
Bootstrapper.GetContainer().Register<ISyncDeviceSpecifications, WindowsSyncDeviceSpecifications>().AsSingleton();
Bootstrapper.GetContainer().Register<IDropboxService, DropboxCoreService>().AsSingleton();
Bootstrapper.GetContainer().Register<ICloudLibraryService, DropboxCoreService>().AsSingleton();
Bootstrapper.GetContainer().Register<IAppConfigProvider, XmlAppConfigProvider>().AsSingleton();
Bootstrapper.GetContainer().Register<NavigationManager, WindowsNavigationManager>().AsSingleton();
Bootstrapper.GetContainer().Register<ISplashView, SplashWindow>().AsMultiInstance();
Expand Down
108 changes: 93 additions & 15 deletions MPfm/MPfm.WPF/Classes/Windows/PreferencesWindow.xaml
Expand Up @@ -3,22 +3,100 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:MPfm.WPF.Classes.Windows.Base"
xmlns:controls="clr-namespace:MPfm.WPF.Classes.Controls"
xmlns:forms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
WindowStartupLocation="CenterScreen" Background="#FF242F35"
Title="Preferences" Height="426" Width="677.9" Icon="/MPfm.WPF;component/Resources/Icon.ico">
Title="Preferences" Height="500" Width="680" Icon="/MPfm.WPF;component/Resources/Icon.ico">
<Grid Margin="0">
<TabControl Grid.Row="0" HorizontalAlignment="Left" Margin="0,0,0,0" VerticalAlignment="Top" Width="668" BorderBrush="#FF344046" Background="#FF344046">
<TabItem Header="General">
<Grid />
</TabItem>
<TabItem Header="Audio">
<Grid />
</TabItem>
<TabItem Header="Library">
<Grid />
</TabItem>
<TabItem Header="Cloud">
<Grid />
</TabItem>
</TabControl>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal">
<Button x:Name="btnTabGeneral" Click="btnTab_OnClick" Style="{StaticResource TabButton}">
<StackPanel Orientation="Horizontal" Margin="0">
<Image Source="/Resources/Images/Buttons/cancel.png" Stretch="None" />
<Label FontSize="11" FontFamily="/Resources/Fonts/#Junction" VerticalContentAlignment="Center" Foreground="White" Margin="4,0,0,0">General</Label>
</StackPanel>
</Button>
<Button x:Name="btnTabAudio" Click="btnTab_OnClick" Style="{StaticResource TabButton}" Margin="0">
<StackPanel Orientation="Horizontal" Margin="0">
<Image Source="/Resources/Images/Buttons/cancel.png" Stretch="None" />
<Label FontSize="11" FontFamily="/Resources/Fonts/#Junction" VerticalContentAlignment="Center" Foreground="White" Margin="4,0,0,0">Audio</Label>
</StackPanel>
</Button>
<Button x:Name="btnTabLibrary" Click="btnTab_OnClick" Style="{StaticResource TabButton}">
<StackPanel Orientation="Horizontal" Margin="0">
<Image Source="/Resources/Images/Buttons/cancel.png" Stretch="None" />
<Label FontSize="11" FontFamily="/Resources/Fonts/#Junction" VerticalContentAlignment="Center" Foreground="White" Margin="4,0,0,0">Library</Label>
</StackPanel>
</Button>
<Button x:Name="btnTabCloud" Click="btnTab_OnClick" Style="{StaticResource TabButton}">
<StackPanel Orientation="Horizontal" Margin="0">
<Image Source="/Resources/Images/Buttons/cancel.png" Stretch="None" />
<Label FontSize="11" FontFamily="/Resources/Fonts/#Junction" VerticalContentAlignment="Center" Foreground="White" Margin="4,0,0,0">Cloud</Label>
</StackPanel>
</Button>
</StackPanel>
<Label Grid.Row="1" x:Name="lblTitle" Content="General Preferences" Background="#FF455865" Foreground="White" FontSize="16" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<StackPanel Grid.Row="2" x:Name="gridAudio" Background="DarkOrange" Visibility="Hidden">

</StackPanel>
<StackPanel Grid.Row="2" x:Name="gridLibrary" Background="Brown" Visibility="Hidden">

</StackPanel>
<StackPanel Grid.Row="2" x:Name="gridCloud">
<StackPanel Background="White" Margin="8,8,8,0">
<Label Content="General" Background="#FF455865" Foreground="White" FontSize="14" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<CheckBox VerticalContentAlignment="Center" Margin="4" Content="Enable synchronization" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
</StackPanel>
<StackPanel Background="White" Margin="8,8,8,0" Orientation="Vertical">
<Label Content="Dropbox" Background="#FF455865" Foreground="White" FontSize="14" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<StackPanel Orientation="Horizontal">
<Button Content="Login to Dropbox" Width="140" Height="32" Margin="0" HorizontalAlignment="Left" FontSize="11" FontFamily="/Resources/Fonts/#Junction" />
<Label Content="Authenticated:" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" VerticalContentAlignment="Center" />
<Label Content="False" Foreground="Black" FontSize="12" FontWeight="Bold" FontFamily="/Resources/Fonts/#Junction" VerticalContentAlignment="Center" />
</StackPanel>
<CheckBox VerticalContentAlignment="Center" Margin="4" Content="Enable Resume Playback with Dropbox" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<Label Content="Note: This will take a small amount of bandwidth (about 1 kilobyte) every time the player switches to a new song." Foreground="#666666" FontSize="11" FontFamily="/Resources/Fonts/#Junction" Margin="25,0,0,5" Padding="0" />
</StackPanel>
</StackPanel>
<StackPanel Grid.Row="2" x:Name="gridGeneral" Visibility="Hidden">
<StackPanel Background="White" Margin="8,8,8,0">
<Label Content="Update Frequency" Background="#FF455865" Foreground="White" FontSize="14" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<StackPanel Orientation="Horizontal">
<Label Content="Song position:" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<Slider Width="200" Margin="4" />
<Label Content="every" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<TextBox x:Name="txtUpdateFrequency_SongPosition" Width="60" FontSize="12" Margin="4" />
<Label Content="ms" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<Label Content="Output meter:" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<Slider Width="200" Margin="4" />
<Label Content="every" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<TextBox x:Name="txtUpdateFrequency_OutputMeter" Width="60" FontSize="12" Margin="4" />
<Label Content="ms" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
</StackPanel>
</StackPanel>
<StackPanel Background="White" Margin="8,8,8,0">
<Label Content="User Interface" Background="#FF455865" Foreground="White" FontSize="14" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<CheckBox VerticalContentAlignment="Center" Margin="4" Content="Show tooltips" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<CheckBox VerticalContentAlignment="Center" Margin="4" Content="Show application in system tray" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<CheckBox VerticalContentAlignment="Center" Margin="24,4,4,4" Content="Minimize in system tray when the app is closed" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
</StackPanel>
<StackPanel Background="White" Margin="8,8,8,0">
<Label Content="Peak Files" Background="#FF455865" Foreground="White" FontSize="14" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<RadioButton x:Name="radioPeakFiles_UseDefaultDirectory" VerticalContentAlignment="Center" Margin="4" Content="Use default directory ([dir])" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<RadioButton x:Name="radioPeakFiles_UseCustomDirectory" VerticalContentAlignment="Center" Margin="4" Content="Use custom directory:" Foreground="Black" FontSize="12" FontFamily="/Resources/Fonts/#Junction" />
<StackPanel Orientation="Vertical">
<StackPanel Orientation="Horizontal" Margin="24,0,0,0">
<TextBox x:Name="txtPeakFiles_CustomDirectory" Width="300" Height="24" FontSize="12" />
<Button Content="Browse..." Width="80" Height="32" Margin="0" FontSize="11" FontFamily="/Resources/Fonts/#Junction" />
</StackPanel>
<Label Content="Note: You will need to launch the app as administrator to use a custom directory." Foreground="#666666" FontSize="11" FontFamily="/Resources/Fonts/#Junction" Margin="19,0,0,0" />
</StackPanel>
</StackPanel>
</StackPanel>
</Grid>
</base:BaseWindow>
17 changes: 17 additions & 0 deletions MPfm/MPfm.WPF/Classes/Windows/PreferencesWindow.xaml.cs
Expand Up @@ -39,6 +39,23 @@ public PreferencesWindow(Action<IBaseView> onViewReady)
ViewIsReady();
}

private void btnTab_OnClick(object sender, RoutedEventArgs e)
{
gridGeneral.Visibility = sender == btnTabGeneral ? Visibility.Visible : Visibility.Hidden;
gridAudio.Visibility = sender == btnTabAudio ? Visibility.Visible : Visibility.Hidden;
gridLibrary.Visibility = sender == btnTabLibrary ? Visibility.Visible : Visibility.Hidden;
gridCloud.Visibility = sender == btnTabCloud ? Visibility.Visible : Visibility.Hidden;

if (sender == btnTabGeneral)
lblTitle.Content = "General Preferences";
else if (sender == btnTabAudio)
lblTitle.Content = "Audio Preferences";
else if (sender == btnTabLibrary)
lblTitle.Content = "Library Preferences";
else if (sender == btnTabCloud)
lblTitle.Content = "Cloud Preferences";
}

#region IDesktopPreferencesView implementation

public Action OnResetLibrary { get; set; }
Expand Down
38 changes: 4 additions & 34 deletions MPfm/MPfm.WPF/Classes/Windows/ResumePlaybackWindow.xaml
Expand Up @@ -7,43 +7,13 @@
Title="Resume Playback" Height="426" Width="677.9" Icon="/MPfm.WPF;component/Resources/Icon.ico">
<Grid Margin="0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Vertical" Margin="4">
<Label Content="Resume Playback" Foreground="White" FontSize="16" FontWeight="Bold" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" Padding="4,2,4,2" />
<Label x:Name="lblIPAddress" Content="My IP address is" Foreground="#FFCCCCCC" FontSize="12" FontFamily="/Resources/Fonts/#Junction" Padding="4,2,4,2" />
</StackPanel>
<ListView Grid.Row="1">
<Label Grid.Row="0" Background="#FF455865" Content="Resume Playback" Foreground="White" FontSize="14" FontFamily="/Resources/Fonts/#TitilliumText22L Lt" />
<Label Grid.Row="1" Content="Select a device from the list to resume playback:" Foreground="#FFCCCCCC" FontSize="12" FontFamily="/Resources/Fonts/#Junction" Padding="6,8,4,8" />
<ListView x:Name="listView" Grid.Row="2">
</ListView>
<Grid Grid.Row="2" Margin="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" x:Name="btnRefresh">
<StackPanel Orientation="Horizontal" Margin="8">
<Image Source="/Resources/Images/Buttons/refresh.png" Stretch="None" />
<TextBlock Margin="6,0,0,0">Refresh devices</TextBlock>
</StackPanel>
</Button>
<StackPanel Grid.Column="1"></StackPanel>
<Button Grid.Column="2" x:Name="btnManualConnect">
<StackPanel Orientation="Horizontal" Margin="8">
<Image Source="/Resources/Images/Buttons/connect.png" Stretch="None" />
<TextBlock Margin="6,0,0,0">Connect manually to device</TextBlock>
</StackPanel>
</Button>
<Button Grid.Column="3" x:Name="btnConnect">
<StackPanel Orientation="Horizontal" Margin="8">
<Image Source="/Resources/Images/Buttons/connect.png" Stretch="None" />
<TextBlock Margin="6,0,0,0">Connect to device</TextBlock>
</StackPanel>
</Button>
</Grid>
</Grid>
</base:BaseWindow>

0 comments on commit 3afc265

Please sign in to comment.