private void BuildPathViewModels(ObservableCollection<SettingsPath> source, ObservableCollection<SettingsPathViewModel> destination, SettingsPathType type)
 {
     destination.Clear();
     for (int i = 0; i < source.Count; ++i)
     {
         var vm = new SettingsPathViewModel(source[i], type);
         vm.IsAdded = true;
         destination.Add(vm);
     }
 }
Beispiel #2
0
        public SettingsPathViewModel(SettingsPath path, SettingsPathType type)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path");
            }

            m_path = path;
            m_path.PropertyChanged += new PropertyChangedEventHandler(m_path_PropertyChanged);

            m_type = type;
        }
Beispiel #3
0
        ListBox GetSource(object p)
        {
            SettingsPathType source = (SettingsPathType)p;

            if (source == SettingsPathType.Type)
            {
                return(TypeList);
            }
            else
            {
                return(ComponentList);
            }
        }
Beispiel #4
0
        internal SettingsPathViewModel BeginAddPath(SettingsPathType type)
        {
            var vm = new SettingsPathViewModel(new SettingsPath(), type);

            vm.IsAdded   = false;
            vm.IsEditing = true;
            if (type == SettingsPathType.Components)
            {
                ComponentPaths.Add(vm);
            }
            else
            {
                TypePaths.Add(vm);
            }

            return(vm);
        }
 void Collection_Changed(ObservableCollection<SettingsPath> sender, ObservableCollection<SettingsPathViewModel> destination, SettingsPathType type, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
 {
     switch (e.Action)
     {
         case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
             {
                 var vm = new SettingsPathViewModel(e.NewItems[0] as SettingsPath, type);
                 vm.IsAdded = true;
                 destination.Add(vm);
             };
             break;
         case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
             {
                 destination.Move(e.OldStartingIndex, e.NewStartingIndex);
             }
             break;
         case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
             {
                 destination.RemoveAt(e.OldStartingIndex);
             }
             break;
         case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
             {
                 var vm = new SettingsPathViewModel(e.NewItems[0] as SettingsPath, type);
                 vm.IsAdded = true;
                 destination[e.OldStartingIndex] = vm;
             }
             break;
         case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
             {
                 BuildPathViewModels(sender, destination, type);
             }
             break;
         default:
             break;
     }
 }
        public SettingsPathViewModel(SettingsPath path, SettingsPathType type)
        {
            if (path == null)
                throw new ArgumentNullException("path");

            m_path = path;
            m_path.PropertyChanged += new PropertyChangedEventHandler(m_path_PropertyChanged);

            m_type = type;
        }
        internal SettingsPathViewModel BeginAddPath(SettingsPathType type)
        {
            var vm = new SettingsPathViewModel(new SettingsPath(), type);
            vm.IsAdded = false;
            vm.IsEditing = true;
            if (type == SettingsPathType.Components)
                ComponentPaths.Add(vm);
            else
                TypePaths.Add(vm);

            return vm;
        }
Beispiel #8
0
        void Collection_Changed(ObservableCollection <SettingsPath> sender, ObservableCollection <SettingsPathViewModel> destination, SettingsPathType type, System.Collections.Specialized.NotifyCollectionChangedEventArgs e)
        {
            switch (e.Action)
            {
            case System.Collections.Specialized.NotifyCollectionChangedAction.Add:
            {
                var vm = new SettingsPathViewModel(e.NewItems[0] as SettingsPath, type);
                vm.IsAdded = true;
                destination.Add(vm);
            };
                break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Move:
            {
                destination.Move(e.OldStartingIndex, e.NewStartingIndex);
            }
            break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Remove:
            {
                destination.RemoveAt(e.OldStartingIndex);
            }
            break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Replace:
            {
                var vm = new SettingsPathViewModel(e.NewItems[0] as SettingsPath, type);
                vm.IsAdded = true;
                destination[e.OldStartingIndex] = vm;
            }
            break;

            case System.Collections.Specialized.NotifyCollectionChangedAction.Reset:
            {
                BuildPathViewModels(sender, destination, type);
            }
            break;

            default:
                break;
            }
        }
Beispiel #9
0
 private void BuildPathViewModels(ObservableCollection <SettingsPath> source, ObservableCollection <SettingsPathViewModel> destination, SettingsPathType type)
 {
     destination.Clear();
     for (int i = 0; i < source.Count; ++i)
     {
         var vm = new SettingsPathViewModel(source[i], type);
         vm.IsAdded = true;
         destination.Add(vm);
     }
 }