Exemplo n.º 1
0
        private async void Button_EndTalking_Click(object sender, RoutedEventArgs e)
        {
            //GlobalData.TalkingPageViewModel.IsRunning = false;

            GlobalData.TalkingPageViewModel.SetTalkingState(ViewModel.Enum.TalkState.Stopped);
            GlobalData.CurrentTalkingEndTime = DateTime.Now;

            _cameraHelperBack.IsStartRec = false;
            _cameraHelperFont.IsStartRec = false;

            _timer.Stop();
            _audioHelper.StopRec();

            _cameraHelperFont.CloseDevice();
            _cameraHelperBack.CloseDevice();

            if (_isVoiceConverterStart)
            {
                RecogStop();
            }

            string talkingMessageListFullPath = $"{AppDomain.CurrentDomain.BaseDirectory}InquiryData\\{GlobalData.NewTalkViewModel.Inquiry.InquiryId}\\talkingMessageList.json";

            GlobalData.TalkingPageViewModel.SaveTalkingMessageList(talkingMessageListFullPath);

            GlobalData.NewTalkViewModel.Inquiry.InquiryChatFilePath = talkingMessageListFullPath;

            InquiryDAL inquiryDAL = new InquiryDAL();
            await inquiryDAL.Update(GlobalData.NewTalkViewModel.Inquiry);
        }
        private async void Button_SaveLawBook_Click(object sender, RoutedEventArgs e)
        {
            PdfFormatProvider pdfFormatProvider = new PdfFormatProvider();

            string pdfPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "InquiryData", GlobalData.NewTalkViewModel.Inquiry.InquiryId, "lawbook.pdf");

            using (Stream stream = File.OpenWrite(pdfPath))
            {
                pdfFormatProvider.Export(this.radRichTextBox.Document, stream);
            }

            GlobalData.NewTalkViewModel.Inquiry.InquiryLawBookFilePath = pdfPath;
            InquiryDAL inquiryDAL = new InquiryDAL();
            await inquiryDAL.Update(GlobalData.NewTalkViewModel.Inquiry);
        }