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

@ -224,12 +224,12 @@ namespace unison
border.Style = b ? (Style)Resources["SelectedButton"] : (Style)Resources["UnselectedButton"];
}
public string FormatSeconds(int time)
public static string FormatSeconds(int time)
{
TimeSpan timespan = TimeSpan.FromSeconds(time);
return timespan.ToString(@"mm\:ss");
}
public string FormatSeconds(double time)
public static string FormatSeconds(double time)
{
TimeSpan timespan = TimeSpan.FromSeconds(time);
return timespan.ToString(@"mm\:ss");
@ -244,7 +244,7 @@ namespace unison
public void Consume_Clicked(object sender, RoutedEventArgs e) => _mpd.Consume();
public void ChangeVolume(int value) => _mpd.SetVolume(value);
public void Snapcast_Clicked(object sender, RoutedEventArgs e)
public static void Snapcast_Clicked(object sender, RoutedEventArgs e)
{
SnapcastHandler snapcast = (SnapcastHandler)Application.Current.Properties["snapcast"];
snapcast.LaunchOrExit();

View File

@ -15,7 +15,7 @@ namespace unison
public partial class Radios : Window
{
private MPDHandler _mpd;
RadioHandler _radio;
private RadioHandler _radio;
public bool IsConnected() => _radio.IsConnected();

View File

@ -85,7 +85,7 @@ namespace unison
}
}
private void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
private static void NumberValidationTextBox(object sender, TextCompositionEventArgs e)
{
Regex regex = new Regex("[^0-9]+");
e.Handled = regex.IsMatch(e.Text);
@ -105,7 +105,7 @@ namespace unison
private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
{
ProcessStartInfo psi = new(e.Uri.AbsoluteUri);
ProcessStartInfo psi = new ProcessStartInfo(e.Uri.AbsoluteUri);
psi.UseShellExecute = true;
Process.Start(psi);
e.Handled = true;
@ -149,7 +149,7 @@ namespace unison
MPDConnect_Clicked(null, null);
}
private void MPDDatabaseUpdate_Clicked(object sender, RoutedEventArgs e)
private static void MPDDatabaseUpdate_Clicked(object sender, RoutedEventArgs e)
{
MPDHandler mpd = (MPDHandler)Application.Current.Properties["mpd"];
if (mpd.IsConnected())
@ -180,7 +180,7 @@ namespace unison
TimedText(UpdateDBMessage2, 2);
}
private void CheckUpdates(object sender, RoutedEventArgs e)
private static void CheckUpdates(object sender, RoutedEventArgs e)
{
UpdateHandler updater = (UpdateHandler)Application.Current.Properties["updater"];
updater.Start(true);
@ -382,7 +382,7 @@ namespace unison
HotkeyChanged();
}
private HotkeyHandler.VK GetVirtualKey(Key key)
private static HotkeyHandler.VK GetVirtualKey(Key key)
{
foreach (object value in System.Enum.GetValues(typeof(HotkeyHandler.VK)))
{
@ -392,7 +392,7 @@ namespace unison
return HotkeyHandler.VK.None;
}
private HotkeyHandler.MOD GetMOD(string str)
private static HotkeyHandler.MOD GetMOD(string str)
{
foreach (object value in System.Enum.GetValues(typeof(HotkeyHandler.MOD)))
{
@ -424,12 +424,12 @@ namespace unison
InitializeShortcuts();
}
private uint GetMod(StackPanel stackPanel)
private static uint GetMod(StackPanel stackPanel)
{
return (uint)(GetMOD(stackPanel.Children.OfType<ComboBox>().First().SelectedItem.ToString()) | GetMOD(stackPanel.Children.OfType<ComboBox>().Last().SelectedItem.ToString()));
}
private uint GetVk(StackPanel stackPanel)
private static uint GetVk(StackPanel stackPanel)
{
Button button = stackPanel.Children.OfType<Button>().First();
TextBlock textBlock = (TextBlock)button.Content;

View File

@ -47,7 +47,7 @@ namespace unison
ListFolder(_mpd._cancelCommand.Token);
}
public async void ListGenre(CancellationToken token)
private async void ListGenre(CancellationToken token)
{
if (GenreList.Count != 0)
return;
@ -64,7 +64,7 @@ namespace unison
GenreList.Add(genre);
}
public async void ListFolder(CancellationToken token)
private async void ListFolder(CancellationToken token)
{
if (FolderList.Count != 0)
return;
@ -83,7 +83,7 @@ namespace unison
private bool IsFilterEmpty()
{
if (Filters.Count() == 0)
if (Filters.Count == 0)
return true;
return false;
}
@ -124,7 +124,7 @@ namespace unison
_shuffle.SongList.Clear();
}
private ITag FilterEquivalence_Type(string value)
private static ITag FilterEquivalence_Type(string value)
{
if (value == "Song")
return MpdTags.Title;
@ -139,7 +139,7 @@ namespace unison
return MpdTags.Title;
}
private FilterOperator FilterEquivalence_Operator(string value)
private static FilterOperator FilterEquivalence_Operator(string value)
{
if (value == "contains")
return FilterOperator.Contains;
@ -224,7 +224,7 @@ namespace unison
TimedText(QueryFilterText2, 1);
}
private void TimedText(TextBlock textBlock, int time)
private static void TimedText(TextBlock textBlock, int time)
{
DispatcherTimer Timer = new DispatcherTimer();
Timer.Interval = TimeSpan.FromSeconds(time);

View File

@ -32,7 +32,7 @@ namespace unison
CanExecuteFunc = () => true
};
public string SnapcastText
public static string SnapcastText
{
get
{
@ -59,7 +59,7 @@ namespace unison
}
}
public ICommand Radios
public static ICommand Radios
{
get
{
@ -71,7 +71,7 @@ namespace unison
}
}
public ICommand Shuffle
public static ICommand Shuffle
{
get
{
@ -83,7 +83,7 @@ namespace unison
}
}
public ICommand Settings
public static ICommand Settings
{
get
{