diff options
Diffstat (limited to 'MediaBrowser.Plugins.DefaultTheme')
15 files changed, 292 insertions, 3 deletions
diff --git a/MediaBrowser.Plugins.DefaultTheme/Converters/TileBackgroundConverter.cs b/MediaBrowser.Plugins.DefaultTheme/Converters/TileBackgroundConverter.cs new file mode 100644 index 000000000..a7a964693 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Converters/TileBackgroundConverter.cs @@ -0,0 +1,43 @@ +using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+
+namespace MediaBrowser.Plugins.DefaultTheme.Converters
+{
+ public class TileBackgroundConverter : IValueConverter
+ {
+ private static readonly Brush[] TileColors = new Brush[] {
+ new SolidColorBrush(Color.FromRgb((byte)111,(byte)189,(byte)69)),
+ new SolidColorBrush(Color.FromRgb((byte)75,(byte)179,(byte)221)),
+ new SolidColorBrush(Color.FromRgb((byte)65,(byte)100,(byte)165)),
+ new SolidColorBrush(Color.FromRgb((byte)225,(byte)32,(byte)38)),
+ new SolidColorBrush(Color.FromRgb((byte)128,(byte)0,(byte)128)),
+ new SolidColorBrush(Color.FromRgb((byte)0,(byte)128,(byte)64)),
+ new SolidColorBrush(Color.FromRgb((byte)0,(byte)148,(byte)255)),
+ new SolidColorBrush(Color.FromRgb((byte)255,(byte)0,(byte)199)),
+ new SolidColorBrush(Color.FromRgb((byte)255,(byte)135,(byte)15)),
+ new SolidColorBrush(Color.FromRgb((byte)127,(byte)0,(byte)55))
+
+ };
+
+ private static int _currentIndex = new Random(DateTime.Now.Millisecond).Next(0, TileColors.Length);
+
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ int index;
+
+ lock (TileColors)
+ {
+ index = (_currentIndex++) % TileColors.Length;
+ }
+
+ return TileColors[index++];
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new System.NotImplementedException();
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Converters/WeatherImageConverter.cs b/MediaBrowser.Plugins.DefaultTheme/Converters/WeatherImageConverter.cs new file mode 100644 index 000000000..0d73a1a6f --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Converters/WeatherImageConverter.cs @@ -0,0 +1,43 @@ +using MediaBrowser.Model.Weather;
+using System;
+using System.ComponentModel.Composition;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace MediaBrowser.Plugins.DefaultTheme.Converters
+{
+ [PartNotDiscoverable]
+ public class WeatherImageConverter : IValueConverter
+ {
+ public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ var weather = value as WeatherInfo;
+
+ if (weather != null)
+ {
+ switch (weather.CurrentWeather.Condition)
+ {
+ case WeatherConditions.Thunderstorm:
+ return "../Images/Weather/Thunder.png";
+ case WeatherConditions.Overcast:
+ return "../Images/Weather/Overcast.png";
+ case WeatherConditions.Mist:
+ case WeatherConditions.Sleet:
+ case WeatherConditions.Rain:
+ return "../Images/Weather/Rain.png";
+ case WeatherConditions.Blizzard:
+ case WeatherConditions.Snow:
+ return "../Images/Weather/Snow.png";
+ default:
+ return "../Images/Weather/Sunny.png";
+ }
+ }
+ return null;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj b/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj index b15a31cc5..2fe9914ab 100644 --- a/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj +++ b/MediaBrowser.Plugins.DefaultTheme/MediaBrowser.Plugins.DefaultTheme.csproj @@ -31,6 +31,9 @@ <ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
+ <PropertyGroup>
+ <RunPostBuildEvent>Always</RunPostBuildEvent>
+ </PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
@@ -48,6 +51,12 @@ <Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
+ <Compile Include="Pages\LoginPage.xaml.cs">
+ <DependentUpon>LoginPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Resources\AppResources.cs" />
+ <Compile Include="Converters\TileBackgroundConverter.cs" />
+ <Compile Include="Converters\WeatherImageConverter.cs" />
<Compile Include="Plugin.cs" />
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
@@ -90,9 +99,28 @@ <Name>MediaBrowser.UI</Name>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <Page Include="Pages\LoginPage.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ <Page Include="Resources\AppResources.xaml">
+ <SubType>Designer</SubType>
+ <Generator>MSBuild:Compile</Generator>
+ </Page>
+ </ItemGroup>
+ <ItemGroup>
+ <Resource Include="Resources\Images\CurrentUserDefault.png" />
+ <Resource Include="Resources\Images\UserLoginDefault.png" />
+ <Resource Include="Resources\Images\Weather\Overcast.png" />
+ <Resource Include="Resources\Images\Weather\Rain.png" />
+ <Resource Include="Resources\Images\Weather\Snow.png" />
+ <Resource Include="Resources\Images\Weather\Sunny.png" />
+ <Resource Include="Resources\Images\Weather\Thunder.png" />
+ </ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
- <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\ProgramData\Plugins\" /y</PostBuildEvent>
+ <PostBuildEvent>xcopy "$(TargetPath)" "$(SolutionDir)\ProgramData-Server\Plugins\" /y</PostBuildEvent>
</PropertyGroup>
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml b/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml new file mode 100644 index 000000000..4b1552bd8 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml @@ -0,0 +1,64 @@ +<base:BaseLoginPage x:Class="MediaBrowser.Plugins.DefaultTheme.Pages.LoginPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+ xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
+ xmlns:base="clr-namespace:MediaBrowser.UI.Pages;assembly=MediaBrowser.UI"
+ xmlns:DTO="clr-namespace:MediaBrowser.Model.DTO;assembly=MediaBrowser.Model"
+ xmlns:controls="clr-namespace:MediaBrowser.UI.Controls;assembly=MediaBrowser.UI" mc:Ignorable="d"
+ d:DesignHeight="300"
+ d:DesignWidth="300"
+ Title="LoginPage">
+
+ <Page.Resources>
+ <ResourceDictionary>
+ <DataTemplate DataType="{x:Type DTO:DtoUser}">
+ <Grid HorizontalAlignment="Left" Margin="3">
+
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="auto"></ColumnDefinition>
+ <ColumnDefinition Width="475"></ColumnDefinition>
+ </Grid.ColumnDefinitions>
+
+ <controls:ExtendedImage HasImage="{Binding HasImage}"
+ PlaceHolderSource="../Resources/Images/UserLoginDefault.png"
+ Source="{Binding Converter={StaticResource UserImageConverter}, ConverterParameter='225,225,0,0'}"
+ Stretch="Uniform"
+ Width="225"
+ Height="225"
+ Background="{Binding Converter={StaticResource TileBackgroundConverter}}"/>
+ <TextBlock Text="{Binding Name}" VerticalAlignment="Top" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="0" Margin="25 30 0 0" FontSize="{StaticResource Heading2FontSize}"></TextBlock>
+ <TextBlock Text="{Binding Converter={StaticResource LastSeenTextConverter}}" VerticalAlignment="Center" HorizontalAlignment="Left" Grid.Column="1" Grid.Row="0" Margin="25 80 0 0"></TextBlock>
+ </Grid>
+ </DataTemplate>
+
+ </ResourceDictionary>
+ </Page.Resources>
+ <Grid>
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="auto"></RowDefinition>
+ <RowDefinition Height="*"></RowDefinition>
+ </Grid.RowDefinitions>
+
+ <Image Style="{StaticResource MBLogoImageBlack}" Margin="0 0 0 10" Height="125" Stretch="Uniform" HorizontalAlignment="Left"></Image>
+
+ <Grid VerticalAlignment="Stretch" HorizontalAlignment="Center" Grid.Row="1">
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="auto"></RowDefinition>
+ <RowDefinition Height="*"></RowDefinition>
+ </Grid.RowDefinitions>
+
+ <TextBlock FontSize="{StaticResource Heading2FontSize}" Grid.Row="0" Margin="0 0 0 30">Select Profile</TextBlock>
+
+ <ListView HorizontalAlignment="Center" Grid.Row="1" ScrollViewer.VerticalScrollBarVisibility="Disabled" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ItemsSource="{Binding Path=Users}" Style="{StaticResource ListViewStyle}" ItemContainerStyle="{StaticResource ListViewItemStyle}">
+ <ListView.ItemsPanel>
+ <ItemsPanelTemplate>
+ <WrapPanel Orientation="Vertical" />
+ </ItemsPanelTemplate>
+ </ListView.ItemsPanel>
+ </ListView>
+ </Grid>
+ </Grid>
+</base:BaseLoginPage>
diff --git a/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml.cs b/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml.cs new file mode 100644 index 000000000..547443086 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Pages/LoginPage.xaml.cs @@ -0,0 +1,15 @@ +using MediaBrowser.UI.Pages;
+
+namespace MediaBrowser.Plugins.DefaultTheme.Pages
+{
+ /// <summary>
+ /// Interaction logic for LoginPage.xaml
+ /// </summary>
+ public partial class LoginPage : BaseLoginPage
+ {
+ public LoginPage()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Plugin.cs b/MediaBrowser.Plugins.DefaultTheme/Plugin.cs index 9dd33f363..f12d53af1 100644 --- a/MediaBrowser.Plugins.DefaultTheme/Plugin.cs +++ b/MediaBrowser.Plugins.DefaultTheme/Plugin.cs @@ -1,4 +1,5 @@ using MediaBrowser.Common.Plugins;
+using System;
using System.ComponentModel.Composition;
namespace MediaBrowser.Plugins.DefaultTheme
@@ -11,9 +12,9 @@ namespace MediaBrowser.Plugins.DefaultTheme get { return "Default Theme"; }
}
- protected override void InitializeInUi()
+ public override Uri LoginPageUri
{
- base.InitializeInUi();
+ get { return GeneratePackUri("Pages/LoginPage.xaml"); }
}
}
}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.cs b/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.cs new file mode 100644 index 000000000..28128c75b --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.Composition;
+using System.Windows;
+
+namespace MediaBrowser.Plugins.DefaultTheme.Resources
+{
+ [Export(typeof(ResourceDictionary))]
+ public partial class AppResources : ResourceDictionary
+ {
+ public AppResources()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.xaml b/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.xaml new file mode 100644 index 000000000..c1e5adeb5 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/AppResources.xaml @@ -0,0 +1,81 @@ +<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ xmlns:themeconverters="clr-namespace:MediaBrowser.Plugins.DefaultTheme.Converters"
+ x:Class="MediaBrowser.Plugins.DefaultTheme.Resources.AppResources">
+
+ <themeconverters:WeatherImageConverter x:Key="WeatherImageConverter"></themeconverters:WeatherImageConverter>
+ <themeconverters:TileBackgroundConverter x:Key="TileBackgroundConverter"></themeconverters:TileBackgroundConverter>
+
+ <Style x:Key="ListViewItemStyle" TargetType="{x:Type ListViewItem}" BasedOn="{StaticResource BaseListViewItemStyle}">
+
+ <Style.Resources>
+ <SolidColorBrush x:Key="{x:Static SystemColors.HighlightBrushKey}" Color="LightBlue"/>
+ </Style.Resources>
+
+ <Style.Triggers>
+ <Trigger Property="IsMouseOver" Value="True">
+ <Setter Property="Opacity" Value=".85" />
+ </Trigger>
+ </Style.Triggers>
+ </Style>
+
+ <!--Override MainWindow style-->
+ <Style TargetType="Window" x:Key="MainWindow" BasedOn="{StaticResource BaseWindow}">
+ <Setter Property="Background">
+ <Setter.Value>
+ <RadialGradientBrush RadiusX=".75" RadiusY=".75">
+ <GradientStop Color="White" Offset="0.0"/>
+ <GradientStop Color="WhiteSmoke" Offset="0.5"/>
+ <GradientStop Color="#cfcfcf" Offset="1.0"/>
+ </RadialGradientBrush>
+ </Setter.Value>
+ </Setter>
+ </Style>
+
+ <!--Override PageContentTemplate-->
+ <ControlTemplate x:Key="PageContentTemplate">
+
+ <Grid Margin="20 15 20 20">
+
+ <StackPanel Orientation="Horizontal" VerticalAlignment="Top" HorizontalAlignment="Right">
+
+ <!--Display CurrentUser-->
+ <StackPanel Orientation="Horizontal" Margin="0 0 30 0" Visibility="{Binding Path=CurrentUser,Converter={StaticResource CurrentUserVisibilityConverter}}">
+ <TextBlock FontSize="{StaticResource Heading2FontSize}" Text="{Binding Path=CurrentUser.Name}" Margin="0 0 5 0">
+ </TextBlock>
+ <Image>
+ <Image.Style>
+ <Style TargetType="{x:Type Image}">
+ <Setter Property="Image.Source" Value="Images\CurrentUserDefault.png" />
+ <Setter Property="Stretch" Value="None" />
+ <Style.Triggers>
+ <DataTrigger Binding="{Binding Path=CurrentUser.HasImage}" Value="true">
+ <Setter Property="Image.Source" Value="{Binding Path=CurrentUser,Converter={StaticResource UserImageConverter}, ConverterParameter='0,64,0,0'}" />
+ </DataTrigger>
+ </Style.Triggers>
+ </Style>
+ </Image.Style>
+ </Image>
+ </StackPanel>
+
+ <!--Display Weather-->
+ <StackPanel Orientation="Horizontal" Margin="0 0 30 0" Visibility="{Binding Path=CurrentWeather,Converter={StaticResource WeatherVisibilityConverter}}">
+
+ <TextBlock FontSize="{StaticResource Heading2FontSize}" Text="{Binding Path=CurrentWeather,Converter={StaticResource WeatherTemperatureConverter}}" Margin="0 0 5 0">
+ </TextBlock>
+ <Image Stretch="None" Source="{Binding Path=CurrentWeather,Converter={StaticResource WeatherImageConverter}}"></Image>
+ </StackPanel>
+
+ <!--Display Clock-->
+ <TextBlock FontSize="{StaticResource Heading2FontSize}">
+ <TextBlock.Text>
+ <Binding Path="CurrentTime" Converter="{StaticResource DateTimeToStringConverter}" ConverterParameter="h:mm" />
+ </TextBlock.Text>
+ </TextBlock>
+ </StackPanel>
+
+ <Frame x:Name="PageFrame"></Frame>
+ </Grid>
+ </ControlTemplate>
+
+</ResourceDictionary>
\ No newline at end of file diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/CurrentUserDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/CurrentUserDefault.png Binary files differnew file mode 100644 index 000000000..f272ed92a --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/CurrentUserDefault.png diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/UserLoginDefault.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/UserLoginDefault.png Binary files differnew file mode 100644 index 000000000..93a06e308 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/UserLoginDefault.png diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Overcast.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Overcast.png Binary files differnew file mode 100644 index 000000000..b9b6765c7 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Overcast.png diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Rain.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Rain.png Binary files differnew file mode 100644 index 000000000..2e526f895 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Rain.png diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Snow.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Snow.png Binary files differnew file mode 100644 index 000000000..94131ed2d --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Snow.png diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Sunny.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Sunny.png Binary files differnew file mode 100644 index 000000000..2a51cd544 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Sunny.png diff --git a/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Thunder.png b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Thunder.png Binary files differnew file mode 100644 index 000000000..f413a2ed7 --- /dev/null +++ b/MediaBrowser.Plugins.DefaultTheme/Resources/Images/Weather/Thunder.png |
