Beispiel #1
0
        public static async Task <DanmakuModel> GetDanmakuModel(string content)
        {
            var window = new TestVoiceReplyParamsWindow();

            window.template = content;
            window.UpdatePreview(null, null);
            window.Show();
            while (!window.isClosed)
            {
                await Task.Delay(100);
            }
            if (!window.isOkClicked)
            {
                return(null);
            }
            return(window.model);
        }
Beispiel #2
0
        private async void Button_TestVoiceReply_Click(object sender, RoutedEventArgs e)
        {
            if (sender == null)
            {
                return;
            }
            var context = (sender as System.Windows.Controls.Button).DataContext as VoiceReplyRule;
            var model   = await TestVoiceReplyParamsWindow.GetDanmakuModel(context.ReplyContent);

            Activate();
            if (model == null)
            {
                return;
            }
            model.MsgType = ((VoiceReplyRule.MatchSource)context.MatchingSource == VoiceReplyRule.MatchSource.GiftName)
                            ||
                            ((VoiceReplyRule.MatchSource)context.MatchingSource == VoiceReplyRule.MatchSource.GiftName) ? MsgTypeEnum.GiftSend : MsgTypeEnum.Comment;
            await TTSPlayer.PlayVoiceReply(model, context, true, true);
        }