Code styling

This commit is contained in:
2022-11-17 23:41:03 +01:00
parent e80f06d8bf
commit 38a7856a0f
9 changed files with 39 additions and 39 deletions

View File

@ -49,12 +49,12 @@ namespace unison
private MpdStatus _currentStatus;
private IMpdFile _currentSong;
private BitmapImage _cover;
public Statistics _stats;
private readonly Statistics _stats;
private readonly System.Timers.Timer _elapsedTimer;
private DispatcherTimer _retryTimer;
private readonly DispatcherTimer _retryTimer;
bool _isUpdatingStatus = false;
bool _isUpdatingSong = false;
private bool _isUpdatingStatus = false;
private bool _isUpdatingSong = false;
public IPAddress _ipAddress;
@ -70,6 +70,8 @@ namespace unison
public CancellationTokenSource _cancelCommand;
private CancellationTokenSource _cancelConnect;
private bool UpdateStarted = false;
public MPDHandler()
{
Startup(null, null);
@ -154,7 +156,7 @@ namespace unison
if (_commandConnection == null || !IsConnected())
{
Trace.WriteLine("[SafelySendCommandAsync] no command connection");
return default(T);
return default;
}
try
@ -176,7 +178,7 @@ namespace unison
Trace.WriteLine($"Sending {command.GetType().Name} failed: {e.Message}");
}
return default(T);
return default;
}
public async void Startup(object sender, EventArgs e)
@ -334,8 +336,6 @@ namespace unison
}, token).ConfigureAwait(false);
}
private bool UpdateStarted = false;
private async Task HandleIdleResponseAsync(string subsystems)
{
try
@ -637,12 +637,12 @@ namespace unison
{
if (_Playlist == null)
return 0;
return _Playlist.ToArray().Count();
return _Playlist.ToArray().Length;
}
public void UpdateDB() => SendCommand(new UpdateCommand());
private string FormatTime(TimeSpan time)
private static string FormatTime(TimeSpan time)
{
string FormattedTime = "";

View File

@ -17,8 +17,8 @@ namespace unison
class ShuffleHandler
{
private readonly MPDHandler _mpd;
public int AddedSongs = 0;
public int AddedSongs = 0;
public List<string> SongList { get; }
public ShuffleHandler()

View File

@ -8,6 +8,7 @@ namespace unison
public class SnapcastHandler
{
private readonly Process _snapcast = new();
public bool HasStarted { get; private set; }
public void OnConnectionChanged(object sender, EventArgs e)
@ -30,7 +31,7 @@ namespace unison
});
}
public void UpdateInterface()
public static void UpdateInterface()
{
TaskbarIcon Systray = (TaskbarIcon)Application.Current.Properties["systray"];
SystrayViewModel DataContext = Systray.DataContext as SystrayViewModel;

View File

@ -1,5 +1,4 @@
using System.Diagnostics;
using System.Windows;
using System.Windows;
using AutoUpdaterDotNET;
namespace unison.Handlers
@ -9,10 +8,10 @@ namespace unison.Handlers
readonly string xmlFile = "https://raw.githubusercontent.com/ZetaKebab/unison/main/Installer/unison.xml";
private bool _UpdateAvailable = false;
public bool UpdateAvailable() => _UpdateAvailable;
private bool _RequestedCheck = false;
public bool UpdateAvailable() => _UpdateAvailable;
public UpdateHandler()
{
AutoUpdater.CheckForUpdateEvent += AutoUpdaterOnCheckForUpdateEvent;
@ -25,7 +24,7 @@ namespace unison.Handlers
AutoUpdater.Start(xmlFile);
}
private string CutVersionNumber(string number)
private static string CutVersionNumber(string number)
{
return number.Substring(0, number.LastIndexOf("."));
}