public AudioRecordingForms()
        {
            InitializeComponent();

            for (int i = 0; i < WaveIn.DeviceCount; i++)
            {
                cb_ListMicIn.Items.Add(WaveIn.GetCapabilities(i).ProductName);
            }
            mRawAudioData         = new Queue <WaveInEventArgs>();
            mListOfflineAudioFile = new List <AudioFileProperty>();

            mErrorBufferData = new Queue <WaveInEventArgs>();

            cb_ListMicIn.SelectedIndex = Int16.Parse(AppsSettings.GetInstance().DefaultMic);
            TB_AudioLength.Text        = AppsSettings.GetInstance().DefaultAudioLength;

            mBackgroundWorker = new BackgroundWorker();
            mBackgroundWorker.WorkerSupportsCancellation = true;
            mBackgroundWorker.DoWork += StartRecording;
            mBackgroundWorker.WorkerReportsProgress = true;
            mBackgroundWorker.RunWorkerCompleted   += worker_RunWorkerCompleted;
            mBackgroundWorker.ProgressChanged      += WorkerConnectionStateChange;


            mBackgroundOfflineWorker = new BackgroundWorker();
            mBackgroundOfflineWorker.WorkerSupportsCancellation = true;
            mBackgroundOfflineWorker.DoWork += StartOfflineRecording;
            mBackgroundOfflineWorker.WorkerReportsProgress = true;
            mBackgroundOfflineWorker.RunWorkerCompleted   += worker_RunWorkerOfflineCompleted;
            mBackgroundOfflineWorker.ProgressChanged      += WorkerPercentageStateChange;
        }
Exemple #2
0
        private GGGExportEntity BuildExportEntity()
        {
            GGGExportEntity gGGExportEntity = new GGGExportEntity();

            gGGExportEntity.sessionId  = AppsSettings.GetInstance().Session.idSession;
            gGGExportEntity.activity   = this.mGGGActivityEntitities.ElementAt(this.CBB_HoatDong.SelectedIndex);
            gGGExportEntity.locationId = this.mGGGLocationEntities.ElementAt(this.CBB_Location.SelectedIndex).place_id;

            if (!this.CB_CheDoMat.Checked)
            {
                gGGExportEntity.confidentialStatus = 0;
            }
            else
            {
                gGGExportEntity.confidentialStatus = 1;
                List <long> listGroupId = new List <long>();
                foreach (CheckBox checkBox in this.mListUserGroupCheckbox)
                {
                    if (checkBox.Checked)
                    {
                        GGGUserGroupEntity entity = this.mGroupNameAndGroupEntity[checkBox.Text];
                        listGroupId.Add(entity.group_id);
                    }
                }
                gGGExportEntity.allowedGroupIds = listGroupId;
            }

            return(gGGExportEntity);
        }
        public static void SaveNewSessionDocument(
            SessionsEntity sessionsEntity, Word.Document document)
        {
            ///Combine path: ConfigurePath/Sang_Datetime_SessionId
            string name       = Utils.FormatDateTimeToSaveFile(sessionsEntity.meetingDay) + sessionsEntity.meetingEntity.name.Substring(0, 1);
            string folderName = Utils.fromUtf8ToAscii(sessionsEntity.meetingEntity.name) + "_" +
                                sessionsEntity.meetingDay + "_" + sessionsEntity.idSession;

            string[] combinePath     = { AppsSettings.GetInstance().DataDir, sessionsEntity.activity.name, folderName };
            string[] combineFullPath = { AppsSettings.GetInstance().DataDir, sessionsEntity.activity.name, folderName, name + ".docx" };

            if (!Directory.Exists(Path.Combine(combinePath)))
            {
                Directory.CreateDirectory(Path.Combine(combinePath));
            }

            ///Check file is exist or not
            int version = 0;

            while (File.Exists(Path.Combine(combineFullPath)) && version <= 10)
            {
                version = version + 1;
                combineFullPath[combineFullPath.Length - 1] = name + "_" + version + ".docx";
            }

            string fillFileName = Path.Combine(combineFullPath);

            ///0.Save as other document
            document.SaveAs2(fillFileName);
            ///1. Remove all document
            TextHelpers.RemoveAllContent(document);
        }
 public void FillingData()
 {
     this.isLoad    = true;
     Cursor.Current = Cursors.WaitCursor;
     RequestData(AppsSettings.GetInstance().Session.nationalAssembly);
     BindingData(this.mListRepresentative);
     Cursor.Current = Cursors.Default;
 }
        private string GetAudioChildPath()
        {
            string path = Path.Combine(AppsSettings.GetInstance().DataDir, mAudioName);

            if (Directory.Exists(path) == false)
            {
                Directory.CreateDirectory(path);
            }

            return(path);
        }
Exemple #6
0
 private void OnKeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.F5)
     {
         Cursor.Current = Cursors.WaitCursor;
         LoadData(AppsSettings.GetInstance().Session.idSession);
         BindingData(this.mListAudio);
         Cursor.Current = Cursors.Default;
     }
     else if (Keys.Escape == e.KeyCode)
     {
         DialogResult = DialogResult.Cancel;
     }
 }
        public static void SaveRepresentativeDocument(
            SessionsEntity sessionsEntity, Word.Document document, string representaiveName
            )
        {
            ///Combine path: ConfigurePath/Sang_Datetime_SessionId
            string name       = representaiveName + ".docx";
            string folderName = Utils.fromUtf8ToAscii(sessionsEntity.meetingEntity.name) + "_" +
                                sessionsEntity.meetingDay + "_" + sessionsEntity.idSession;

            string[] combinePath     = { AppsSettings.GetInstance().DataDir, sessionsEntity.activity.name, folderName };
            string[] combineFullPath = { AppsSettings.GetInstance().DataDir, sessionsEntity.activity.name, folderName, name };

            if (!Directory.Exists(Path.Combine(combinePath)))
            {
                Directory.CreateDirectory(Path.Combine(combinePath));
            }
            string fillFileName = Path.Combine(combineFullPath);

            ///0.Save as other document
            document.SaveAs2(Path.Combine(fillFileName));
        }
Exemple #8
0
        private void SelectRow(int rowIndex)
        {
            SessionsEntity entity = null;

            if (this.mSearchSession.Count > 0)
            {
                entity = this.mSearchSession[rowIndex];
            }
            else if (this.mListSession.Count > 0)
            {
                entity = this.mListSession[rowIndex];
            }

            if (entity != null)
            {
                AppsSettings.GetInstance().Session = entity;
                DialogResult = DialogResult.OK;
            }
            else
            {
                DialogResult = DialogResult.Cancel;
            }
        }
        private void On_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            Debug.WriteLine("On_CellDoubleClick");
            if (e.RowIndex >= this.DGV_SplitRepresentative.Rows.Count ||
                e.RowIndex < 0)
            {
                return;
            }
            string representative_name = (string)this.DGV_SplitRepresentative.Rows[e.RowIndex].Cells["Representative_Name"].Value;
            string representative_duty = (string)this.DGV_SplitRepresentative.Rows[e.RowIndex].Cells["Representative_Duty"].Value;
            List <DocumentParagraph> representativeDocumentParagraphs = new List <DocumentParagraph>();

            foreach (DocumentParagraph para in this.mDocumentEntity.paragraphs)
            {
                if (para.belongTo != null &&
                    Utils.FormatRepresentative(para.belongTo.name, para.belongTo.duty).Equals(
                        Utils.FormatRepresentative(representative_name, representative_duty)))
                {
                    ///Generate document here
                    representativeDocumentParagraphs.Add(para);
                }
            }
            if (representativeDocumentParagraphs.Count > 0)
            {
                Word.Document newDocument = Globals.ThisAddIn.Application.Documents.Add();
                WordProcessingHelper.SaveRepresentativeDocument(AppsSettings.GetInstance().Session, newDocument, representativeDocumentParagraphs[0].belongTo.name);
                WordProcessingHelper.CreateDefaultDocumentStyle(newDocument);
                WordProcessingHelper.CreateDocumentTitle(newDocument, AppsSettings.GetInstance().Session);
                WordProcessingHelper.GenerateRepresentativeDocument(representativeDocumentParagraphs, newDocument);
                newDocument.Save();
            }
            else
            {
            }

            DialogResult = DialogResult.OK;
        }
        /// <summary>
        /// Create default title.
        /// BẢN TỔNG HỢP THẢO LUẬN TẠI HỘI TRƯỜNG
        ///       (Ghi theo băng ghi âm)
        ///      Buổi sáng ngày 07/12/2020
        ///             Nội dung:
        ///                 1
        ///      Đại biểu chủ trì 2 chủ trì
        ///Người điều hành nội dung điều hành nội dung

        /// </summary>
        /// <param name="document"></param>
        /// <param name="sessionEntity"></param>
        public static void CreateDocumentTitle(Word.Document document, SessionsEntity sessionEntity)
        {
            Word.Selection selection = Globals.ThisAddIn.Application.Selection;

            /// Create title
            /// BẢN TỔNG HỢP THẢO LUẬN TẠI HỘI TRƯỜNG
            string meetingTitle = "BẢN TỔNG HỢP THẢO LUẬN TẠI HỘI TRƯỜNG";

            if (sessionEntity.activity.type == Constants.ACTIVITY_TYPE_TO)
            {
                meetingTitle = string.Format("BẢN TỔNG HỢP THẢO LUẬN TẠI {0}", sessionEntity.activityGroup.nameActivityGroup);
            }
            selection.set_Style(document.Styles[Constants.MeetingTitleStyle]);
            selection.TypeText(meetingTitle);
            selection.TypeParagraph();

            ///  (Ghi theo băng ghi âm)
            selection.set_Style(document.Styles[Constants.RecordingTitleStyle]);
            selection.TypeText("(Ghi theo băng ghi âm)");
            selection.TypeParagraph();

            ///Buổi sáng ngày 07/12/2020
            string meetingDate = string.Format("Buổi {0} ngày {1}", sessionEntity.meetingEntity.name.ToLower(), Utils.FormatDateTime(sessionEntity.meetingDay));

            selection.set_Style(document.Styles[Constants.MeetingTimeTitleStyle]);
            selection.TypeText(meetingDate);
            selection.TypeParagraph();

            /// Tieu de: Nội dung:
            selection.set_Style(document.Styles[Constants.MeetingContentTitleStyle]);
            selection.TypeText("Nội dung:");
            selection.TypeParagraph();

            /// Noi dung
            selection.set_Style(document.Styles[Constants.MeetingContentTitleStyle]);
            selection.TypeText(sessionEntity.contentMeeting);
            selection.TypeParagraph();

            if (sessionEntity.activity.type == Constants.ACTIVITY_TYPE_TO)
            {
                string contentControl = string.Format("Chủ trì: {0}", sessionEntity.leadConference);
                selection.set_Style(document.Styles[Constants.MeetingContentTitleStyle]);
                selection.TypeText(contentControl);
                selection.TypeParagraph();
                selection.set_Style(document.Styles[Constants.ContentStyle]);
            }
            else
            {
                ///Đại biểu chủ trì 2 chủ
                string leadingCoference = string.Format("{0} chủ trì", sessionEntity.leadConference);
                selection.set_Style(document.Styles[Constants.MeetingContentTitleStyle]);
                selection.TypeText(leadingCoference);
                selection.TypeParagraph();

                ///Người điều hành nội dung điều hành nội dung
                string contentControl = string.Format("{0} điều hành nội dung", sessionEntity.personContentControl);
                selection.set_Style(document.Styles[Constants.MeetingContentTitleStyle]);
                selection.TypeText(contentControl);
                selection.TypeParagraph();
                selection.set_Style(document.Styles[Constants.ContentStyle]);
            }

            if (AppsSettings.GetInstance().IsAddPageNumber == false)
            {
                Globals.ThisAddIn.Application.ActiveWindow.ActivePane.View.SeekView = Microsoft.Office.Interop.Word.WdSeekView.wdSeekCurrentPageFooter;
                Globals.ThisAddIn.Application.ActiveWindow.ActivePane.Selection.Paragraphs.Alignment = Microsoft.Office.Interop.Word.WdParagraphAlignment.wdAlignParagraphCenter;
                Object CurrentPage = Word.WdFieldType.wdFieldPage;
                Globals.ThisAddIn.Application.ActiveWindow.Selection.Fields.Add(Globals.ThisAddIn.Application.ActiveWindow.Selection.Range, ref CurrentPage);

                Globals.ThisAddIn.Application.ActiveWindow.ActivePane.View.SeekView = Microsoft.Office.Interop.Word.WdSeekView.wdSeekMainDocument;

                AppsSettings.GetInstance().IsAddPageNumber = true;
            }
        }
Exemple #11
0
 public ListAudioForm()
 {
     InitializeComponent();
     LoadData(AppsSettings.GetInstance().Session.idSession);
     BindingData(this.mListAudio);
 }