コード例 #1
0
        public void UserClickCommand(NetworkViewModel that, UserOrTeam user)
        {
            DemoMode.SetValue(false);
            UnselectAll();

            bool selected = false;
            // If already selected then toggle
            if (user == null || that.SelectedUserId.GetValue() == user.Id.ToString())
            {
                that.SelectedUserId.SetValue(null);
            }
            else
            {
                that.SelectedUserId.SetValue(user.Id.ToString());
                selected = true;
            }

            if (selected)
            {

                foreach (string partyid in user.Parties.Keys)
                {
                    EntityReference party = user.Parties[partyid];

                    // If overflow - add that instead
                    string key = GetIdIndexKeyEntityRef(party);

                    if (idIndex.ContainsKey(key) && idIndex[key].ReplacedByOverflow != null)
                    {

                        Entity overflow = (Entity)idIndex[GetIdIndexKeyEntityRef(party)].ReplacedByOverflow.SourceData;

                        HighlightedEntities.Push(new EntityReference(new Guid(overflow.Id), overflow.LogicalName, null));
                    }
                    else
                    {
                        HighlightedEntities.Push(party);
                    }

                }

            }
            if (OnSelectedNodesAdded != null)
                OnSelectedNodesAdded(this, null);
            if (OnSelectedLinksAdded != null)
                OnSelectedLinksAdded(this, null);
        }
コード例 #2
0
        public UserOrTeam GetUserOrTeamReference(EntityReference userOrTeamId)
        {
            UserOrTeam user;
            // Add to the list of users if not already
            if (!userOrTeamIds.ContainsKey(userOrTeamId.Id.ToString()))
            {

                user = new UserOrTeam();
                user.Id = userOrTeamId.Id.ToString();
                user.IsTeam = (userOrTeamId.LogicalName == "team");
                user.LogicalName = user.IsTeam ? "team" : "systemuser";
                user.FullName = null;
                user.Parties = new Dictionary<string, EntityReference>();
                userOrTeamIds[user.Id] = user;

            }
            else
            {
                user = userOrTeamIds[userOrTeamId.Id.ToString()];
            }
            return user;
        }