Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
pomianowski committed Mar 24, 2024
1 parent feba649 commit 1102641
Show file tree
Hide file tree
Showing 19 changed files with 125 additions and 81 deletions.
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ file_header_template = This Source Code Form is subject to the terms of the MIT

# this. and Me. preferences
dotnet_style_qualification_for_event = false:warning
dotnet_style_qualification_for_field = true:warning
dotnet_style_qualification_for_field = false:warning
dotnet_style_qualification_for_method = false:warning
dotnet_style_qualification_for_property = false:warning

Expand Down Expand Up @@ -388,9 +388,12 @@ dotnet_diagnostic.SA1633.severity = none
dotnet_diagnostic.SA1634.severity = none
dotnet_diagnostic.SA1652.severity = none

dotnet_diagnostic.IDE0009.severity = none

# Additional Stylecop Analyzers
dotnet_diagnostic.SA1111.severity = none
dotnet_diagnostic.SA1121.severity = none
dotnet_diagnostic.SA1204.severity = none
dotnet_diagnostic.SA1208.severity = none
dotnet_diagnostic.SA1518.severity = none
dotnet_diagnostic.SA1615.severity = none
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<PropertyGroup>
<Version>3.0.2</Version>
<Version>3.0.3</Version>
<LangVersion>12.0</LangVersion>
<Deterministic>true</Deterministic>
</PropertyGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui.Demo.Console/Wpf.Ui.Demo.Console.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Nullable>enable</Nullable>
<UseWPF>true</UseWPF>
<ApplicationIcon>wpfui.ico</ApplicationIcon>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui.Demo.Mvvm/Wpf.Ui.Demo.Mvvm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions src/Wpf.Ui.Demo.Simple/Wpf.Ui.Demo.Simple.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<ApplicationManifest>app.manifest</ApplicationManifest>
<ApplicationIcon>applicationIcon.ico</ApplicationIcon>
<Platforms>AnyCPU;x64</Platforms>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Extension.Template.Blank/Wpf.Ui.Blank.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="3.0.2" />
<PackageReference Include="WPF-UI" Version="3.0.3" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0 " />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2 "/>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="3.0.2" />
<PackageReference Include="WPF-UI" Version="3.0.3" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0 " />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2 "/>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Extension.Template.Fluent/Wpf.Ui.Fluent.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="WPF-UI" Version="3.0.2" />
<PackageReference Include="WPF-UI" Version="3.0.3" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2 "/>
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui.Extension/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="WPFUI.f1be4a7a-6073-492b-ac8c-dc46e836e926" Version="3.0.1" Language="en-US" Publisher="lepo.co" />
<Identity Id="WPFUI.f1be4a7a-6073-492b-ac8c-dc46e836e926" Version="3.0.3" Language="en-US" Publisher="lepo.co" />
<DisplayName>WPF UI</DisplayName>
<Description xml:space="preserve">WPF UI provides the Fluent experience in your known and loved WPF framework. Intuitive design, themes, navigation and new immersive controls. All natively and effortlessly.</Description>
<MoreInfo>https://github.com/lepoco/wpfui</MoreInfo>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ public partial class EditorWindowViewModel : ObservableObject
private int _progress = 70;

[ObservableProperty]
private string _currentlyOpenedFile = String.Empty;
private string _currentlyOpenedFile = string.Empty;

[ObservableProperty]
private Visibility _statusBarVisibility = Visibility.Visible;

[RelayCommand]
public void OnStatusBarAction(string value)
{
if (String.IsNullOrEmpty(value))
if (string.IsNullOrEmpty(value))
{
return;

switch (value) { }
}
}
}
1 change: 1 addition & 0 deletions src/Wpf.Ui.Gallery/Wpf.Ui.Gallery.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<RootNamespace>Wpf.Ui.Gallery</RootNamespace>
<Platforms>AnyCPU;x64;x86</Platforms>
<SupportedOSPlatformVersion>10.0.18362.0</SupportedOSPlatformVersion>
<NoWarn>$(NoWarn);SA1601</NoWarn>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion src/Wpf.Ui/Controls/AutoSuggestBox/AutoSuggestBox.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private void TextBoxOnPreviewKeyDown(object sender, KeyEventArgs e)
return;
}

_ = SuggestionsList.Focus();
_ = SuggestionsList?.Focus();
}

private void TextBoxOnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
Expand Down
59 changes: 32 additions & 27 deletions src/Wpf.Ui/Controls/DynamicScrollViewer/DynamicScrollViewer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ namespace Wpf.Ui.Controls;
/// <summary>
/// Custom <see cref="System.Windows.Controls.ScrollViewer"/> with events depending on actions taken by the user.
/// </summary>
//[ToolboxItem(true)]
//[ToolboxBitmap(typeof(DynamicScrollViewer), "DynamicScrollViewer.bmp")]
// [ToolboxItem(true)]
// [ToolboxBitmap(typeof(DynamicScrollViewer), "DynamicScrollViewer.bmp")]
[DefaultEvent("ScrollChangedEvent")]
public class DynamicScrollViewer : PassiveScrollViewer
{
Expand Down Expand Up @@ -70,7 +70,7 @@ public class DynamicScrollViewer : PassiveScrollViewer
);

/// <summary>
/// Gets or sets information whether the user was scrolling vertically for the last few seconds.
/// Gets or sets a value indicating whether the user was scrolling vertically for the last few seconds.
/// </summary>
public bool IsScrollingVertically
{
Expand All @@ -79,7 +79,7 @@ public bool IsScrollingVertically
}

/// <summary>
/// Gets or sets information whether the user was scrolling horizontally for the last few seconds.
/// Gets or sets a value indicating whether the user was scrolling horizontally for the last few seconds.
/// </summary>
public bool IsScrollingHorizontally
{
Expand All @@ -105,16 +105,6 @@ public int Timeout
set => SetValue(TimeoutProperty, value);
}

//protected override void OnPreviewMouseWheel(MouseWheelEventArgs e)
//{
// base.OnPreviewMouseWheel(e);
//}

//protected override void OnKeyDown(KeyEventArgs e)
//{
// base.OnKeyDown(e);
//}

/// <summary>
/// OnScrollChanged is an override called whenever scrolling state changes on this <see cref="DynamicScrollViewer"/>.
/// </summary>
Expand All @@ -127,16 +117,15 @@ protected override void OnScrollChanged(ScrollChangedEventArgs e)
{
base.OnScrollChanged(e);

//#if DEBUG
// System.Diagnostics.Debug.WriteLine($"DEBUG | {typeof(DynamicScrollBar)}.{nameof(e.VerticalChange)} - {e.VerticalChange}", "WPFUI");
// System.Diagnostics.Debug.WriteLine($"DEBUG | {typeof(DynamicScrollBar)}.{nameof(e.HorizontalChange)} - {e.HorizontalChange}", "WPFUI");
//#endif

if (e.HorizontalChange > _minimalChange || e.HorizontalChange < -_minimalChange)
{
UpdateHorizontalScrollingState();
}

if (e.VerticalChange > _minimalChange || e.VerticalChange < -_minimalChange)
{
UpdateVerticalScrollingState();
}
}

private async void UpdateVerticalScrollingState()
Expand All @@ -146,17 +135,22 @@ private async void UpdateVerticalScrollingState()
// If more than Timeout has passed since the last event, there is no interaction.
// We pass this value to the ScrollBar and link it to IsMouseOver.
// This way we have a dynamic scrollbar that responds to scroll / mouse over.

var currentEvent = _verticalIdentifier.GetNext();
long currentEvent = _verticalIdentifier.GetNext();

if (!_scrollingVertically)
IsScrollingVertically = true;
{
SetCurrentValue(IsScrollingVerticallyProperty, true);
}

if (_timeout > -1)
{
await Task.Delay(_timeout < 10000 ? _timeout : 1000);
}

if (_verticalIdentifier.IsEqual(currentEvent) && _scrollingVertically)
IsScrollingVertically = false;
{
SetCurrentValue(IsScrollingVerticallyProperty, false);
}
}

private async void UpdateHorizontalScrollingState()
Expand All @@ -166,16 +160,19 @@ private async void UpdateHorizontalScrollingState()
// If more than Timeout has passed since the last event, there is no interaction.
// We pass this value to the ScrollBar and link it to IsMouseOver.
// This way we have a dynamic scrollbar that responds to scroll / mouse over.

var currentEvent = _horizontalIdentifier.GetNext();
long currentEvent = _horizontalIdentifier.GetNext();

if (!_scrollingHorizontally)
IsScrollingHorizontally = true;
{
SetCurrentValue(IsScrollingHorizontallyProperty, true);
}

await Task.Delay(Timeout < 10000 ? Timeout : 1000);

if (_horizontalIdentifier.IsEqual(currentEvent) && _scrollingHorizontally)
IsScrollingHorizontally = false;
{
SetCurrentValue(IsScrollingHorizontallyProperty, false);
}
}

private static void IsScrollingVerticallyProperty_OnChanged(
Expand All @@ -184,7 +181,9 @@ DependencyPropertyChangedEventArgs e
)
{
if (d is not DynamicScrollViewer scroll)
{
return;
}

scroll._scrollingVertically = scroll.IsScrollingVertically;
}
Expand All @@ -195,7 +194,9 @@ DependencyPropertyChangedEventArgs e
)
{
if (d is not DynamicScrollViewer scroll)
{
return;
}

scroll._scrollingHorizontally = scroll.IsScrollingHorizontally;
}
Expand All @@ -206,15 +207,19 @@ DependencyPropertyChangedEventArgs e
)
{
if (d is not DynamicScrollViewer scroll)
{
return;
}

scroll._minimalChange = scroll.MinimalChange;
}

private static void TimeoutProperty_OnChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is not DynamicScrollViewer scroll)
{
return;
}

scroll._timeout = scroll.Timeout;
}
Expand Down
Loading

0 comments on commit 1102641

Please sign in to comment.