示例#1
0
        public void UpdateMessage(MessageViewModel message)
        {
            _message = message;

            message.PlaybackService.PropertyChanged -= OnCurrentItemChanged;

            var voiceNote = GetContent(message.Content);

            if (voiceNote == null || !_templateApplied)
            {
                return;
            }

            message.PlaybackService.PropertyChanged += OnCurrentItemChanged;

            Progress.UpdateWaveform(voiceNote);

            //UpdateDuration();
            UpdateFile(message, voiceNote.Voice);
        }
        public void UpdateMessage(MessageViewModel message)
        {
            _message = message;

            message.PlaybackService.PropertyChanged -= OnCurrentItemChanged;

            var voiceNote = GetContent(message.Content);

            if (voiceNote == null || !_templateApplied)
            {
                return;
            }

            message.PlaybackService.PropertyChanged += OnCurrentItemChanged;

            Progress.UpdateWaveform(voiceNote);

            if (message.ProtoService.IsPremium && message.SchedulingState == null)
            {
                if (Recognize == null)
                {
                    Recognize        = GetTemplateChild(nameof(Recognize)) as ToggleButton;
                    Recognize.Click += Recognize_Click;
                }

                Recognize.Visibility = Visibility.Visible;
            }
            else if (Recognize != null)
            {
                Recognize.Visibility = Visibility.Collapsed;
            }

            UpdateRecognitionResult(voiceNote.SpeechRecognitionResult);

            UpdateManager.Subscribe(this, message, voiceNote.Voice, ref _fileToken, UpdateFile);
            UpdateFile(message, voiceNote.Voice);
        }