本文整理匯總了C#中System.Windows.Forms.SaveFileDialog.InitializeLifetimeService方法的典型用法代碼示例。如果您正苦於以下問題:C# SaveFileDialog.InitializeLifetimeService方法的具體用法?C# SaveFileDialog.InitializeLifetimeService怎麽用?C# SaveFileDialog.InitializeLifetimeService使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類System.Windows.Forms.SaveFileDialog
的用法示例。
在下文中一共展示了SaveFileDialog.InitializeLifetimeService方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: SaveFileDialog
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);
}
}
示例2: saveResultToFile_Click
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!");
}
}