本文整理汇总了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!");
}
}