Пример #1
0
        btnEditTarget_Click(
            object sender,
            RoutedEventArgs e)
        {
            if (lbTargets.SelectedItem != null)
            {
                TargetCollection tc =
                    configuration.CopyGroupInstance.CopyOperation.Targets;
                Target t = tc.Targets[lbTargets.SelectedValue.ToString()];
                Regex  r = new Regex("^ftp://.*/$");

                AddTarget at =
                    new AddTarget(AddTarget.Mode.Edit,
                                  r.IsMatch(t.Location) ? AddTarget.Type.Ftp
                                  : AddTarget.Type.Local);
                at.TargetName     = t.Name;
                at.TargetLocation = t.Location;
                at.TargetAuthenticationCredential = t.AuthorizationCredential;

                if ((at.ShowDialog()).Value)
                {
                    tc.RemoveTarget(t.Name);
                    lbTargets.Items.RemoveAt(lbTargets.SelectedIndex);
                    tc.AddTarget(at.TargetName,
                                 at.TargetLocation,
                                 at.TargetAuthenticationCredential);
                    lbTargets.Items.Add(at.TargetName);
                }
            }
        }
Пример #2
0
        btnRemoveTarget_Click(
            object sender,
            RoutedEventArgs e)
        {
            TargetCollection tc =
                configuration.CopyGroupInstance.CopyOperation.Targets;

            tc.RemoveTarget((string)lbTargets.SelectedItem);
            lbTargets.Items.RemoveAt(lbTargets.SelectedIndex);

            btnRemoveTarget.IsEnabled = btnEditTarget.IsEnabled = false;
        }