public NewTask(bool NewOrEditTask)
 {
     _NewTask = NewOrEditTask;
     InitializeComponent();
     intervalComboBox.SelectedIndex = endon_type.SelectedIndex = 0;
     MirrorTask = new PathFromAndTo();
     MirrorTask.RoboCopy_Options = ServiceConfig.RoboCopyOptions;
     if (!_NewTask)
     {
         Text = "Edit Task";
     }
 }
        /// <param name="task">Task whose excluded items are to be edited.</param>
        public ExcludedItemsDialog(PathFromAndTo task)
        {
            if (task == null)
            {
                throw new ArgumentNullException("task");
            }
            InitializeComponent();
            sourceFolder = task.From.Path;
            excludedFilesControl.BaseFolder   = sourceFolder;
            excludedFoldersControl.BaseFolder = sourceFolder;
            ExcludedFiles   = new List <string>(task.From.ExcludedFiles);
            ExcludedFolders = new List <string>(task.From.ExcludedFolders);


            foreach (string file in ExcludedFiles)
            {
                excludedFilesControl.ExcludedItems.Add(file);
            }
            foreach (string folder in ExcludedFolders)
            {
                excludedFoldersControl.ExcludedItems.Add(folder);
            }
        }
Exemple #3
0
        /// <summary>
        /// Creates an appropriate ListViewItem and adds it to the list view.
        /// </summary>
        bool AddTaskToListView(PathFromAndTo task)
        {
            if (string.IsNullOrWhiteSpace(task.From.Path))
            {
                return(false);
            }
            ListViewItem lvi = new ListViewItem(task.From.Path, 0);

            lvi.SubItems.Add(task.To.Path);
            lvi.SubItems.Add("");
            lvi.SubItems.Add("");
            if (task.ScheduleTask == null || !task.ScheduleTask.IsEnabled)
            {
                lvi.SubItems.Add("");
            }
            else
            {
                lvi.SubItems.Add(task.GetSchdulerAsText());
            }
            lvi.Tag = task;// new PathFromAndTo(task.From, task.To);

            if (!task.From.PathExists())
            {
                lvi.ImageIndex  = 1;
                lvi.ToolTipText = "Source folder does not exist or inaccessible.";
            }

            if (lvi.ImageIndex == 0 && (task.From.IsPathHasUserName || task.To.IsPathHasUserName))
            {
                lvi.ImageIndex = 3;
            }

            if (!task.IsEnabled)
            {
                lvi.ForeColor             = System.Drawing.Color.Gray;
                lvi.Font                  = new System.Drawing.Font(lvi.Font, System.Drawing.FontStyle.Strikeout);
                lvi.SubItems[3].Text      = "No";
                lvi.SubItems[3].BackColor = System.Drawing.Color.LightGray;
                lvi.ToolTipText           = "This Task is not active.";
                lvi.ImageIndex            = 5;
            }
            else
            {
                // lvi.ForeColor = System.Drawing.Color.Black ;
                // lvi.Font = new System.Drawing.Font(lvi.Font, System.Drawing.FontStyle.Regular);
                lvi.SubItems[3].Text      = "Yes";
                lvi.SubItems[3].BackColor = System.Drawing.Color.White;
            }

            if (listView1.InvokeRequired)
            {
                listView1.Invoke(new MethodInvoker(delegate
                {
                    listView1.Items.Add(lvi);
                }));
            }
            else
            {
                listView1.Items.Add(lvi);
            }

            return(true);
        }