private void SetHighlightRelationship(FriendsVertex v)
 {
     if ((v.Info.Relationship_Status != "Single") && (!string.IsNullOrEmpty(v.Info.Relationship_Status)))
     {
         v.State.Relationship = true;
     }
     else
     {
         if (string.IsNullOrEmpty(v.Info.Relationship_Status))
             v.Info.Relationship_Status = "No Relationship Posted" + ",\r\n" + Words.RelationshipDescription;
         v.State.Relationship = false;
     }
 }
        private void SetHighlightProfile(FriendsVertex v)
        {
            long epocTime = v.Info.Profile_Update_Time;

            if (epocTime > 0)
            {
                TimeSpan ts = EpocTime.EpocToTimeSpan(epocTime);
                v.Info.Profile_Update_Time_String = EpocTime.TimeSpanString(ts);

                if (ts.TotalDays < 7)
                    v.State.ProfileUpdated = true;
                else
                    v.State.ProfileUpdated = false;
            }
            else
            {
                v.Info.Profile_Update_Time_String = "No Recent Updates" + ",\r\n" + Words.ProfileDescription;
                v.State.ProfileUpdated = false;
            }
        }
        private void SetHighlightBirthday(FriendsVertex v)
        {
            DateTime birthday;

            if (DateTime.TryParse(v.Info.Birthday_date, out birthday))
            {
                //12/28/1988 12:00:00 AM
                v.Info.Birthday_date = birthday.ToString("MMMM d");
                birthday = birthday.AddYears(DateTime.Now.Year - birthday.Year);
                TimeSpan ts = birthday - DateTime.Now;

                if ((0 <= ts.TotalDays) && (ts.TotalDays <= 31))
                    v.State.BirthdayUpdated = true;
                else
                    v.State.BirthdayUpdated = false;
            }
            else
            {
                v.Info.Birthday_date = "No Birthday Posted" + ",\r\n" + Words.BirthdayDescription;
                v.State.BirthdayUpdated = false;
            }
        }
        private void UpdateShorestPathControls(FriendsVertex CurrentSelectedFriend, FriendsVertex CurrentShorestPathTarget)
        {
            if (CurrentSelectedFriend.Uid == 0d)
                return;

            if (CurrentShorestPathTarget.Uid == 0d)
                return;

            //Clear
            foreach (FriendsVertex fv in vertexShorestPath)
            {
                fv.State.IsShorestPathMember = false;
                fv.State.IsShorestPathTarget = false;
            }

            //Clear
            foreach (Line L in edgeShorestPathControls)
            {
                ZoomPanCanvas.Children.Remove(L);
            }

            List<FriendsEdge> shorestPath = friendsGraph.GetShorestPath(CurrentSelectedFriend, CurrentShorestPathTarget);

            foreach (FriendsEdge edge in shorestPath)
            {
                vertexShorestPath.Add(edge.Source);
                vertexShorestPath.Add(edge.Target);
                edge.Source.State.IsShorestPathMember = true;
                edge.Target.State.IsShorestPathTarget = true;

                int vertexCenter = 28;

                Line L = new Line();
                L.Fill = new SolidColorBrush(Colors.Red);
                L.Stroke = new SolidColorBrush(Colors.Red);
                L.StrokeThickness = 4d;
                L.X1 = edge.Source.Layout.FlockPoint.X + vertexCenter;
                L.Y1 = edge.Source.Layout.FlockPoint.Y + vertexCenter;
                L.X2 = edge.Target.Layout.FlockPoint.X + vertexCenter;
                L.Y2 = edge.Target.Layout.FlockPoint.Y + vertexCenter;
                L.SetValue(Canvas.ZIndexProperty, 2);

                if (isFlockLayout)
                    L.Visibility = Visibility.Visible;
                else
                    L.Visibility = Visibility.Collapsed;

                edgeShorestPathControls.Add(L);
                ZoomPanCanvas.Children.Add(L);
            }
        }
        private void UpdateMutualFriendsControls(FriendsVertex CurrentSelectedFriend)
        {
            if (CurrentSelectedFriend.Uid == 0d)
                return;

            //Clear
            foreach (FriendsVertex fv in vertexMutualFriends)
            {
                fv.State.IsMutualFriend = false;
            }

            //Clear
            foreach (Line L in edgeMutualFriendsControls)
            {
                ZoomPanCanvas.Children.Remove(L);
            }

            long currentUid = CurrentSelectedFriend.Uid;
            foreach (FriendsVertex v in friendsGraph.VertexDictionary[currentUid].AdjacentVertexes.Values)
            {
                vertexMutualFriends.Add(v);
                v.State.IsMutualFriend = true;

                int vertexCenter = 28;

                Line L = new Line();
                L.Fill = new SolidColorBrush(Colors.Blue);
                L.Stroke = new SolidColorBrush(Colors.Blue);
                L.StrokeThickness = 4d;
                L.X1 = CurrentSelectedFriend.Layout.FlockPoint.X + vertexCenter;
                L.Y1 = CurrentSelectedFriend.Layout.FlockPoint.Y + vertexCenter;
                L.X2 = v.Layout.FlockPoint.X + vertexCenter;
                L.Y2 = v.Layout.FlockPoint.Y + vertexCenter;
                L.SetValue(Canvas.ZIndexProperty, 1);

                if (isFlockLayout)
                    L.Visibility = Visibility.Visible;
                else
                    L.Visibility = Visibility.Collapsed;

                edgeMutualFriendsControls.Add(L);
                ZoomPanCanvas.Children.Add(L);
            }
        }
        //Friends Info
        void friendsInfoAgent_FriendsInfoAgent_Complete(object sender, FriendsInfoAgentEventArgs e)
        {
            if (e.Success)
            {
                //Sync Graph
                List<long> friendsList = new List<long>();
                lock (friendsGraph)
                {
                    friendsGraph.UserInfo = e.UserInfo;

                    foreach (FriendsInfo fi in e.FriendsInfo.Values)
                    {
                        FriendsVertex fv = new FriendsVertex(fi.Uid);
                        fv.Info = fi;
                        friendsGraph.AddVertex(fv);
                        friendsList.Add(fv.Uid);
                    }
                }

                //Sync Grid Controls
                canvasModel.SyncGridControls(appModel);

                //Start Flock Service
                flockLayoutAgent = new FlockLayoutAgent(FbToken, UserUid, friendsList, IsTestMode);
                flockLayoutAgent.FlockLayoutAgent_Complete += new FlockLayoutAgent.FlockLayoutAgentEventHandler(flockLayoutAgent_FlockLayoutAgent_Complete);
                flockLayoutAgent.FlockLayoutAgentProgress_Update += new FlockLayoutAgent.FlockLayoutAgentProgressEventHandler(flockLayoutAgent_FlockLayoutAgentProgress_Update);
                flockLayoutAgent.RunAsync();
            }
            else
            {
                ShowFriendsFailed();

            }
        }
Example #7
0
 public CurrentFriends(FriendsVertex SelectedFriend, FriendsVertex PathTarget)
 {
     this.SelectedFriend = SelectedFriend;
     this.PathTarget = PathTarget;
 }
Example #8
0
 private void UpdateShorestPathTarget(FriendsVertex shorestPathTarget)
 {
     CurrentShorestPathTarget = shorestPathTarget;
 }
Example #9
0
 private void UpdateSelectedFriend(FriendsVertex selectedFriend)
 {
     CurrentSelectedFriend = selectedFriend;
 }
 private void SetHighlightStatus(FriendsVertex v)
 {
     if (!string.IsNullOrEmpty(v.Info.Status_Message))
             v.State.StatusUpdated = true;
         else
         {
             v.Info.Status_Message = "No Recent Status" + ",\r\n" + Words.StatusDescription;
             v.State.StatusUpdated = false;
         }
 }