Inheritance: ViewModelBase
Ejemplo n.º 1
0
        private void SketchView_Loaded(object sender, RoutedEventArgs e)
        {
            //var ct = cvMain.RenderTransform as CompositeTransform;
            //cvMainContainer.Scale = ct.ScaleX;

            vm = new Sketch();
            //LoadSampleSketch();
            //this.DataContext = vm;

            //foreach (var pg in vm.Pages) {
            //    StorageService.Instance.AzureStorage.Save<ISketchPageDataModel>(pg);
            //}

        }
Ejemplo n.º 2
0
        public void Unload()
        {
            if (vm != null)
            {

                if (cvMain.Children.Count > 0)
                {
                    foreach (var nc in cvMain.Children)
                    {
                        if (nc is PageLayout)
                        {
                            var ncpl = nc as PageLayout;
                            ncpl.PerformAction -= PageLayout_PerformAction;
                            ncpl.DataContext = null;
                        }
                    }
                    cvMain.Children.Clear();
                }

                if (vm.Pages != null)
                {
                    foreach (var pg in vm.Pages)
                    {
                        pg.Layers.Clear();
                    }
                    vm.Pages.Clear();
                }
                if (cvMain.Children.Count > 0)
                {
                    //foreach (var nc in cvMain.Children) {
                    //    if (nc is PageLayout) {
                    //        var ncpl = nc as PageLayout;
                    //        ncpl.PerformAction -= PageLayout_PerformAction;
                    //    }
                    //}
                    cvMain.Children.Clear();
                }

                vm = null;
            }

            cvMainContainer.Content = null;
            cvMain.RenderTransform = null;
            cvMain = null;
            


            layoutRoot.Children.Remove(cvMainContainer);
            //cvMainContainer.Content = null;
            cvMainContainer = null;
        }