-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFrmMain.cs
More file actions
51 lines (50 loc) · 1.71 KB
/
FrmMain.cs
File metadata and controls
51 lines (50 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
using System.IO;
namespace QuestionPaperMaker
{
public partial class FrmMain : DevExpress.XtraEditors.XtraForm
{
private string wordDocument = string.Empty;
public FrmMain()
{
InitializeComponent();
}
private void btnLoad_Click(object sender, EventArgs e)
{
var dlg = new OpenFileDialog()
{
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments),
Title = "Word dokumentini seçin",
Filter = "Word Documents|*.doc;*.docx",
FilterIndex = 1,
Multiselect = false,
};
if (dlg.ShowDialog() != DialogResult.OK)
return;
if (Path.GetExtension(dlg.FileName) != ".doc" && Path.GetExtension(dlg.FileName) != ".docx")
{
MessageBox.Show("Bu Word dokumenti deyil!", "Word", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
wordDocument = dlg.FileName;
}
private void btnPreview_Click(object sender, EventArgs e)
{
if (wordDocument == "")
{
MessageBox.Show("Suallar yüklənməyib!", "Suallar", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
var arguments = new List<string>()
{
txtFaculty.Text,
txtGroup.Text,
txtSubject.Text,
txtTeacher.Text,
txtYearAndSemester.Text,
spnPaperCount.Text
};
var frm = new FrmPreview(wordDocument, arguments);
frm.ShowDialog();
}
}
}