Example #1
0
        private void ButtonAddSource_Click(object sender, EventArgs e)
        {
            if (!_machineAvailable)
            {
                return;
            }

            _disableStateChangedEvents = true;
            _selectedSource            = new DistributionSource();
            DistributionSources.Add(_selectedSource);
            DistributionSourcesChanged = true;
            DisplayPath(_selectedSource.Path);
            textBoxFilter.Text        = _selectedSource.Filter;
            checkBoxRecursive.Checked = _selectedSource.Recursive;
            checkBoxInclusive.Checked = _selectedSource.Inclusive;
            ListViewItem item = listViewSources.Items.Add(new ListViewItem(new[]
            {
                _selectedSource.Path ?? UNSPECIFIED_PATH,
                _selectedSource.Filter,
                _selectedSource.Recursive.ToString(CultureInfo.InvariantCulture),
                _selectedSource.Inclusive.ToString(CultureInfo.InvariantCulture)
            })
            {
                Tag = _selectedSource
            });

            _disableStateChangedEvents = false;
            item.Selected       = true;
            panelSource.Visible = true;
            EnableControls();
            textBoxPath.Focus();
        }
Example #2
0
 public DTODistributionSource(DistributionSource distributionSource)
 {
     ID        = distributionSource.ID;
     Path      = distributionSource.Path;
     Filter    = distributionSource.Filter;
     Recursive = distributionSource.Recursive;
     Inclusive = distributionSource.Inclusive;
 }
Example #3
0
 private static IEnumerable <string> DistributionSourceIsValid(DistributionSource source)
 {
     if (string.IsNullOrEmpty(source.Path))
     {
         yield return("Source path missing");
     }
     else if (!Path.IsPathRooted(source.Path))
     {
         yield return("Source path must be rooted");
     }
 }
Example #4
0
        public DistributionSourcesForm(Machine machine, Application application, Func <IEnumerable <Group> > getAllGroups)
        {
            InitializeComponent();

            Machine                    = machine;
            Application                = application;
            DistributionSources        = new List <DistributionSource>(application.Sources.Select(source => source.Clone()));
            DistributionSourcesChanged = false;
            _getAllGroups              = getAllGroups;
            _machineAvailable          = ConnectionStore.ConnectionCreated(Machine);
            _selectedSource            = null;
            _disableStateChangedEvents = false;
        }
Example #5
0
        private void ButtonRemoveSource_Click(object sender, EventArgs e)
        {
            if (!_machineAvailable)
            {
                return;
            }

            if (listViewSources.SelectedItems.Count == 0)
            {
                return;
            }

            _selectedSource = (DistributionSource)listViewSources.SelectedItems[0].Tag;
            DistributionSources.Remove(_selectedSource);
            DistributionSourcesChanged = true;
            listViewSources.Items.Remove(listViewSources.SelectedItems[0]);
            _selectedSource = null;
            EnableControls();
        }
Example #6
0
 private void ListViewSources_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewSources.SelectedItems.Count == 0)
     {
         panelSource.Visible = false;
         _selectedSource     = null;
     }
     else
     {
         _disableStateChangedEvents = true;
         _selectedSource            = (DistributionSource)listViewSources.SelectedItems[0].Tag;
         DisplayPath(_selectedSource.Path);
         textBoxFilter.Text         = _selectedSource.Filter;
         checkBoxRecursive.Checked  = _selectedSource.Recursive;
         checkBoxInclusive.Checked  = _selectedSource.Inclusive;
         _disableStateChangedEvents = false;
         EnableControls();
         panelSource.Visible = true;
     }
 }