private async void OnRecordingSnugglerAbort(AbortType abortType)
        {
            if (abortType == AbortType.TimeOut)
            {
                IAudioService audioService = new NAudioService();
                IDataStorage  dataStorage  = new MongoDatabaseHandler(conectionString, "Shaitan",
                                                                      "Songs", "Hash");
                var result = await QueryCommandBuilder.Instance.BuildQueryCommand()
                             .From(recorderSnuggler.FilePath)
                             .UsingServices(dataStorage, audioService)
                             .Query();

                if (result.BestMath != null)
                {
                    var notificationManager = new NotificationManager();

                    notificationManager.Show(new NotificationContent
                    {
                        Title   = result.BestMath.Title,
                        Message = result.BestMath.Artist,
                        Type    = NotificationType.Success
                    });
                    prevMatch = result.BestMath;
                    isNoty    = true;
                }
            }
            isRecordingSunn = !isRecordingSunn;
        }
 private void OnRecordingAbort(AbortType abortType)
 {
     ImageVisibility = Visibility.Hidden;
     isRecording     = false;
     Application.Current.Dispatcher.Invoke((Action) delegate {
         RecognizeFile(recorder.FilePath);
     });
 }
Example #3
0
        void HandleConditionalAborts(T context)
        {
            if (_hasLowerPriorityConditionalAbort)
            {
                UpdateLowerPriorityAbortConditional(context, TaskStatus.Success);
            }

            if (AbortType.Has(AbortTypes.Self))
            {
                UpdateSelfAbortConditional(context, TaskStatus.Success);
            }
        }
Example #4
0
        void HandleConditionalAborts(T context)
        {
            // check any lower priority tasks to see if they changed to a success
            if (_hasLowerPriorityConditionalAbort)
            {
                UpdateLowerPriorityAbortConditional(context, TaskStatus.Failure);
            }

            if (AbortType.Has(AbortTypes.Self))
            {
                UpdateSelfAbortConditional(context, TaskStatus.Failure);
            }
        }
        private IEnumerable <BonsaiNode> Abortables(BonsaiNode aborter, AbortType abortType)
        {
            switch (abortType)
            {
            case AbortType.Self:
                return(SelfAbortables(aborter));

            case AbortType.LowerPriority:
                return(LowerPriorityAbortables(aborter));

            case AbortType.Both:
                return(SelfAbortables(aborter).Concat(LowerPriorityAbortables(aborter)));

            default:
                return(Enumerable.Empty <BonsaiNode>());
            }
        }