private string GetBGColor(ESRState state)
        {
            switch (state)
            {
            default:
            case ESRState.Recording: return(Colors.LightGray.ToString());

            case ESRState.Playing: return(Colors.LightGray.ToString());
            }
        }
        private string GetImageSource(ESRState state)
        {
            switch (state)
            {
            default:
            case ESRState.Recording: return("/EasyRecorder;component/Resources/icons8-video-record-64.png");

            case ESRState.Playing: return("/EasyRecorder;component/Resources/icons8-play-64.png");
            }
        }
 public void SetState(ESRState state)
 {
     this.InvokeIfRequired(() =>
     {
         this.ToastMessage.ToastMessage     = GetMessage(state);
         this.ToastMessage.ToastImageSource = GetImageSource(state);
         this.ToastMessage.ToastBGColor     = GetBGColor(state);
         this.imgToast.BeginAnimation(OpacityProperty, this.FadeInOutAnimation);
         this.ToastMessage.UpdateProperties();
     });
 }
Example #4
0
 private void EnableToolbarButton(ESRState state)
 {
     if (state == ESRState.Playing)
     {
         buttonPlay.IsEnabled      = false;
         buttonPause.IsEnabled     = true;
         buttonStop.IsEnabled      = true;
         buttonRecord.IsEnabled    = false;
         buttonDragClick.IsEnabled = false;
     }
     else if (state == ESRState.Recording)
     {
         buttonPlay.IsEnabled      = false;
         buttonPause.IsEnabled     = true;
         buttonStop.IsEnabled      = true;
         buttonRecord.IsEnabled    = false;
         buttonDragClick.IsEnabled = false;
     }
     else if (state == ESRState.Stop || state == ESRState.PlayDone)
     {
         buttonPlay.IsEnabled      = true;
         buttonPause.IsEnabled     = false;
         buttonStop.IsEnabled      = false;
         buttonRecord.IsEnabled    = true;
         buttonDragClick.IsEnabled = true;
     }
     else if (state == ESRState.PlayingPause)
     {
         buttonPlay.IsEnabled      = true;
         buttonPause.IsEnabled     = false;
         buttonStop.IsEnabled      = true;
         buttonRecord.IsEnabled    = false;
         buttonDragClick.IsEnabled = false;
     }
     else if (state == ESRState.RecordingPause)
     {
         buttonPlay.IsEnabled      = false;
         buttonPause.IsEnabled     = false;
         buttonStop.IsEnabled      = true;
         buttonRecord.IsEnabled    = true;
         buttonDragClick.IsEnabled = false;
     }
     else if (state == ESRState.DragClick)
     {
         buttonPlay.IsEnabled      = false;
         buttonPause.IsEnabled     = true;
         buttonStop.IsEnabled      = true;
         buttonRecord.IsEnabled    = false;
         buttonDragClick.IsEnabled = false;
     }
 }
 public void SetCurrentState(ESRState state)
 {
     this.InvokeIfRequired(() =>
     {
         if (state == ESRState.Playing)
         {
             this.StatusBarItem.StatusText        = "Playing...";
             this.StatusBarItem.StatusImageSource = "/EasyRecorder;component/Resources/icons8-play-64.png";
             this.imgStatusStatusBar.BeginAnimation(OpacityProperty, this.FadeInOutAnimation);
         }
         else if (state == ESRState.PlayingPause)
         {
             this.StatusBarItem.StatusText        = "Pause playing";
             this.StatusBarItem.StatusImageSource = "/EasyRecorder;component/Resources/icons8-pause-64.png";
             this.imgStatusStatusBar.BeginAnimation(OpacityProperty, new DoubleAnimation());
         }
         else if (state == ESRState.PlayDone)
         {
             this.StatusBarItem.StatusText        = "Done";
             this.StatusBarItem.StatusImageSource = "/EasyRecorder;component/Resources/icons8-simplestop-64.png";
             this.imgStatusStatusBar.BeginAnimation(OpacityProperty, new DoubleAnimation());
         }
         else if (state == ESRState.Recording)
         {
             this.StatusBarItem.StatusText        = "Recording...";
             this.StatusBarItem.StatusImageSource = "/EasyRecorder;component/Resources/icons8-video-record-64.png";
             this.imgStatusStatusBar.BeginAnimation(OpacityProperty, this.FadeInOutAnimation);
         }
         else if (state == ESRState.RecordingPause)
         {
             this.StatusBarItem.StatusText        = "Pause recording";
             this.StatusBarItem.StatusImageSource = "/EasyRecorder;component/Resources/icons8-pause-64.png";
             this.imgStatusStatusBar.BeginAnimation(OpacityProperty, new DoubleAnimation());
         }
         else if (state == ESRState.Stop)
         {
             this.StatusBarItem.StatusText        = string.Empty;
             this.StatusBarItem.StatusImageSource = string.Empty;
             this.imgStatusStatusBar.BeginAnimation(OpacityProperty, new DoubleAnimation());
         }
         this.StatusBarItem.UpdateProperties();
     });
 }
 private string GetMessage(ESRState state)
 {
     return(state.ToString());
 }
Example #7
0
 public static bool IsStopPause(ESRState state)
 {
     return(state == ESRState.Stop || state == ESRState.PlayDone || state == ESRState.PlayingPause || state == ESRState.RecordingPause);
 }
Example #8
0
 public static bool IsStop(ESRState state)
 {
     return(state == ESRState.Stop || state == ESRState.PlayDone);
 }