Skip to content
This repository has been archived by the owner on Feb 16, 2021. It is now read-only.

Commit

Permalink
Merge pull request #81 from frg2089/darkmode
Browse files Browse the repository at this point in the history
简单加了一个暗色模式
  • Loading branch information
Communist Fish committed May 4, 2020
2 parents 333f9c0 + 07c1d9c commit abdbff2
Show file tree
Hide file tree
Showing 24 changed files with 302 additions and 42 deletions.
12 changes: 9 additions & 3 deletions PixivFSUWP/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,16 @@
xmlns:viewmodels="using:PixivFSUWP.ViewModels"
xmlns:local="using:PixivFSUWP"
xmlns:converters="using:PixivFSUWP.Converters"
RequestedTheme="Light">
>
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark" Source="/Themes/Dark.xaml" />
<ResourceDictionary x:Key="Default" Source="/Themes/Light.xaml" />
</ResourceDictionary.ThemeDictionaries>
<converters:MultiPageVisibilityConverter x:Name="MultiPageVisibilityConverter"/>
<converters:BookmarkHeartVisibilityConverter x:Name="BookmarkHeartVisibilityConverter"/>
<AcrylicBrush x:Name="PageBackGround" BackgroundSource="HostBackdrop" TintColor="White" TintOpacity="0.5" FallbackColor="White"/>
<AcrylicBrush x:Name="PageBackGround" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemAltHighColor}" TintOpacity="{ThemeResource PageBackGroundTintOpacity}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
<ControlTemplate x:Name="ScrollViewerScrollBarlessTemplate" TargetType="ScrollViewer">
<Grid Background="{TemplateBinding Background}">
<ScrollContentPresenter x:Name="ScrollContentPresenter" ContentTemplate="{TemplateBinding ContentTemplate}" Margin="{TemplateBinding Padding}"/>
Expand All @@ -25,7 +30,7 @@
<RowDefinition MaxHeight="50"/>
</Grid.RowDefinitions>
<Image Grid.RowSpan="2" Stretch="Uniform" Source="{Binding ImageSource}"/>
<Grid Grid.Row="1" Background="#88ffffff">
<Grid Grid.Row="1" Background="{ThemeResource SystemAltMediumColor}">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
Expand Down Expand Up @@ -128,5 +133,6 @@
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
9 changes: 9 additions & 0 deletions PixivFSUWP/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,15 @@ public App()
this.InitializeComponent();
this.Suspending += OnSuspending;
this.UnhandledException += App_UnhandledException;
switch (localSettings.Values["ColorTheme"])
{
case false:
Current.RequestedTheme = ApplicationTheme.Light;
break;
case true:
Current.RequestedTheme = ApplicationTheme.Dark;
break;
}
}

private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
Expand Down
Binary file added PixivFSUWP/Assets/PixivHeader_L.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added PixivFSUWP/Assets/PixivText_L.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions PixivFSUWP/Assets/Pixiv_Logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion PixivFSUWP/BigImage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<Grid x:Name="grdTip" HorizontalAlignment="Center" Grid.RowSpan="3"
VerticalAlignment="Bottom" Margin="20" Visibility="Collapsed" Opacity="0">
<Grid.Background>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="White" FallbackColor="White"/>
<AcrylicBrush BackgroundSource="Backdrop" TintOpacity="0.2" TintColor="{ThemeResource SystemAltHighColor}" FallbackColor="{ThemeResource SystemAltHighColor}"/>
</Grid.Background>
<TextBlock x:Name="txtTip" Margin="10" VerticalAlignment="Center" HorizontalAlignment="Center"/>
</Grid>
Expand Down
13 changes: 13 additions & 0 deletions PixivFSUWP/Controls/Pixiv_Logo.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Path
x:Class="PixivFSUWP.Controls.Pixiv_Logo"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:PixivFSUWP.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="400"
Fill="{ThemeResource SystemBaseHighColor}"
Data="M51.742 23.355c-4.64-4.026-11.134-6.35-18.683-6.35C13.382 17.006 0 32.09 0 32.09l3.77 5.945s2.088.174.983-3.328c.954-1.79 2.82-4.2 6.466-6.98v39.6c-1.572.44-3.65 1.268-2.234 2.675H19.82c1.43-1.42-.823-2.276-2.195-2.675v-9.342s7.427 2.896 15.434 2.896c7.034 0 13.435-2.08 18.196-5.835 4.76-3.733 7.83-9.308 7.81-15.68.014-6.257-2.682-12-7.324-16.01zM46 51.92c-3.292 3.228-8.08 5.27-13.602 5.266-6.162.003-11.348-1.182-14.773-2.857V24.62c3.758-2.653 9.852-4.287 14.773-4.277 5.98.005 10.674 2.25 13.85 5.654 3.168 3.426 4.898 7.977 4.914 13.267-.02 5.154-1.87 9.4-5.162 12.655zm22.65-34.914h-2.207c-.98 0-1.774.79-1.774 1.763v40.498c0 .973.793 1.763 1.773 1.763h2.206c.978 0 1.773-.788 1.773-1.762v-40.5c0-.972-.795-1.762-1.774-1.762zm57.66 0h-2.206c-.98 0-1.774.79-1.774 1.763v40.498c0 .973.793 1.763 1.774 1.763h2.206c.98 0 1.774-.788 1.774-1.762v-40.5c0-.972-.796-1.762-1.774-1.762zm51.872 0h-2.053c-1.614 0-2.06.207-2.785 1.654-.724 1.44-16.7 32.906-16.7 32.906s-15.98-31.466-16.7-32.906c-.728-1.447-1.173-1.654-2.786-1.654h-2.054c-1.51 0-2.326.667-1.475 2.366.854 1.7 20.53 40.088 20.53 40.088.517.972 1.463 1.57 2.486 1.57 1.02 0 1.965-.598 2.483-1.57.033-.07 19.676-38.39 20.525-40.088.85-1.7.038-2.366-1.473-2.366zM108.886 59.56c.834 1.054 1.432 1.47 3.044 1.47h3.308c2.082 0 1.35-.94.76-1.71-1.47-1.927-15.97-20.25-15.97-20.25s15.022-18.425 16.493-20.353c.59-.77 1.323-1.71-.76-1.71h-3.307c-1.613 0-2.212.415-3.045 1.472-.832 1.053-13.04 15.97-13.04 15.97S84.15 19.534 83.317 18.48c-.833-1.058-1.432-1.474-3.044-1.474h-3.308c-2.08 0-1.35.94-.76 1.71 1.47 1.93 16.503 20.355 16.503 20.355S77.77 57.394 76.3 59.32c-.59.77-1.322 1.71.76 1.71h3.308c1.613 0 2.21-.416 3.045-1.47.832-1.057 12.954-15.872 12.954-15.872l12.52 15.87zM67.54 0c-1.317 0-2.412.436-3.29 1.307-.875.87-1.314 1.96-1.314 3.268 0 1.306.44 2.396 1.315 3.267.878.87 1.973 1.307 3.29 1.307 1.314 0 2.41-.437 3.286-1.308.877-.87 1.316-1.96 1.316-3.267s-.44-2.397-1.316-3.268C69.95.437 68.854 0 67.54 0zm57.66 0c-1.314 0-2.41.436-3.285 1.307-.878.87-1.316 1.96-1.316 3.268 0 1.306.437 2.396 1.315 3.267.876.87 1.97 1.307 3.286 1.307 1.317 0 2.412-.437 3.29-1.308.875-.87 1.314-1.96 1.314-3.267s-.44-2.397-1.314-3.268C127.612.437 126.517 0 125.2 0z"
/>
27 changes: 27 additions & 0 deletions PixivFSUWP/Controls/Pixiv_Logo.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;

//https://go.microsoft.com/fwlink/?LinkId=234236 上介绍了“用户控件”项模板

namespace PixivFSUWP.Controls
{
public sealed partial class Pixiv_Logo
{
public Pixiv_Logo()
{
this.InitializeComponent();
}
}
}
28 changes: 14 additions & 14 deletions PixivFSUWP/IllustDetailPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
</ListView>
<StackPanel x:Name="stkAuthor" Margin="15,15,15,0" Height="70" Orientation="Horizontal">
<Button Style="{StaticResource ButtonRevealStyle}"
BorderThickness="1.5" Background="#99F3F3F3"
BorderThickness="1.5" Background="{ThemeResource SystemChromeLowColor}"
VerticalAlignment="Stretch" Click="Button_Click">
<Grid>
<Grid.ColumnDefinitions>
Expand All @@ -71,11 +71,11 @@
</Ellipse.Fill>
</Ellipse>
<TextBlock x:Name="txtAuthor" Margin="10,0" Grid.Column="1" FontSize="16" FontWeight="Bold" VerticalAlignment="Bottom"/>
<TextBlock x:Name="txtAuthorAccount" Margin="10,0" Grid.Row="1" Grid.Column="1" FontSize="14" Foreground="Gray" VerticalAlignment="Top"/>
<TextBlock x:Name="txtAuthorAccount" Margin="10,0" Grid.Row="1" Grid.Column="1" FontSize="14" Foreground="{ThemeResource SystemBaseMediumColor}" VerticalAlignment="Top"/>
</Grid>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}" x:Name="btnPlay" Click="BtnPlay_Click"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Visibility="Collapsed">
<StackPanel Margin="5">
<FontIcon x:Name="iconPlay" FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -84,7 +84,7 @@
</StackPanel>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}" x:Name="btnSaveGif" Click="BtnSaveGif_Click"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Visibility="Collapsed">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -93,7 +93,7 @@
</StackPanel>
</Button>
<Button Style="{StaticResource ButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -109,7 +109,7 @@
</Button.Flyout>
</Button>
<ToggleButton x:Name="btnBookmark" Style="{StaticResource ToggleButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Click="BtnBookmark_Click">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -118,7 +118,7 @@
</StackPanel>
</ToggleButton>
<ToggleButton x:Name="btnFollow" Style="{StaticResource ToggleButtonRevealStyle}"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" Height="70"
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" Height="70"
Width="70" Click="BtnFollow_Click">
<StackPanel Margin="5">
<FontIcon FontFamily="{StaticResource SymbolThemeFontFamily}"
Expand All @@ -131,20 +131,20 @@
<StackPanel Margin="15,15,15,0" Orientation="Horizontal">
<TextBlock x:Name="txtCommentTitle" Height="Auto" FontSize="20" FontWeight="Bold"/>
<ToggleButton x:Uid="NewComment" Height="Auto" Style="{StaticResource ToggleButtonRevealStyle}" Visibility="Collapsed"
Margin="5,0,0,0" Background="#99F3F3F3" BorderThickness="1.5" x:Name="btnNewComment" IsChecked="False"/>
Margin="5,0,0,0" Background="{ThemeResource SystemChromeLowColor}" BorderThickness="1.5" x:Name="btnNewComment" IsChecked="False"/>
</StackPanel>
<StackPanel Margin="17,15,15,0" Width="600" Orientation="Vertical" HorizontalAlignment="Left" Visibility="{x:Bind Path=btnNewComment.IsChecked, Mode=OneWay}">
<TextBox TextWrapping="Wrap" AcceptsReturn="True" x:Name="txtComment" Height="80" PlaceholderText="编写评论..."/>
<StackPanel Margin="0 5 0 0" Orientation="Horizontal">
<Button x:Name="btnPublishComment" Click="btnPublishComment_Click">发表评论</Button>
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12" Foreground="Gray">*请带着鼓励和建设性的态度发表评论</TextBlock>
<TextBlock Margin="5 0 0 0" VerticalAlignment="Center" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}">*请带着鼓励和建设性的态度发表评论</TextBlock>
</StackPanel>
</StackPanel>
<ListView x:Name="listComments" Margin="0,15" IncrementalLoadingTrigger="None" SelectionMode="None"
ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.HorizontalScrollMode="Disabled">
<ListView.ItemTemplate>
<DataTemplate x:DataType="viewmodels:CommentViewModel">
<Border Background="#99F3F3F3" Margin="5,10" BorderThickness="1.5">
<Border Background="{ThemeResource SystemChromeLowColor}" Margin="5,10" BorderThickness="1.5">
<Border.BorderBrush>
<RevealBorderBrush Color="Transparent" FallbackColor="LightGray"/>
</Border.BorderBrush>
Expand All @@ -170,10 +170,10 @@
</Ellipse.Fill>
</Ellipse>
<TextBlock Margin="5,0" Grid.Column="1" FontSize="14" FontWeight="Bold" VerticalAlignment="Bottom" Text="{Binding UserName}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="Gray" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
</Grid>
<TextBlock Grid.Row="1" Margin="0,5,0,0" Text="{Binding Comment}" TextWrapping="WrapWholeWords"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="Gray"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}"/>
<ListView Grid.Row="3" Margin="10,5,0,0" Visibility="{Binding ChildrenComments,Converter={StaticResource ChildrenCommentVisibilityConverter}}"
ItemsSource="{Binding ChildrenComments}" SelectionMode="None"
ScrollViewer.VerticalScrollMode="Disabled" ScrollViewer.HorizontalScrollMode="Disabled">
Expand Down Expand Up @@ -201,10 +201,10 @@
</Ellipse.Fill>
</Ellipse>
<TextBlock Margin="5,0" Grid.Column="1" FontSize="14" FontWeight="Bold" VerticalAlignment="Bottom" Text="{Binding UserName}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="Gray" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
<TextBlock Margin="5,0" Grid.Row="1" Grid.Column="1" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}" VerticalAlignment="Top" Text="{Binding UserAccount}"/>
</Grid>
<TextBlock Grid.Row="1" Text="{Binding Comment}" TextWrapping="WrapWholeWords"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="Gray"/>
<TextBlock Grid.Row="2" Margin="0,3,0,0" Text="{Binding DateTime}" FontSize="12" Foreground="{ThemeResource SystemBaseMediumColor}"/>
</Grid>
</Border>
</DataTemplate>
Expand Down
Loading

0 comments on commit abdbff2

Please sign in to comment.