Exemplo n.º 1
0
 private void ContentReaders_ItemAdded(object sender, ObservableCollectionEventArgs <IContentReader> e)
 {
     lock (registeredContentReaders)
     {
         registeredContentReaders.Add(e.Item);
     }
 }
Exemplo n.º 2
0
 private void ContentResolvers_ItemRemoved(object sender, ObservableCollectionEventArgs <IContentResolver> e)
 {
     lock (registeredContentResolvers)
     {
         registeredContentResolvers.Remove(e.Item);
     }
 }
Exemplo n.º 3
0
 void ReaderFactories_ItemRemoved(object sender, ObservableCollectionEventArgs <IContentReaderFactory> e)
 {
     lock (registeredContentReaderFactories)
     {
         registeredContentReaderFactories.Remove(e.Item);
     }
 }
Exemplo n.º 4
0
 private void FrozenLayers_BeforeAddItem(ObservableCollection <Layer> sender, ObservableCollectionEventArgs <Layer> e)
 {
     if (e.Item == null)
     {
         // the frozen layer list cannot contain null items
         e.Cancel = true;
     }
     else if (this.Owner != null && e.Item.Owner == null)
     {
         // the frozen layer and the viewport must belong to the same document
         e.Cancel = true;
     }
     else if (this.Owner == null && e.Item.Owner != null)
     {
         // the frozen layer and the viewport must belong to the same document
         e.Cancel = true;
     }
     else if (this.Owner != null && e.Item.Owner != null)
     {
         // the frozen layer and the viewport must belong to the same document
         if (!ReferenceEquals(this.Owner.Owner.Owner.Owner, e.Item.Owner.Owner))
         {
             e.Cancel = true;
         }
     }
     else if (this.frozenLayers.Contains(e.Item))
     {
         // the frozen layer list cannot contain duplicates
         e.Cancel = true;
     }
 }
Exemplo n.º 5
0
        private void Segments_AddItem(ObservableCollection <LinetypeSegment> sender, ObservableCollectionEventArgs <LinetypeSegment> e)
        {
            this.OnLinetypeSegmentAddedEvent(e.Item);

            if (e.Item.Type == LinetypeSegmentType.Text)
            {
                ((LinetypeTextSegment)e.Item).TextStyleChanged += this.LinetypeTextSegment_StyleChanged;
            }
        }
Exemplo n.º 6
0
        private void OnEffectRemoved(ObservableCollectionEventArgs <Effect> e)
        {
            EventHandler <ObservableCollectionEventArgs <Effect> > handler = EffectRemoved;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Exemplo n.º 7
0
 private void Vertexes_AddItem(ObservableCollection <PolylineVertex> sender, ObservableCollectionEventArgs <PolylineVertex> e)
 {
     // if the polyline already belongs to a document
     if (this.Owner != null)
     {
         // get the document
         DxfDocument doc = this.Owner.Record.Owner.Owner;
         doc.NumHandles = e.Item.AssignHandle(doc.NumHandles);
     }
     e.Item.Owner = this;
 }
Exemplo n.º 8
0
        private void ContentResolvers_ItemAdded(object sender, ObservableCollectionEventArgs <IContentResolver> e)
        {
            if (e.Item == null)
            {
                throw new ArgumentNullException("Cannot add a null IContentResolver", "value");
            }

            lock (registeredContentResolvers)
            {
                registeredContentResolvers.Add(e.Item);
            }
        }
Exemplo n.º 9
0
        void ReaderFactories_ItemAdded(object sender, ObservableCollectionEventArgs <IContentReaderFactory> e)
        {
            if (e.Item == null)
            {
                throw new ArgumentNullException("Cannot add a null IContentReader", "value");
            }

            lock (registeredContentReaderFactories)
            {
                registeredContentReaderFactories.Add(e.Item);
            }
        }
Exemplo n.º 10
0
        private void GameSystems_ItemAdded(object sender, ObservableCollectionEventArgs <IGameSystem> e)
        {
            var gameSystem = e.Item;

            // If the game is already running, then we can initialize the game system now
            if (IsRunning)
            {
                gameSystem.Initialize();
            }
            else
            {
                // else we need to initialize it later
                pendingGameSystems.Add(gameSystem);
            }

            // Add a contentable system to a separate list
            var contentableSystem = gameSystem as IContentable;

            if (contentableSystem != null)
            {
                lock (contentableGameSystems)
                {
                    if (!contentableGameSystems.Contains(contentableSystem))
                    {
                        contentableGameSystems.Add(contentableSystem);
                    }
                }

                if (IsRunning)
                {
                    // Load the content of the system if the game is already running
                    contentableSystem.LoadContent();
                }
            }

            // Add an updateable system to the separate list
            var updateableGameSystem = gameSystem as IUpdateable;

            if (updateableGameSystem != null && AddGameSystem(updateableGameSystem, updateableGameSystems, UpdateableSearcher.Default, UpdateableComparison))
            {
                updateableGameSystem.UpdateOrderChanged += updateableGameSystem_UpdateOrderChanged;
            }

            // Add a drawable system to the separate list
            var drawableGameSystem = gameSystem as IDrawable;

            if (drawableGameSystem != null && AddGameSystem(drawableGameSystem, drawableGameSystems, DrawableSearcher.Default, DrawableComparison))
            {
                drawableGameSystem.DrawOrderChanged += drawableGameSystem_DrawOrderChanged;
            }
        }
Exemplo n.º 11
0
        private void GameSystems_ItemRemoved(object sender, ObservableCollectionEventArgs <IGameSystem> e)
        {
            var gameSystem = e.Item;

            if (!IsRunning)
            {
                pendingGameSystems.Remove(gameSystem);
            }

            var contentableSystem = gameSystem as IContentable;

            if (contentableSystem != null)
            {
                lock (contentableGameSystems)
                {
                    contentableGameSystems.Remove(contentableSystem);
                }

                if (IsRunning)
                {
                    contentableSystem.UnloadContent();
                }
            }

            var gameComponent = gameSystem as IUpdateable;

            if (gameComponent != null)
            {
                lock (updateableGameSystems)
                {
                    updateableGameSystems.Remove(gameComponent);
                }

                gameComponent.UpdateOrderChanged -= updateableGameSystem_UpdateOrderChanged;
            }

            var item = gameSystem as IDrawable;

            if (item != null)
            {
                lock (drawableGameSystems)
                {
                    drawableGameSystems.Remove(item);
                }

                item.DrawOrderChanged -= drawableGameSystem_DrawOrderChanged;
            }
        }
Exemplo n.º 12
0
 private void Hatch_BoundaryPathAdded(Hatch sender, ObservableCollectionEventArgs <HatchBoundaryPath> e)
 {
     foreach (EntityObject entity in e.Item.Entities)
     {
         if (entity.Owner != null)
         {
             if (!ReferenceEquals(entity.Owner, this))
             {
                 throw new ArgumentException("The HatchBoundaryPath entity and the hatch must belong to the same block. Clone it instead.");
             }
         }
         else
         {
             this.Entities.Add(entity);
         }
     }
 }
Exemplo n.º 13
0
        private void BoundaryPaths_BeforeAddItem(ObservableCollection <HatchBoundaryPath> sender, ObservableCollectionEventArgs <HatchBoundaryPath> e)
        {
            // null items are not allowed in the list.
            if (e.Item == null)
            {
                e.Cancel = true;
            }
            else if (this.boundaryPaths.Contains(e.Item))
            {
                e.Cancel = true;
            }

            e.Cancel = false;
        }
Exemplo n.º 14
0
 private void BoundaryPaths_RemoveItem(ObservableCollection<HatchBoundaryPath> sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
     if (this.associative)
     {
         foreach (EntityObject entity in e.Item.Entities)
         {
             entity.RemoveReactor(this);
         }
     }
     this.OnHatchBoundaryPathRemovedEvent(e.Item);
 }
Exemplo n.º 15
0
 private void Elements_AddItem(ObservableCollection<MLineStyleElement> sender, ObservableCollectionEventArgs<MLineStyleElement> e)
 {
     this.OnMLineStyleElementAddedEvent(e.Item);
     e.Item.LineTypeChange += this.MLineStyleElement_LineTypeChange;
 }
Exemplo n.º 16
0
 private void Vertexes_BeforeAddItem(ObservableCollection<PolylineVertex> sender, ObservableCollectionEventArgs<PolylineVertex> e)
 {
     // null items and vertexes that belong to another polyline are not allowed.
     if (e.Item == null)
         e.Cancel = true;
     else if (e.Item.Owner != null)
         e.Cancel = true;
     else
         e.Cancel = false;
 }
Exemplo n.º 17
0
        private void Segments_RemoveItem(ObservableCollection <LinetypeSegment> sender, ObservableCollectionEventArgs <LinetypeSegment> e)
        {
            OnLinetypeSegmentRemovedEvent(e.Item);

            if (e.Item.Type == LinetypeSegmentType.Text)
            {
                ((LinetypeTextSegment)e.Item).TextStyleChanged -= LinetypeTextSegment_StyleChanged;
            }
        }
Exemplo n.º 18
0
 private void XData_AddAppReg(XDataDictionary sender, ObservableCollectionEventArgs <ApplicationRegistry> e)
 {
     OnXDataAddAppRegEvent(e.Item);
 }
Exemplo n.º 19
0
 private void Elements_AddItem(ObservableCollection <MLineStyleElement> sender, ObservableCollectionEventArgs <MLineStyleElement> e)
 {
     this.OnMLineStyleElementAddedEvent(e.Item);
     e.Item.LineTypeChanged += this.MLineStyleElement_LineTypeChanged;
 }
Exemplo n.º 20
0
 void Entity_XDataRemoveAppReg(EntityObject sender, ObservableCollectionEventArgs<ApplicationRegistry> e)
 {
     this.appRegistries.References[e.Item.Name].Remove(sender);
 }
Exemplo n.º 21
0
        private void BoundaryPaths_BeforeAddItem(ObservableCollection<HatchBoundaryPath> sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
        {
            // null items are not allowed in the list.
            if (e.Item == null)
                e.Cancel = true;
            else if (this.boundaryPaths.Contains(e.Item))
                e.Cancel = true;

            e.Cancel = false;
        }
Exemplo n.º 22
0
 private void Elements_RemoveItem(ObservableCollection<MLineStyleElement> sender, ObservableCollectionEventArgs<MLineStyleElement> e)
 {
     this.OnMLineStyleElementRemovedEvent(e.Item);
     e.Item.LinetypeChanged -= this.MLineStyleElement_LinetypeChanged;
 }
Exemplo n.º 23
0
 private void TankRemoved(object sender, ObservableCollectionEventArgs<TankBase> e)
 {
     TankBase newTank = e.Item;
     newTank.Turret.Cannon.BulletFired -= BulletFired;
 }
Exemplo n.º 24
0
 private void Hatch_BoundaryPathRemoved(Hatch sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
     foreach (EntityObject entity in e.Item.Entities)
     {
         this.RemoveEntity(entity);
     }
 }
Exemplo n.º 25
0
 private void Hatch_BoundaryPathAdded(Hatch sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
     Layout layout = sender.Owner.Record.Layout;
     foreach (EntityObject entity in e.Item.Entities)
     {
         // the hatch belongs to a layout
         if (entity.Owner != null)
         {
             // the hatch and its entities must belong to the same document or block
             if (!ReferenceEquals(entity.Owner.Record.Layout, layout))
                 throw new ArgumentException("The HatchBoundaryPath entity and the hatch must belong to the same layout and document. Clone it instead.");
             // there is no need to do anything else we will not add the same entity twice
         }
         else
         {
             // we will add the new entity to the same document and layout of the hatch
             string active = this.ActiveLayout;
             this.ActiveLayout = layout.Name;
             // the entity does not belong to anyone
             this.AddEntity(entity, false, true);
             this.ActiveLayout = active;
         }
     }
 }
Exemplo n.º 26
0
 private void Elements_BeforeAddItem(ObservableCollection<MLineStyleElement> sender, ObservableCollectionEventArgs<MLineStyleElement> e)
 {
     // null items are not allowed
     if (e.Item == null)
         e.Cancel = true;
     else
         e.Cancel = false;
 }
Exemplo n.º 27
0
 private void Hatch_BoundaryPathAdded(Hatch sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
     foreach (EntityObject entity in e.Item.Entities)
     {
         if (entity.Owner != null)
         {
             if (!ReferenceEquals(entity.Owner, this))
                 throw new ArgumentException("The HatchBoundaryPath entity and the hatch must belong to the same block. Clone it instead.");
         }
         else
         {
             this.Entities.Add(entity);
         }
     }
 }
Exemplo n.º 28
0
 private void Elements_BeforeRemoveItem(ObservableCollection<MLineStyleElement> sender, ObservableCollectionEventArgs<MLineStyleElement> e)
 {
 }
Exemplo n.º 29
0
 void Entity_XDataAddAppReg(EntityObject sender, ObservableCollectionEventArgs<ApplicationRegistry> e)
 {
     sender.XData[e.Item.Name].ApplicationRegistry = this.appRegistries.Add(sender.XData[e.Item.Name].ApplicationRegistry);
     this.appRegistries.References[e.Item.Name].Add(sender);
 }
Exemplo n.º 30
0
 private void XData_RemoveAppReg(XDataDictionary sender, ObservableCollectionEventArgs<ApplicationRegistry> e)
 {
     this.OnXDataRemoveAppRegEvent(e.Item);
 }
Exemplo n.º 31
0
 private void Hatch_BoundaryPathRemoved(Hatch sender, ObservableCollectionEventArgs <HatchBoundaryPath> e)
 {
     this.Entities.Remove(e.Item.Entities);
 }
Exemplo n.º 32
0
 private void Segments_BeforeAddItem(ObservableCollection <LinetypeSegment> sender, ObservableCollectionEventArgs <LinetypeSegment> e)
 {
     // null items are not allowed
     e.Cancel = e.Item == null;
 }
Exemplo n.º 33
0
 private void OnEffectRemoved(ObservableCollectionEventArgs<Effect> e)
 {
     EventHandler<ObservableCollectionEventArgs<Effect>> handler = EffectRemoved;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Exemplo n.º 34
0
 private void Hatch_BoundaryPathRemoved(Hatch sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
     this.Entities.Remove(e.Item.Entities);
 }
Exemplo n.º 35
0
 private void BoundaryPaths_BeforeRemoveItem(ObservableCollection <HatchBoundaryPath> sender, ObservableCollectionEventArgs <HatchBoundaryPath> e)
 {
 }
Exemplo n.º 36
0
 private void BoundaryPaths_AddItem(ObservableCollection<HatchBoundaryPath> sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
     if (this.associative)
     {
         foreach (EntityObject entity in e.Item.Entities)
         {
             entity.AddReactor(this);
         }
     }
     else
     {
         e.Item.ClearContour();
     }
     this.OnHatchBoundaryPathAddedEvent(e.Item);
 }
Exemplo n.º 37
0
 private void Elements_BeforeAddItem(ObservableCollection <MLineStyleElement> sender, ObservableCollectionEventArgs <MLineStyleElement> e)
 {
     // null items are not allowed
     if (e.Item == null)
     {
         e.Cancel = true;
     }
     else
     {
         e.Cancel = false;
     }
 }
Exemplo n.º 38
0
 private void Vertexes_RemoveItem(ObservableCollection<PolylineVertex> sender, ObservableCollectionEventArgs<PolylineVertex> e)
 {
     e.Item.Handle = null;
     e.Item.Owner = null;
 }
Exemplo n.º 39
0
 private void Elements_RemoveItem(ObservableCollection <MLineStyleElement> sender, ObservableCollectionEventArgs <MLineStyleElement> e)
 {
     this.OnMLineStyleElementRemovedEvent(e.Item);
     e.Item.LinetypeChanged -= this.MLineStyleElement_LinetypeChanged;
 }
Exemplo n.º 40
0
 private void Vertexes_BeforeRemoveItem(ObservableCollection<PolylineVertex> sender, ObservableCollectionEventArgs<PolylineVertex> e)
 {
 }
Exemplo n.º 41
0
 private void Vertexes_AddItem(ObservableCollection<PolylineVertex> sender, ObservableCollectionEventArgs<PolylineVertex> e)
 {
     // if the polyline already belongs to a document
     if (this.Owner != null)
     {
         // get the document
         DxfDocument doc = this.Owner.Record.Owner.Owner;
         doc.NumHandles = e.Item.AsignHandle(doc.NumHandles);
     }
     e.Item.Owner = this;
 }
Exemplo n.º 42
0
 private void Segments_BeforeRemoveItem(ObservableCollection <LinetypeSegment> sender, ObservableCollectionEventArgs <LinetypeSegment> e)
 {
 }
Exemplo n.º 43
0
 private void Vertexes_RemoveItem(ObservableCollection <PolylineVertex> sender, ObservableCollectionEventArgs <PolylineVertex> e)
 {
     e.Item.Handle = null;
     e.Item.Owner  = null;
 }
Exemplo n.º 44
0
 private void BoundaryPaths_AddItem(ObservableCollection <HatchBoundaryPath> sender, ObservableCollectionEventArgs <HatchBoundaryPath> e)
 {
     if (this.associative)
     {
         foreach (EntityObject entity in e.Item.Entities)
         {
             entity.AddReactor(this);
         }
     }
     else
     {
         e.Item.ClearContour();
     }
     this.OnHatchBoundaryPathAddedEvent(e.Item);
 }
Exemplo n.º 45
0
 private void BoundaryPaths_BeforeRemoveItem(ObservableCollection<HatchBoundaryPath> sender, ObservableCollectionEventArgs<HatchBoundaryPath> e)
 {
 }
Exemplo n.º 46
0
 private void BoundaryPaths_RemoveItem(ObservableCollection <HatchBoundaryPath> sender, ObservableCollectionEventArgs <HatchBoundaryPath> e)
 {
     if (this.associative)
     {
         foreach (EntityObject entity in e.Item.Entities)
         {
             entity.RemoveReactor(this);
         }
     }
     this.OnHatchBoundaryPathRemovedEvent(e.Item);
 }
Exemplo n.º 47
0
 private void Vertexes_BeforeAddItem(ObservableCollection <PolylineVertex> sender, ObservableCollectionEventArgs <PolylineVertex> e)
 {
     // null items and vertexes that belong to another polyline are not allowed.
     if (e.Item == null)
     {
         e.Cancel = true;
     }
     else if (e.Item.Owner != null)
     {
         e.Cancel = true;
     }
     else
     {
         e.Cancel = false;
     }
 }
Exemplo n.º 48
0
 private void Elements_BeforeRemoveItem(ObservableCollection <MLineStyleElement> sender, ObservableCollectionEventArgs <MLineStyleElement> e)
 {
 }
Exemplo n.º 49
0
 private void Vertexes_BeforeRemoveItem(ObservableCollection <PolylineVertex> sender, ObservableCollectionEventArgs <PolylineVertex> e)
 {
 }
Exemplo n.º 50
0
 private void XData_RemoveAppReg(XDataDictionary sender, ObservableCollectionEventArgs <ApplicationRegistry> e)
 {
     this.OnXDataRemoveAppRegEvent(e.Item);
 }
Exemplo n.º 51
0
 void UIRenderer_ItemAdded(object sender, ObservableCollectionEventArgs <UIControl> e)
 {
     layoutDone = false;
     e.Item.CheckInitialize();
 }