//获取组合的图元的每个子对象
        internal List <IGroupable> GetGroupChilds(IGroupable parent)
        {
            var list     = _designerCanvas.Children.OfType <IGroupable>();
            var children = list.Where(node => node.ParentID == parent.ID);

            return(children.ToList());
        }
Example #2
0
        /// <summary>
        /// Creates a new <see cref="IGroup"/>.
        /// </summary>
        /// <param name="founder">The <see cref="IGroupable"/> that will be the founder of the group.</param>
        /// <returns>If the group was successfully created, returns the new <see cref="IGroup"/> with the
        /// <paramref name="founder"/> set as the group's founder. Otherwise, returns null.
        /// A group may not be created by someone who is already in a group.</returns>
        public IGroup TryCreateGroup(IGroupable founder)
        {
            // Make sure not already in a group
            if (founder.Group != null)
                return null;

            // Create the group
            var newGroup = _tryCreateGroup(this, founder);
            if (newGroup == null)
                return null;

            // Make sure the founder had their group property updated
            founder.Group = newGroup;

            // Add the new group to the list
            _groups.Add(newGroup);

            // Listen for when the group is disbanded so we can remove it
            newGroup.Disbanded += _groupDisbandHandler;

            // Raise events
            OnCreateGroup(newGroup);

            if (GroupCreated != null)
                GroupCreated.Raise(this, EventArgsHelper.Create(newGroup));

            return newGroup;
        }
Example #3
0
        internal List<IGroupable> GetGroupMembers(IGroupable item)
        {
            IEnumerable<IGroupable> list        = canvas.Children.OfType<IGroupable>();
            IGroupable              rootItem    = this.GetRoot(list, item);

            return GetGroupMembers(list, rootItem);
        }
Example #4
0
        internal List <IGroupable> GetGroupMembers(IGroupable item)
        {
            IEnumerable <IGroupable> list = dataSource.GetGroupableList();
            IGroupable rootItem           = GetRoot(list, item);

            return(GetGroupMembers(list, rootItem));
        }
Example #5
0
        /// <summary>
        /// Creates a new <see cref="IGroup"/>.
        /// </summary>
        /// <param name="founder">The <see cref="IGroupable"/> that will be the founder of the group.</param>
        /// <returns>If the group was successfully created, returns the new <see cref="IGroup"/> with the
        /// <paramref name="founder"/> set as the group's founder. Otherwise, returns null.
        /// A group may not be created by someone who is already in a group.</returns>
        public IGroup TryCreateGroup(IGroupable founder)
        {
            // Make sure not already in a group
            if (founder.Group != null)
            {
                return(null);
            }

            // Create the group
            var newGroup = _tryCreateGroup(this, founder);

            if (newGroup == null)
            {
                return(null);
            }

            // Make sure the founder had their group property updated
            founder.Group = newGroup;

            // Add the new group to the list
            _groups.Add(newGroup);

            // Listen for when the group is disbanded so we can remove it
            newGroup.Disbanded += _groupDisbandHandler;

            // Raise events
            OnCreateGroup(newGroup);

            if (GroupCreated != null)
            {
                GroupCreated.Raise(this, EventArgsHelper.Create(newGroup));
            }

            return(newGroup);
        }
Example #6
0
        public void InitReportControl()
        {
            var assembly = this.GetType().GetAssembly();

            foreach (Type type in assembly.GetTypes())
            {
                var attr = type.GetCustomAttribute(typeof(ReportAttribute)) as ReportAttribute;
                if (attr == null)
                {
                    continue;
                }
                if (attr.ReportName == ReportName && attr.HspName == HspName)
                {
                    this.Text = ReportName;

                    Report = (IReport)assembly.CreateInstance(type.FullName);
                }
                else
                {
                    continue;
                }

                grpGroup.Visible = Report is IGroupable;
                GroupableReport  = Report as IGroupable;

                Report.Control.Dock = DockStyle.Fill;
                panelControl1.Controls.Add(Report.Control);
            }

            if (Report == null)
            {
                throw new Exception("没有找到报表:" + ReportName);
            }
        }
Example #7
0
        internal List <IGroupable> GetGroupMembers(IGroupable item)
        {
            IEnumerable <IGroupable> list = designerCanvas.Children.OfType <IGroupable>();
            IGroupable rootItem           = GetRoot(list, item);

            return(GetGroupMembers(list, rootItem));
        }
        private bool BelongToSameGroup(IGroupable item1, IGroupable item2)
        {
            IGroupable root1 = SelectionService.GetGroupRoot(item1);
            IGroupable root2 = SelectionService.GetGroupRoot(item2);

            return(root1.ID == root2.ID);
        }
Example #9
0
 public void AddFigure(IGroupable figure)
 {
     if (!figure.IsInGroup)
     {
         figure.IsInGroup = true;
         figuresGroup.Add(figure as CTwoDFigure);
     }
 }
Example #10
0
        /// <summary>
        /// When overridden in the derived class, allows for additional handling for when a group member
        /// leaves the group the <see cref="GroupMemberInfo{T}.Owner"/> is currently in.
        /// </summary>
        /// <param name="groupMember">The group member that joined the group. This will never be equal to
        /// the <see cref="GroupMemberInfo{T}.Owner"/>. That is, we will only receive events related to other
        /// group members in our group.</param>
        protected override void OnGroupMemberLeft(IGroupable groupMember)
        {
            using (var pw = ServerPacket.GroupInfo(x => UserGroupInformation.WriteRemoveMember(x, groupMember)))
            {
                Owner.Send(pw, ServerMessageType.GUI);
            }

            Owner.Send(GameMessage.GroupMemberLeft, ServerMessageType.GUI, GetGroupMemberName(groupMember));
        }
        /// <summary>
        /// Returns <c>true</c> when the group has the specified name.
        /// </summary>
        /// <param name="group"></param>
        /// <param name="name"></param>
        public static bool IsGroup(this IGroupable group, string name)
        {
            if (group == null)
            {
                return(false);
            }

            return(group.GroupId.ToLowerInvariant() == name?.ToLowerInvariant());
        }
Example #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Group"/> class.
        /// </summary>
        /// <param name="founder">The group founder.</param>
        /// <exception cref="ArgumentNullException"><paramref name="founder" /> is <c>null</c>.</exception>
        public Group(IGroupable founder)
        {
            if (founder == null)
                throw new ArgumentNullException("founder");

            _founder = founder;
            _members.Add(_founder);

            founder.Group = this;
        }
Example #13
0
 /// <summary>
 /// 자식노드가 group인지 data인지 판단
 /// </summary>
 public bool IsitGroup(IGroupable what)
 {
     if (what is ClassGroup)
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Example #14
0
        /// <summary>
        /// Tries to invite the <paramref name="member"/> to this group.
        /// </summary>
        /// <param name="member">The <see cref="IGroupable"/> to invite.</param>
        /// <returns>True if the <paramref name="member"/> was successfully invited; otherwise false.</returns>
        public bool TryInvite(IGroupable member)
        {
            if (!_groupSettings.CanJoinGroupHandler(member, this))
            {
                return(false);
            }

            member.NotifyInvited(this);

            return(true);
        }
Example #15
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Group"/> class.
        /// </summary>
        /// <param name="founder">The group founder.</param>
        /// <exception cref="ArgumentNullException"><paramref name="founder" /> is <c>null</c>.</exception>
        public Group(IGroupable founder)
        {
            if (founder == null)
            {
                throw new ArgumentNullException("founder");
            }

            _founder = founder;
            _members.Add(_founder);

            founder.Group = this;
        }
Example #16
0
    void Start()
    {
        groupButtonDelegates[0] = OnGroup;
        groupButtonDelegates[1] = OnUnGroup;

        groupable = GetComponent <IGroupable>();

        if (groupable != null && groupable.IsOwner)
        {
            delegateIndex = UNGROUP;
        }
    }
Example #17
0
        /// <summary>
        /// Tries to add an <see cref="IGroupable"/> to this group.
        /// </summary>
        /// <param name="groupable">The <see cref="IGroupable"/> to try to add to the group.</param>
        /// <returns>
        /// True if the <paramref name="groupable"/> was successfully added to the group;
        /// otherwise false.
        /// This method will always return false is the <paramref name="groupable"/> is already in a group.
        /// </returns>
        public virtual bool TryAddMember(IGroupable groupable)
        {
            // Check the max members value
            if (_members.Count >= _groupSettings.MaxMembersPerGroup)
            {
                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - the group is full.", groupable, this);
                }
                return(false);
            }

            // Ensure not already in a group
            if (groupable.Group != null)
            {
                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - they were already in a group (`{2}`).", groupable, this,
                                   groupable.Group);
                }
                return(false);
            }

            // Check that they can be added
            if (_groupSettings.CanJoinGroupHandler != null && !_groupSettings.CanJoinGroupHandler(groupable, this))
            {
                if (log.IsInfoEnabled)
                {
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - GroupSettings.CanJoinGroupHandler returned false.",
                                   groupable, this);
                }
                return(false);
            }

            // Add the member
            _members.Add(groupable);
            groupable.Group = this;

            if (log.IsInfoEnabled)
            {
                log.InfoFormat("Added `{0}` to group `{1}`.", groupable, this);
            }

            // Raise events
            OnMemberJoin(groupable);

            if (MemberJoin != null)
            {
                MemberJoin.Raise(this, EventArgsHelper.Create(groupable));
            }

            return(true);
        }
        //从组合后的图元中取得图元的列表
        internal List <IGroupable> GetGroupMembers(IGroupable item)
        {
            var groupList = new List <IGroupable>();
            var rootItem  = GetGroupRoot(item);

            if (rootItem == null)
            {
                groupList.Add(item);
                return(groupList);
            }
            return(GetGroupMembersFromCanvas(rootItem));
        }
Example #19
0
        /// <summary>
        /// Gets the name to use for a group's member.
        /// </summary>
        /// <param name="member">The group member.</param>
        /// <returns>The name to use for a group's member.</returns>
        static string GetGroupMemberName(IGroupable member)
        {
            var asCharacter = member as Character;

            if (asCharacter != null)
            {
                return(asCharacter.Name);
            }
            else
            {
                return(member.ToString());
            }
        }
Example #20
0
    public override void Group(IGroupable other)
    {
        UnGroup();

        base.Group(other);

        (owner as Player).isDriving = true;

        //物体自身的是否为动力学刚体显示为 false
        body.isKinematic = false;
        //对象的标签为 player
        gameObject.tag = "Player";
    }
Example #21
0
        //Method to create Connectors.
        private ConnectorViewModel CreateConnector(IGroupable sourceNode, IGroupable targetNode)
        {
            ConnectorViewModel connector = new ConnectorViewModel()
            {
                SourceNode             = sourceNode,
                TargetNode             = targetNode,
                ConnectorGeometryStyle = App.Current.Resources["ConnectorGeometryPathStyle"] as Style,
                TargetDecorator        = App.Current.Resources["ClosedSharp"],
                TargetDecoratorStyle   = App.Current.Resources["DecoratorFillStyle"] as Style,
            };

            return(connector);
        }
Example #22
0
        private List <IGroupable> GetGroupMembers(IEnumerable <IGroupable> list, IGroupable parent)
        {
            List <IGroupable> groupMembers = new List <IGroupable>();

            groupMembers.Add(parent);

            var children = list.Where(node => node.ParentID == parent.ID);

            foreach (IGroupable child in children)
            {
                groupMembers.AddRange(GetGroupMembers(list, child));
            }

            return(groupMembers);
        }
 //取得组合后的顶层图元
 private IGroupable GetRoot(IEnumerable <IGroupable> list, IGroupable node)
 {
     if (node == null || node.ParentID == Guid.Empty)
     {
         return(node);
     }
     foreach (IGroupable item in list)
     {
         if (item.ID == node.ParentID)
         {
             return(GetRoot(list, item));
         }
     }
     return(null);
 }
Example #24
0
    public override void Group(IGroupable other)
    {
        UnGroup();
        base.Group(other);

        body.isKinematic = true;
        //对象的标签为 player
        gameObject.tag     = "ColdWeapon";
        owner.ShouldShowUI = true;

        //this.owner = owner;
        //this.owner.isFly = true;
        //GameController.Attach(transform, owner.transform.Find("BackPoint"));
        ////物体自身的是否为动力学刚体显示为 true
    }
Example #25
0
        /// <summary>
        /// Removes a member from the group.
        /// </summary>
        /// <param name="member">The member to remove.</param>
        /// <returns>
        /// True if the <paramref name="member"/> was successfully removed; false if the <paramref name="member"/>
        /// was either not in a group already, or was in a different group. If the <paramref name="member"/> is not
        /// in this group, their <see cref="IGroupable.Group"/> value will not be altered.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="member"/> is null.</exception>
        public bool RemoveMember(IGroupable member)
        {
            if (member == null)
            {
                throw new ArgumentNullException("member");
            }

            // Ensure they are in this group
            if (member.Group != this)
            {
                return(false);
            }

            // Remove their group value
            member.Group = null;

            // Remove the member from the member list
            if (!_members.Remove(member))
            {
                const string errmsg =
                    "Group member `{0}` was removed from group `{1}`, but they were not in the _group list. That is bad...";
                if (log.IsErrorEnabled)
                {
                    log.ErrorFormat(errmsg, member, this);
                }

                Debug.Fail(string.Format(errmsg, member, this));

                return(false);
            }

            // Raise events
            OnMemberLeave(member);

            if (MemberLeave != null)
            {
                MemberLeave.Raise(this, EventArgsHelper.Create(member));
            }

            // If they were the founder, disband the group completely
            if (member == Founder)
            {
                Disband();
            }

            return(true);
        }
Example #26
0
    //组合功能
    public static void Group(IGroupable groupable)
    {
        groupable.Group(player.GetComponent <IGroupable>());
        player.GetComponent <IGroupable>().Group(groupable);
        ////驾驶获取父对象vehicle组件
        //Vehicle vehicle = parent.GetComponent<Vehicle>();

        //if(vehicle)
        //{
        //    vehicle.Group(player.GetComponent<Play1>());
        //}
        //Fly fly = parent.GetComponent<Fly>();
        //if (fly)
        //{
        //    fly.Group(player.GetComponent<Play1>());
        //}
    }
Example #27
0
    public virtual void Group(IGroupable other)
    {
        UnGroup();

        GameController.TryAttach(trans, other.trans);

        //if(IsGroupParent)
        //{
        //    GameController.Attach(other.trans, trans, attachPointName);
        //}
        //else
        //{
        //    GameController.Attach(trans, other.trans, attachPointName);
        //}

        owner    = other;
        HasGroup = true;
    }
Example #28
0
        /// <summary>
        /// Recursively searches the group tree structure, taking item as the root.
        /// </summary>
        /// <param name="item">Tree root from which to search.</param>
        /// <returns>An unsorted list of all IGroupable items in the group tree structure</returns>
        private static IEnumerable <IGroupable> TraverseGroup(IGroupable item)
        {
            List <IGroupable> result = new List <IGroupable>();

            if (item == null)
            {
                return(null);
            }
            result.Add(item);
            if (item is Group g)
            {
                foreach (IGroupable i in g.GetChildren())
                {
                    result.AddRange(TraverseGroup(i));
                }
            }
            return(result);
        }
Example #29
0
        /// <summary>
        /// Forces the group to disband.
        /// </summary>
        public void Disband()
        {
            // Raise events
            OnDisbanded();

            if (Disbanded != null)
            {
                Disbanded.Raise(this, EventArgs.Empty);
            }

            // Clear the founder
            _founder = null;

            // Remove all members from the group
            foreach (var member in Members.ToImmutable())
            {
                RemoveMember(member);
            }

            Debug.Assert(_members.Count == 0, "Uh-oh, some members managed to not get removed!");
        }
        //取得图元列表
        private List <IGroupable> GetGroupMembersFromCanvas(IGroupable parent)
        {
            if (parent == null)
            {
                return(null);
            }
            var list         = _designerCanvas.Children.OfType <IGroupable>();
            var groupMembers = new List <IGroupable>();

            groupMembers.Add(parent);
            IEnumerable <IGroupable> children = null;

            if (parent != null)
            {
                children = list.Where(node => node.ParentID == parent.ID);
            }
            foreach (var child in children)
            {
                groupMembers.AddRange(GetGroupMembersFromCanvas(child));
            }

            return(groupMembers);
        }
Example #31
0
 public bool addInGroup(IGroupable newObject)
 {
     throw new NotImplementedException();
 }
Example #32
0
            public bool addItem(IGroupable item)
            {
                if (items.Keys.Contains(item.GetId())) return false;

                items.Add(item.GetId(), item);

                throw new NotImplementedException();
            }
Example #33
0
 /// <summary>
 /// Appends a message to a <see cref="BitStream"/> for synchronizing the client's group information for when
 /// a member is removed from the group.
 /// The message is then read and handled by the receiver using <see cref="UserGroupInformation.Read"/>.
 /// </summary>
 /// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
 /// <param name="member">The group member to remove.</param>
 public static void WriteRemoveMember(BitStream bs, IGroupable member)
 {
     bs.WriteEnum(GroupInfoMessages.RemoveMember);
     bs.Write(member.Name);
 }
Example #34
0
        /// <summary>
        /// Forces the group to disband.
        /// </summary>
        public void Disband()
        {
            // Raise events
            OnDisbanded();

            if (Disbanded != null)
                Disbanded.Raise(this, EventArgs.Empty);

            // Clear the founder
            _founder = null;

            // Remove all members from the group
            foreach (var member in Members.ToImmutable())
            {
                RemoveMember(member);
            }

            Debug.Assert(_members.Count == 0, "Uh-oh, some members managed to not get removed!");
        }
Example #35
0
        internal IGroupable GetGroupRoot(IGroupable item)
        {
            IEnumerable <IGroupable> list = designerCanvas.Children.OfType <IGroupable>();

            return(GetRoot(list, item));
        }
 internal IGroupable GetGroupRoot(IGroupable item)
 {
     IEnumerable<IGroupable> list = designCanvas.Children.OfType<IGroupable>();
     return GetRoot(list, item);
 }
 private IGroupable GetRoot(IEnumerable<IGroupable> list, IGroupable node)
 {
     if (node == null || node.ParentID == Guid.Empty)
     {
         return node;
     }
     else
     {
         foreach (IGroupable item in list)
         {
             if (item.ID == node.ParentID)
             {
                 return GetRoot(list, item);
             }
         }
         return null;
     }
 }
Example #38
0
 public void Group(IGroupable other)
 {
     groupables.Add(other);
     HasGroup = true;
 }
Example #39
0
 /// <summary>
 /// Appends a message to a <see cref="BitStream"/> for synchronizing the client's group information for when
 /// a member is removed from the group.
 /// The message is then read and handled by the receiver using <see cref="UserGroupInformation.Read"/>.
 /// </summary>
 /// <param name="bs">The <see cref="BitStream"/> to append the message to.</param>
 /// <param name="member">The group member to remove.</param>
 public static void WriteRemoveMember(BitStream bs, IGroupable member)
 {
     bs.WriteEnum(GroupInfoMessages.RemoveMember);
     bs.Write(member.Name);
 }
 internal IGroupable GetGroupRoot( ICanvasModel model, IGroupable item )
 {
     var list = model.GetItems<IGroupable>();
     return GetRoot( list, item );
 }
Example #41
0
 internal IGroupable GetGroupRoot(IGroupable item)
 {
     IEnumerable<IGroupable> list = dataSource.GetGroupableList();
     return GetRoot(list, item);
 }
Example #42
0
 internal List<IGroupable> GetGroupMembers(IGroupable item)
 {
     IEnumerable<IGroupable> list = dataSource.GetGroupableList();
     IGroupable rootItem = GetRoot(list, item);
     return GetGroupMembers(list, rootItem);
 }
Example #43
0
 /// <summary>
 /// When overridden in the derived class, allows for handling of the <see cref="IGroup.MemberJoin"/> event.
 /// </summary>
 /// <param name="member">The group member that joined the group.</param>
 protected virtual void OnMemberJoin(IGroupable member)
 {
 }
Example #44
0
 /// <summary>
 /// When overridden in the derived class, allows for handling of the <see cref="IGroup.MemberLeave"/> event.
 /// </summary>
 /// <param name="member">The group member that left the group.</param>
 protected virtual void OnMemberLeave(IGroupable member)
 {
 }
Example #45
0
 /// <summary>
 /// Gets all the <see cref="IGroupable"/>s in this <see cref="IGroup"/> that are in range of the
 /// <paramref name="origin"/> group member. This will include all group members where
 /// <see cref="IGroupable.IsInShareDistance"/> returns true for the <paramref name="origin"/>.
 /// </summary>
 /// <param name="origin">The group member that will be used to get the group members that are near.</param>
 /// <param name="includeOrigin">If true, the <paramref name="origin"/> will be included in the returned
 /// collection. Otherwise, the <paramref name="origin"/> will not be included in the returned collection.</param>
 /// <returns>
 /// All the other group members within sharing range of the <paramref name="origin"/>.
 /// </returns>
 public IEnumerable<IGroupable> GetGroupMembersInShareRange(IGroupable origin, bool includeOrigin)
 {
     return _members.Where(x => x.IsInShareDistance(origin) && (includeOrigin || (x != origin)));
 }
Example #46
0
        /// <summary>
        /// Tries to add an <see cref="IGroupable"/> to this group.
        /// </summary>
        /// <param name="groupable">The <see cref="IGroupable"/> to try to add to the group.</param>
        /// <returns>
        /// True if the <paramref name="groupable"/> was successfully added to the group;
        /// otherwise false.
        /// This method will always return false is the <paramref name="groupable"/> is already in a group.
        /// </returns>
        public virtual bool TryAddMember(IGroupable groupable)
        {
            // Check the max members value
            if (_members.Count >= _groupSettings.MaxMembersPerGroup)
            {
                if (log.IsInfoEnabled)
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - the group is full.", groupable, this);
                return false;
            }

            // Ensure not already in a group
            if (groupable.Group != null)
            {
                if (log.IsInfoEnabled)
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - they were already in a group (`{2}`).", groupable, this,
                        groupable.Group);
                return false;
            }

            // Check that they can be added
            if (_groupSettings.CanJoinGroupHandler != null && !_groupSettings.CanJoinGroupHandler(groupable, this))
            {
                if (log.IsInfoEnabled)
                    log.InfoFormat("Failed to add `{0}` to group `{1}` - GroupSettings.CanJoinGroupHandler returned false.",
                        groupable, this);
                return false;
            }

            // Add the member
            _members.Add(groupable);
            groupable.Group = this;

            if (log.IsInfoEnabled)
                log.InfoFormat("Added `{0}` to group `{1}`.", groupable, this);

            // Raise events
            OnMemberJoin(groupable);

            if (MemberJoin != null)
                MemberJoin.Raise(this, EventArgsHelper.Create(groupable));

            return true;
        }
Example #47
0
 internal List<IGroupable> GetGroupMembers(IGroupable item)
 {
   var list = editorEntities.OfType<IGroupable>();
   var rootItem = GetRoot(list, item);
   return GetGroupMembers(list, rootItem);
 }
Example #48
0
 /// <summary>
 /// Method used to determine if an <see cref="IGroupable"/> can join an existing <see cref="IGroup"/>.
 /// </summary>
 /// <param name="member">The <see cref="IGroupable"/> to check if can join the <paramref name="group"/>.</param>
 /// <param name="group">The <see cref="IGroup"/> the <paramref name="member"/> is trying to join.</param>
 /// <returns>True if the <paramref name="member"/> can join the <paramref name="group"/>; otherwise false.</returns>
 static bool CanJoinGroupHandler(IGroupable member, IGroup group)
 {
     // Put your additional group restrictions here, such as level range restrictions. No need to check for stuff
     // that is already checked for such as if the member is already in a group, if the group is full, etc.
     return true;
 }
        private List<IGroupable> GetGroupMembers(IEnumerable<IGroupable> list, IGroupable parent)
        {
            List<IGroupable> groupMembers = new List<IGroupable>();
            groupMembers.Add(parent);

            var children = list.Where(node => node.ParentID == parent.ID);

            foreach (IGroupable child in children)
            {
                groupMembers.AddRange(GetGroupMembers(list, child));
            }

            return groupMembers;
        }
 internal List<IGroupable> GetGroupMembers( ICanvasModel model, IGroupable item )
 {
     var list = model.GetItems<IGroupable>();
     var rootItem = GetRoot( list, item );
     return GetGroupMembers( list, rootItem );
 }
        private bool BelongToSameGroup(IGroupable item1, IGroupable item2)
        {
            IGroupable root1 = SelectionService.GetGroupRoot(item1);
            IGroupable root2 = SelectionService.GetGroupRoot(item2);

            return (root1.ID == root2.ID);
        }
Example #52
0
        internal IGroupable GetGroupRoot(IGroupable item)
        {
            IEnumerable<IGroupable> list = this.canvas.Children.OfType<IGroupable>();

            return this.GetRoot(list, item);
        }
Example #53
0
 internal IGroupable GetGroupRoot(IGroupable item)
 {
   var list = editorEntities.OfType<IGroupable>();
   return GetRoot(list, item);
 }
Example #54
0
        /// <summary>
        /// Removes a member from the group.
        /// </summary>
        /// <param name="member">The member to remove.</param>
        /// <returns>
        /// True if the <paramref name="member"/> was successfully removed; false if the <paramref name="member"/>
        /// was either not in a group already, or was in a different group. If the <paramref name="member"/> is not
        /// in this group, their <see cref="IGroupable.Group"/> value will not be altered.
        /// </returns>
        /// <exception cref="ArgumentNullException"><paramref name="member"/> is null.</exception>
        public bool RemoveMember(IGroupable member)
        {
            if (member == null)
                throw new ArgumentNullException("member");

            // Ensure they are in this group
            if (member.Group != this)
                return false;

            // Remove their group value
            member.Group = null;

            // Remove the member from the member list
            if (!_members.Remove(member))
            {
                const string errmsg =
                    "Group member `{0}` was removed from group `{1}`, but they were not in the _group list. That is bad...";
                if (log.IsErrorEnabled)
                    log.ErrorFormat(errmsg, member, this);

                Debug.Fail(string.Format(errmsg, member, this));

                return false;
            }

            // Raise events
            OnMemberLeave(member);

            if (MemberLeave != null)
                MemberLeave.Raise(this, EventArgsHelper.Create(member));

            // If they were the founder, disband the group completely
            if (member == Founder)
                Disband();

            return true;
        }
Example #55
0
 public bool remove(IGroupable item)
 {
     throw new NotImplementedException();
 }
Example #56
0
        /// <summary>
        /// Tries to invite the <paramref name="member"/> to this group.
        /// </summary>
        /// <param name="member">The <see cref="IGroupable"/> to invite.</param>
        /// <returns>True if the <paramref name="member"/> was successfully invited; otherwise false.</returns>
        public bool TryInvite(IGroupable member)
        {
            if (!_groupSettings.CanJoinGroupHandler(member, this))
                return false;

            member.NotifyInvited(this);

            return true;
        }