Esempio n. 1
0
        internal void AddContent(IDockContent content)
        {
            if (Contents.Contains(content))
            {
                return;
            }

            Contents.Add(content);
        }
Esempio n. 2
0
        internal void RemoveContent(IDockContent content)
        {
            if (!Contents.Contains(content))
            {
                return;
            }

            Contents.Remove(content);
        }
Esempio n. 3
0
 /// <summary>
 /// 添加到选择集
 /// </summary>
 /// <param name="entity">实体</param>
 public static void AddSelection(IFeature entity)
 {
     UnmarkSelection();
     if (!Contents.Contains(entity))
     {
         Contents.Add(entity);
     }
     MarkSelection();
     OnSelectionChanged();
 }
Esempio n. 4
0
		internal void AddContent(IDockContent content)
		{
			if (content == null)
				throw(new ArgumentNullException());

			if (!Contents.Contains(content))
			{
				Contents.Add(content);
				OnContentAdded(new DockContentEventArgs(content));
			}
		}
Esempio n. 5
0
		internal void RemoveContent(IDockContent content)
		{
			if (content == null)
				throw(new ArgumentNullException());
			
			if (Contents.Contains(content))
			{
				Contents.Remove(content);
				OnContentRemoved(new DockContentEventArgs(content));
			}
		}
Esempio n. 6
0
 public bool Remove(TContent content)
 {
     if (isUpdating)
     {
         beRemoved.AddLast(content);
         return(Contents.Contains(content) || beAdded.Contains(content));
     }
     else
     {
         return(RemoveFromContents(content));
     }
 }
Esempio n. 7
0
 public override bool CanFit(IInventoryItem item)
 {
     if (!Contents.Contains(item) && Capacity > Count)
     {
         return(true);
     }
     if (item is IInventoryStack stack)
     {
         return(stack.Capacity > stack.Count);
     }
     return(false);
 }
Esempio n. 8
0
 /// <summary>
 /// Adds item to the list of scanned items List. If the item is already in the List, 1 quantity is added; else the item is added with 1 qty.
 /// </summary>
 /// <param name="itm">Item to be added to the contents of this box.</param>
 public void AddItem(Item itm)
 {
     if (Contents.Contains(itm))                //check if item is in the box
     {
         var indexItem = Contents.IndexOf(itm); //find it's index
         Contents[indexItem].Quantity += 1;     //add 1 quantity
     }
     else
     {//else add the new item
         Contents.Add(itm);
     }
 }
Esempio n. 9
0
        /// <summary>
        /// Move an entity out of this' named container
        /// </summary>
        /// <typeparam name="T">the type of entity to remove</typeparam>
        /// <param name="thing">the entity</param>
        /// <param name="containerName">the name of the container</param>
        /// <returns>errors</returns>
        public string MoveFrom <T>(T thing, string containerName)
        {
            var implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T));

            if (implimentedTypes.Contains(typeof(IInanimate)))
            {
                var obj = (IInanimate)thing;

                if (!Contents.Contains(obj, containerName))
                {
                    return("That is not in the container");
                }

                Contents.Remove(obj, containerName);
                obj.CurrentLocation = null;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }


            if (implimentedTypes.Contains(typeof(IMobile)))
            {
                var obj = (IMobile)thing;

                if (!MobilesInside.Contains(obj, containerName))
                {
                    return("That is not in the container");
                }

                MobilesInside.Remove(obj, containerName);
                obj.CurrentLocation = null;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            if (implimentedTypes.Contains(typeof(IPathway)))
            {
                var obj = (IPathway)thing;

                if (!Pathways.Contains(obj, containerName))
                {
                    return("That is not in the container");
                }

                Pathways.Remove(obj, containerName);
                obj.CurrentLocation = null;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            return("Invalid type to move from container.");
        }
Esempio n. 10
0
 /// <summary>
 /// 添加到选择集
 /// </summary>
 /// <param name="entities">实体数组</param>
 public static void AddSelection(IFeature[] entities)
 {
     UnmarkSelection();
     entities.ToList().ForEach(x =>
     {
         if (!Contents.Contains(x))
         {
             Contents.Add(x);
         }
     });
     MarkSelection();
     OnSelectionChanged();
 }
Esempio n. 11
0
 /// <summary>
 /// 从选择集减去
 /// </summary>
 /// <param name="entities">实体数组</param>
 public static void SubtractSelection(IFeature[] entities)
 {
     UnmarkSelection();
     entities.ToList().ForEach(x =>
     {
         if (Contents.Contains(x))
         {
             Contents.Remove(x);
         }
     });
     MarkSelection();
     OnSelectionChanged();
 }
Esempio n. 12
0
        /// <summary>
        /// Move an entity into a named container in this
        /// </summary>
        /// <typeparam name="T">the type of the entity to add</typeparam>
        /// <param name="thing">the entity to add</param>
        /// <param name="containerName">the name of the container</param>
        /// <returns>errors</returns>
        public string MoveInto <T>(T thing, string containerName)
        {
            var implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T));

            if (implimentedTypes.Contains(typeof(IInanimate)))
            {
                var obj = (IInanimate)thing;

                if (Contents.Contains(obj, containerName))
                {
                    return("That is already in the container");
                }

                Contents.Add(obj, containerName);
                obj.CurrentLocation = this;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            if (implimentedTypes.Contains(typeof(IMobile)))
            {
                var obj = (IMobile)thing;

                if (MobilesInside.Contains(obj, containerName))
                {
                    return("That is already in the container");
                }

                MobilesInside.Add(obj, containerName);
                obj.CurrentLocation = this;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            if (implimentedTypes.Contains(typeof(IPathway)))
            {
                var obj = (IPathway)thing;

                if (Pathways.Contains(obj, containerName))
                {
                    return("That is already in the container");
                }

                Pathways.Add(obj, containerName);
                obj.CurrentLocation = this;
                this.UpsertToLiveWorldCache();
                return(string.Empty);
            }

            return("Invalid type to move to container.");
        }
Esempio n. 13
0
 /// <summary>
 /// Move the specified element to this cell.
 /// The element will be removed from any cell it occupies.
 /// TODO: Modify this for multi-cell entities?
 /// </summary>
 /// <param name="element"></param>
 public void PlaceInCell(Element element)
 {
     if (!Contents.Contains(element))
     {
         MapData mD = element.GetData <MapData>(true);
         if (mD.MapCell != null && mD.MapCell.Contents.Contains(element))
         {
             mD.MapCell.RemoveFromCell(element);
         }
         Contents.Add(element);
         mD.MapCell = this;
         NotifyPropertyChanged("Contents"); //TEMP
     }
 }
Esempio n. 14
0
        internal void AddContent(Content c)
        {
            if (Contents.Contains(c))
            {
                return;
            }

            Contents.Add(c);
            SetDockState();
            if (!c.IsHidden && CountOfVisibleContents == 1)
            {
                ActiveContent = c;
                Refresh();
            }
        }
Esempio n. 15
0
        internal void RemoveContent(IDockableWindow content)
        {
            if (!Contents.Contains(content))
            {
                return;
            }

            Contents.Remove(content);
            if (content.DockHandler.Pane == this)
            {
                content.DockHandler.SetPane(null);
            }
            if (Contents.Count == 0)
            {
                Dispose();
            }
        }
Esempio n. 16
0
        /// <summary>
        /// Add the collection of hot zones.
        /// </summary>
        /// <param name="redock">Reference to a redocker instance.</param>
        /// <param name="collection">Collection of hot zones.</param>
        public void AddHotZones(Redocker redock, HotZoneCollection collection)
        {
            RedockerContent redocker = redock as RedockerContent;

            bool itself   = false;
            bool nullZone = false;

            // We process differently for WindowContent to redock into itself!
            if ((redocker.WindowContent != null) && (redocker.WindowContent == this))
            {
                itself = true;
            }

            // We do not allow a Content to redock into its existing container
            if (itself && !Contents.Contains(redocker.Content))
            {
                nullZone = true;
            }

            Rectangle newSize = this.RectangleToScreen(this.ClientRectangle);
            Rectangle hotArea = _tabControl.RectangleToScreen(_tabControl.ClientRectangle);;

            // Find any caption detail and use that area as the hot area
            foreach (WindowDetail wd in WindowDetails)
            {
                WindowDetailCaption wdc = wd as WindowDetailCaption;

                if (wdc != null)
                {
                    hotArea = wdc.RectangleToScreen(wdc.ClientRectangle);
                    hotArea.Inflate(_hotAreaInflate, _hotAreaInflate);
                    break;
                }
            }

            if (nullZone)
            {
                collection.Add(new HotZoneNull(hotArea));
            }
            else
            {
                collection.Add(new HotZoneTabbed(hotArea, newSize, this, itself));
            }
        }
Esempio n. 17
0
 private static void MarkSelection() // mod 20130226
 {
     foreach (var layer in MapControl.Current.Layers)
     {
         if (layer is DrawingMapLayer)
         {
             foreach (var content in (layer as DrawingMapLayer).Features)
             {
                 var feature = content.Key;
                 var drawing = content.Value;
                 if (Contents.Contains(feature))
                 {
                     if (FindLayer(feature).GeoType != VectorLayer.GEOTYPE_LINEAR)
                     {
                         (layer as DrawingMapLayer).BringToFront(drawing);
                     }
                     drawing.Pen.Brush = MarkBrush;
                     //_tempDrawings.Add(drawing);
                 }
             }
         }
         else
         {
             foreach (var content in layer.Features)
             {
                 var feature = content.Key;
                 var shape   = content.Value;
                 //System.Windows.Controls.Canvas.SetZIndex(shape, 0);
                 if (Contents.Contains(feature))
                 {
                     if (FindLayer(feature).GeoType != VectorLayer.GEOTYPE_LINEAR)
                     {
                         layer.BringToFront(shape);
                     }
                     shape.Stroke = MarkBrush;
                     //_tempShapes.Add(shape);
                 }
             }
         }
     }
     //UpdateSelectionMark();
 }
Esempio n. 18
0
 public Bill_Identifier(string path)
 {
     if (File.Exists(path))
     {
         LobPath  = path;
         Contents = FileUtils.FileContents(path);
         if (Contents.Contains("&lt;")) // < isn't always done correctly
         {
             var re_lt = "&lt;";
             Contents = Regex.Replace(Contents, re_lt, "<").ToString();
         }
         ExtractID(Contents);
         ExtractAuthor(Contents);
         ExtractTitle(Contents);
     }
     else
     {
         throw new ArgumentException($"{path} does not exist.");
     }
 }
Esempio n. 19
0
        internal void AddContent(IDockContent content)
        {
            if (content == null)
            {
                throw (new ArgumentNullException());
            }

            if (!Contents.Contains(content))
            {
                Contents.Add(content);
                OnContentAdded(new DockContentEventArgs(content));
            }
            else
            {
                string msg = "1) your PersistStringInstantiator returned the same instance twice"
                             + "2) REMOVE SHOWING DOCKED FORMS DURING LOADFROMXML()";
                throw new Exception(msg);
                Contents.Add(content);
                OnContentAdded(new DockContentEventArgs(content));
            }
        }
Esempio n. 20
0
        /// <summary>
        /// Move an entity out of this' named container
        /// </summary>
        /// <typeparam name="T">the type of entity to remove</typeparam>
        /// <param name="thing">the entity</param>
        /// <param name="containerName">the name of the container</param>
        /// <returns>errors</returns>
        public string MoveFrom <T>(T thing, string containerName)
        {
            IEnumerable <Type> implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T));

            if (implimentedTypes.Contains(typeof(IInanimate)))
            {
                IInanimate obj = (IInanimate)thing;

                if (!Contents.Contains(obj, containerName))
                {
                    return("That is not in the container");
                }

                Contents.Remove(obj, containerName);
                UpsertToLiveWorldCache();

                return(string.Empty);
            }

            if (implimentedTypes.Contains(typeof(IMobile)))
            {
                IMobile obj = (IMobile)thing;

                if (!MobilesInside.Contains(obj, containerName))
                {
                    return("That is not in the container");
                }

                MobilesInside.Remove(obj, containerName);
                UpsertToLiveWorldCache();

                return(string.Empty);
            }

            return("Invalid type to move from container.");
        }
Esempio n. 21
0
 public bool HasItem(IGameObject item)
 {
     return(Contents.Contains(item));
 }
        public void ConsolidateConnections()
        {
            // Ensure components consuming composition inputs/outputs have a source

            // Find connections that are consumed by internal components but are not provided by external components
            var neglectedInternalConnections = from c in Connections
                                               where c.Source == this
                                               where Contents.Contains(c.Destination)
                                               where !Connections.Any(con => con.DestinationInput == c.SourceOutput)
                                               select c;

            if (neglectedInternalConnections.Any())
            {
                throw new NoProvidingSourceException(Name, from c in neglectedInternalConnections select c.SourceOutput);
            }

            // Find connections that are consumed by external components but are not provided by internal components
            var neglectedExternalConnections = from c in Connections
                                               where c.Source == this
                                               where c.Destination != this
                                               where !Contents.Contains(c.Destination)
                                               where !Connections.Any(con => con.DestinationInput == c.SourceOutput)
                                               select c;

            if (neglectedExternalConnections.Any())
            {
                throw new NoProvidingSourceException(Name, from c in neglectedExternalConnections select c.SourceOutput);
            }

            // Begin consolidating composition connections

            // First, consolidate the connections leading into the composition
            var incomingConnections = from c in Connections
                                      where c.Destination == this
                                      where c.Source != this
                                      where !Contents.Contains(c.Source)
                                      select c;

            foreach (var connection in incomingConnections)
            {
                // Find all of the places this input is consumed
                var destinationConnections = from c in Connections
                                             where c.Source == this
                                             where c.SourceOutput == connection.DestinationInput
                                             select c;

                foreach (var destinationConnection in destinationConnections)
                {
                    var trueDestinations = Enumerable.Repeat(destinationConnection, 1);

                    // If the input passes through straight to an output, connect the input to the external components
                    if (destinationConnection.Destination == this)
                    {
                        trueDestinations = from c in Connections
                                           where c.Source == this
                                           where c.SourceOutput == destinationConnection.DestinationInput
                                           select c;
                    }

                    // Connect the source to the current destination and remove the destination's connection to the composition
                    foreach (var trueDestination in trueDestinations)
                    {
                        connection.Source.Connect(trueDestination.Destination, connection.SourceOutput, trueDestination.DestinationInput, connection.ConnectionType);
                        trueDestination.Destination.Connections.Remove(trueDestination);
                    }
                }

                // Remove the source's connection to the composition
                connection.Source.Connections.Remove(connection);
            }

            // Then, consolidate the connections leading out of the composition
            var outgoingConnections = from c in Connections
                                      where c.Destination == this
                                      where Contents.Contains(c.Source)
                                      select c;

            foreach (var connection in outgoingConnections)
            {
                var destinationConnections = from c in Connections
                                             where c.Source == this
                                             where c.SourceOutput == connection.DestinationInput
                                             select c;

                foreach (var destinationConnection in destinationConnections)
                {
                    connection.Source.Connect(destinationConnection.Destination, connection.SourceOutput, destinationConnection.DestinationInput, connection.ConnectionType);
                    destinationConnection.Destination.Connections.Remove(destinationConnection);
                }

                connection.Source.Connections.Remove(connection);
            }

            // Remove all connections and content from the composition
            Connections.Clear();
            Contents.Clear();
        }
Esempio n. 23
0
 public bool Contains(string thing)
 {
     return(Contents.Contains(thing));
 }
Esempio n. 24
0
        protected virtual void UpdateContents()
        {
            foreach (var trackedObject in TrackedObject.TrackedObjects)
            {
                if (trackedObject == TrackedPlayer.LocalPlayer || trackedObject.Trackers.Any(t => t != null && t.trackerContinuity && t.trackerContinuity.IsTracking))
                {
                    if (trackedObject.Trackers.Any(t => t != null && t.trackerContinuity && Zone.Contains(t.optitrackRigidBody.transform.position)))
                    {
                        // Some of the Tracked Object's RBs are inside this zone

                        if (Contents.Contains(trackedObject))
                        {
                            // Object already present
                            //Debug.Log(trackedObject + " is in zone " + this.name);
                        }
                        else if (priorContents.Remove(trackedObject))
                        {
                            // Object was last in this zone
                            if (Contents.Add(trackedObject))
                            {
                                Spaces.LBE.DebugLog.Log("tracker", trackedObject.name + " [Returned to " + this.name + "]");

                                if (OnZoneEntered != null)
                                {
                                    OnZoneEntered(this, trackedObject);
                                }
                            }
                        }
                        else
                        {
                            // Object has not been in this zone recently

                            if (m_ConnectedZones.Length == 0 ||
                                m_ConnectedZones.Any(z => z && (z.Contents.Contains(trackedObject) || z.priorContents.Contains(trackedObject))) ||
                                !Zones.Any(z => z && (z.Contents.Contains(trackedObject) || z.priorContents.Contains(trackedObject)))
                                )
                            {
                                if (Contents.Add(trackedObject))
                                {
                                    // Object has just entered zone!
                                    Spaces.LBE.DebugLog.Log("tracker", trackedObject.name + " [Entered " + this.name + "]");

                                    if (OnZoneEntered != null)
                                    {
                                        OnZoneEntered(this, trackedObject);
                                    }
                                }
                            }
                            else
                            {
                                // Object isn't entering via a valid edge
                                Spaces.LBE.DebugLog.Log("tracker", trackedObject.name + " [Entered " + this.name + " from an invalid edge]");
                            }
                        }
                    }
                    else if (TrackedPlayer.LocalPlayer && trackedObject == TrackedPlayer.LocalPlayer && Zone.Contains(TrackedPlayer.LocalPlayer.HmdTracker.transform.position))
                    {
                        // The current TrackedObject is the Local Player and its the Hmd is inside this zone

                        if (Contents.Contains(TrackedPlayer.LocalPlayer))
                        {
                            // Local Player is already in this zone
                        }
                        else if (m_ConnectedZones.Length == 0 ||
                                 m_ConnectedZones.Any(z => z && (z.Contents.Contains(TrackedPlayer.LocalPlayer) || z.priorContents.Contains(TrackedPlayer.LocalPlayer))) ||
                                 !Zones.Any(z => z && (z.Contents.Contains(TrackedPlayer.LocalPlayer) || z.priorContents.Contains(TrackedPlayer.LocalPlayer)))
                                 )
                        {
                            if (Contents.Add(TrackedPlayer.LocalPlayer))
                            {
                                // LocalPlayer has just entered this zone! Zone now active.
                                Spaces.LBE.DebugLog.Log("tracker", trackedObject.name + " [Entered " + this.name + "]");

                                if (OnZoneEntered != null)
                                {
                                    OnZoneEntered(this, trackedObject);
                                }
                            }
                        }
                        else
                        {
                            // Player isn't entering via a valid edge
                            Spaces.LBE.DebugLog.Log("tracker", TrackedPlayer.LocalPlayer.name + " [Entered " + this.name + " from an invalid edge]");
                        }
                    }
                    else
                    {
                        // None of this object's trackers are inside this zone currently

                        // TODO: Decide if player can leave if not entering a valid zone to do so. Do we raise an alarm?
                        //if (m_ConnectedZones.Any(z => z.Contents.Contains(trackedObject) || z.priorContents.Contains(trackedObject)))

                        if (Contents.Remove(trackedObject))
                        {
                            // Object has just left zone
                            priorContents.Add(trackedObject);
                            Spaces.LBE.DebugLog.Log("tracker", trackedObject.name + " [Exited " + this.name + "]");

                            if (OnZoneExited != null)
                            {
                                OnZoneExited(this, trackedObject);
                            }
                        }
                        else if (priorContents.Contains(trackedObject))
                        {
                            // TODO: determine better criteria for removing objects from priors

                            if (Zones.Any(z => z != this && z.Contents.Contains(trackedObject)))
                            {
                                // Object is still contained in some other zone, so we will go ahead and remove it from prior contents

                                if (priorContents.Remove(trackedObject))
                                {
                                    Spaces.LBE.DebugLog.Log("tracker", trackedObject.name + " [No longer in Prior Contents of " + this.name + "]");
                                }
                            }
                            else
                            {
                                // Object has been out of zone for an entire update cycle and is in no other zone, therefore we will keep it in this one's priors.
                                // This will allow it to re-enter this zone rather than only be able to enter via a start zone.
                            }
                        }
                        else
                        {
                            // Object is not in any zone...
                        }
                    }
                }
            }
        }
Esempio n. 25
0
 public bool Contains <T>(T item) where T : Thing
 {
     return(Contents.Contains(item));
 }
Esempio n. 26
0
 /// <summary>
 /// Checks if this hand contains that element.
 /// </summary>
 /// <param name="element"></param>
 /// <returns></returns>
 public virtual bool Contains(TElement element)
 {
     return(Contents.Contains(element));
 }
Esempio n. 27
0
 public bool Contains(T item)
 {
     return(Contents.Contains(item));
 }