Esempio n. 1
0
 private void btnOkay_Click(object sender, EventArgs e)
 {
     foreach (char nameChar in txtFileName.Text)
     {
         foreach (char forbiddenChar in "\\/:*?\"<>|")
         {
             if (nameChar == forbiddenChar)
             {
                 ShowValidationError("Note name may not contain \\/:*?\"<>| characters.");
                 return;
             }
         }
     }
     if (string.IsNullOrEmpty(txtFileName.Text))
     {
         ShowValidationError("Note name may not be blank.");
         return;
     }
     if (File.Exists(_NoteFolder.GetFullPath(txtFileName.Text + ".txt")))
     {
         ShowValidationError("A note by that name already exists.");
         return;
     }
     this.DialogResult = DialogResult.OK;
     this.Close();
 }
Esempio n. 2
0
 private void menuMove_Click(object sender, EventArgs e)
 {
     Monitor.Enter(_System.LockObject);
     try
     {
         if (GetSelectedFile() == null)
         {
             return;
         }
         NoteFolder newNoteFolder = FolderNameForm.GetValue("Enter note tab to move to:", _System);
         if (newNoteFolder == null)
         {
             return;
         }
         string newFullPath = newNoteFolder.GetFullPath(GetSelectedFile().BareFileName);
         File.Move(GetSelectedFile().GetFullPath(), newFullPath);
         _System.RefreshCurrentFolder();
     }
     catch (Exception ex)
     {
         ShowException(ex);
     }
     finally
     {
         Monitor.Exit(_System.LockObject);
     }
 }
Esempio n. 3
0
 public string GetFullPath()
 {
     return(Folder.GetFullPath(BareFileName));
 }