public ServiceModel() { friendsGraph = new FriendsGraph(); appModel = new AppModel(friendsGraph); canvasModel = new CanvasModel(friendsGraph); LayoutState = LayoutStateEnum.Grid; HighlighState = HighlighStateEnum.Clear; }
public void SyncGridControls(AppModel appModel) { Debug.WriteLine("SyncGridControls"); GalaSoft.MvvmLight.Threading.DispatcherHelper.UIDispatcher.BeginInvoke(() => { //Grid Layout lock (friendsGraph) { friendsGraph.ComputeGridLayout(); } //Cache Friends' Updates CacheUpdates cu = new CacheUpdates(friendsGraph); cu.Run(); //Create Vertex Controls foreach (FriendsVertex fv in friendsGraph.VertexDictionary.Values) { //Create Vertex Control, Set Picture VertexControl vc = new VertexControl(fv, appModel); if (!string.IsNullOrEmpty(fv.Info.Pic_Sqaure_Url)) vc.PicSource = new BitmapImage(new Uri(fv.Info.Pic_Sqaure_Url, UriKind.RelativeOrAbsolute)); //Cache to Dictionary vertexControls.Add(vc.Friend.Uid, vc); //Add to Canvas ZoomPanCanvas.Children.Add(vc); } }); }