Skip to content

Commit

Permalink
Use some new C#10 features
Browse files Browse the repository at this point in the history
  • Loading branch information
mscrivo committed Nov 5, 2023
1 parent f76b000 commit dcdf43c
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 26 deletions.
2 changes: 1 addition & 1 deletion NetSparkle
11 changes: 3 additions & 8 deletions OotD.Core/Events/InstanceRemovedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@

namespace OotD.Events;

public class InstanceRemovedEventArgs : EventArgs
public class InstanceRemovedEventArgs(string instanceName) : EventArgs
{
public InstanceRemovedEventArgs(string instanceName)
{
InstanceName = instanceName;
}

public string InstanceName { get; }
}
public string InstanceName { get; } = instanceName;
}
14 changes: 4 additions & 10 deletions OotD.Core/Events/InstanceRenamedEventArgs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,9 @@

namespace OotD.Events;

public class InstanceRenamedEventArgs : EventArgs
public class InstanceRenamedEventArgs(string oldInstanceName, string newInstanceName) : EventArgs
{
public InstanceRenamedEventArgs(string oldInstanceName, string newInstanceName)
{
OldInstanceName = oldInstanceName;
NewInstanceName = newInstanceName;
}
public string OldInstanceName { get; } = oldInstanceName;

public string OldInstanceName { get; }

public string NewInstanceName { get; }
}
public string NewInstanceName { get; } = newInstanceName;
}
9 changes: 2 additions & 7 deletions OotD.Core/Preferences/InstancePreferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,15 @@

namespace OotD.Preferences;

public class InstancePreferences
public class InstancePreferences(string instanceName)
{
public const int DefaultHeight = 500;
public const int DefaultLeftPosition = 100;
public const double DefaultOpacity = 0.5;
public const int DefaultTopPosition = 100;
public const int DefaultWidth = 700;

private readonly RegistryKey _appReg;

public InstancePreferences(string instanceName)
{
_appReg = Registry.CurrentUser.CreateSubKey("Software\\" + Application.CompanyName + "\\" + Application.ProductName + "\\" + instanceName) ?? throw new InvalidOperationException();
}
private readonly RegistryKey _appReg = Registry.CurrentUser.CreateSubKey("Software\\" + Application.CompanyName + "\\" + Application.ProductName + "\\" + instanceName) ?? throw new InvalidOperationException();

/// <summary>
/// Main Window Opacity.
Expand Down

0 comments on commit dcdf43c

Please sign in to comment.