Пример #1
0
        private void dgvShowNote_DoubleClick(object sender, EventArgs e)
        {
            string filePath = dgvShowNote.CurrentCell.Value.ToString();

            string extension = System.IO.Path.GetExtension(filePath);

            if (extension == ".txt")
            {
                frmShowTxt frmShowtxt = new frmShowTxt();
                frmShowtxt.OpenFile(filePath);
                frmShowtxt.Text = filePath.ToString();
                frmShowtxt.Show();
            }
            if (extension == ".doc" || extension == ".docx")
            {
                frmShowWord frmWord = new frmShowWord();
                frmWord.OpenFile(filePath);
                frmWord.Text = filePath.ToString();

                frmWord.Show();
            }
            if (extension == ".pdf")
            {
                frmShowPDF frmPDF = new frmShowPDF();
                frmPDF.OpenFile(filePath);
                frmPDF.Text = filePath.ToString();

                frmPDF.Show();
            }
        }
Пример #2
0
        private void btnOpen_Click(object sender, EventArgs e)
        {
            History fileNearOpen = new History();
            string  filePath     = dataGridViewLibrary.CurrentCell.Value.ToString();
            string  extension    = System.IO.Path.GetExtension(filePath);

            if (extension == ".txt")
            {
                frmShowTxt frmShowtxt = new frmShowTxt();
                frmShowtxt.OpenFile(filePath);
                frmShowtxt.Text = filePath.ToString();
                frmShowtxt.Show();
            }
            if (extension == ".doc" || extension == ".docx")
            {
                frmShowWord frmWord = new frmShowWord();
                frmWord.OpenFile(filePath);
                frmWord.Text = filePath.ToString();
                frmWord.Show();
            }
            if (extension == ".pdf")
            {
                frmShowPDF frmPDF = new frmShowPDF();
                frmPDF.OpenFile(filePath);
                frmPDF.Text = filePath.ToString();
                frmPDF.Show();
            }


            fileNearOpen.FilePath = filePath.ToString();
            fileNearOpen.TimeOpen = DateTime.Now;

            HistoryController.AddHistory(fileNearOpen);

            HistoryController.UpdateHistory(fileNearOpen);
        }