This commit is contained in:
2022-11-13 15:28:10 +01:00
parent 52b0a6fc85
commit 468ec8be07
3 changed files with 12 additions and 68 deletions

View File

@ -7,10 +7,6 @@ using System.Windows.Interop;
using System.Windows.Input;
using System.Windows.Controls.Primitives;
using System.Diagnostics;
using System.Linq;
using System.Threading.Tasks;
using unison.Handlers;
using System.Windows.Navigation;
namespace unison
{
@ -126,24 +122,14 @@ namespace unison
EndTime.Text = FormatSeconds(_mpd.GetCurrentSong().Time);
}
Debug.WriteLine("Song changed called!");
Trace.WriteLine("Song changed called!");
if (!_shuffleWin.GetContinuous())
return;
Debug.WriteLine("playlist length => " + _mpd.GetStatus().PlaylistLength);
if (_mpd.GetStatus().PlaylistLength > 4)
if (_shuffleWin.GetContinuous())
{
Debug.WriteLine("return :)");
return;
_mpd.CanPrevNext = false;
await _shuffleWin.HandleContinuous();
_mpd.CanPrevNext = true;
}
Debug.WriteLine("start continuous handling");
_mpd.CanPrevNext = false;
await _shuffleWin.HandleContinuous();
_mpd.CanPrevNext = true;
Debug.WriteLine("finished continuous");
}
public void OnStatusChanged(object sender, EventArgs e)

View File

@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
@ -159,8 +158,6 @@ namespace unison
private async Task UpdateFilter()
{
Debug.WriteLine("update filter => start");
Filters.Clear();
foreach (ContentPresenter superChild in FilterPanel.Children)
@ -170,8 +167,6 @@ namespace unison
string value = "";
bool isDir = false;
Debug.WriteLine("update filter => part 1");
StackPanel stackPanel = VisualTreeHelper.GetChild(superChild, 0) as StackPanel;
foreach (TextBox child in stackPanel.Children.OfType<TextBox>())
{
@ -179,8 +174,6 @@ namespace unison
value = child.Text;
}
Debug.WriteLine("update filter => part 2");
foreach (ComboBox child in stackPanel.Children.OfType<ComboBox>())
{
if (child.Name == "FilterType")
@ -198,8 +191,6 @@ namespace unison
value = child.SelectedItem.ToString();
}
Debug.WriteLine("update filter => part 3");
if (value != "")
{
if (!isDir)
@ -214,11 +205,7 @@ namespace unison
SongFilterPanel.Visibility = Visibility.Visible;
SongFilterNumber.Text = _shuffle.SongList.Count.ToString();
}
Debug.WriteLine("update filter => part 4");
}
Debug.WriteLine("update filter => stop");
}
private void FilterType_Change(object sender, string Operator, List<string> Listing)
@ -281,7 +268,6 @@ namespace unison
private void OperatorType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
Debug.WriteLine("selection changed => operator type");
SongFilterNumber.Text = "0";
}
@ -382,19 +368,15 @@ namespace unison
public async Task HandleContinuous()
{
if (!_continuous)
{
Debug.WriteLine("continuous return nothing!");
return;
}
Debug.WriteLine("continuous __before__ add to queue");
int PlaylistLength = _mpd.GetStatus().PlaylistLength;
int Num = 10 - PlaylistLength;
if (Num < 1)
return;
await UpdateFilter();
int Num = 5;
await UpdateFilter();
await AddToQueue_Internal(Num);
Debug.WriteLine("continuous __after__ add to queue");
}
private async void ContinuousShuffle_Checked(object sender, RoutedEventArgs e)
@ -404,7 +386,7 @@ namespace unison
else
_continuous = false;
if (_mpd.GetStatus().PlaylistLength < 5)
if (_mpd.GetStatus().PlaylistLength < 10)
await HandleContinuous();
}