Exemplo n.º 1
0
 public object InitializeLifetimeService()
 {
     return(_saveFileDialog.InitializeLifetimeService());
 }
Exemplo n.º 2
0
        private void lưuNhưToolStripMenuItem_Click(object sender, EventArgs e)
        {
            String Location = String.Empty;
            #if DEBUG
            Location = "D:/Bộ câu hỏi 1.json";
            #else
            SaveFileDialog frm = new SaveFileDialog();
            frm.InitializeLifetimeService();
            frm.Filter = "Bộ đề (*.json)|*.json";
            frm.Title = "Browse Config file";
            DialogResult ret = STAShowDialog(frm);

            if (ret == DialogResult.OK)
            {
                Location = frm.FileName;
            }
            #endif
            tbAddress.Text = Location;
            if (Location != "")
            {
                _groupquestion.SaveToFile(tbQuestionGroupName.Text, tbAddress.Text);
            }
        }
Exemplo n.º 3
0
        private void saveResultToFile_Click(object sender, EventArgs e)
        {
            string pathFile = "";
            #if DEBUG
            pathFile = "D:/test_result.txt";
            #else
            String Location = String.Empty;
            SaveFileDialog frm = new SaveFileDialog();
            frm.InitializeLifetimeService();
            frm.Filter = "Bộ đề (*.json)|*.json";
            frm.Title = "Browse Config file";
            DialogResult ret = STAShowDialog(frm);

            if (ret == DialogResult.OK)
            {
                pathFile = frm.FileName;
            }
            #endif
            if (_groupquestion != null)
            {
                System.IO.StreamWriter file = new System.IO.StreamWriter(pathFile, true);
                file.WriteLine("Bộ câu hỏi: " + _groupquestion.name + " số lượng: " + _groupquestion.questions.Count);
                file.WriteLine("Ngày kiểm tra: " + DateTime.Now);
                file.Close();
                _myClientManage.writeResultToFile(pathFile, _groupquestion);

                System.IO.StreamWriter file2 = new System.IO.StreamWriter(pathFile, true);
                file2.WriteLine("**************************");
                file2.WriteLine("**************************");
                file2.Close();
                MessageBox.Show("Đã ghi xong file kết quả!");
            }
            else
            {
                MessageBox.Show("Chưa có bộ câu hỏi!");
            }
        }