Skip to content

Commit

Permalink
Bump to Avalonia 0.10.15
Browse files Browse the repository at this point in the history
Bump to FluentAvalonia 1.4.0
  • Loading branch information
rmbadmin committed Jun 7, 2022
1 parent 3eb03d4 commit 32ffa2f
Show file tree
Hide file tree
Showing 16 changed files with 176 additions and 494 deletions.
32 changes: 16 additions & 16 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,11 @@

<!-- SkiaSharp & HarfBuzzSharp -->
<!-- https://github.com/AvaloniaUI/Avalonia/blob/master/build/HarfBuzzSharp.props -->
<PackageVersion Include="HarfBuzzSharp" Version="2.8.2" />
<PackageVersion Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2" />
<PackageVersion Include="HarfBuzzSharp" Version="2.8.2.1-preview.1" />
<PackageVersion Include="HarfBuzzSharp.NativeAssets.Linux" Version="2.8.2.1-preview.1" />
<!-- https://github.com/AvaloniaUI/Avalonia/blob/master/build/SkiaSharp.props -->
<PackageVersion Include="SkiaSharp" Version="2.88.0" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.0" />
<PackageVersion Include="SkiaSharp" Version="2.88.1-preview.1" />
<PackageVersion Include="SkiaSharp.NativeAssets.Linux" Version="2.88.1-preview.1" />

<!-- AutoMapper -->
<PackageVersion Include="AutoMapper" Version="10.1.1" />
Expand Down Expand Up @@ -231,22 +231,22 @@
<PackageVersion Include="Polly" Version="7.2.3" />

<!--Avalonia Start-->
<PackageVersion Include="Avalonia" Version="0.10.14" />
<PackageVersion Include="Avalonia.Desktop" Version="0.10.14" />
<PackageVersion Include="Avalonia.Skia" Version="0.10.14" />
<PackageVersion Include="Avalonia.Diagnostics" Version="0.10.14" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="0.10.14" />
<!--<PackageVersion Include="Avalonia.Direct2D1" Version="0.10.14" />-->
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="0.10.14" />
<PackageVersion Include="Avalonia.Xaml.Behaviors" Version="0.10.13.3" />
<PackageVersion Include="Avalonia" Version="0.10.15" />
<PackageVersion Include="Avalonia.Desktop" Version="0.10.15" />
<PackageVersion Include="Avalonia.Skia" Version="0.10.15" />
<PackageVersion Include="Avalonia.Diagnostics" Version="0.10.15" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="0.10.15" />
<!--<PackageVersion Include="Avalonia.Direct2D1" Version="0.10.15" />-->
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="0.10.15" />
<PackageVersion Include="Avalonia.Xaml.Behaviors" Version="0.10.14" />
<!--<PackageVersion Include="Avalonia.AvaloniaEdit" Version="0.10.12.2" />-->
<!--<PackageVersion Include="CefNet.Avalonia" Version="93.1.21240.857" />-->
<!--<PackageVersion Include="LibVLCSharp.Avalonia" Version="3.5.1" />-->
<!--<PackageVersion Include="FluentAvaloniaUI" Version="1.3.0" />-->
<PackageVersion Include="FluentAvaloniaUI" Version="1.4.0" />
<PackageVersion Include="JumpLists.Win32.Avalonia" Version="1.0.0" />
<PackageVersion Include="Avalonia.Native" Version="0.10.14" />
<PackageVersion Include="Avalonia.Win32" Version="0.10.14" />
<PackageVersion Include="Avalonia.X11" Version="0.10.14" />
<PackageVersion Include="Avalonia.Native" Version="0.10.15" />
<PackageVersion Include="Avalonia.Win32" Version="0.10.15" />
<PackageVersion Include="Avalonia.X11" Version="0.10.15" />
<!--Avalonia End-->

<!-- Xamarin.Android -->
Expand Down
2 changes: 1 addition & 1 deletion references/FluentAvalonia

This file was deleted.

19 changes: 13 additions & 6 deletions src/ST.Client.Desktop.Avalonia/Application/UI/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -100,24 +100,28 @@ public AppTheme Theme

public void SetThemeNotChangeValue(AppTheme value)
{
string? the;
string? themeName = null;
//FluentThemeMode mode;

switch (value)
{
case AppTheme.HighContrast:
themeName = FluentAvaloniaTheme.HighContrastModeString;
//mode = FluentThemeMode.Light;
break;
case AppTheme.Light:
the = "Light";
themeName = FluentAvaloniaTheme.LightModeString;
//mode = FluentThemeMode.Light;
break;
case AppTheme.Dark:
default:
the = "Dark";
themeName = FluentAvaloniaTheme.DarkModeString;
//mode = FluentThemeMode.Dark;
break;
}

//var uri_0 = new Uri($"avares://Avalonia.Themes.Fluent/Fluent{the}.xaml");
var uri_1 = new Uri($"avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Styles/Theme{the}.xaml");
//var uri_0 = new Uri($"avares://Avalonia.Themes.Fluent/Fluent{themeName}.xaml");
var uri_1 = new Uri($"avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Styles/Theme{themeName}.xaml");

//Styles[0] = new FluentTheme(uri_0)
//{
Expand All @@ -127,7 +131,10 @@ public void SetThemeNotChangeValue(AppTheme value)
{
Source = uri_1,
};
AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>()!.RequestedTheme = the;

var faTheme = AvaloniaLocator.Current.GetService<FluentAvaloniaTheme>();
if (faTheme != null)
faTheme.RequestedTheme = themeName;
}

public static void SetThemeAccent(string? colorHex)
Expand Down
71 changes: 36 additions & 35 deletions src/ST.Client.Desktop.Avalonia/Application/UI/Styles/Controls.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,44 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:sys="using:System">
<Styles.Resources>
<Thickness x:Key="ScrollMargin">10 10 10 10</Thickness>
<Thickness x:Key="PageMargin">10 0 10 0</Thickness>
<Easing x:Key="FluentEasing">0.4,0,0.6,1</Easing>
<KeySpline x:Key="FluentKeySpline">0.4,0,0.6,1</KeySpline>
<sys:Double x:Key="TitleBarHeight">32</sys:Double>
<Thickness x:Key="TitleBarAfterMargin">0, 32, 0, 0</Thickness>
<sys:Double x:Key="ContentOpacity">0.85</sys:Double>
<Thickness x:Key="UnifyTitleBarAfterContentMargin">34, 30, 34, 0</Thickness>
<Thickness x:Key="ContentMargin">34, 0, 34, 0</Thickness>
<sys:Double x:Key="IconElementThemeHeight">16</sys:Double>
<Styles.Resources>
<Thickness x:Key="ScrollMargin">10 10 10 10</Thickness>
<Thickness x:Key="PageMargin">10 0 10 0</Thickness>
<Easing x:Key="FluentEasing">0.4,0,0.6,1</Easing>
<KeySpline x:Key="FluentKeySpline">0.4,0,0.6,1</KeySpline>
<sys:Double x:Key="TitleBarHeight">32</sys:Double>
<Thickness x:Key="TitleBarAfterMargin">0, 32, 0, 0</Thickness>
<sys:Double x:Key="ContentOpacity">0.85</sys:Double>
<Thickness x:Key="UnifyTitleBarAfterContentMargin">34, 30, 34, 0</Thickness>
<Thickness x:Key="ContentMargin">34, 0, 34, 0</Thickness>
<sys:Double x:Key="IconElementThemeHeight">16</sys:Double>

<sys:Char x:Key="PasswordChar">•</sys:Char>
</Styles.Resources>
<StyleInclude Source="/Application/UI/Styles/DrawingSvg.xaml" />
<sys:Char x:Key="PasswordChar">•</sys:Char>
<FontFamily x:Key="ContentControlThemeFontFamily">Null</FontFamily>
</Styles.Resources>
<StyleInclude Source="/Application/UI/Styles/DrawingSvg.xaml" />

<StyleInclude Source="/Application/UI/Styles/Controls/PathIcon.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/TitleBar.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/FontSizes.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Separator.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/TabControl.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/TextBox.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Border.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Button.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/NavigationView.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Menu.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/CheckBox.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/ListBox.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/DataGrid.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/DateTimePicker.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/ProgressBar.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/ToggleSwitch.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/PathIcon.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/TitleBar.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/FontSizes.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Separator.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/TabControl.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/TextBox.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Border.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Button.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/NavigationView.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/Menu.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/CheckBox.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/ListBox.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/DataGrid.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/DateTimePicker.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/ProgressBar.xaml" />
<StyleInclude Source="/Application/UI/Styles/Controls/ToggleSwitch.xaml" />

<StyleInclude Source="/Application/UI/Views/Controls/Badge.xaml" />
<StyleInclude Source="/Application/UI/Views/Controls/OptionsDisplayItem.xaml" />
<StyleInclude Source="/Application/UI/Views/Controls/CustomFilePicker.xaml" />
<StyleInclude Source="/Application/UI/Views/Controls/Badge.xaml" />
<StyleInclude Source="/Application/UI/Views/Controls/OptionsDisplayItem.xaml" />
<StyleInclude Source="/Application/UI/Views/Controls/CustomFilePicker.xaml" />

<StyleInclude Source="/Application/UI/Styles/Window.xaml" />
<StyleInclude Source="/Application/UI/Styles/Settings.xaml" />
<StyleInclude Source="/Application/UI/Styles/Window.xaml" />
<StyleInclude Source="/Application/UI/Styles/Settings.xaml" />
</Styles>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
xmlns:wnd="using:Avalonia.Controls">
<Design.PreviewWith />
<Styles.Resources>
<!--<FontFamily x:Key="ContentControlThemeFontFamily">Null</FontFamily>-->
<ControlTemplate x:Key="WindowTemplate" TargetType="{x:Type Window}">
<Panel>
<Border Name="PART_TransparencyFallback" IsHitTestVisible="False" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,24 @@
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="200"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:controls="using:System.Application.UI.Views.Controls"
xmlns:gif="using:AvaloniaGif"
x:Class="System.Application.UI.Views.Controls.CarouselBanner">
<Panel>
<Carousel Name="carousel" Grid.Column="1">
<Carousel Name="carousel"
Grid.Column="1">
<Carousel.PageTransition>
<PageSlide Duration="0.25" Orientation="Horizontal" />
</Carousel.PageTransition>
<controls:Banner/>
<controls:Banner/>
<controls:Banner/>
<Carousel.ItemTemplate>
<DataTemplate>
<Border>
<gif:Image2 FallbackSource="avares://System.Application.SteamTools.Client.Avalonia/Application/UI/Assets/AppResources/applogo.jpg"
Stretch="UniformToFill"/>
</Border>
</DataTemplate>
</Carousel.ItemTemplate>
</Carousel>
<Button Name="left"
<Button Name="left"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Background="Transparent"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
using Avalonia;
using Avalonia.Collections;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using Avalonia.Markup.Xaml;
using Avalonia.Threading;
using FluentAvalonia.Core;
using System.Collections;
using System.Linq;
using System.Threading;

Expand All @@ -22,6 +25,49 @@ public partial class CarouselBanner : UserControl
public static readonly StyledProperty<int> AutoScrollIntervalProperty =
AvaloniaProperty.Register<CarouselBanner, int>(nameof(AutoScrollInterval), 5000);

/// <summary>
/// Defines the Avalonia.Controls.ItemsControl.Items property.
/// </summary>
public static readonly DirectProperty<CarouselBanner, IEnumerable> ItemsProperty =
ItemsControl.ItemsProperty.AddOwner<CarouselBanner>(x => x.Items,
(x, v) => x.Items = v);

/// <summary>
/// Defines the Avalonia.Controls.ItemsControl.ItemTemplate property.
/// </summary>
public static readonly StyledProperty<IDataTemplate> ItemTemplateProperty =
AvaloniaProperty.Register<CarouselBanner, IDataTemplate>(nameof(ItemTemplate));

private IEnumerable _items = new AvaloniaList<object>();

/// <summary>
/// Gets or sets the items to display.
/// </summary>
public IEnumerable Items
{
get
{
return _items;
}

set
{
SetAndRaise(ItemsProperty, ref _items, value);
}
}

/// <summary>
/// Gets or sets the data template used to display the items in the control.
/// </summary>
public IDataTemplate ItemTemplate
{
get
{
return GetValue(ItemTemplateProperty);
}
set => SetValue(ItemTemplateProperty, value);
}

/// <summary>
/// AutoScroll
/// </summary>
Expand Down Expand Up @@ -85,6 +131,11 @@ public CarouselBanner()
}
});

this.GetObservable(ItemsProperty)
.Subscribe(x => _carousel.Items = x);

this.GetObservable(ItemTemplateProperty)
.Subscribe(x => _carousel.ItemTemplate = x);
}

private void InitializeComponent()
Expand All @@ -94,13 +145,17 @@ private void InitializeComponent()

private void SwipersLoad()
{
if (_carousel.ItemCount < 1)
return;
var arr = new bool[_carousel.ItemCount];
arr[_carousel.SelectedIndex] = true;
_swipers.Items = arr;
}

private void SwiperNext()
{
if (_carousel.ItemCount < 1)
return;
if (_carousel.SelectedIndex < _carousel.ItemCount - 1)
{
_carousel.Next();
Expand All @@ -113,6 +168,8 @@ private void SwiperNext()

private void SwiperPrevious()
{
if (_carousel.ItemCount < 1)
return;
if (_carousel.SelectedIndex > 0)
{
_carousel.Previous();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_SystemDefault,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_Light,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_Dark,Mode=OneWay,Source={x:Static resx:R.Current}}"/>
<!--<ComboBoxItem Content="{ReflectionBinding Path=Res.Settings_UI_HighContrast,Mode=OneWay,Source={x:Static resx:R.Current}}"/>-->
</ComboBox>
</DockPanel>
</Border>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<DockPanel>
<ScrollViewer HorizontalScrollBarVisibility="Disabled"
DockPanel.Dock="Top"
VerticalScrollBarVisibility="Auto">
VerticalScrollBarVisibility="Auto">
<StackPanel Margin="10 0"
Spacing="8">
<StackPanel Margin="0 15 0 0"
Expand Down Expand Up @@ -120,7 +120,7 @@
<Border DockPanel.Dock="Bottom"
VerticalAlignment="Bottom"
Height="150">
<controls:CarouselBanner/>
<controls:CarouselBanner />
</Border>
</DockPanel>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,25 @@ bool HitTestCaptionButtons(APoint pos)
return result;
}

bool HitTestMaximizeButton(APoint pos)
{
return SystemCaptionButtons?.HitTestMaxButton(pos) ?? default;
}
//bool HitTestMaximizeButton(APoint pos)
//{
// return SystemCaptionButtons?.HitTestMaxButton(pos) ?? default;
//}

void FakeMaximizeHover(bool hover)
{
SystemCaptionButtons?.FakeMaximizeHover(hover);
}
//void FakeMaximizeHover(bool hover)
//{
// SystemCaptionButtons?.FakeMaximizeHover(hover);
//}

void FakeMaximizePressed(bool pressed)
{
SystemCaptionButtons?.FakeMaximizePressed(pressed);
}
//void FakeMaximizePressed(bool pressed)
//{
// SystemCaptionButtons?.FakeMaximizePressed(pressed);
//}

void FakeMaximizeClick()
{
SystemCaptionButtons?.FakeMaximizeClick();
}
//void FakeMaximizeClick()
//{
// SystemCaptionButtons?.FakeMaximizeClick();
//}
}

partial interface ICoreWindow : IStyleable, IAvaloniaObject, INamed, IFocusScope, ILayoutRoot, ILayoutable, IVisual
Expand Down
Loading

0 comments on commit 32ffa2f

Please sign in to comment.