Skip to content

Commit

Permalink
Format code
Browse files Browse the repository at this point in the history
  • Loading branch information
SlimeNull committed Aug 1, 2024
1 parent 6240f53 commit 67cdc4c
Show file tree
Hide file tree
Showing 5 changed files with 221 additions and 247 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
Expand All @@ -7,49 +7,40 @@
using System.Threading.Tasks;
using System.Windows.Media;

namespace EleCho.WpfSuite
{
/// <summary>
/// <see cref="WindowOptionColor"/> converter
/// </summary>
public class WindowOptionColorConverter : TypeConverter
{
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType)
{
if (sourceType == typeof(string) ||
sourceType == typeof(Color))
return true;
namespace EleCho.WpfSuite {
/// <summary>
/// <see cref="WindowOptionColor"/> converter
/// </summary>
public class WindowOptionColorConverter : TypeConverter {
/// <inheritdoc/>
public override bool CanConvertFrom(ITypeDescriptorContext? context, Type sourceType) {
if (sourceType == typeof(string) ||
sourceType == typeof(Color))
return true;

return base.CanConvertFrom(context, sourceType);
}
return base.CanConvertFrom(context, sourceType);
}

/// <inheritdoc/>
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value)
{
if (value is string stringValue)
{
if (stringValue.Equals(nameof(WindowOptionColor.Default), StringComparison.OrdinalIgnoreCase))
{
return WindowOptionColor.Default;
}
else if (stringValue.Equals(nameof(WindowOptionColor.None), StringComparison.OrdinalIgnoreCase))
{
return WindowOptionColor.None;
}
else if (ColorConverter.ConvertFromString(stringValue) is Color color)
{
color.A = 0xFF;
return (WindowOptionColor)color;
}
}
else if (value is Color colorValue)
{
colorValue.A = 0xFF;
return (WindowOptionColor)colorValue;
}
/// <inheritdoc/>
public override object? ConvertFrom(ITypeDescriptorContext? context, CultureInfo? culture, object value) {
if (value is string stringValue) {
if (stringValue.Equals(nameof(WindowOptionColor.Default), StringComparison.OrdinalIgnoreCase)) {
return WindowOptionColor.Default;
}
else if (stringValue.Equals(nameof(WindowOptionColor.None), StringComparison.OrdinalIgnoreCase)) {
return WindowOptionColor.None;
}
else if (ColorConverter.ConvertFromString(stringValue) is Color color) {
color.A = 0xFF;
return (WindowOptionColor)color;
}
}
else if (value is Color colorValue) {
colorValue.A = 0xFF;
return (WindowOptionColor)colorValue;
}

return base.ConvertFrom(context, culture, value);
}
}
return base.ConvertFrom(context, culture, value);
}
}
}
64 changes: 31 additions & 33 deletions dnSpy/dnSpy/Lib/EleCho.WpfSuite/Utilities/WindowAccentState.cs
Original file line number Diff line number Diff line change
@@ -1,38 +1,36 @@
namespace EleCho.WpfSuite
{
/// <summary>
/// Window accent state
/// </summary>
public enum WindowAccentState
{
/// <summary>
/// None
/// </summary>
None,
namespace EleCho.WpfSuite {
/// <summary>
/// Window accent state
/// </summary>
public enum WindowAccentState {
/// <summary>
/// None
/// </summary>
None,

/// <summary>
/// Gradient
/// </summary>
Gradient = 1,
/// <summary>
/// Gradient
/// </summary>
Gradient = 1,

/// <summary>
/// Transparent
/// </summary>
Transparent = 2,

/// <summary>
/// Blur behind
/// </summary>
BlurBehind = 3,
/// <summary>
/// Transparent
/// </summary>
Transparent = 2,

/// <summary>
/// Acrylic blur behind
/// </summary>
AcrylicBlurBehind = 4,
/// <summary>
/// Blur behind
/// </summary>
BlurBehind = 3,

/// <summary>
/// Host backdrop
/// </summary>
HostBackdrop = 5,
}
/// <summary>
/// Acrylic blur behind
/// </summary>
AcrylicBlurBehind = 4,

/// <summary>
/// Host backdrop
/// </summary>
HostBackdrop = 5,
}
}
56 changes: 27 additions & 29 deletions dnSpy/dnSpy/Lib/EleCho.WpfSuite/Utilities/WindowBackdrop.cs
Original file line number Diff line number Diff line change
@@ -1,35 +1,33 @@
using System.Windows.Media;
using System.Windows.Media;

namespace EleCho.WpfSuite
{
/// <summary>
/// Window backdrop
/// </summary>
public enum WindowBackdrop
{
/// <summary>
/// Automatic
/// </summary>
Auto = 0,
namespace EleCho.WpfSuite {
/// <summary>
/// Window backdrop
/// </summary>
public enum WindowBackdrop {
/// <summary>
/// Automatic
/// </summary>
Auto = 0,

/// <summary>
/// None
/// </summary>
None = 1,
/// <summary>
/// None
/// </summary>
None = 1,

/// <summary>
/// Mica
/// </summary>
Mica = 2,
/// <summary>
/// Mica
/// </summary>
Mica = 2,

/// <summary>
/// Acrylic
/// </summary>
Acrylic = 3,
/// <summary>
/// Acrylic
/// </summary>
Acrylic = 3,

/// <summary>
/// Mica alternate
/// </summary>
MicaAlt = 4
}
/// <summary>
/// Mica alternate
/// </summary>
MicaAlt = 4
}
}
46 changes: 22 additions & 24 deletions dnSpy/dnSpy/Lib/EleCho.WpfSuite/Utilities/WindowCorner.cs
Original file line number Diff line number Diff line change
@@ -1,28 +1,26 @@
namespace EleCho.WpfSuite
{
/// <summary>
/// Window corner
/// </summary>
public enum WindowCorner
{
/// <summary>
/// Default
/// </summary>
Default = 0,
namespace EleCho.WpfSuite {
/// <summary>
/// Window corner
/// </summary>
public enum WindowCorner {
/// <summary>
/// Default
/// </summary>
Default = 0,

/// <summary>
/// Do not round
/// </summary>
DoNotRound = 1,
/// <summary>
/// Do not round
/// </summary>
DoNotRound = 1,

/// <summary>
/// Round
/// </summary>
Round = 2,
/// <summary>
/// Round
/// </summary>
Round = 2,

/// <summary>
/// Round small
/// </summary>
RoundSmall = 3
}
/// <summary>
/// Round small
/// </summary>
RoundSmall = 3
}
}
Loading

0 comments on commit 67cdc4c

Please sign in to comment.