mirror of
https://jihulab.com/DGP-Studio/Snap.Hutao.git
synced 2025-11-19 21:02:53 +08:00
infobar view optimization
This commit is contained in:
@@ -45,6 +45,6 @@ internal sealed class InfoBarService : IInfoBarService
|
|||||||
await taskContext.SwitchToMainThreadAsync();
|
await taskContext.SwitchToMainThreadAsync();
|
||||||
|
|
||||||
ArgumentNullException.ThrowIfNull(collection);
|
ArgumentNullException.ThrowIfNull(collection);
|
||||||
collection.Add(builder.Options);
|
collection.Insert(0, builder.Options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -21,7 +21,7 @@ internal struct Bgra32
|
|||||||
A = a;
|
A = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly double Luminance { get => ((0.299 * R) + (0.587 * G) + (0.114 * B)) / 255; }
|
public readonly double Luminance { get => ((0.2126 * R) + (0.7152 * G) + (0.0722 * B)) / 255; }
|
||||||
|
|
||||||
public static unsafe implicit operator Bgra32(Color color)
|
public static unsafe implicit operator Bgra32(Color color)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -37,9 +37,9 @@ internal struct Rgba32
|
|||||||
A = a;
|
A = a;
|
||||||
}
|
}
|
||||||
|
|
||||||
public readonly double Luminance { get => ((0.299 * R) + (0.587 * G) + (0.114 * B)) / 255; }
|
public readonly double Luminance { get => Luminance255 / 255; }
|
||||||
|
|
||||||
public readonly double Luminance255 { get => (0.299 * R) + (0.587 * G) + (0.114 * B); }
|
public readonly double Luminance255 { get => (0.2126 * R) + (0.7152 * G) + (0.0722 * B); }
|
||||||
|
|
||||||
public static unsafe implicit operator Color(Rgba32 rgba32)
|
public static unsafe implicit operator Color(Rgba32 rgba32)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,53 +18,6 @@
|
|||||||
|
|
||||||
<UserControl.Resources>
|
<UserControl.Resources>
|
||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.ThemeDictionaries>
|
|
||||||
<ResourceDictionary x:Key="Light">
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarErrorSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#FDE7E9"
|
|
||||||
TintColor="#FDE7E9"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarWarningSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#FFF4CE"
|
|
||||||
TintColor="#FFF4CE"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarSuccessSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#DFF6DD"
|
|
||||||
TintColor="#DFF6DD"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarInformationalSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#80F6F6F6"
|
|
||||||
TintColor="#80F6F6F6"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
</ResourceDictionary>
|
|
||||||
<ResourceDictionary x:Key="Dark">
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarErrorSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#442726"
|
|
||||||
TintColor="#442726"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarWarningSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#433519"
|
|
||||||
TintColor="#433519"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarSuccessSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#393D1B"
|
|
||||||
TintColor="#393D1B"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
<AcrylicBrush
|
|
||||||
x:Key="InfoBarInformationalSeverityBackgroundBrush"
|
|
||||||
FallbackColor="#34424d"
|
|
||||||
TintColor="#34424d"
|
|
||||||
TintOpacity="0.6"/>
|
|
||||||
</ResourceDictionary>
|
|
||||||
</ResourceDictionary.ThemeDictionaries>
|
|
||||||
|
|
||||||
<DataTemplate x:Key="InfoBarTemplate" x:DataType="shsn:InfoBarOptions">
|
<DataTemplate x:Key="InfoBarTemplate" x:DataType="shsn:InfoBarOptions">
|
||||||
<InfoBar
|
<InfoBar
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
@@ -212,14 +165,14 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<ScrollViewer Grid.Row="1">
|
<ScrollView Grid.Row="1">
|
||||||
<ItemsControl
|
<ItemsControl
|
||||||
MaxWidth="480"
|
MaxWidth="480"
|
||||||
ItemContainerTransitions="{StaticResource AddDeleteThemeTransitions}"
|
ItemContainerTransitions="{StaticResource AddDeleteThemeTransitions}"
|
||||||
ItemTemplateSelector="{StaticResource InfoBarTemplateSelector}"
|
ItemTemplateSelector="{StaticResource InfoBarTemplateSelector}"
|
||||||
ItemsPanel="{StaticResource StackPanelSpacing8Template}"
|
ItemsPanel="{StaticResource StackPanelSpacing8Template}"
|
||||||
ItemsSource="{Binding InfoBars, Mode=OneWay}"/>
|
ItemsSource="{Binding InfoBars, Mode=OneWay}"/>
|
||||||
</ScrollViewer>
|
</ScrollView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ internal sealed partial class InfoBarView : UserControl
|
|||||||
while (InfoBars.Count > 0)
|
while (InfoBars.Count > 0)
|
||||||
{
|
{
|
||||||
InfoBars.RemoveAt(0);
|
InfoBars.RemoveAt(0);
|
||||||
await Task.Delay(150).ConfigureAwait(true);
|
await Task.Delay(100).ConfigureAwait(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user