private void btnAddMoveCmd_Click(object sender, EventArgs e)
        {
            var fileOperand = lblFileName.Text;
            if (String.IsNullOrEmpty(fileOperand))
            {
                PrintToOut("No current file to work with. Load File(s) first");
                return;
            }
            var moveToSelection = cbTargetFolder.Text;
            if (String.IsNullOrEmpty(moveToSelection))
            {
                PrintToOut("Please select a Folder to move to in the select box");
                return;
            }
            if (commandsToRunDict.ContainsKey(fileOperand))
            {
                PrintToOut(String.Format("{0} already has command: '{1}'",
                  fileOperand, commandsToRunDict[fileOperand].ToString()));
                return;
            }

            var fileToMove
              = new FileItem(Path.Combine(m_inputFolder1.TheFolder.FullName, fileOperand));
            string newState
              = Path.Combine(m_inputFolder1.TheFolder.FullName, moveToSelection, fileOperand);

            commandsToRunDict.Add(fileToMove.TheFile.Name, new Command("move", fileToMove, newState));

            PrintToOut(String.Format("{0} set to move to sub-directory: {1}",
              fileOperand, moveToSelection));
            LoadNextPicture();
        }
Beispiel #2
0
 // Suppport move file
 public Command(String operation, FileItem operand, String newState)
 {
     Operation = operation;
       Operand = operand;
       NewState = newState;
 }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (m_inputFolder1 == null || String.IsNullOrEmpty(m_inputFolder1.TheFolder.Name))
            {
                PrintToOut("Load a directory first");
                return;
            }

            var fileOperand = lblFileName.Text;
            if (String.IsNullOrEmpty(fileOperand))
            {
                PrintToOut("No current file to work with. Load File(s) first");
                return;
            }

            if (commandsToRunDict.ContainsKey(fileOperand))
            {
                PrintToOut(String.Format("{0} already has command: '{1}'",
                  fileOperand, commandsToRunDict[fileOperand].ToString()));
                return;
            }

            var fileToDelete
              = new FileItem(Path.Combine(m_inputFolder1.TheFolder.FullName, fileOperand));

            commandsToRunDict.Add(fileOperand, new Command("Del", fileToDelete.TheFile.FullName));
            PrintToOut(String.Format("Adding command to delete the file: {0}", fileToDelete.TheFile.FullName));
            LoadNextPicture();
        }