Exemplo n.º 1
0
        private void toolStripButton2_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedIndices.Count == 0)
            {
                return;
            }
            var     paths = (PathFromAndTo)listView1.SelectedItems[0].Tag;
            NewTask x     = new NewTask(false)
            {
                MirrorTask = (PathFromAndTo)paths.Clone()
            };

            if (x.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrWhiteSpace(x.MirrorTask.From.Path))
                {
                    return;
                }
                ListViewItem lvi = listView1.SelectedItems[0];
                lvi.Text             = x.MirrorTask.From.Path;
                lvi.SubItems[1].Text = x.MirrorTask.To.Path;
                lvi.SubItems[4].Text = x.MirrorTask.To.Path;

                if (x.MirrorTask.ScheduleTask == null || !x.MirrorTask.ScheduleTask.IsEnabled)
                {
                    lvi.SubItems[4].Text = "";
                }
                else
                {
                    lvi.SubItems[4].Text = Enum.GetName(typeof(TriggerType), x.MirrorTask.ScheduleTask.Triggertype) + " At " + x.MirrorTask.ScheduleTask.StartTime.ToString("hh:mm tt");
                }


                lvi.Tag = (PathFromAndTo)x.MirrorTask.Clone();
                if (!x.MirrorTask.From.PathExists())
                {
                    lvi.ImageIndex = 1;
                }
                else
                {
                    lvi.ImageIndex = x.MirrorTask.From.IsPathHasUserName || x.MirrorTask.To.IsPathHasUserName ? 3 : 0;
                }

                _savestate           = false;
                _restart_service_req = x.MirrorTask.From != paths.From || x.MirrorTask.To != paths.To;
            }
        }
Exemplo n.º 2
0
        private void duplicateToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listView1.SelectedItems.Count < 1)
            {
                return;
            }
            var     item = listView1.SelectedItems[0];
            NewTask x    = new NewTask(true);

            x.MirrorTask = (PathFromAndTo)((PathFromAndTo)item.Tag).Clone();

            if (x.ShowDialog() == DialogResult.OK)
            {
                AddTaskToListView(x.MirrorTask);
                _savestate = false;
            }
        }
Exemplo n.º 3
0
        private void toolStripButton1_Click(object sender, EventArgs e)
        {
            NewTask x = new NewTask(true);

            if (x.ShowDialog() == DialogResult.OK)
            {
                if (string.IsNullOrWhiteSpace(x.MirrorTask.From.Path))
                {
                    return;
                }
                AddTaskToListView((PathFromAndTo)x.MirrorTask.Clone());
                //ListViewItem lvi = new ListViewItem(x.MirrorTask.From.Path, 0);
                //lvi.SubItems.Add(x.MirrorTask.To.Path);
                //lvi.Tag = (PathFromAndTo)x.MirrorTask.Clone();

                //listView1.Items.Add(lvi);
                _savestate = false;
            }
        }