Reset() публичный Метод

public Reset ( ) : void
Результат void
Пример #1
0
 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;
 }
Пример #2
0
 public void Reset()
 {
     _saveFileDialog.Reset();
 }
Пример #3
0
		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");
		}
Пример #4
0
        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();
        }