/// <summary> /// Создает форму для добавления BiWeekly-отчета /// </summary> /// <param name="dialogFileName"></param> public BiWeeklyForm(string dialogFileName) { currentBiWeeklyReport = new BiWeekly(); mode = ScreenMode.Add; InitializeComponent(); string fileName = dialogFileName.Substring(dialogFileName.LastIndexOf('\\') + 1); if (fileName.LastIndexOf('.') == -1) { textBoxShortName.Text = fileName; } else { textBoxShortName.Text = fileName.Substring(0, fileName.LastIndexOf('.')); } currentBiWeeklyReport.LoadReport(dialogFileName); }
private void buttonLoad_Click(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.Filter = "Adobe PDF Files|*.pdf"; if (dialog.ShowDialog() == DialogResult.OK) { RemoveTempFile(); tempReport.LoadReport(dialog.FileName); if (textBoxReportName.Text == "") { string fileName = dialog.FileName.Substring(dialog.FileName.LastIndexOf('\\') + 1); tempReport.RealName = fileName; if (fileName.LastIndexOf('.') == -1) { textBoxShortName.Text = fileName; } else { textBoxShortName.Text = fileName.Substring(0, fileName.LastIndexOf('.')); } textBoxReportName.Text = fileName; } else { tempReport.RealName = textBoxReportName.Text; } tempReport.SaveReportToFile(out tempFilePath); if (mode == ScreenMode.Add) { buttonSaveToFile.Enabled = true; reportViewItem.Icon = icons.PDF; reportViewItem.Cursor = Cursors.Hand; } } }