Skip to content

Commit

Permalink
Update TitleBar to allow Larger Content
Browse files Browse the repository at this point in the history
Update packages
  • Loading branch information
ChrisPulman committed Oct 1, 2024
1 parent fe79638 commit a3ebbb6
Show file tree
Hide file tree
Showing 11 changed files with 37 additions and 37 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
<!--<Compile Update="**\*.cs" DependentUpon="I%(Filename).cs" />-->
<PackageReference Include="Nerdbank.GitVersioning" Version="3.6.143" PrivateAssets="all" Condition="!Exists('packages.config')" />
<PackageReference Include="stylecop.analyzers" Version="1.2.0-beta.556" PrivateAssets="all" />
<PackageReference Include="Roslynator.Analyzers" Version="4.12.5" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="4.12.7" PrivateAssets="All" />
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
</ItemGroup>
</Project>
4 changes: 0 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
{
"sdk": {
"version": "8.0.10",
"rollForward": "latestFeature"
},
"msbuild-sdks": {
"MSBuild.Sdk.Extras": "3.0.44"
}
Expand Down
4 changes: 2 additions & 2 deletions src/CrissCross.WPF.Plot/CrissCross.WPF.Plot.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="AppBarButton.WPF" Version="1.0.1" />
<PackageReference Include="AppBarButton.WPF" Version="1.0.2" />
<PackageReference Include="ReactiveList" Version="2.0.3" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" PrivateAssets="all" />
<PackageReference Include="ReactiveUI.SourceGenerators" Version="1.1.31" PrivateAssets="all" />
<PackageReference Include="ScottPlot.WPF" Version="5.0.39" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="Polyfill" Version="6.9.0">
<PackageReference Include="Polyfill" Version="6.12.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
Expand Down
5 changes: 4 additions & 1 deletion src/CrissCross.WPF.UI.CC_Nav.Test/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
mc:Ignorable="d">
<ui:FluentNavigationWindow.TitleContent>
<StackPanel ui:MarginSetter.Margin="5,0" Orientation="Horizontal">
<ui:Button x:Name="NavBack" Content="Back" />
<ui:Button
x:Name="NavBack"
Height="80"
Content="Back" />
</StackPanel>
</ui:FluentNavigationWindow.TitleContent>
<ui:FluentNavigationWindow.TopContent>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void CalDisplay_SelectedDatesChanged(object? sender, EventArgs e)
var hours = (Hours?.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "0";
var minutes = (Min?.SelectedItem as ComboBoxItem)?.Content?.ToString() ?? "0";
var timeSpan = TimeSpan.Parse(hours + ":" + minutes);
if (CalDisplay.SelectedDate.Value.Date == DateTime.Today.Date && timeSpan.CompareTo(DateTime.Now.TimeOfDay) < 0)
if (CalDisplay.SelectedDate!.Value.Date == DateTime.Today.Date && timeSpan.CompareTo(DateTime.Now.TimeOfDay) < 0)
{
timeSpan = TimeSpan.FromHours(DateTime.Now.Hour + 1);
}
Expand All @@ -134,14 +134,10 @@ private void SaveTime_Click(object sender, RoutedEventArgs e)
PopUpCalendarButton.IsChecked = false;
}

private void Time_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
CalDisplay_SelectedDatesChanged(sender, e);
}
private void Time_SelectionChanged(object sender, SelectionChangedEventArgs e) => CalDisplay_SelectedDatesChanged(sender, e);

private void CalDisplay_PreviewMouseUp(object sender, MouseButtonEventArgs e)
{
// that it's not necessary to click twice after opening the calendar https://stackoverflow.com/q/6024372
if (Mouse.Captured is CalendarItem)
{
Mouse.Capture(null);
Expand Down
37 changes: 19 additions & 18 deletions src/CrissCross.WPF.UI/Controls/GifImage/ImageBehavior.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

using System.IO;
using System.IO.Packaging;
using System.Net;
using System.Net.Http;
using System.Text;
using System.Windows.Markup;
using System.Windows.Media.Animation;
Expand Down Expand Up @@ -557,7 +557,7 @@ private static void AnimateInDesignModeChanged(DependencyObject o, DependencyPro
}
}

private static void InitAnimationOrImage(Image imageControl)
private static async void InitAnimationOrImage(Image imageControl)
{
var controller = GetAnimationController(imageControl);
controller?.Dispose();
Expand Down Expand Up @@ -597,7 +597,7 @@ void Handler(object? sender, EventArgs args)
return;
}

var animation = GetAnimation(imageControl, source);
var animation = await GetAnimationAsync(imageControl, source);
if (animation != null)
{
if (animation.KeyFrames.Count > 0)
Expand Down Expand Up @@ -626,21 +626,22 @@ void Handler(object? sender, EventArgs args)
}
}

private static ObjectAnimationUsingKeyFrames? GetAnimation(Image imageControl, BitmapSource source)
private static async Task<ObjectAnimationUsingKeyFrames?> GetAnimationAsync(Image imageControl, BitmapSource source)
{
var cacheEntry = AnimationCache.Get(source);
if (cacheEntry == null)
{
if (GetDecoder(source, imageControl, out var gifMetadata) is GifBitmapDecoder decoder && decoder.Frames.Count > 1)
var (bitmapDecoder, gifFile) = await GetDecoderAsync(source, imageControl);
if (bitmapDecoder is GifBitmapDecoder decoder && decoder.Frames.Count > 1)
{
var fullSize = GetFullSize(decoder, gifMetadata!);
var fullSize = GetFullSize(decoder, gifFile!);
var index = 0;
var keyFrames = new ObjectKeyFrameCollection();
var totalDuration = TimeSpan.Zero;
BitmapSource? baseFrame = null;
foreach (var rawFrame in decoder.Frames)
{
var metadata = GetFrameMetadata(decoder, gifMetadata!, index);
var metadata = GetFrameMetadata(decoder, gifFile!, index);

var frame = MakeFrame(fullSize, rawFrame, metadata, baseFrame!);
var keyFrame = new DiscreteObjectKeyFrame(frame, totalDuration);
Expand Down Expand Up @@ -673,7 +674,7 @@ void Handler(object? sender, EventArgs args)
index++;
}

var repeatCount = GetRepeatCountFromMetadata(decoder, gifMetadata!);
var repeatCount = GetRepeatCountFromMetadata(decoder, gifFile!);
cacheEntry = new AnimationCacheEntry(keyFrames, totalDuration, repeatCount);
AnimationCache.Add(source, cacheEntry);
}
Expand Down Expand Up @@ -729,7 +730,7 @@ private static double GetActualSpeedRatio(Image imageControl, Duration naturalDu
return 1.0;
}

private static BitmapSource ClearArea(BitmapSource frame, FrameMetadata metadata)
private static WriteableBitmap ClearArea(BitmapSource frame, FrameMetadata metadata)
{
var visual = new DrawingVisual();
using (var context = visual.RenderOpen())
Expand Down Expand Up @@ -782,17 +783,17 @@ private static bool IsLoadingDeferred(BitmapSource source, Image imageControl)
return false;
}

if (bmp.UriSource != null && !bmp.UriSource.IsAbsoluteUri)
if (bmp.UriSource?.IsAbsoluteUri == false)
{
return bmp.BaseUri == null && (imageControl as IUriContext)?.BaseUri == null;
}

return false;
}

private static BitmapDecoder GetDecoder(BitmapSource image, Image imageControl, out GifFile? gifFile)
private static async Task<(BitmapDecoder bitmapDecoder, GifFile gifFile)> GetDecoderAsync(BitmapSource image, Image imageControl)
{
gifFile = null;
GifFile? gifFile = default;
BitmapDecoder? decoder = null;
Stream? stream = null;
Uri? uri = null;
Expand Down Expand Up @@ -831,7 +832,7 @@ private static BitmapDecoder GetDecoder(BitmapSource image, Image imageControl,
stream.Position = 0;
decoder = BitmapDecoder.Create(stream, createOptions, BitmapCacheOption.OnLoad);
}
else if (uri != null && uri.IsAbsoluteUri)
else if (uri?.IsAbsoluteUri == true)
{
decoder = BitmapDecoder.Create(uri, createOptions, BitmapCacheOption.OnLoad);
}
Expand All @@ -846,7 +847,7 @@ private static BitmapDecoder GetDecoder(BitmapSource image, Image imageControl,
}
else if (uri != null)
{
gifFile = DecodeGifFile(uri);
gifFile = await DecodeGifFileAsync(uri);
}
else
{
Expand All @@ -859,7 +860,7 @@ private static BitmapDecoder GetDecoder(BitmapSource image, Image imageControl,
throw new InvalidOperationException("Can't get a decoder from the source. AnimatedSource should be either a BitmapImage or a BitmapFrame.");
}

return decoder;
return (decoder, gifFile!);
}

private static bool CanReadNativeMetadata(BitmapDecoder decoder)
Expand All @@ -875,7 +876,7 @@ private static bool CanReadNativeMetadata(BitmapDecoder decoder)
}
}

private static GifFile? DecodeGifFile(Uri uri)
private static async Task<GifFile?> DecodeGifFileAsync(Uri uri)
{
Stream? stream = default;
if (uri.Scheme == PackUriHelper.UriSchemePack)
Expand All @@ -897,8 +898,8 @@ private static bool CanReadNativeMetadata(BitmapDecoder decoder)
}
else
{
var wc = new WebClient();
stream = wc.OpenRead(uri);
using var httpClient = new HttpClient();
stream = await httpClient.GetStreamAsync(uri);
}

if (stream != null)
Expand Down
2 changes: 1 addition & 1 deletion src/CrissCross.WPF.UI/Controls/TitleBar/TitleBar.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
<Setter Property="HorizontalAlignment" Value="Stretch" />
<Setter Property="Padding" Value="16,4,16,4" />
<!--<Setter Property="FontSize" Value="12" />-->
<Setter Property="Height" Value="48" />
<Setter Property="MinHeight" Value="48" />
<Setter Property="FontWeight" Value="Normal" />
<Setter Property="Focusable" Value="False" />
<Setter Property="VerticalContentAlignment" Value="Stretch" />
Expand Down
6 changes: 5 additions & 1 deletion src/CrissCross.WPF.UI/CrissCross.WPF.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
<Reference Include="System.Windows.Forms" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net4'))">
<PackageReference Include="System.Net.Http" Version="4.3.4" />
</ItemGroup>

<ItemGroup>
<Resource Include="Images\*.png" />
<Resource Include="Resources\Fonts\FluentSystemIcons-Filled.ttf" />
Expand All @@ -25,7 +29,7 @@
<PackageReference Include="ReactiveList" Version="2.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="ReactiveMarbles.ObservableEvents.SourceGenerator" Version="1.3.1" />
<PackageReference Include="AppBarButton.WPF" Version="1.0.1" />
<PackageReference Include="AppBarButton.WPF" Version="1.0.2" />
<PackageReference Include="BBCode.WPF" Version="0.2.0" />
<PackageReference Include="CP.Xaml.Converters" Version="1.0.2" />
<PackageReference Include="Microsoft.Xaml.Behaviors.Wpf" Version="1.1.135" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<ItemGroup>
<ProjectReference Include="..\CrissCross.WPF.WebView2\CrissCross.WPF.WebView2.csproj" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2739.15" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
</ItemGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/CrissCross.WPF.WebView2/CrissCross.WPF.WebView2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2739.15" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/CrissCross.WPF/CrissCross.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<ItemGroup>
<PackageReference Include="CompiledBindings.WPF" Version="1.0.18" />
<PackageReference Include="ReactiveUI.WPF" Version="$(ReactiveUIVersion)" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2739.15" />
<PackageReference Include="Microsoft.Web.WebView2" Version="1.0.2792.45" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462' Or '$(TargetFramework)' == 'net472' Or '$(TargetFramework)' == 'net48'">
Expand Down

0 comments on commit a3ebbb6

Please sign in to comment.