예제 #1
0
 //Return:
 // 0 -- Abort/Cancel
 // 1 -- Retry
 // 2 -- Ignore
 private static int CheckNodePath(string nodePath)
 {
     if (!GoodiesPath.IsDwgPath(nodePath))
     {
         string msg = string.Format("P_NOTES file ({0}) is not a .dwg file", nodePath);
         MessageBox.Show(msg, "Not a DWG file", MessageBoxButtons.OK);
         return(0);
     }
     else if (!GoodiesPath.IsNotePath(nodePath))
     {
         string       msg    = string.Format("Note file {0} does not look like a P_NOTES file.", nodePath);
         DialogResult result = MessageBox.Show(msg, "Does not look like P_NOTES file", MessageBoxButtons.AbortRetryIgnore);
         if (result == DialogResult.Ignore)
         {
             return(2);
         }
         else if (result == DialogResult.Retry)
         {
             return(1);
         }
         else
         {
             return(0);
         }
     }
     return(2);
 }
 private void ProgramManagerForm_DragDrop(object sender, DragEventArgs e)
 {
     if (e.Data.GetDataPresent(DataFormats.FileDrop))
     {
         string[] fileList = (string[])e.Data.GetData(DataFormats.FileDrop, false);
         foreach (string path in fileList)
         {
             if (System.IO.Path.GetFileName(path) == (ConstantName.databasePostFix))
             {
                 string relativePNotePath = Model.ReadDatabase(path);
                 P_NODE_PATH_BOX.Text = Model.ProjectFolder + relativePNotePath;
                 SetUpFolderTreeView.Nodes.Clear();
                 setupGridView.Rows.Clear();
                 Model.UpdateTheForm(SetUpFolderTreeView, setupGridView, P_NODE_PATH_BOX.Text);
                 break;
             }
             else if (System.IO.Path.GetFileName(path) == ConstantName.centerFolder && Directory.Exists(path))
             {
                 string databasePath = path + "/" + ConstantName.databasePostFix;
                 if (System.IO.File.Exists(databasePath))
                 {
                     string relativePNotePath = Model.ReadDatabase(databasePath);
                     P_NODE_PATH_BOX.Text = Model.ProjectFolder + relativePNotePath;
                     Model.UpdateTheForm(SetUpFolderTreeView, setupGridView, P_NODE_PATH_BOX.Text);
                     break;
                 }
             }
             {
                 if (GoodiesPath.IsNotePath(path))
                 {
                     P_NODE_PATH_BOX.Text = path;
                     Model.ProjectFolder  = System.IO.Path.GetDirectoryName(path);
                     Model.GetFilesDrag(P_NODE_PATH_BOX, setupGridView, SetUpFolderTreeView);
                     break;
                 }
             }
         }
     }
     else
     {
         e.Effect = DragDropEffects.None;
     }
 }