Beispiel #1
0
        public RecordingActor(IRecording rec)
        {
            _irecord = rec;

            Receive <StringMessage>(msg =>
            {
                _irecord.Record($"{msg.Message}");
            });
        }
        private async Task <bool> ActionPerformed(int actionPerformed)
        {
            try
            {
                if (actionPerformed == Constants.ACTION_PERFORMED_RECORD)
                {
                    this.recording = new Recording();
                }

                switch (actionPerformed)
                {
                case Constants.ACTION_PERFORMED_RECORD:
                    await recording.Record();

                    break;

                case Constants.ACTION_PERFORMED_STOP:
                    await recording.Stop(Dispatcher);

                    break;

                case Constants.ACTION_PERFORMED_DISPLAY_CREATE_FILES:
                    StorageFile audio = await recording.DisplayRecording();

                    BuildAudio(audio);
                    break;

                case Constants.ACTION_PERFORMED_PLAY_CREATED_FILES:
                    await PlayDirectory();

                    break;

                default:
                    throw new Exception("Unknown Action Performed - actionPerformed: " + actionPerformed.ToString());
                }
            }
            catch (Exception e)
            {
                throw e;
            }

            return(true); //HACK!
        }