本文整理汇总了C#中System.Windows.Forms.SaveFileDialog.Reset方法的典型用法代码示例。如果您正苦于以下问题:C# SaveFileDialog.Reset方法的具体用法?C# SaveFileDialog.Reset怎么用?C# SaveFileDialog.Reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.SaveFileDialog
的用法示例。
在下文中一共展示了SaveFileDialog.Reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Reset
public void Reset ()
{
SaveFileDialog sfd = new SaveFileDialog ();
sfd.AddExtension = false;
sfd.CheckFileExists = true;
sfd.CheckPathExists = false;
sfd.CreatePrompt = true;
sfd.DefaultExt = "txt";
sfd.DereferenceLinks = false;
sfd.FileName = "default.build";
sfd.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
sfd.FilterIndex = 5;
sfd.InitialDirectory = Path.GetTempPath ();
sfd.OverwritePrompt = false;
sfd.RestoreDirectory = true;
sfd.ShowHelp = true;
sfd.Title = "Saving";
sfd.ValidateNames = false;
sfd.Reset ();
Assert.IsTrue (sfd.AddExtension, "#1");
Assert.IsFalse (sfd.CheckFileExists, "#2");
Assert.IsTrue (sfd.CheckPathExists, "#3");
Assert.IsFalse (sfd.CreatePrompt, "#4");
Assert.IsNotNull (sfd.DefaultExt, "#5");
Assert.AreEqual (string.Empty, sfd.DefaultExt, "#6");
Assert.IsTrue (sfd.DereferenceLinks, "#7");
Assert.IsNotNull (sfd.FileName, "#8");
Assert.AreEqual (string.Empty, sfd.FileName, "#9");
Assert.IsNotNull (sfd.FileNames, "#10");
Assert.AreEqual (0, sfd.FileNames.Length, "#11");
Assert.IsNotNull (sfd.Filter, "#12");
Assert.AreEqual (string.Empty, sfd.Filter, "#13");
Assert.AreEqual (1, sfd.FilterIndex, "#14");
Assert.IsNotNull (sfd.InitialDirectory, "#15");
Assert.AreEqual (string.Empty, sfd.InitialDirectory, "#16");
Assert.IsTrue (sfd.OverwritePrompt, "#17");
Assert.IsFalse (sfd.RestoreDirectory, "#18");
Assert.IsFalse (sfd.ShowHelp, "#19");
Assert.IsNotNull (sfd.Title, "#20");
Assert.AreEqual (string.Empty, sfd.Title, "#21");
Assert.IsTrue (sfd.ValidateNames, "#22");
}
示例2: SaveButton_Click
private void SaveButton_Click( object sender, EventArgs e )
{
if (_saveFileDialogOpened) return;
_saveFileDialogOpened = true;
_saveFileDialog = new SaveFileDialog();
_saveFileDialog.Reset();
_saveFileDialog.DefaultExt = ".xml";
_saveFileDialog.InitialDirectory = _defaultFolder;
_saveFileDialog.Filter = "XML files(*.xml)|*.xml|config files(*.config)|*.config";
_saveFileDialog.FilterIndex = 1;
_saveFileDialog.Title = "Save Custom Bedlam Config File...";
DialogResult result = _saveFileDialog.ShowDialog();
if(result == DialogResult.OK)
{
string fileName = _saveFileDialog.FileName;
SaveBedlamConfigValues(fileName);
}
_saveFileDialogOpened = false;
}
示例3: cmdBrowse_Click
private void cmdBrowse_Click(object sender, EventArgs e)
{
// Show the save box
if (lvTemplates.SelectedItems.Count == 0) {
MessageBox.Show("Please select a template to use before setting the file to save.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
return;
}
string fileExtension = Path.GetExtension(lvTemplates.SelectedItems[0].Tag.ToString().Split('|')[1]);
Directory.SetCurrentDirectory(g.Project.ProjectPath);
SaveFileDialog sfd = new SaveFileDialog();
sfd.RestoreDirectory = true;
sfd.Title = "Add New Item";
sfd.Filter = "*" + fileExtension + " Files|*" + fileExtension + "|All Files (*.*)|*.*";
sfd.OverwritePrompt = true;
sfd.CheckPathExists = true;
DialogResult result = sfd.ShowDialog(this);
if (result == DialogResult.Cancel)
return;
txtSaveTo.Text = sfd.FileName;
sfd.Reset();
}