Esempio n. 1
0
        private void OnEcuProgrammingActionsChanged(object sender, NotifyCollectionChangedEventArgs e)
        {
            NotifyCollectionChangedAction action = e.Action;

            if (action <= NotifyCollectionChangedAction.Remove)
            {
                foreach (object obj in e.NewItems)
                {
                    IProgrammingAction programmingAction = obj as IProgrammingAction;
                    if (programmingAction != null)
                    {
                        object obj2 = this.threadLock;
                        lock (obj2)
                        {
                            if (e.Action == NotifyCollectionChangedAction.Add)
                            {
                                programmingAction.PropertyChanged += this.OnActionPropertyChanged;
                                if (programmingAction.IsSelected && !this.dataContext.SelectedActionData.Contains(programmingAction.DataContext))
                                {
                                    this.AddItem(programmingAction);
                                }
                            }
                            else if (e.Action == NotifyCollectionChangedAction.Remove)
                            {
                                programmingAction.PropertyChanged -= this.OnActionPropertyChanged;
                                if (this.dataContext.SelectedActionData.Contains(programmingAction.DataContext))
                                {
                                    this.dataContext.SelectedActionData.Remove(programmingAction.DataContext);
                                }
                            }
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        //internal ICollection<XEP_SWIACTION> XepSwiActionList { get; private set; }

        public IProgrammingAction GetProgrammingAction(ProgrammingActionType type)
        {
            using (IEnumerator <ProgrammingAction> enumerator = this.programmingActionList.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    IProgrammingAction programmingAction = enumerator.Current;
                    if (programmingAction.Type == type)
                    {
                        return(programmingAction);
                    }
                }
            }
            return(null);
        }
Esempio n. 3
0
 private void AddItem(IProgrammingAction itemToAdd)
 {
     for (int i = 0; i < this.dataContext.SelectedActionData.Count; i++)
     {
         IProgrammingActionData programmingActionData = this.dataContext.SelectedActionData[i];
         if (itemToAdd.DataContext.Order < programmingActionData.Order)
         {
             this.dataContext.SelectedActionData.Insert(i, itemToAdd.DataContext);
             this.OnPropertyChanged("SelectedActions");
             return;
         }
     }
     this.dataContext.SelectedActionData.Add(itemToAdd.DataContext);
     this.OnPropertyChanged("SelectedActions");
 }
Esempio n. 4
0
        public void SelectReplacementForIndustrialCustomer(IEcu ecu, string category, bool value)
        {
            IEcuProgrammingInfo item = this.GetItem(ecu, category);

            if (item == null)
            {
                throw new ArgumentNullException("ecu");
            }
            IProgrammingAction programmingAction = item.GetProgrammingAction(ProgrammingActionType.Replacement);

            if (programmingAction == null)
            {
                return;
            }
            programmingAction.Select(value);
        }
Esempio n. 5
0
        public void SelectCodingForIndustrialCustomer(IEcu ecu, string category, bool value)
        {
            IEcuProgrammingInfo item = this.GetItem(ecu, category);

            if (item == null)
            {
                throw new ArgumentNullException("ecu");
            }
            IProgrammingAction programmingAction = item.GetProgrammingAction(ProgrammingActionType.Coding);

            if (programmingAction != null)
            {
                programmingAction.Select(value);
            }
            if (programmingAction != null)
            {
                item.IsCodingScheduled = value;
            }
        }
Esempio n. 6
0
 protected virtual void OnActionPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsSelected")
     {
         IProgrammingAction programmingAction = sender as IProgrammingAction;
         if (programmingAction == null)
         {
             return;
         }
         object obj = this.threadLock;
         lock (obj)
         {
             if (!programmingAction.IsSelected && this.dataContext.SelectedActionData.Contains(programmingAction.DataContext))
             {
                 this.dataContext.SelectedActionData.Remove(programmingAction.DataContext);
             }
             else if (programmingAction.IsSelected && !this.dataContext.SelectedActionData.Contains(programmingAction.DataContext))
             {
                 this.AddItem(programmingAction);
             }
         }
     }
 }