mirror of
https://github.com/crskycode/GARbro.git
synced 2024-11-23 13:45:34 +08:00
(MainWindow) 1. Next/Previous functionality. 2. Fix StopPlayback bug for multiple-file playback
This commit is contained in:
parent
44a90b3fed
commit
5ca4bcb22c
@ -273,28 +273,48 @@
|
||||
</StatusBarItem>
|
||||
<Separator Width="1"/>
|
||||
<!-- ADL -->
|
||||
<!-- TODO
|
||||
|
||||
<StatusBarItem x:Name="appNextControl" Visibility="Visible">
|
||||
<Button x:Name="btn_appPauseControl" Width="18" Height="18"
|
||||
<StatusBarItem x:Name="appPreviousAudioControl" Visibility="Collapsed">
|
||||
<Button Width="18" Height="18"
|
||||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
|
||||
Command="{x:Static local:Commands.AudioPauseContinue}">
|
||||
Command="{x:Static local:Commands.AudioPrevious}">
|
||||
<Canvas HorizontalAlignment="Center" VerticalAlignment="Center" FlowDirection="RightToLeft">
|
||||
<Path Stroke="Black" StrokeThickness ="2" Canvas.Left="-5" Canvas.Top="-4">
|
||||
<Path.Data>
|
||||
<PathGeometry>
|
||||
<PathFigure StartPoint="2,0">
|
||||
<LineSegment Point="2,8"></LineSegment>
|
||||
</PathFigure>
|
||||
</PathGeometry>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Polygon Fill="Black" Stretch="None" Points="0,0 0,8 6,4" Canvas.Left="0" Canvas.Top="-4" />
|
||||
</Canvas>
|
||||
</Button>
|
||||
</StatusBarItem>
|
||||
<StatusBarItem x:Name="appPreviousControl" Visibility="Visible">
|
||||
<Button x:Name="btn_appPauseControl" Width="18" Height="18"
|
||||
<StatusBarItem x:Name="appNextAudioControl" Visibility="Collapsed">
|
||||
<Button Width="18" Height="18"
|
||||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
|
||||
Command="{x:Static local:Commands.AudioPauseContinue}">
|
||||
Command="{x:Static local:Commands.AudioNext}">
|
||||
<Canvas HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||
<Path Stroke="Black" StrokeThickness ="2" Canvas.Left="-5" Canvas.Top="-4">
|
||||
<Path.Data>
|
||||
<PathGeometry>
|
||||
<PathFigure StartPoint="2,0">
|
||||
<LineSegment Point="2,8"></LineSegment>
|
||||
</PathFigure>
|
||||
</PathGeometry>
|
||||
</Path.Data>
|
||||
</Path>
|
||||
<Polygon Fill="Black" Stretch="None" Points="0,0 0,8 6,4" Canvas.Left="0" Canvas.Top="-4" />
|
||||
</Canvas>
|
||||
</Button>
|
||||
</StatusBarItem>
|
||||
|
||||
-->
|
||||
<StatusBarItem x:Name="appPauseControl" Visibility="Collapsed">
|
||||
<StatusBarItem x:Name="appPauseAudioControl" Visibility="Collapsed">
|
||||
<Button x:Name="btn_appPauseControl" Width="18" Height="18"
|
||||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
|
||||
Command="{x:Static local:Commands.AudioPauseContinue}">
|
||||
|
||||
<!-- click to pause
|
||||
<!-- click to pause-->
|
||||
|
||||
<Path Stroke="Black" StrokeThickness="3">
|
||||
<Path.Data>
|
||||
@ -307,7 +327,7 @@
|
||||
</PathFigure>
|
||||
</PathGeometry>
|
||||
</Path.Data>
|
||||
</Path>-->
|
||||
</Path>
|
||||
<!-- Click to continue
|
||||
|
||||
|
||||
@ -318,7 +338,8 @@
|
||||
<StatusBarItem x:Name="appPlaybackControl" Visibility="Collapsed">
|
||||
<Button Width="18" Height="18"
|
||||
HorizontalContentAlignment="Center" VerticalContentAlignment="Center"
|
||||
Command="{x:Static local:Commands.StopPlayback}">
|
||||
Command="{x:Static local:Commands.AudioStopAll}">
|
||||
<!--ADL-->
|
||||
<Rectangle Stretch="Fill" Fill="Black" Width="8" Height="8"/>
|
||||
</Button>
|
||||
</StatusBarItem>
|
||||
@ -489,6 +510,8 @@
|
||||
<CommandBinding Command="{x:Static local:Commands.AudioPlayAll}" Executed="AudioPlayAllExec" CanExecute="CanAudioPlayAllExec"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.AudioStopAll}" Executed="AudioStopAllExec" CanExecute="CanAudioStopAllExec"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.AudioPauseContinue}" Executed="AudioPauseContinueExec" CanExecute="CanAudioPauseContinueExec"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.AudioNext}" Executed="AudioNextExec" CanExecute="CanAudioNextExec"/>
|
||||
<CommandBinding Command="{x:Static local:Commands.AudioPrevious}" Executed="AudioPreviousExec" CanExecute="CanAudioPreviousExec"/>
|
||||
|
||||
</Window.CommandBindings>
|
||||
</Window>
|
||||
|
@ -65,6 +65,7 @@ namespace GARbro.GUI
|
||||
const StringComparison StringIgnoreCase = StringComparison.CurrentCultureIgnoreCase;
|
||||
|
||||
#region ADL
|
||||
|
||||
Icon app_icon = new Icon(Application.GetResourceStream(new Uri("pack://application:,,,/images/sample.ico")).Stream);
|
||||
TaskbarIcon tray = new TaskbarIcon();
|
||||
Form.Timer hide_timer = null;
|
||||
@ -1147,6 +1148,26 @@ namespace GARbro.GUI
|
||||
SetStatusText(string.Format("Files in {0} cannot be played.", selected));
|
||||
}
|
||||
}
|
||||
private void CanAudioNextExec(object control, CanExecuteRoutedEventArgs e)
|
||||
{
|
||||
e.CanExecute = (AudioFileList.Count > 1) ? true : false;
|
||||
}
|
||||
private void AudioNextExec(object control, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
++CurrentAudioFileListIdx;
|
||||
if (CurrentAudioFileListIdx >= AudioFileList.Count) CurrentAudioFileListIdx = 0;
|
||||
PlayFile(AudioFileList[CurrentAudioFileListIdx]);
|
||||
}
|
||||
private void CanAudioPreviousExec(object control, CanExecuteRoutedEventArgs e)
|
||||
{
|
||||
e.CanExecute = (AudioFileList.Count > 1) ? true : false;
|
||||
}
|
||||
private void AudioPreviousExec(object control, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
--CurrentAudioFileListIdx;
|
||||
if (CurrentAudioFileListIdx < 0) CurrentAudioFileListIdx = AudioFileList.Count - 1;
|
||||
PlayFile(AudioFileList[CurrentAudioFileListIdx]);
|
||||
}
|
||||
private void AudioLoopAllExec(object control, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
isAudioLoop = true;
|
||||
@ -1244,7 +1265,7 @@ namespace GARbro.GUI
|
||||
#region ADL
|
||||
if (AudioFileList.Count == 0)
|
||||
AudioFileList.Add(entry);
|
||||
appPauseControl.Visibility = Visibility.Visible;
|
||||
appPauseAudioControl.Visibility = Visibility.Visible;
|
||||
SetAppPauseControlIcon();
|
||||
|
||||
//this.app_notify_icon.ShowBalloonTip(2000, "Now playing:", entry.Name, Form.ToolTipIcon.Info);
|
||||
@ -1254,6 +1275,11 @@ namespace GARbro.GUI
|
||||
String.Format(guiStrings.MsgNowPlaying, entry.Name)
|
||||
);
|
||||
trayUpdate(String.Format(guiStrings.MsgNowPlaying, entry.Name));
|
||||
if (AudioFileList.Count > 1)
|
||||
{
|
||||
appNextAudioControl.Visibility = Visibility.Visible;
|
||||
appPreviousAudioControl.Visibility = Visibility.Visible;
|
||||
}
|
||||
#endregion
|
||||
|
||||
appPlaybackControl.Visibility = Visibility.Visible;
|
||||
@ -1305,7 +1331,9 @@ namespace GARbro.GUI
|
||||
}
|
||||
else
|
||||
{
|
||||
appPauseControl.Visibility = Visibility.Collapsed;
|
||||
appPauseAudioControl.Visibility = Visibility.Collapsed;
|
||||
appNextAudioControl.Visibility = Visibility.Collapsed;
|
||||
appPreviousAudioControl.Visibility = Visibility.Collapsed;
|
||||
AudioFileList.Clear();
|
||||
trayUpdate(guiStrings.MsgRunning);
|
||||
}
|
||||
@ -1749,6 +1777,11 @@ namespace GARbro.GUI
|
||||
Trace.WriteLine (X.Message, "Drop event failed");
|
||||
}
|
||||
}
|
||||
|
||||
private void CommandBinding_Executed(object sender, ExecutedRoutedEventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public class SortModeToBooleanConverter : IValueConverter
|
||||
@ -1825,8 +1858,8 @@ namespace GARbro.GUI
|
||||
public static readonly RoutedCommand AudioLoopAll = new RoutedCommand();
|
||||
public static readonly RoutedCommand AudioStopAll = new RoutedCommand();
|
||||
public static readonly RoutedCommand AudioPauseContinue = new RoutedCommand();
|
||||
//public static readonly RoutedCommand AudioNext = new RoutedCommand();
|
||||
//public static readonly RoutedCommand AudioPrevious = new RoutedCommand();
|
||||
public static readonly RoutedCommand AudioNext = new RoutedCommand();
|
||||
public static readonly RoutedCommand AudioPrevious = new RoutedCommand();
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user