Skip to content

Commit

Permalink
Prevent User from Editing Queue Items when Encode is Running #74
Browse files Browse the repository at this point in the history
  • Loading branch information
Alkl58 committed Dec 19, 2021
1 parent 28029c9 commit acbd5ac
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions NotEnoughAV1Encodes/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ private void ButtonCancelEncode_Click(object sender, RoutedEventArgs e)
if (cancellationTokenSource == null) return;
cancellationTokenSource.Cancel();
ImageStartStop.Source = new BitmapImage(new Uri(@"/NotEnoughAV1Encodes;component/resources/img/start.png", UriKind.Relative));
ButtonAddToQueue.IsEnabled = true;
ButtonRemoveSelectedQueueItem.IsEnabled = true;
ButtonEditSelectedItem.IsEnabled = true;
}

private void ButtonProgramSettings_Click(object sender, RoutedEventArgs e)
Expand All @@ -133,6 +136,7 @@ private void ButtonProgramSettings_Click(object sender, RoutedEventArgs e)

private void ButtonRemoveSelectedQueueItem_Click(object sender, RoutedEventArgs e)
{
if (ProgramState != 0) return;
if (ListBoxQueue.SelectedItem != null)
{
Queue.QueueElement tmp = (Queue.QueueElement)ListBoxQueue.SelectedItem;
Expand Down Expand Up @@ -352,6 +356,10 @@ private void ButtonStartStop_Click(object sender, RoutedEventArgs e)
// Main Start
if (ProgramState is 0)
{
ButtonAddToQueue.IsEnabled = false;
ButtonRemoveSelectedQueueItem.IsEnabled = false;
ButtonEditSelectedItem.IsEnabled = false;

PreStart();
}

Expand Down Expand Up @@ -432,6 +440,7 @@ private void ButtonDeletePreset_Click(object sender, RoutedEventArgs e)

private void ButtonEditSelectedItem_Click(object sender, RoutedEventArgs e)
{
if (ProgramState != 0) return;
if (ListBoxQueue.SelectedItem != null)
{
Queue.QueueElement tmp = (Queue.QueueElement)ListBoxQueue.SelectedItem;
Expand Down Expand Up @@ -1591,6 +1600,9 @@ private async Task MainStartAsync(CancellationToken _cancelToken)
ProgramState = 0;
ImageStartStop.Source = new BitmapImage(new Uri(@"/NotEnoughAV1Encodes;component/resources/img/start.png", UriKind.Relative));
LabelStartPauseButton.Content = LocalizedStrings.Instance["LabelStartPauseButton"];
ButtonAddToQueue.IsEnabled = true;
ButtonRemoveSelectedQueueItem.IsEnabled = true;
ButtonEditSelectedItem.IsEnabled = true;

Shutdown();
}
Expand Down

0 comments on commit acbd5ac

Please sign in to comment.