예제 #1
0
        public async void StopRecordingAndShowPreview()
        {
            this.StopRecording();
            this.ResetValues();
            StorageFile audioFileAsync = await this._viewModel.GetAudioFileAsync();

            if (audioFileAsync == null)
            {
                this._disableHideAnimation = true;
                this.IsOpened = false;
            }
            else
            {
                int        recordDurationSeconds = this._viewModel.RecordDurationSeconds;
                List <int> waveform = this._viewModel.Waveform;
                this._previewUC = new AudioRecorderPreviewUC();
                ((PresentationFrameworkCollection <UIElement>)((Panel)this.gridRoot).Children).Add((UIElement)this._previewUC);
                this._previewUC.CancelTap = (Action)(() =>
                {
                    this._disableHideAnimation = true;
                    this.IsOpened = false;
                });
                this._previewUC.SendTap = new Action(this.Send);
                this._previewUC.SetData(audioFileAsync, recordDurationSeconds, waveform);
            }
        }
예제 #2
0
 private void Hide(bool animated = true)
 {
     try
     {
         this._isOpened = false;
         if (this._currentPage != null)
         {
             this._currentPage.SuppressMenu  = this._wasMenuSuppressed;
             this._currentPage.BackKeyPress -= (new EventHandler <CancelEventArgs>(this.Page_OnBackKeyPress));
         }
         this.CancelRecording();
         AudioRecorderPreviewUC previewUc = this._previewUC;
         if (previewUc != null)
         {
             previewUc.Pause();
         }
         if (this._previewUC != null && ((PresentationFrameworkCollection <UIElement>)((Panel)this.gridRoot).Children).Contains((UIElement)this._previewUC))
         {
             ((PresentationFrameworkCollection <UIElement>)((Panel)this.gridRoot).Children).Remove((UIElement)this._previewUC);
         }
         if (animated)
         {
             this.AnimateOverlay(false);
         }
         else
         {
             this.UpdateVisibilityState();
         }
     }
     catch
     {
     }
 }
예제 #3
0
        public void HandleManipulationCompleted(ManipulationCompletedEventArgs e)
        {
            if (this._isInSendState)
            {
                return;
            }
            AudioRecorderPreviewUC previewUc = this._previewUC;

            if ((previewUc != null ? (((UIElement)previewUc).Visibility == 0 ? 1 : 0) : 0) != 0)
            {
                return;
            }
            Point translation = e.TotalManipulation.Translation;

            // ISSUE: explicit reference operation
            if (Math.Abs(((Point)@translation).Y) > 80.0 && !this._isInSendState)
            {
                this.GoToSendState();
            }
            else if (this.transformButton.TranslateX > -160.0)
            {
                if (this._viewModel.RecordDuration > 500)
                {
                    this.StopRecordingAndSend();
                }
                else
                {
                    this.IsOpened = false;
                }
            }
            else
            {
                if (this.transformButton.TranslateX > -16.0)
                {
                    this.transformButton.CenterX = 44.0;
                }
                this.IsOpened = false;
            }
        }