当前位置: 首页>>代码示例>>C#>>正文


C# SaveFileDialog.InitializeLifetimeService方法代码示例

本文整理汇总了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);
            }
        }
开发者ID:hieuntp2,项目名称:TruongChuyen,代码行数:23,代码来源:CreateQuestion.cs

示例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!");
            }
        }
开发者ID:hieuntp2,项目名称:TruongChuyen,代码行数:37,代码来源:Server.cs


注:本文中的System.Windows.Forms.SaveFileDialog.InitializeLifetimeService方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。