Example #1
0
        //public RichDelegateCommand OpenImageDescriptionsManualCommand { get; private set; }

        private void initCommands()
        {
            m_Logger.Log(@"ShellView.initCommands", Category.Debug, Priority.Medium);

            OpenOnlineDocCommand = new RichDelegateCommand(
                Tobi_Lang.CmdDocOnline_ShortDesc,
                Tobi_Lang.CmdDocOnline_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                null,
                () =>
            {
                m_Logger.Log(@"ShellView.OpenOnlineDocCommand", Category.Debug, Priority.Medium);

                ExecuteShellProcess("http://www.daisy.org/tobi/doc");
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Help)
                );

            RegisterRichCommand(OpenOnlineDocCommand);


            OpenLocalDocCommand = new RichDelegateCommand(
                Tobi_Lang.CmdDocLocal_ShortDesc,
                Tobi_Lang.CmdDocLocal_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                null,
                () =>
            {
                m_Logger.Log(@"ShellView.OpenLocalDocCommand", Category.Debug, Priority.Medium);

                string appFolder = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
                string chmPath   = Path.Combine(appFolder, "TobiHelp.chm");

                ExecuteShellProcess(chmPath);
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Help)
                );

            RegisterRichCommand(OpenLocalDocCommand);

            //OpenImageDescriptionsManualCommand = new RichDelegateCommand(
            //    Tobi_Lang.CmdOpenImageDescriptionsManual_ShortDesc,
            //    Tobi_Lang.CmdOpenImageDescriptionsManual_LongDesc,
            //    null, // KeyGesture obtained from settings (see last parameters below)
            //    null,
            //    () =>
            //    {
            //        m_Logger.Log(@"ShellView.OpenImageDescriptionsManualCommand", Category.Debug, Priority.Medium);

            //        ExecuteShellProcess("http://www.daisy.org/tobi/image-description-manual");
            //    },
            //     () => true,
            //    Settings_KeyGestures.Default,
            //    null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiFolder)
            //    );

            //RegisterRichCommand(OpenImageDescriptionsManualCommand);
            //
            ExitCommand = new RichDelegateCommand(
                Tobi_Lang.CmdMenuExit_ShortDesc,
                Tobi_Lang.CmdMenuExit_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                //UserInterfaceStrings.Menu_Exit_KEYS,
                LoadTangoIcon(@"system-log-out"),
                //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Exit")),
                //LoadTangoIcon("document-save"),
                () =>
            {
                m_Logger.Log(@"ShellView.ExitCommand", Category.Debug, Priority.Medium);

                if (askUserConfirmExit())
                {
                    exit();
                }
            },
                () => {
                m_Logger.Log(@"Application.Current.Windows.Count: " + Application.Current.Windows.Count + " -- " + Debugger.IsAttached, Category.Debug, Priority.Medium);
                return(Application.Current.Windows.Count ==
#if NET40
                       (Debugger.IsAttached ? 2 : 1)
#else
                       1
#endif
                       && !m_UrakawaSession.isAudioRecording);
            },
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_AppExit));

            RegisterRichCommand(ExitCommand);
            //

            MagnifyUiResetCommand = new RichDelegateCommand(
                Tobi_Lang.CmdUIResetMagnification_ShortDesc,
                Tobi_Lang.CmdUIResetMagnification_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                LoadTangoIcon(@"weather-clear"),
                () =>
            {
                m_Logger.Log(@"ShellView.MagnifyUiResetCommand", Category.Debug, Priority.Medium);

                MagnificationLevel = 1;
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_UI_Zoom_Reset));

            RegisterRichCommand(MagnifyUiResetCommand);
            //
            MagnifyUiIncreaseCommand = new RichDelegateCommand(
                Tobi_Lang.CmdUIIncreaseMagnification_ShortDesc,
                Tobi_Lang.CmdUIIncreaseMagnification_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                //LoadTangoIcon("mail-forward"),
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource(@"Horizon_Image_Zoom_In")),
                () =>
            {
                m_Logger.Log(@"ShellView.MagnifyUiIncreaseCommand", Category.Debug, Priority.Medium);

                MagnificationLevel += 0.15;
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_UI_Zoom_Increase));

            RegisterRichCommand(MagnifyUiIncreaseCommand);
            //

            MagnifyUiDecreaseCommand = new RichDelegateCommand(
                Tobi_Lang.CmdUIDecreaseMagnification_ShortDesc,
                Tobi_Lang.CmdUIDecreaseMagnification_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource(@"Horizon_Image_Zoom_out")),
                () =>
            {
                m_Logger.Log(@"ShellView.MagnifyUiDecreaseCommand", Category.Debug, Priority.Medium);

                MagnificationLevel -= 0.15;
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_UI_Zoom_Decrease));

            RegisterRichCommand(MagnifyUiDecreaseCommand);
            //
#if ICONS
            DisplayPreviewIconsDebugCommand = new RichDelegateCommand(
                UserInterfaceStrings.IconsDebug,
                null,
                UserInterfaceStrings.IconsDebug_KEYS,
                null,
                DisplayPreviewIconsDebugCommand_Executed,
                () => true);

            RegisterRichCommand(DisplayPreviewIconsDebugCommand);
#endif

#if DEBUG
            ManageShortcutsCommand = new RichDelegateCommand(
                Tobi_Lang.CmdManageShortcuts_ShortDesc,
                Tobi_Lang.CmdManageShortcuts_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                LoadTangoIcon(@"preferences-desktop-keyboard-shortcuts"),
                () =>
            {
                m_Logger.Log(@"ShellView.ManageShortcutsCommand_Executed", Category.Debug, Priority.Medium);

                var windowPopup = new PopupModalWindow(this,
                                                       UserInterfaceStrings.EscapeMnemonic(Tobi_Lang.CmdManageShortcuts_ShortDesc),
                                                       new KeyboardShortcuts(this),
                                                       PopupModalWindow.DialogButtonsSet.Ok,
                                                       PopupModalWindow.DialogButton.Ok,
                                                       true, 500, 600, null, 0, null);

                windowPopup.ShowFloating(null);
            },
                () => true,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_DisplayShortcuts)
                );

            RegisterRichCommand(ManageShortcutsCommand);
#endif

            //#if DEBUG
            //            ShowLogFilePathCommand = new RichDelegateCommand(
            //                UserInterfaceStrings.ShowLogFilePath,
            //                UserInterfaceStrings.ShowLogFilePath_,
            //                null, // KeyGesture obtained from settings (see last parameters below)
            //                null, //LoadTangoIcon(@"help-browser"),
            //                () =>
            //                {
            //                    m_Logger.Log(@"ShellView.ShowLogFilePathCommand", Category.Debug, Priority.Medium);


            //                    var label = new TextBlock
            //                    {
            //                        Text = UserInterfaceStrings.ShowLogFilePath_,
            //                        Margin = new Thickness(8, 0, 8, 0),
            //                        HorizontalAlignment = HorizontalAlignment.Center,
            //                        VerticalAlignment = VerticalAlignment.Center,
            //                        Focusable = true,
            //                        TextWrapping = TextWrapping.Wrap
            //                    };

            //                    var iconProvider = new ScalableGreyableImageProvider(LoadTangoIcon("edit-find"), MagnificationLevel);

            //                    var panel = new StackPanel
            //                    {
            //                        Orientation = Orientation.Horizontal,
            //                        HorizontalAlignment = HorizontalAlignment.Center,
            //                        VerticalAlignment = VerticalAlignment.Stretch,
            //                    };
            //                    panel.Children.Add(iconProvider.IconLarge);
            //                    panel.Children.Add(label);
            //                    //panel.Margin = new Thickness(8, 8, 8, 0);


            //                    var details = new TextBoxReadOnlyCaretVisible(ApplicationConstants.LOG_FILE_PATH)
            //                    {
            //                    };

            //                    var windowPopup = new PopupModalWindow(this,
            //                                                           UserInterfaceStrings.EscapeMnemonic(
            //                                                               UserInterfaceStrings.ShowLogFilePath),
            //                                                           panel,
            //                                                           PopupModalWindow.DialogButtonsSet.Close,
            //                                                           PopupModalWindow.DialogButton.Close,
            //                                                           true, 300, 160, details, 40);

            //                    windowPopup.ShowModal();

            //                },
            //                 () => true,
            //                Settings_KeyGestures.Default,
            //                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_DisplayLogFilePath)
            //                );

            //            RegisterRichCommand(ShowLogFilePathCommand);
            //            //
            //#endif //DEBUG
            //

            OpenTobiIsolatedStorageCommand = new RichDelegateCommand(
                Tobi_Lang.CmdOpenTobiIsolatedStorage_ShortDesc,
                Tobi_Lang.CmdOpenTobiIsolatedStorage_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                LoadGnomeNeuIcon(@"Neu_applications-office"),
                () =>
            {
                m_Logger.Log(@"ShellView.OpenTobiIsolatedStorageCommand", Category.Debug, Priority.Medium);

                ExecuteShellProcess(ExternalFilesDataManager.STORAGE_FOLDER_PATH);
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiFolder)
                );

            RegisterRichCommand(OpenTobiIsolatedStorageCommand);
            //
            OpenTobiFolderCommand = new RichDelegateCommand(
                Tobi_Lang.CmdOpenTobiFolder_ShortDesc,
                Tobi_Lang.CmdOpenTobiFolder_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                LoadGnomeNeuIcon(@"Neu_user-home"),
                () =>
            {
                m_Logger.Log(@"ShellView.OpenTobiFolderCommand", Category.Debug, Priority.Medium);

                ExecuteShellProcess(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiFolder)
                );

            RegisterRichCommand(OpenTobiFolderCommand);
            //
            OpenTobiSettingsFolderCommand = new RichDelegateCommand(
                Tobi_Lang.CmdOpenTobiSettingsFolder_ShortDesc,
                Tobi_Lang.CmdOpenTobiSettingsFolder_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                LoadGnomeFoxtrotIcon(@"Foxtrot_folder"),
                () =>
            {
                m_Logger.Log(@"ShellView.OpenTobiSettingsFolderCommand", Category.Debug, Priority.Medium);

                Configuration config = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.PerUserRoamingAndLocal);
                string settingsPath  = Path.GetDirectoryName(config.FilePath);
                ExecuteShellProcess(settingsPath);
            },
                () => !m_UrakawaSession.isAudioRecording,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_ShowTobiSettingsFolder)
                );

            RegisterRichCommand(OpenTobiSettingsFolderCommand);
            //
#if DEBUG
            HelpCommand = new RichDelegateCommand(
                Tobi_Lang.CmdHelp_ShortDesc,
                Tobi_Lang.CmdHelp_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                LoadTangoIcon("help-browser"),
                () =>
            {
                m_Logger.Log("ShellView.HelpCommand", Category.Debug, Priority.Medium);

                throw new NotImplementedException("Functionality not implemented, sorry :(",
                                                  new ArgumentOutOfRangeException("First Inner exception",
                                                                                  new FileNotFoundException("Second inner exception !")));
                //    try
                //    { }
                //catch (Exception ex)
                //{
                //    ExceptionHandler.Handle(ex, false, this);
                //}
            },
                () => true,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Help));

            RegisterRichCommand(HelpCommand);
#endif
            //
            //PreferencesCommand = new RichDelegateCommand(
            //    UserInterfaceStrings.Preferences,
            //    UserInterfaceStrings.Preferences_,
            //    null, // KeyGesture obtained from settings (see last parameters below)
            //    LoadTangoIcon("preferences-system"),
            //    () => Debug.Fail("Functionality not implemented yet."),
            //    () => true,
            //    Settings_KeyGestures.Default,
            //    PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Preferences));

            //RegisterRichCommand(PreferencesCommand);
            //
            //WebHomeCommand = new RichDelegateCommand(UserInterfaceStrings.WebHome,
            //    UserInterfaceStrings.WebHome_,
            //    UserInterfaceStrings.WebHome_KEYS,
            //    //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Home_icon")),
            //    LoadTangoIcon("go-home"),
            //    ()=> { throw new NotImplementedException("Functionality not implemented, sorry :("); }, ()=> true);

            //RegisterRichCommand(WebHomeCommand);
            ////
            //NavNextCommand = new RichDelegateCommand(UserInterfaceStrings.NavNext,
            //    UserInterfaceStrings.NavNext_,
            //    UserInterfaceStrings.NavNext_KEYS,
            //    ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Forward")),
            //    ()=> { throw new NotImplementedException("Functionality not implemented, sorry :("); }, ()=> true);

            //RegisterRichCommand(NavNextCommand);
            ////
            //NavPreviousCommand = new RichDelegateCommand(UserInterfaceStrings.NavPrevious,
            //    UserInterfaceStrings.NavPrevious_,
            //    UserInterfaceStrings.NavPrevious_KEYS,
            //    ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Back")),
            //    ()=> { throw new NotImplementedException("Functionality not implemented, sorry :("); }, ()=> true);

            //RegisterRichCommand(NavPreviousCommand);
        }
Example #2
0
        private void initializeCommands_Selection()
        {
            CommandSelectPreviousChunk = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectPreviousChunk_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectPreviousChunk_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("go-previous"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandSelectPreviousChunk", Category.Debug, Priority.Medium);

                CommandStepBack.Execute();

                SelectChunk(PlayBytePosition);
            },
                () => CommandStepBack.CanExecute(),
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectPreviousChunk));

            m_ShellView.RegisterRichCommand(CommandSelectPreviousChunk);
            //
            CommandSelectNextChunk = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectNextChunk_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectNextChunk_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("go-next"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandSelectNextChunk", Category.Debug, Priority.Medium);

                CommandStepForward.Execute();

                SelectChunk(PlayBytePosition);
            },
                () => CommandStepForward.CanExecute(),
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectNextChunk));

            m_ShellView.RegisterRichCommand(CommandSelectNextChunk);
            //
            //
            CommandEndSelection = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioEndSelection_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioEndSelection_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Right1")),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandEndSelection", Category.Debug, Priority.Medium);

                if (m_SelectionBeginTmpBytePosition < 0)
                {
                    return;
                }

                CommandPause.Execute();

                long begin = m_SelectionBeginTmpBytePosition;
                long end   = PlayBytePosition;

                AudioCues.PlayTockTock();

                if (begin == end)
                {
                    CommandClearSelection.Execute();
                    return;
                }

                if (begin > end)
                {
                    long tmp = begin;
                    begin    = end;
                    end      = tmp;
                }

                State.Selection.SetSelectionBytes(begin, end);

                if (IsAutoPlay)
                {
                    CommandPlay.Execute();
                }

                //if (IsAutoPlay)
                //{
                //    //if (!State.Audio.HasContent)
                //    //{
                //    //    return;
                //    //}

                //    //IsAutoPlay = false;
                //    //LastPlayHeadTime = begin;
                //    //IsAutoPlay = true;

                //    //long bytesFrom = State.Audio.ConvertMillisecondsToBytes(begin);
                //    //long bytesTo = State.Audio.ConvertMillisecondsToBytes(end);

                //    //AudioPlayer_PlayFromTo(bytesFrom, bytesTo);
                //}
            },
                () => CommandSelectAll.CanExecute()
                //CanManipulateWaveForm
                // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring
                // && State.Audio.HasContent
                && m_SelectionBeginTmpBytePosition >= 0,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_EndSelection));

            m_ShellView.RegisterRichCommand(CommandEndSelection);
            //
            CommandBeginSelection = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioBeginSelection_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioBeginSelection_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Left1")),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandBeginSelection", Category.Debug, Priority.Medium);

                //CommandPause.Execute();
                CommandClearSelection.Execute();

                m_SelectionBeginTmpBytePosition = PlayBytePosition;

                AudioCues.PlayTock();
            },
                () => CommandSelectLeft.CanExecute(),
                //CommandSelectAll.CanExecute()
                //         //CanManipulateWaveForm
                //         ////&& !IsWaveFormLoading && !IsRecording && !IsMonitorin
                //         //&& State.Audio.HasContent,
                //         && PlayBytePosition >= 0,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_BeginSelection));

            m_ShellView.RegisterRichCommand(CommandBeginSelection);
            //
            CommandSelectLeft = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectLeft_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectLeft_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("format-indent-less"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandSelectLeft", Category.Debug, Priority.Medium);

                if (PlayBytePosition <= 0)
                {
                    AudioCues.PlayBeep();
                    return;
                }

                State.Selection.SetSelectionBytes(0, PlayBytePosition);

                PlayBytePosition = State.Selection.SelectionEndBytePosition;

                //AudioCues.PlayTock();
            },
                () => CommandSelectAll.CanExecute()
                //CanManipulateWaveForm
                // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring
                // && State.Audio.HasContent
                && PlayBytePosition >= 0,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectLeft));

            m_ShellView.RegisterRichCommand(CommandSelectLeft);
            //
            CommandSelectRight = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectRight_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioSelectRight_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("format-indent-more"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandSelectRight", Category.Debug, Priority.Medium);

                if (PlayBytePosition >= State.Audio.DataLength)
                {
                    AudioCues.PlayBeep();
                    return;
                }

                State.Selection.SetSelectionBytes(PlayBytePosition, State.Audio.DataLength);
                //AudioCues.PlayTock();
            },
                () => CommandSelectLeft.CanExecute(),
                //CanManipulateWaveForm
                // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring
                // && State.Audio.HasContent && PlayBytePosition >= 0,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectRight));

            m_ShellView.RegisterRichCommand(CommandSelectRight);
            //
            CommandSelectAll = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdSelectAll_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdSelectAll_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("view-fullscreen"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandSelectAll", Category.Debug, Priority.Medium);

                //if (!State.Audio.HasContent)
                //{
                //    if (View != null)
                //    {
                //        View.SelectAll();
                //    }
                //    return;
                //}

                State.Selection.SetSelectionBytes(0, State.Audio.DataLength);

                //AudioCues.PlayTockTock();
            },
                () => CanManipulateWaveForm
                //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring
                && State.Audio.HasContent,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_SelectAll));

            m_ShellView.RegisterRichCommand(CommandSelectAll);
            //
            CommandClearSelection = new RichDelegateCommand(Tobi_Plugin_AudioPane_Lang.CmdAudioClearSelection_ShortDesc,
                                                            Tobi_Plugin_AudioPane_Lang.CmdAudioClearSelection_LongDesc,
                                                            null, // KeyGesture obtained from settings (see last parameters below)
                                                            m_ShellView.LoadTangoIcon("edit-clear"),
                                                            () =>
            {
                //Logger.Log("AudioPaneViewModel.CommandClearSelection", Category.Debug, Priority.Medium);

                State.Selection.ClearSelection();
            },
                                                            () => CommandSelectAll.CanExecute()
                                                            //CanManipulateWaveForm
                                                            // //&& !IsWaveFormLoading && !IsRecording && !IsMonitoring
                                                            // && State.Audio.HasContent
                                                            && IsSelectionSet,
                                                            Settings_KeyGestures.Default,
                                                            PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ClearSelection));

            m_ShellView.RegisterRichCommand(CommandClearSelection);
            //
        }
Example #3
0
        private void initializeCommands_View()
        {
            CommandStopPlayMonitorRecord = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioStopRecord_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioStopRecord_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                //null, //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Refresh")),
                null,
                () =>
                {
                    //Logger.Log("AudioPaneViewModel.CommandRefresh", Category.Debug, Priority.Medium);

                    OnStopPlayMonitorRecord();
                },
                () => true,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_StopPlayMonitorRecord));

            m_ShellView.RegisterRichCommand(CommandStopPlayMonitorRecord);
            //
            CommandRefresh = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioReload_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioReload_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                //null, //ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Refresh")),
                m_ShellView.LoadTangoIcon("view-refresh"),
                () =>
                {
                    //Logger.Log("AudioPaneViewModel.CommandRefresh", Category.Debug, Priority.Medium);

                    //StartWaveFormLoadTimer(0);

                    AudioPlayer_LoadWaveForm(false);
                },
                () => CanManipulateWaveForm,
                //!IsWaveFormLoading,
                null, null); //IsAudioLoaded

            m_ShellView.RegisterRichCommand(CommandRefresh);
            //
            CommandZoomSelection = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioZoomSelection_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioZoomSelection_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Search")),
                //shellView.LoadTangoIcon("system-search"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoomSelection", Category.Debug, Priority.Medium);

                    View.ZoomSelection();
                },
                () => View != null
                    && State.Audio.HasContent
                    && CanManipulateWaveForm
                    //&&!IsWaveFormLoading
                    && IsSelectionSet,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ZoomSelection));

            m_ShellView.RegisterRichCommand(CommandZoomSelection);
            //
            CommandZoomFitFull = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoomFitFull", Category.Debug, Priority.Medium);

                    View.ZoomFitFull();
                },
                () => View != null
                    && State.Audio.HasContent
                    && CanManipulateWaveForm,
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ZoomFitFull));
            //Settings_KeyGestures.Default.Keyboard_Audio_Zoom_0

            m_ShellView.RegisterRichCommand(CommandZoomFitFull);
            //
            CommandZoom_0 = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioFitFull_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    //Logger.Log("AudioPaneViewModel.CommandZoom_0", Category.Debug, Priority.Medium);
                    //View.ZoomFitFull();

                    CommandZoomFitFull.Execute();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_0));

            m_ShellView.RegisterRichCommand(CommandZoom_0);
            //
            CommandZoom_1 = new RichDelegateCommand(
                "Zoom 1",
                "Zoom 1",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_1", Category.Debug, Priority.Medium);

                    View.Zoom_1();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_1));

            m_ShellView.RegisterRichCommand(CommandZoom_1);
            //
            CommandZoom_2 = new RichDelegateCommand(
                "Zoom 2",
                "Zoom 2",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_2", Category.Debug, Priority.Medium);

                    View.Zoom_2();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_2));

            m_ShellView.RegisterRichCommand(CommandZoom_2);
            //
            CommandZoom_3 = new RichDelegateCommand(
                "Zoom 3",
                "Zoom 3",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_3", Category.Debug, Priority.Medium);

                    View.Zoom_3();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_3));

            m_ShellView.RegisterRichCommand(CommandZoom_3);
            //
            CommandZoom_4 = new RichDelegateCommand(
                "Zoom 4",
                "Zoom 4",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_4", Category.Debug, Priority.Medium);

                    View.Zoom_4();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_4));

            m_ShellView.RegisterRichCommand(CommandZoom_4);
            //
            CommandZoom_5 = new RichDelegateCommand(
                "Zoom 5",
                "Zoom 5",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_5", Category.Debug, Priority.Medium);

                    View.Zoom_5();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_5));

            m_ShellView.RegisterRichCommand(CommandZoom_5);
            //
            CommandZoom_6 = new RichDelegateCommand(
                "Zoom 6",
                "Zoom 6",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_6", Category.Debug, Priority.Medium);

                    View.Zoom_6();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_6));

            m_ShellView.RegisterRichCommand(CommandZoom_6);
            //
            CommandZoom_7 = new RichDelegateCommand(
                "Zoom 7",
                "Zoom 7",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_7", Category.Debug, Priority.Medium);

                    View.Zoom_7();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_7));

            m_ShellView.RegisterRichCommand(CommandZoom_7);
            //
            CommandZoom_8 = new RichDelegateCommand(
                "Zoom 8",
                "Zoom 8",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_8", Category.Debug, Priority.Medium);

                    View.Zoom_8();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_8));

            m_ShellView.RegisterRichCommand(CommandZoom_8);
            //
            CommandZoom_9 = new RichDelegateCommand(
                "Zoom 9",
                "Zoom 9",
                null, // KeyGesture obtained from settings (see last parameters below)
                null, //m_ShellView.LoadGnomeNeuIcon("Neu_utilities-system-monitor"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandZoom_9", Category.Debug, Priority.Medium);

                    View.Zoom_9();
                },
                () => CommandZoomFitFull.CanExecute(),
                //&& !IsWaveFormLoading,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_Zoom_9));

            m_ShellView.RegisterRichCommand(CommandZoom_9);
            //
            CommandAudioSettings = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioSettings_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioSettings_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeNeuIcon("Neu_audio-x-generic"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandAudioSettings", Category.Debug, Priority.Medium);

                    var windowPopup = new PopupModalWindow(m_ShellView,
                                                           UserInterfaceStrings.EscapeMnemonic(Tobi_Plugin_AudioPane_Lang.CmdAudioSettings_ShortDesc),
                                                           new AudioSettings(this),
                                                           PopupModalWindow.DialogButtonsSet.Close,
                                                           PopupModalWindow.DialogButton.Close,
                                                           true, 420, 220, null, 0,null);
                    windowPopup.EnableEnterKeyDefault = true;
                    windowPopup.ShowFloating(()=>
                        {
                            m_SpeechSynthesizer.SpeakAsyncCancelAll();
                        });
                },
                () => !IsRecording,
                Settings_KeyGestures.Default,
                null //PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ShowOptions)
                );

            m_ShellView.RegisterRichCommand(CommandAudioSettings);
            //
#if DEBUG
            CommandShowAudioOptionsDialog = new RichDelegateCommand(
                @"Show audio options",
                null,
                null, // KeyGesture obtained from settings (see last parameters below)
                null,
                ()=>
                {
                    Logger.Log("AudioPaneViewModel.CommandShowOptionsDialog", Category.Debug, Priority.Medium);

                    //var window = shellView.View as Window;

                    var pane = new AudioOptions { DataContext = this };

                    var windowPopup = new PopupModalWindow(m_ShellView,
                                                           UserInterfaceStrings.EscapeMnemonic(@"Show audio options"),
                                                           pane,
                                                           PopupModalWindow.DialogButtonsSet.Close,
                                                           PopupModalWindow.DialogButton.Close,
                                                           true, 400, 500, null, 0,null);
                    windowPopup.EnableEnterKeyDefault = true;
                    windowPopup.Show();
                },
                () => true,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ExpertOptions)
                );

            m_ShellView.RegisterRichCommand(CommandShowAudioOptionsDialog);
#endif //DEBUG
            //
            CommandFocus = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioFocus_ShortDesc,
                null,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("audio-volume-low"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandFocus", Category.Debug, Priority.Medium);

                    View.BringIntoFocus();
                },
                () => View != null,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Focus_Audio));

            m_ShellView.RegisterRichCommand(CommandFocus);
            //
            CommandFocusStatusBar = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioFocusStatusBar_ShortDesc,
                null,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeNeuIcon("Neu_utilities-terminal"),
                () =>
                {
                    Logger.Log("AudioPaneViewModel.CommandFocusStatusBar", Category.Debug, Priority.Medium);

                    View.BringIntoFocusStatusBar();
                },
                () => View != null,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Focus_StatusBar));

            m_ShellView.RegisterRichCommand(CommandFocusStatusBar);
            //
        }
Example #4
0
        private void initializeCommands_Player()
        {
            CommandPlaybackRateReset = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateReset_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateReset_LongDesc,
                null,   // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeGionIcon("Gion_go-previous"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandPlaybackRateReset", Category.Debug, Priority.Medium);

                PlaybackRate = PLAYBACK_RATE_MIN;
            },
                () => true
                //&& !IsWaveFormLoading
                ,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ResetPlaybackRate));

            m_ShellView.RegisterRichCommand(CommandPlaybackRateReset);
            //
            CommandPlaybackRateDown = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateDown_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateDown_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeGionIcon("Gion_go-down"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandPlaybackRateDown", Category.Debug, Priority.Medium);

                if ((PlaybackRate - PLAYBACK_RATE_STEP) >= PLAYBACK_RATE_MIN)
                {
                    PlaybackRate -= PLAYBACK_RATE_STEP;
                }
                else
                {
                    PlaybackRate = PLAYBACK_RATE_MIN;
                    Debug.Fail("This should never happen !");
                }
            },
                () => (PlaybackRate - PLAYBACK_RATE_STEP) >= PLAYBACK_RATE_MIN
                //&& !IsWaveFormLoading
                ,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlaybackRateDown));

            m_ShellView.RegisterRichCommand(CommandPlaybackRateDown);
            //
            CommandPlaybackRateUp = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateUp_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayRateUp_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeGionIcon("Gion_go-up"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandPlaybackRateUp", Category.Debug, Priority.Medium);

                if ((PlaybackRate + PLAYBACK_RATE_STEP) <= PLAYBACK_RATE_MAX)
                {
                    PlaybackRate += PLAYBACK_RATE_STEP;
                }
                else
                {
                    PlaybackRate = PLAYBACK_RATE_MAX;
                    Debug.Fail("This should never happen !");
                }
            },
                () => (PlaybackRate + PLAYBACK_RATE_STEP) <= PLAYBACK_RATE_MAX
                //&& !IsWaveFormLoading
                ,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlaybackRateUp));

            m_ShellView.RegisterRichCommand(CommandPlaybackRateUp);
            //
            CommandAutoPlay = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioAutoPlay_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioAutoPlay_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("applications-multimedia"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandAutoPlay", Category.Debug, Priority.Medium);

                //if (IsAutoPlay)
                //{
                //    AudioCues.PlayTock();
                //}
                //else
                //{
                //    AudioCues.PlayTockTock();
                //}

                IsAutoPlay = !IsAutoPlay;
            },
                () => true
                //&& !IsWaveFormLoading
                ,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_ToggleAutoPlayMode));

            m_ShellView.RegisterRichCommand(CommandAutoPlay);
            //
            //
            CommandPause = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPause_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPause_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("media-playback-pause"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandPause", Category.Debug, Priority.Medium);

                m_PlayAutoAdvance = false;

                SetRecordAfterPlayOverwriteSelection(-1);

                long playBytePosition = PlayBytePosition;

                m_Player.Stop();

                SetPlayHeadTimeBypassAutoPlay(playBytePosition);

                if (EventAggregator != null)
                {
                    EventAggregator.GetEvent <StatusBarMessageUpdateEvent>().Publish(Tobi_Plugin_AudioPane_Lang.PlaybackStopped);
                }

                if (IsMonitoringAlways)
                {
                    CommandStartMonitor.Execute();
                }
            },
                () => State.Audio.HasContent && IsPlaying
                //&& !IsWaveFormLoading
                ,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayPause));

            m_ShellView.RegisterRichCommand(CommandPause);
            //
            CommandPlay = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlay_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlay_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadTangoIcon("media-playback-start"),
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandPlay", Category.Debug, Priority.Medium);
                CommandPause.Execute();

                if (IsMonitoring)
                {
                    CommandStopMonitor.Execute();
                }

                //#if DEBUG
                //                    Logger.Log("AudioPaneViewModel.CommandPlay (called PAUSE)", Category.Debug, Priority.Medium);
                //#endif


                if (PlayBytePosition < 0)
                {
                    m_LastSetPlayBytePosition = 0;
                }

                if (!IsSelectionSet)
                {
                    //if (LastPlayHeadTime >= State.Audio.ConvertBytesToMilliseconds(State.Audio.DataLength))
                    if (PlayBytePosition >= State.Audio.DataLength)
                    {
                        if (Settings.Default.Audio_DisableAutoJumpToBegin_AtEndOfPlayback)
                        {
                            //m_LastSetPlayBytePosition = State.Audio.DataLength;
                            //PlayBytePosition = State.Audio.DataLength;
                            AudioCues.PlayBeep();
                        }
                        else
                        {
                            //LastPlayHeadTime = 0; infinite loop !
                            AudioPlayer_PlayFromTo(0, -1);
                        }
                    }
                    else
                    {
                        AudioPlayer_PlayFromTo(PlayBytePosition, -1);
                    }
                }
                else
                {
                    if (false &&
                        PlayBytePosition >= State.Selection.SelectionBeginBytePosition &&
                        PlayBytePosition < State.Selection.SelectionEndBytePosition)
                    {
                        //if (verifyBeginEndPlayerValues(byteLastPlayHeadTime, byteSelectionRight))
                        //{
                        //}
                        AudioPlayer_PlayFromTo(PlayBytePosition, State.Selection.SelectionEndBytePosition);
                    }
                    else
                    {
                        //if (verifyBeginEndPlayerValues(byteSelectionLeft, byteSelectionRight))
                        //{
                        //}
                        AudioPlayer_PlayFromTo(State.Selection.SelectionBeginBytePosition, State.Selection.SelectionEndBytePosition);
                    }
                }
            },
                () => State.Audio.HasContent &&
                !IsPlaying &&
                (!IsMonitoring || IsMonitoringAlways) &&
                !IsRecording
                //&& !IsWaveFormLoading
                ,
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayPause));

            m_ShellView.RegisterRichCommand(CommandPlay);
            //
            CommandPlayAutoAdvance = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayAutoAdvance_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayAutoAdvance_LongDesc,
                null,                                                     // KeyGesture obtained from settings (see last parameters below)
                m_ShellView.LoadGnomeGionIcon("applications-multimedia"), //emblem-system
                () =>
            {
                Logger.Log("AudioPaneViewModel.CommandPlayAutoAdvance", Category.Debug, Priority.Medium);

                m_PlayAutoAdvance = true;
                CommandPlay.Execute();
            },
                () => CommandPlay.CanExecute(),
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayAutoAdvance));

            m_ShellView.RegisterRichCommand(CommandPlayAutoAdvance);
            //
            CommandPlayPreviewLeft = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewLeft_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewLeft_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Left")),
                () => PlayPreviewLeftRight(true),
                () => CommandPlay.CanExecute(),
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayLeftPreview));

            m_ShellView.RegisterRichCommand(CommandPlayPreviewLeft);
            //
            CommandPlayPreviewRight = new RichDelegateCommand(
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewRight_ShortDesc,
                Tobi_Plugin_AudioPane_Lang.CmdAudioPlayPreviewRight_LongDesc,
                null, // KeyGesture obtained from settings (see last parameters below)
                ScalableGreyableImageProvider.ConvertIconFormat((DrawingImage)Application.Current.FindResource("Horizon_Image_Right")),
                () => PlayPreviewLeftRight(false),
                () => CommandPlay.CanExecute(),
                Settings_KeyGestures.Default,
                PropertyChangedNotifyBase.GetMemberName(() => Settings_KeyGestures.Default.Keyboard_Audio_PlayRightPreview));

            m_ShellView.RegisterRichCommand(CommandPlayPreviewRight);
            //
        }