private void AILayer_KaijuManagement_TamedKaijusCollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     if (e.Action == CollectionChangeAction.Add && this.IsActive())
     {
         Kaiju kaiju = e.Element as Kaiju;
         if (kaiju != null && this.MajorEmpire.TamedKaijus.Contains(kaiju) && kaiju.OnArmyMode())
         {
             AICommander aicommander = this.aiCommanders.Find((AICommander match) => match.ForceArmyGUID == kaiju.KaijuArmy.GUID);
             if (aicommander == null)
             {
                 this.AddCommander(new AICommander_KaijuSupport
                 {
                     ForceArmyGUID = kaiju.KaijuArmy.GUID,
                     Empire        = base.AIEntity.Empire,
                     AIPlayer      = base.AIEntity.AIPlayer
                 });
                 return;
             }
             aicommander.Initialize();
             aicommander.Load();
             aicommander.CreateMission();
         }
     }
 }
예제 #2
0
 /// <summary>
 /// Handles the Comments.Changed event.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="CollectionChangeEventArgs{Comment}"/> instance containing the event data.</param>
 private void Comments_Changed(object sender, CollectionChangeEventArgs <Comment> e)
 {
     if (InvokeRequired)
     {
         Invoke(new CollectionChangeEventHandler <Comment>(Comments_Changed), sender, e);
     }
     else
     {
         if (e.Action == CollectionChangeActionType.RemoveItem)
         {
             Control control = (Control)FindCommentControl(e.OldValue);
             if (control != null)
             {
                 commentsLayoutPanel.Controls.Remove(control);
                 ((CommentControl)control).Comment = null;
                 ((CommentControl)control).Dispose();
             }
         }
         else if (e.Action == CollectionChangeActionType.InsertItem)
         {
             AddCommentControl(e.NewValue);
         }
     }
 }
예제 #3
0
        protected virtual void ObjectStateManager_ObjectStateManagerChanged(object sender,
                                                                            CollectionChangeEventArgs e)
        {
            var contextAdapter = (IObjectContextAdapter)this;

            if (e.Action != CollectionChangeAction.Add)
            {
                return;
            }

            var entry = contextAdapter.ObjectContext.ObjectStateManager.GetObjectStateEntry(e.Element);

            switch (entry.State)
            {
            case EntityState.Added:
                CheckAndSetId(entry.Entity);
                CheckAndSetMustHaveTenantIdProperty(entry.Entity);
                SetCreationAuditProperties(entry.Entity, GetAuditUserId());
                break;
                //case EntityState.Deleted: //It's not going here at all
                //    SetDeletionAuditProperties(entry.Entity, GetAuditUserId());
                //    break;
            }
        }
예제 #4
0
        void VMCollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            Program.AssertOnEventThread();

            VM vm = (VM)e.Element;

            switch (e.Action)
            {
            case CollectionChangeAction.Add:
                vm.PropertyChanged -= vm_PropertyChanged;
                vm.PropertyChanged += vm_PropertyChanged;
                break;

            case CollectionChangeAction.Remove:
                vm.PropertyChanged -= vm_PropertyChanged;
                break;
            }

            Program.Invoke(this, () =>
            {
                // Find row for VM
                ListViewItem item = FindItemFromVM(vm);
                if (item != null)
                {
                    listViewVMs.BeginUpdate();
                    try
                    {
                        UpdateVmRow(item);
                    }
                    finally
                    {
                        listViewVMs.EndUpdate();
                    }
                }
            });
        }
예제 #5
0
        void MenuItemsCollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            int height = this.menuItems.Count * 32;

            this.Height = height;
            DXControl ctl = (DXControl)e.Element;

            if (e.Action == CollectionChangeAction.Add)
            {
                int width = CalcItemWidth(ctl.Text);
                if (width > this.Width)
                {
                    this.Width = width;
                }
                ctl.Location = new Point(0, this.Height - 32);
                ctl.Size     = new Size(this.Width, 32);
                ctl.Parent   = this;
                this.Controls.Add(ctl);
            }
            else
            {
                this.Controls.Remove(ctl);
            }
        }
예제 #6
0
        private void OnCollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            var itm = (TabControlItem)e.Element;

            if (e.Action == CollectionChangeAction.Add)
            {
                this.Controls.Add(itm);
                this.OnTabControlItemChanged(new TabControlItemChangedEventArgs(itm, TabControlItemChangeTypes.Added));
            }
            else if (e.Action == CollectionChangeAction.Remove)
            {
                this.Controls.Remove(itm);
                this.OnTabControlItemChanged(
                    new TabControlItemChangedEventArgs(itm, TabControlItemChangeTypes.Removed));
            }
            else
            {
                this.OnTabControlItemChanged(
                    new TabControlItemChangedEventArgs(itm, TabControlItemChangeTypes.Changed));
            }

            this.UpdateLayout();
            this.Invalidate();
        }
예제 #7
0
 void SR_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     Program.Invoke(this, refresh);
 }
예제 #8
0
 private void OnScrollHorizontalViewChanged(object sender,
                                            CollectionChangeEventArgs e)
 {
     RaiseAutomationPropertyChangedEvent();
 }
예제 #9
0
 void XenConnections_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     Program.BeginInvoke(this, getAllCurrentConnections);
 }
예제 #10
0
 private void XenConnections_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     Program.BeginInvoke(Program.MainWindow, buildList);
 }
예제 #11
0
 internal void OnColumnPropertyChanged(CollectionChangeEventArgs ccevent)
 {
     _table.UpdatePropertyDescriptorCollectionCache();
     ColumnPropertyChanged?.Invoke(this, ccevent);
 }
 private void OnColumnHeaderItemsEvent(object sender,
                                       CollectionChangeEventArgs args)
 {
     RaiseAutomationPropertyChangedEvent();
 }
예제 #13
0
        private void Columns_CollectionChanged(object sender, CollectionChangeEventArgs e)
        {
            switch (e.Action)
            {
            case CollectionChangeAction.Add:
            {
                if (e.Element is InternalDataColumn dataColumn && dataColumn.IsInternalAction == false)
                {
                    if (dataColumn.IsKey == true)
                    {
                        dataColumn.Table.AddKey(dataColumn);
                    }

                    if (dataColumn.CremaType != null)
                    {
                        dataColumn.CremaType.AddReference(dataColumn);
                    }

                    dataColumn.InternalIndex = this.columnList.Count;
                    this.columnList.Add(dataColumn);

                    if (this.OmitSignatureDate == false)
                    {
                        dataColumn.InternalCreationInfo     = this.SignatureDate;
                        dataColumn.InternalModificationInfo = this.SignatureDate;
                    }
                }
            }
            break;

            case CollectionChangeAction.Remove:
            {
                if (e.Element is InternalDataColumn dataColumn && dataColumn.IsInternalAction == false)
                {
                    if (dataColumn.CremaType != null)
                    {
                        dataColumn.CremaType.RemoveReference(dataColumn);
                    }

                    this.columnList.Remove(dataColumn);

                    if (this.OmitSignatureDate == false)
                    {
                        dataColumn.InternalCreationInfo     = SignatureDate.Empty;
                        dataColumn.InternalModificationInfo = SignatureDate.Empty;
                    }
                    dataColumn.InternalIndex = -1;
                    for (var i = 0; i < this.columnList.Count; i++)
                    {
                        this.columnList[i].InternalIndex = i;
                    }
                }
            }
            break;

            case CollectionChangeAction.Refresh:
            {
                this.columnList.Clear();
                foreach (var item in this.Columns)
                {
                    if (item is InternalDataColumn dataColumn)
                    {
                        this.columnList.Add(dataColumn);
                    }
                }

                for (var i = 0; i < this.columnList.Count; i++)
                {
                    this.columnList[i].InternalIndex = i;
                }
            }
            break;
            }
        }
예제 #14
0
 private void Relations_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     _changesCounter++;
 }
 private void ParentChartPlotter_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     stackPanel.Children.Clear();
     PopulateLegend();
 }
예제 #16
0
 public void OnClear(object sender, CollectionChangeEventArgs e)
 {
     ClearEvent?.Invoke(sender, e);
 }
예제 #17
0
 public void OnRemove(object sender, CollectionChangeEventArgs e)
 {
     RemoveEvent?.Invoke(sender, e);
 }
예제 #18
0
 public void OnInsert(object sender, CollectionChangeEventArgs e)
 {
     InsertEvent?.Invoke(sender, e);
 }
 private void CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     Program.Invoke(this, PopulateComboBox);
 }
예제 #20
0
 private void Columns_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     UpdateColumnNames();
 }
예제 #21
0
 private void Constraints_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
 }
예제 #22
0
 public void OnPop(object sender, CollectionChangeEventArgs e)
 {
     PopEvent?.Invoke(sender, e);
 }
예제 #23
0
 private void DepartmentOfEducation_VaultItemsCollectionChange(object sender, CollectionChangeEventArgs e)
 {
     base.NeedRefresh = true;
 }
예제 #24
0
 private void Columns_CollectionChanged1(object sender, CollectionChangeEventArgs e)
 {
     _eventOccurred = true;
 }
예제 #25
0
 /// <summary>
 /// Raises the <see cref='System.Data.ConstraintCollection.CollectionChanged'/> event.
 /// </summary>
 private void OnCollectionChanged(CollectionChangeEventArgs ccevent)
 {
     _onCollectionChanged?.Invoke(this, ccevent);
 }
예제 #26
0
 private void OnCollectionChanging(CollectionChangeEventArgs ccevent)
 {
     CollectionChanging?.Invoke(this, ccevent);
 }
예제 #27
0
 private void Columns_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     _counter++;
     _change_element = e.Element;
 }
예제 #28
0
 void SR_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     Program.Invoke(this, BuildList);
 }
 protected virtual void OnToolBoxCategoryCollectionChanged(Object sender, CollectionChangeEventArgs e)
 {
 }
예제 #30
0
 private void Host_CollectionChanged(object sender, CollectionChangeEventArgs e)
 {
     buildList();
 }