Ejemplo n.º 1
0
        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;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// When an object in the InfoPannel is clicked set it to the focus of the screen
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ListObjectFocusOnMouseDown(object sender, MouseButtonEventArgs e)
        {
            // Get the sending object's view model from it's data context
            InterstellaObjectViewModel SenderVM = ((Ellipse)sender).DataContext as InterstellaObjectViewModel;

            // Set the view canvas page to focus on this object
            CanvasPageViewModel.FocusOnObject(SenderVM);
        }
Ejemplo n.º 3
0
        public CanvasPage()
        {
            this.InitializeComponent();
            viewModel = null;

            this.DataContext         = viewModel;
            this.NavigationCacheMode = NavigationCacheMode.Required;
        }