當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。