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


C# System.Windows.Forms.SaveFileDialog.ShowDialog方法代码示例

本文整理汇总了C#中System.Windows.Forms.SaveFileDialog.ShowDialog方法的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.SaveFileDialog.ShowDialog方法的具体用法?C# System.Windows.Forms.SaveFileDialog.ShowDialog怎么用?C# System.Windows.Forms.SaveFileDialog.ShowDialog使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.SaveFileDialog的用法示例。


在下文中一共展示了System.Windows.Forms.SaveFileDialog.ShowDialog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnClick

        protected override void OnClick()
        {
            if (IsExportMode)
            {
                var saveFile = new System.Windows.Forms.SaveFileDialog();
                saveFile.AddExtension = true;
                saveFile.AutoUpgradeEnabled = true;
                saveFile.CheckPathExists = true;
                saveFile.DefaultExt = ExportModeDefaultExtension;
                saveFile.Filter = ExportModeExtensionFilter;
                saveFile.FilterIndex = 0;
                var result = saveFile.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    var fileName = saveFile.FileName;
                    this.CommandParameter = fileName;
                    base.OnClick();
                }
            }
            else
            {
                base.OnClick();
            }
        }
开发者ID:iLuffy,项目名称:ILuffy,代码行数:25,代码来源:ImageButton.xaml.cs

示例2: saveBtn_Click

        private void saveBtn_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.SaveFileDialog save = new System.Windows.Forms.SaveFileDialog();
            save.DefaultExt = "txt";
            save.Filter = Strings.GetLabelString("TxtFileDescriptionPlural") + "|*.txt|" + Strings.GetLabelString("AllFileDescriptionPlural") + "|*";
            save.Title = Strings.GetLabelString("SaveReportQuestion");

            if (AAnalyzer.LastSavePath == null)
                save.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
            else
                save.InitialDirectory = AAnalyzer.LastSavePath;

            save.FileName = analyzer.game.Name + ".txt";
            if (save.ShowDialog(this.GetIWin32Window()) != System.Windows.Forms.DialogResult.Cancel) {
                AAnalyzer.LastSavePath = Path.GetDirectoryName(save.FileName);
                try {
                    StreamWriter writer = File.CreateText(save.FileName);
                    writer.Write(reportTxt.Text);
                    writer.Close();
                    saved = true;
                } catch (Exception ex) {
                    TranslatingMessageHandler.SendError("WriteError", ex, save.FileName);
                }
            }
        }
开发者ID:raven-ie,项目名称:MASGAU,代码行数:25,代码来源:ReportWindow.xaml.cs

示例3: menuitem_Click

		void menuitem_Click(object sender, EventArgs e)
		{
			if (_host.Chats.Length != 0) {
				System.Windows.Forms.SaveFileDialog sf = new System.Windows.Forms.SaveFileDialog();
				sf.DefaultExt = ".xml";
				sf.Filter = "XMLファイル(*.xml)|*.xml";
				sf.FileName = "export_" + _host.Id + ".xml";
				if (sf.ShowDialog((System.Windows.Forms.IWin32Window)_host.Win32WindowOwner) == System.Windows.Forms.DialogResult.OK) {
					string xml = buildNicoXML();
					if (xml != null) {
						try {
							using (System.IO.StreamWriter sw = new System.IO.StreamWriter(sf.FileName)) {
								sw.WriteLine(xml);
								sw.Close();
							}

							_host.ShowStatusMessage("エクスポートに成功しました。");

						} catch (Exception ex) {
							NicoApiSharp.Logger.Default.LogException(ex);
							_host.ShowFaitalMessage("エクスポートに失敗しました。詳しい情報はログファイルを参照してください");
						}
					}
				}
			}
		}
开发者ID:nico-lab,项目名称:niconama-ocv,代码行数:26,代码来源:Exporter.cs

示例4: _export_Click

 private void _export_Click(object sender, RoutedEventArgs e)
 {
     //打开对话框
     System.Windows.Forms.SaveFileDialog saveFile = new System.Windows.Forms.SaveFileDialog();
     saveFile.Filter = "JPG(*.jpg)|*.jpg";
     saveFile.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
     if (saveFile.ShowDialog() == System.Windows.Forms.DialogResult.Cancel)
     {
         return;
     }
     var saveFilePath = saveFile.FileName;
     if (saveFilePath != "")
     {
         if (web != null)
         {
             if (web.ReadyState == System.Windows.Forms.WebBrowserReadyState.Complete)
             {
                 System.Drawing.Rectangle r = web.Document.Body.ScrollRectangle;
                 web.Height = r.Height;
                 web.Width = r.Width;
                 Bitmap bitMapPic = new Bitmap(r.Width, r.Height);
                 web.DrawToBitmap(bitMapPic, r);
                 bitMapPic.Save(saveFilePath);
                 Toolkit.MessageBox.Show("文件导出成功!", "系统提示", MessageBoxButton.OK, MessageBoxImage.Information);
             }
         }
     }
 }
开发者ID:wuqiangqiang,项目名称:dcs,代码行数:28,代码来源:SysQuarterAnalysis.xaml.cs

示例5: btnAddData_Click

        private void btnAddData_Click(object sender, EventArgs e)
        {
            /////////////////////////////////
            //Replace with something that uses the default data provider
            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
            sfd.OverwritePrompt = true;
            sfd.Filter = "Shape Files|*.shp";
            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                IFeatureSet _addedFeatureSet = new MapWindow.Data.Shapefile();
                _addedFeatureSet.Filename = sfd.FileName;

                //If the features set is null do nothing the user probably hit cancel
                if (_addedFeatureSet == null)
                    return;

                //If the feature type is good save it
                else
                {
                    //This inserts the new featureset into the list
                    textBox1.Text = System.IO.Path.GetFileNameWithoutExtension(_addedFeatureSet.Filename);
                    base.Param.Value = _addedFeatureSet;
                    base.Status = ToolStatus.Ok;
                    base.LightTipText = MapWindow.MessageStrings.FeaturesetValid;
                }
            }
        }
开发者ID:zhongshuiyuan,项目名称:mapwindowsix,代码行数:27,代码来源:FeatureSetElementOut.cs

示例6: btnExport_Click

        private void btnExport_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(txbAPIKey.Text) || string.IsNullOrEmpty(txbEventId.Text))
            {
                MessageBox.Show("Please enter all the information on the form.", "Export", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            //load data from meetup should be async
            IMeetupService service = new MeetupService(new MeetupRepository(txbAPIKey.Text));
            IList<RsvpItem> rsvpItems = service.GetRsvpsForEvent(long.Parse(txbEventId.Text));

            //export it
            var saveFileDialog = new SaveFileDialog
                         {
                             InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop),
                             DefaultExt = "csv",
                             AddExtension = true,
                             Filter = @"CSV Files (*.csv)|*.csv"
                         };

            if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    File.WriteAllText(saveFileDialog.FileName, new RsvpManager().GetAttendees(rsvpItems).ToCsv(true));
                    MessageBox.Show("Export done.", "Export", MessageBoxButton.OK, MessageBoxImage.Information);
                }
                catch
                {
                    MessageBox.Show("Export Failed.", "Export", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
开发者ID:davidpadbury,项目名称:MeetupManager,代码行数:34,代码来源:Window1.xaml.cs

示例7: OnClick

        public override void OnClick()
        {
            System.Data.IDbConnection resultConnection = CheckApplication.CurrentTask.ResultConnection as System.Data.OleDb.OleDbConnection;
            if (resultConnection == null)
            {
                DevExpress.XtraEditors.XtraMessageBox.Show("��ǰ����״̬�����Ϊ�Ѵ����������������ѱ��Ƴ���");
                return;
            }

            System.Windows.Forms.SaveFileDialog dlgShpFile = new System.Windows.Forms.SaveFileDialog();
            dlgShpFile.FileName = Environment.CurrentDirectory + "\\" + CheckApplication.CurrentTask.Name + ".xls";
            dlgShpFile.Filter = "SHP �ļ�|*.Shp";
            if (dlgShpFile.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;

            string strFile = dlgShpFile.FileName;
            string strPath = System.IO.Path.GetDirectoryName(strFile);
            string strName = System.IO.Path.GetFileNameWithoutExtension(strFile);

            Hy.Check.Task.Task curTask = CheckApplication.CurrentTask;
               ErrorExporter exporter = new ErrorExporter();
            exporter.BaseWorkspace = curTask.BaseWorkspace;
            exporter.ResultConnection = curTask.ResultConnection;
            exporter.SchemaID = curTask.SchemaID;
            exporter.Topology = curTask.Topology;
            exporter.ExportToShp(strPath, strName);
        }
开发者ID:hy1314200,项目名称:HyDM,代码行数:27,代码来源:ExportToVCTCommand.cs

示例8: DoAction

        private void DoAction(Mine2D game, int buttonNumber)
        {
            switch (buttonNumber)
            {
                case 0:
                    game.gameState = GameState.Playing;
                    break;

                case 1:
                    System.Windows.Forms.SaveFileDialog saveWorld = new System.Windows.Forms.SaveFileDialog();
                    saveWorld.Filter = "Сжатые миры Mine2D|*.m2d";
                    if (saveWorld.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        game.gameState = GameState.SavingWorld;
                        new System.Threading.Thread(delegate()
                        {
                            LevelManager.SaveLevel(game, saveWorld.FileName);
                        }).Start();
                    }
                    break;

                case 2:
                    LevelManager.RecreateLevel(game);
                    game.gameState = GameState.MainMenu;
                    break;
            }
        }
开发者ID:ArtSin,项目名称:Mine2D-Old,代码行数:27,代码来源:PauseMenu.cs

示例9: ExportToXML

 /// <summary>                                                                                                                                                        
 /// 导出用户选择的XML文件                                                                                                                                                
 /// </summary>                                                                                                                                                           
 /// <param name="ds">DataSet</param>                                                                                                                                     
 public void ExportToXML(DataSet ds)
 {
     System.Windows.Forms.SaveFileDialog saveFileDlg = new System.Windows.Forms.SaveFileDialog();
     saveFileDlg.DefaultExt = "xml";
     saveFileDlg.Filter = "xml文件 (*.xml)|*.xml";
     if (saveFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         doExportXML(ds, saveFileDlg.FileName);
 }
开发者ID:rew170,项目名称:soomecode,代码行数:12,代码来源:ExcelUtils.cs

示例10: SaveTheme

 public static void SaveTheme(this MsDev2013_Theme theme)
 {
     using (var sfd = new System.Windows.Forms.SaveFileDialog() { Filter = "YAML File|*.yml" })
       {
     if (sfd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
     theme.SaveTheme(sfd.FileName);
       }
 }
开发者ID:tfwio,项目名称:sd-ext,代码行数:8,代码来源:ThemeGen2.cs

示例11: btnSaveImg_Click

        private void btnSaveImg_Click(object sender, RoutedEventArgs e)
        {
            var sfd = new System.Windows.Forms.SaveFileDialog
	                      {
		                      Title = "Select where do you want to save the Screenshot", 
							  Filter = "PNG Image (*.png)|*.png"
	                      };
	        if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                SaveImage(sfd.FileName);
        }
开发者ID:YxCREATURExY,项目名称:Assembly,代码行数:10,代码来源:HaloScreenshot.xaml.cs

示例12: SaveAsMenuItem_Click

 private void SaveAsMenuItem_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.SaveFileDialog dialog = new System.Windows.Forms.SaveFileDialog();
     dialog.DefaultExt = ".bvh";
     dialog.Filter = "BVHファイル(*.bvh)|*.bvh";
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         bvhTo.BVH.Save(dialog.FileName);
     }
 }
开发者ID:satokoba,项目名称:MMDBVHToSLBVH,代码行数:10,代码来源:Window1.xaml.cs

示例13: SelectAndSavePath

 /// <summary>
 /// 选择保存路径
 /// </summary>
 /// <param name="title"></param>
 /// <param name="filter"></param>
 /// <returns></returns>
 public static string SelectAndSavePath(string title, string filter)
 {
     var sp = new System.Windows.Forms.SaveFileDialog
         {
             Title = title,
             RestoreDirectory = true,
             Filter = filter
         };
     if (sp.ShowDialog() != System.Windows.Forms.DialogResult.OK) return null;
     var oppath = sp.FileName;
     return oppath;
 }
开发者ID:RyanFu,项目名称:A51C1B616A294D4BBD6D3D46FD7F78A7,代码行数:18,代码来源:BaseDialog.cs

示例14: ButtonScreenshot_OnClick

 private void ButtonScreenshot_OnClick(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.SaveFileDialog Dialog = new System.Windows.Forms.SaveFileDialog
     {
         Filter = "PNG|*.png|MRC|*.mrc"
     };
     System.Windows.Forms.DialogResult Result = Dialog.ShowDialog();
     if (Result == System.Windows.Forms.DialogResult.OK)
     {
         Viewport.GrabScreenshot(Dialog.FileName);
     }
 }
开发者ID:dtegunov,项目名称:membranorama,代码行数:12,代码来源:PatchWindow.xaml.cs

示例15: SaveProject

        public static void SaveProject(TestProject testProject, bool showDialogAlways = false)
        {
            System.Windows.Forms.SaveFileDialog saveFileDialog = new System.Windows.Forms.SaveFileDialog();
            saveFileDialog.Title = "Save test project";
            saveFileDialog.RestoreDirectory = true;
            saveFileDialog.InitialDirectory = Directory.GetCurrentDirectory();
            saveFileDialog.Filter = "Controller Tester Projects (*.fmpx) | *.fmpx";
            saveFileDialog.FileName = testProject.Name;

            if (showDialogAlways == true || testProject.Path == null)
            {
                if (saveFileDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (!saveFileDialog.FileName.Contains(".fmpx"))
                    {
                        testProject.Name = Path.GetFileNameWithoutExtension(saveFileDialog.FileName);
                        testProject.Path = saveFileDialog.FileName + ".fmpx";
                    }
                    else
                    {
                        testProject.Name = Path.GetFileNameWithoutExtension(saveFileDialog.FileName);
                        testProject.Path = saveFileDialog.FileName;
                    }
                }
                else
                {
                    return;
                }
            }

            if (testProject.Path != null)
            {
                FileStream f = File.Create(testProject.Path);

                var listOfFaultModelAssemblies = (from lAssembly in AppDomain.CurrentDomain.GetAssemblies()
                                                  where lAssembly.FullName.Contains("FaultModel")
                                                  select lAssembly).ToArray();
                var extraTypes = (from lAssembly in listOfFaultModelAssemblies
                                  from lType in lAssembly.GetTypes()
                                  where lType.IsSubclassOf(typeof(FM4CC.Environment.FaultModelConfiguration))
                                  select lType).ToArray();
                var extraTypes2 = (from lAssembly in listOfFaultModelAssemblies
                                   from lType in lAssembly.GetTypes()
                                   where lType.IsSubclassOf(typeof(FM4CC.TestCase.FaultModelTesterTestCase))
                                   select lType).ToArray();
                XmlSerializer xsSubmit = new XmlSerializer(typeof(TestProject), extraTypes.Concat(extraTypes2).ToArray());

                XmlWriter writer = XmlWriter.Create(f);
                xsSubmit.Serialize(writer, testProject);

                f.Close();
            }
        }
开发者ID:sac16controllertester,项目名称:ControllerTester,代码行数:53,代码来源:OpenSaveHandler.cs


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