Skip to content

Commit

Permalink
v1.1.2.20
Browse files Browse the repository at this point in the history
  • Loading branch information
zdy1988 committed Feb 19, 2023
1 parent c52307a commit 30a390f
Show file tree
Hide file tree
Showing 19 changed files with 677 additions and 266 deletions.
3 changes: 1 addition & 2 deletions src/AboutWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ZDY="http://www.zdyla.com/coding"
xmlns:Properties="clr-namespace:Zhai.VideoView.Properties"
xmlns:Converters="clr-namespace:Zhai.VideoView.Converters"
Title="{Binding Path=AppName, Source={x:Static Properties:Settings.Default}, StringFormat=关于 {0}}"
Theme="{Binding SettingsWindow.IsWindowDarked, Source={StaticResource Locator}, Converter={Converters:VideoViewThemeConverter}}"
Theme="Dark"
WindowStartupLocation ="CenterScreen"
TitleBarVisibility="Collapsed"
ShowInTaskbar="False"
Expand Down
6 changes: 3 additions & 3 deletions src/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
<setting name="IsStartWindowMaximized" serializeAs="String">
<value>False</value>
</setting>
<setting name="IsWindowDarked" serializeAs="String">
<value>True</value>
</setting>
<setting name="Volume" serializeAs="String">
<value>75</value>
</setting>
<setting name="VideoHistory" serializeAs="String">
<value />
</setting>
</Zhai.VideoView.Properties.Settings>
</userSettings>
</configuration>
60 changes: 60 additions & 0 deletions src/Converters/GreaterOrEqualsToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Zhai.Famil.Converters;

namespace Zhai.VideoView.Converters
{
public class GreaterOrEqualsToBoolConverter : ConverterMarkupExtensionBase<GreaterOrEqualsToBoolConverter>, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter != null && double.TryParse(parameter.ToString(), out double than))
{
if (value is double d)
{
return d >= than;
}
else if (value is float f)
{
return f >= than;
}
else if (value is ulong ul)
{
return ul >= than;
}
else if (value is long l)
{
return l >= than;
}
else if (value is uint ui)
{
return ui >= than;
}
else if (value is int i)
{
return i >= than;
}
else if (value is ushort us)
{
return us >= than;
}
else if (value is short s)
{
return s >= than;
}
}

return false;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
39 changes: 39 additions & 0 deletions src/Converters/KeywordToListItemVisibilityConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Data;
using Zhai.Famil.Converters;

namespace Zhai.VideoView.Converters
{
internal class KeywordToListItemVisibilityConverter : ConverterMarkupExtensionBase<KeywordToListItemVisibilityConverter>, IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
if (values != null && values.Length == 2)
{
string keyword = values[0] == null ? "" : values[0].ToString();
string name = values[1] == null ? "" : values[1].ToString();

if (!string.IsNullOrWhiteSpace(keyword) && !string.IsNullOrWhiteSpace(name))
{
if (name.IndexOf(keyword) != -1)
return Visibility.Visible;
else
return Visibility.Collapsed;
}
}

return Visibility.Visible;
}

public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
60 changes: 60 additions & 0 deletions src/Converters/LessToBoolConverter.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Zhai.Famil.Converters;

namespace Zhai.VideoView.Converters
{
internal class LessConverter : ConverterMarkupExtensionBase<LessConverter>, IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (parameter != null && double.TryParse(parameter.ToString(), out double than))
{
if (value is double d)
{
return d < than;
}
else if (value is float f)
{
return f < than;
}
else if (value is ulong ul)
{
return ul < than;
}
else if (value is long l)
{
return l < than;
}
else if (value is uint ui)
{
return ui < than;
}
else if (value is int i)
{
return i < than;
}
else if (value is ushort us)
{
return us < than;
}
else if (value is short s)
{
return s < than;
}
}

return false;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotSupportedException();
}
}
}
28 changes: 0 additions & 28 deletions src/Converters/VideoViewThemeConverter.cs

This file was deleted.

Loading

0 comments on commit 30a390f

Please sign in to comment.