예제 #1
0
파일: GUI.cs 프로젝트: Cantanos/BibTeX
 public GUI()
 {
     InitializeComponent();
     texFile = new FileManager();
     bibFile = new FileManager();
     bibRecordsCurrent = new BibTeXRecordsCollection();
     bibRecordsReference = new BibTeXRecordsCollection();
     isFilesOpened = false;
     gridViewEntryDetail.EditMode = DataGridViewEditMode.EditOnEnter;
     bibEntryContent = new BibTeXEntryContent();
     styleCollection = new StyleCollection();
     styleInterpreter = new StyleInterpreter(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location) + @"\Style.xml");
 }
예제 #2
0
파일: GUI.cs 프로젝트: Cantanos/BibTeX
        private void saveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (bibRecordsCurrent.getRecords().Count == 0)
            {
                MessageBox.Show("There is no data to save.");
                return;
            }

            SaveFileDialog sfd = new SaveFileDialog();
            sfd.Filter = "Bib File (*.bib)| *.bib";
            DialogResult result = sfd.ShowDialog();

            if (result == DialogResult.OK)
            {
                if (sfd.FileName.Substring(sfd.FileName.LastIndexOf(".") + 1).Equals("bib"))
                {
                    FileManager fileManager = new FileManager();
                    string data = "";
                    foreach (BibTeXRecord bibRecord in bibRecordsCurrent.getRecords())
                    {
                        data += bibRecord.toString();
                    }
                    fileManager.saveBibFile(sfd.FileName, data);

                    MessageBox.Show("Successfully saved.");
                }
                else
                {
                    MessageBox.Show("Wrong extension. Please select .bib file.");
                }
            }
        }