Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore: Apply JetBrains Rider code style & cleanup #2586

Merged
merged 4 commits into from
Dec 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Source/GlobalAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
[assembly: AssemblyCulture("")]

[assembly: AssemblyVersion("2023.12.9.0")]
[assembly: AssemblyFileVersion("2023.12.9.0")]
[assembly: AssemblyFileVersion("2023.12.9.0")]
16 changes: 9 additions & 7 deletions Source/NETworkManager.Controls/MultiSelectDataGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ namespace NETworkManager.Controls;

public class MultiSelectDataGrid : DataGrid
{
public static readonly DependencyProperty SelectedItemsListProperty =
DependencyProperty.Register("SelectedItemsList", typeof(IList), typeof(MultiSelectDataGrid),
new PropertyMetadata(null));

public MultiSelectDataGrid()
{
SelectionChanged += DataGridMultiItemSelect_SelectionChanged;
}

private void DataGridMultiItemSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedItemsList = SelectedItems;
}

public IList SelectedItemsList
{
get => (IList)GetValue(SelectedItemsListProperty);
set => SetValue(SelectedItemsListProperty, value);
}

public static readonly DependencyProperty SelectedItemsListProperty = DependencyProperty.Register("SelectedItemsList", typeof(IList), typeof(MultiSelectDataGrid), new PropertyMetadata(null));
}
private void DataGridMultiItemSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedItemsList = SelectedItems;
}
}
14 changes: 8 additions & 6 deletions Source/NETworkManager.Controls/MultiSelectScrollingDataGrid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,25 @@ namespace NETworkManager.Controls;

public class MultiSelectScrollingDataGrid : DataGrid
{
public static readonly DependencyProperty SelectedItemsListProperty =
DependencyProperty.Register("SelectedItemsList", typeof(IList), typeof(MultiSelectScrollingDataGrid),
new PropertyMetadata(null));

public MultiSelectScrollingDataGrid()
{
SelectionChanged += DataGridMultiItemSelect_SelectionChanged;
}

private void DataGridMultiItemSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedItemsList = SelectedItems;
}

public IList SelectedItemsList
{
get => (IList)GetValue(SelectedItemsListProperty);
set => SetValue(SelectedItemsListProperty, value);
}

public static readonly DependencyProperty SelectedItemsListProperty = DependencyProperty.Register("SelectedItemsList", typeof(IList), typeof(MultiSelectScrollingDataGrid), new PropertyMetadata(null));
private void DataGridMultiItemSelect_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
SelectedItemsList = SelectedItems;
}

protected override void OnItemsChanged(NotifyCollectionChangedEventArgs e)
{
Expand Down
32 changes: 16 additions & 16 deletions Source/NETworkManager.Controls/NETworkManager.Controls.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<ProjectGuid>{95EA884C-E498-4A47-A316-DC890BF7F0D2}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>NETworkManager.Controls</RootNamespace>
<AssemblyName>NETworkManager.Controls</AssemblyName>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
<SelfContained>false</SelfContained>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyInfo.cs" Link="Properties\GlobalAssemblyInfo.cs" />
</ItemGroup>
<PropertyGroup>
<ProjectGuid>{95EA884C-E498-4A47-A316-DC890BF7F0D2}</ProjectGuid>
<OutputType>Library</OutputType>
<RootNamespace>NETworkManager.Controls</RootNamespace>
<AssemblyName>NETworkManager.Controls</AssemblyName>
<TargetFramework>net8.0-windows10.0.17763.0</TargetFramework>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PlatformTarget>x64</PlatformTarget>
<SelfContained>false</SelfContained>
<UseWPF>true</UseWPF>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\GlobalAssemblyInfo.cs" Link="Properties\GlobalAssemblyInfo.cs"/>
</ItemGroup>
</Project>
10 changes: 3 additions & 7 deletions Source/NETworkManager.Controls/ObservableSetCollection.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
using System.Collections.Generic;
using System.Collections.ObjectModel;


namespace NETworkManager.Controls;

public class ObservableSetCollection<T> : ObservableCollection<T>
{
{
public ObservableSetCollection()
{

}

public ObservableSetCollection(List<T> list) : base(list)
public ObservableSetCollection(List<T> list) : base(list)
{

}

public ObservableSetCollection(IEnumerable<T> collection) : base(collection)
{

}

protected override void InsertItem(int index, T item)
Expand All @@ -31,7 +27,7 @@ protected override void InsertItem(int index, T item)

protected override void SetItem(int index, T item)
{
int i = IndexOf(item);
var i = IndexOf(item);

if (i >= 0 && i != index)
return; // Item already exists
Expand Down
2 changes: 1 addition & 1 deletion Source/NETworkManager.Controls/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
[assembly: AssemblyDescription("Library contains NETworkManager controls.")]
[assembly: AssemblyProduct("NETworkManager.Controls")]
[assembly: ComVisible(false)]
[assembly: Guid("95ea884c-e498-4a47-a316-dc890bf7f0d2")]
[assembly: Guid("95ea884c-e498-4a47-a316-dc890bf7f0d2")]
13 changes: 6 additions & 7 deletions Source/NETworkManager.Converters/AccentToStringConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,29 @@
using System.Globalization;
using System.Windows.Data;
using NETworkManager.Localization;
using NETworkManager.Settings;

namespace NETworkManager.Converters;

/// <summary>
/// Convert <see cref="AccentColorInfo"/> to translated <see cref="string"/> or wise versa.
/// Convert <see cref="AccentColorInfo" /> to translated <see cref="string" /> or wise versa.
/// </summary>
public sealed class AccentToStringConverter : IValueConverter
{
/// <summary>
/// Convert <see cref="AccentColorInfo"/> to translated <see cref="string"/>.
/// Convert <see cref="AccentColorInfo" /> to translated <see cref="string" />.
/// </summary>
/// <param name="value">Object from type <see cref="AccentColorInfo"/>.</param>
/// <param name="value">Object from type <see cref="AccentColorInfo" />.</param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns>Translated <see cref="AccentColorInfo"/>.</returns>
/// <returns>Translated <see cref="AccentColorInfo" />.</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is not string accent ? "-/-" : ResourceTranslator.Translate(ResourceIdentifier.Accent, accent);
}

/// <summary>
/// !!! Method not implemented !!!
/// !!! Method not implemented !!!
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
Expand All @@ -36,4 +35,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
namespace NETworkManager.Converters;

/// <summary>
/// Convert <see cref="ApplicationName"/> to icon (<see cref="Canvas"/>) or wise versa.
/// Convert <see cref="ApplicationName" /> to icon (<see cref="Canvas" />) or wise versa.
/// </summary>
public sealed class ApplicationNameToIconConverter : IValueConverter
{
/// <summary>
/// Convert <see cref="ApplicationName"/> to icon (<see cref="Canvas"/>).
/// Convert <see cref="ApplicationName" /> to icon (<see cref="Canvas" />).
/// </summary>
/// <param name="value">Object from type <see cref="ApplicationName"/>.</param>
/// <param name="value">Object from type <see cref="ApplicationName" />.</param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
Expand All @@ -23,9 +23,9 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
{
return value is not ApplicationName name ? null : ApplicationManager.GetIcon(name);
}

/// <summary>
/// !!! Method not implemented !!!
/// !!! Method not implemented !!!
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
Expand All @@ -36,4 +36,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
using NETworkManager.Models;
using System;
using System;
using System.Globalization;
using System.Windows.Data;
using NETworkManager.Localization;
using NETworkManager.Models;

namespace NETworkManager.Converters;

/// <summary>
/// Convert <see cref="ApplicationName"/> to translated <see cref="string"/> or wise versa.
/// Convert <see cref="ApplicationName" /> to translated <see cref="string" /> or wise versa.
/// </summary>
public sealed class ApplicationNameToTranslatedStringConverter : IValueConverter
{
/// <summary>
/// Convert <see cref="ApplicationName"/> to translated <see cref="string"/>.
/// Convert <see cref="ApplicationName" /> to translated <see cref="string" />.
/// </summary>
/// <param name="value">Object from type <see cref="ApplicationName"/>.</param>
/// <param name="value">Object from type <see cref="ApplicationName" />.</param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns>Translated <see cref="ApplicationName"/>.</returns>
/// <returns>Translated <see cref="ApplicationName" />.</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is not ApplicationName name
? "-/-"
: ResourceTranslator.Translate(ResourceIdentifier.ApplicationName, name);
}

/// <summary>
/// !!! Method not implemented !!!
/// !!! Method not implemented !!!
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
Expand All @@ -38,4 +38,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
namespace NETworkManager.Converters;

/// <summary>
/// Convert <see cref="TimeUnit"/> to translated <see cref="string"/> or wise versa.
/// Convert <see cref="TimeUnit" /> to translated <see cref="string" /> or wise versa.
/// </summary>
public sealed class AutoRefreshTimeToStringConverter : IValueConverter
{
/// <summary>
/// Convert <see cref="TimeUnit"/> to translated <see cref="string"/>.
/// Convert <see cref="TimeUnit" /> to translated <see cref="string" />.
/// </summary>
/// <param name="value">Object from type <see cref="TimeUnit"/>.</param>
/// <param name="value">Object from type <see cref="TimeUnit" />.</param>
/// <param name="targetType"></param>
/// <param name="parameter"></param>
/// <param name="culture"></param>
/// <returns>Translated <see cref="TimeUnit"/>.</returns>
/// <returns>Translated <see cref="TimeUnit" />.</returns>
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value is not TimeUnit timeUnit
Expand All @@ -27,7 +27,7 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
}

/// <summary>
/// !!! Method not implemented !!!
/// !!! Method not implemented !!!
/// </summary>
/// <param name="value"></param>
/// <param name="targetType"></param>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ public sealed class BandwidthBytesToSpeedConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
return value != null ? $"{FileSizeConverter.GetBytesReadable((long)value * 8)}it/s ({FileSizeConverter.GetBytesReadable((long)value)}/s)" : "-/-";
return value != null
? $"{FileSizeConverter.GetBytesReadable((long)value * 8)}it/s ({FileSizeConverter.GetBytesReadable((long)value)}/s)"
: "-/-";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ public object Convert(object value, Type targetType, object parameter, CultureIn
if (DesignerProperties.GetIsInDesignMode(new DependencyObject()))
return "-/-";

return value != null ? ((BigInteger) value).ToString() : "-/-";
return value != null ? ((BigInteger)value).ToString() : "-/-";
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ public object ConvertBack(object value, Type targetType, object parameter, Cultu
{
throw new NotImplementedException();
}
}
}
9 changes: 5 additions & 4 deletions Source/NETworkManager.Converters/BooleanToStringConverter.cs
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
using System;
using System.Globalization;
using System.Windows.Data;
using NETworkManager.Localization.Resources;

namespace NETworkManager.Converters;

public sealed class BooleanToStringConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value != null && (bool) value)
return Localization.Resources.Strings.Yes;
if (value != null && (bool)value)
return Strings.Yes;

return Localization.Resources.Strings.No;
return Strings.No;
}

public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
throw new NotImplementedException();
}
}
}
Loading