protected override void OnNavigatedTo(NavigationEventArgs e) { base.OnNavigatedTo(e); CanvasElements canvasElements = new CanvasElements (canvas, toolbar, commandBar, openHamburger, closeHamburger); if (e.Parameter is GroupsContent) { GroupsContent content = (GroupsContent)e.Parameter; // load group's stroke container canvas.InkPresenter.StrokeContainer = content.strokes; this.viewModel = new CanvasPageViewModel(canvasElements, content); this.DataContext = viewModel; // set the background image if there is one if (content.backgroundPath != null) { viewModel.setBackgroundImage(content.backgroundPath); } else if (content.imageContainer != null) { ImageContainer ic = content.imageContainer; viewModel.imageFilePath = ic.imagePath; viewModel.ImageBitmap = ic.image; viewModel.xOffset = ic.xOffset; viewModel.yOffset = ic.yOffset; viewModel.newWidth = ic.newWidth; viewModel.newHeight = ic.newHeight; } } }
/// <summary> /// Determines if a group was updated based on the members in the group or the name of the group /// </summary> /// <param name="newGroup">Group to compare to</param> /// <return>True if the group members are different</return> public bool isUpdated(GroupsContent newGroup) { // check for matching ids, then check if the group members have changed if (group.id == newGroup.group.id && groupMembers == newGroup.groupMembers && group.Name == newGroup.group.Name) { return(false); } return(true); }
// updates the canvas portion of the groups content public void updateCanvasFrom(GroupsContent gc) { strokes = gc.strokes; backgroundPath = gc.backgroundPath; imageContainer = gc.imageContainer; }