Inheritance: Windows.UI.Xaml.Controls.UserControl
示例#1
0
        private void layoutRoot_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            IsMouseDown     = false;
            IsMovingPage    = false;
            IsResizingPage  = false;
            IsResizingStamp = false;
            //IsMovingStamp = false;

            _currentPageLayout = null;
            _currentStamp      = null;

            ptDifXStart = ptDifX;
            ptDifYStart = ptDifY;
        }
示例#2
0
        private Vector4 AddPage(int width, int height, int left = -1, int top = -1)
        {
            var rect      = new Vector4();
            var leftToUse = vm.Pages.Count() == 0 ? 150 : vm.Pages[vm.Pages.Count - 1].Left + vm.Pages[vm.Pages.Count - 1].Width + 150;

            rect.X = leftToUse;
            rect.Y = 100;
            rect.W = width;
            rect.Z = height;

            if (left != -1)
            {
                rect.X = left;
            }
            if (top != -1)
            {
                rect.Y = top;
            }

            //var nextLeft = vm.Pages[vm.Pages.Count - 1].Left + vm.Pages[vm.Pages.Count - 1].Width + 150;

            var pg = new SketchPage()
            {
                Width = width, Height = height, Top = (int)rect.Y, Left = (int)rect.X
            };
            //pg.Layers.Add(new PageLayer());
            var nc = new Controls.PageLayout()
            {
                DataContext = pg, Width = pg.Width, Height = pg.Height
            };

            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            return(rect);
        }
示例#3
0
        private async void LoadSketch(int sketchId)
        {
      
            var foundS = StorageService.Instance.Storage.RetrieveById<SketchDataModel>(sketchId);
            if (foundS != null && foundS.Count() > 0)
            {
                var fs = foundS.First();
                var foundSP = StorageService.Instance.Storage.RetrieveByField<SketchPageDataModel>("SketchId", fs.Id.ToString());
                if (foundSP != null && foundSP.Count() > 0)
                {
                    foreach (var fsp in foundSP)
                    {
                        var pg = new SketchPage() { Title = fsp.Title, Width = (int)fsp.Width, Height = (int)fsp.Height, Top = (int)fsp.Top, Left = (int)fsp.Left };

                        var foundSPL = StorageService.Instance.Storage.RetrieveByField<SketchPageLayerDataModel>("SketchPageId", fsp.Id.ToString());
                        if (foundSPL != null && foundSPL.Count() > 0)
                        {
                            foreach (var fspl in foundSPL)
                            {
                                var pl = new PageLayer() { PersistedId = fspl.Id, HasChildContainerCanvas = fspl.HasChildContainerCanvas };

                                //add xamlfrags
                                var foundSPLXF = StorageService.Instance.Storage.RetrieveByField<SketchPageLayerXamlFragmentDataModel>("SketchPageLayerId", fspl.Id.ToString());
                                if (foundSPLXF != null && foundSPLXF.Count() > 0)
                                {
                                    foreach (var fsplxf in foundSPLXF)
                                    {
                                        var dt = string.IsNullOrEmpty(fsplxf.DataType) ? null : Type.GetType(fsplxf.DataType);
                                        var xf = new XamlFragment() { Uid = fsplxf.Uid, Xaml = fsplxf.Xaml, Data = fsplxf.Data, Type = dt };
                                        pl.XamlFragments.Add(xf);
                                    }
                                }

                                pg.Layers.Add(pl);

                            }

                        }

                        var nc = new Controls.PageLayout() { DataContext = pg, Width = pg.Width, Height = pg.Height };
                        nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
                        nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
                        nc.PerformAction += PageLayout_PerformAction;
                        cvMain.Children.Add(nc);

                        vm.Pages.Add(pg);


                        //// add xaml frags
                        //foreach (var pl in pg.Layers)
                        //{
                        //    var foundSPLXF = StorageService.Instance.Storage.RetrieveByField<SketchPageLayerXamlFragmentDataModel>("SketchPageLayerId", pl.PersistedId.ToString());
                        //    if (foundSPLXF != null && foundSPLXF.Count() > 0)
                        //    {
                        //        foreach (var fsplxf in foundSPLXF)
                        //        {
                        //            var dt =  string.IsNullOrEmpty(fsplxf.DataType) ? null: Type.GetType(fsplxf.DataType);
                        //            var xf = new XamlFragment() { Uid = fsplxf.Uid, Xaml = fsplxf.Xaml, Data = fsplxf.Data, Type = dt };
                        //            pl.XamlFragments.Add(xf);
                        //        }
                        //    }
                        //    pl.ExternalPC("Layers");
                        //}
                    }
                }

             
                //    foreach (var pgg in vm.Pages)
                //    {
                //        pgg.ExternalPC("Layers");
                //    }
            }



        }
示例#4
0
        private void LoadSampleSketch()
        {
            var pg = new SketchPage() { Title = "Splash", Width = 360, Height = 640, Top = 100, Left = 100 };
            pg.Layers.Add(new PageLayer());
            var nc = new Controls.PageLayout() { DataContext = pg, Width = pg.Width, Height = pg.Height };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            pg = new SketchPage() { Title = "Shell", Width = 360, Height = 640, Top = 100, Left = 600 };
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            nc = new Controls.PageLayout() { DataContext = pg, Width = pg.Width, Height = pg.Height };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            pg = new SketchPage() { Title = "Landing Page", Width = 360, Height = 640, Top = 100, Left = 1100 };
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            nc = new Controls.PageLayout() { DataContext = pg, Width = pg.Width, Height = pg.Height };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            pg = new SketchPage() { Title = "Profile", Width = 360, Height = 640, Top = 100, Left = 1600 };
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            nc = new Controls.PageLayout() { DataContext = pg, Width = pg.Width, Height = pg.Height };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            vm.Pages[1].Layers[0].XamlFragments.Add(new XamlFragment() { Uid = "xx1", Xaml = @"<Rectangle HorizontalAlignment=""Stretch"" VerticalAlignment=""Stretch"" Fill=""Black""></Rectangle>" });
            vm.Pages[1].Layers[1].XamlFragments.Add(new XamlFragment() { Uid = "xx2", Xaml = @"<Rectangle Fill=""#FF252525"" Height=""40"" Opacity=""0.8"" HorizontalAlignment=""Stretch"" VerticalAlignment=""Bottom""/><StackPanel Orientation=""Horizontal"" HorizontalAlignment=""Right"" VerticalAlignment=""Bottom"" Margin=""0,0,5,5"" ><StackPanel Orientation=""Vertical""><TextBlock Text=""4:49 PM"" Margin=""7,0,0,0"" FontSize=""12"" Foreground=""White"" /><TextBlock Text=""3/04/2016"" FontSize=""12"" Foreground=""White"" /></StackPanel><xuip:Path PathType=""More"" Rotation=""90"" Width=""20"" Height=""30"" Foreground=""White"" /></StackPanel>" });
            vm.Pages[1].ExternalPC("Layers");

            vm.Pages[2].Layers[0].XamlFragments.Add(new XamlFragment() { Uid = "xx3", Xaml = @"<Rectangle Fill=""Black"" />" });
            vm.Pages[2].Layers[1].XamlFragments.Add(new XamlFragment() { Uid = "xx4", Xaml = @"<Rectangle Fill=""#FF252525"" Height=""160"" HorizontalAlignment=""Stretch"" VerticalAlignment=""Top""/>" });
            vm.Pages[2].Layers[2].XamlFragments.Add(new XamlFragment() { Uid = "xx5", Xaml = @"<TextBlock x:Name=""textBlock"" HorizontalAlignment=""Center"" TextWrapping=""Wrap"" Text=""Jose Fajardo"" VerticalAlignment=""Top"" Foreground=""White"" Margin=""0,120,0,0"" /><Ellipse Height=""85"" Margin=""0,15,0,0"" VerticalAlignment=""Top"" Width=""85"" HorizontalAlignment=""Center""><Ellipse.Fill><ImageBrush ImageSource=""http://art.ngfiles.com/images/378000/378294_kukatoo_minecraft-aqua-blue-avatar.png"" Stretch=""UniformToFill"" /></Ellipse.Fill></Ellipse>" });
            vm.Pages[2].ExternalPC("Layers");

            vm.Pages[3].Layers[0].XamlFragments.Add(new XamlFragment() { Uid = "xx6", Xaml = @"<Rectangle Fill=""Black"" />" });
            vm.Pages[3].Layers[0].XamlFragments.Add(new XamlFragment() { Uid = "xx7", Xaml = @"<Rectangle Fill=""#FF252525"" Height=""30"" Opacity=""0.4"" HorizontalAlignment=""Stretch"" VerticalAlignment=""Top""/>" });
            vm.Pages[3].Layers[1].XamlFragments.Add(new XamlFragment() { Uid = "xx8", Xaml = @"<StackPanel Orientation=""Horizontal"" HorizontalAlignment=""Left"" VerticalAlignment=""Top"" Margin=""10,5,0,0""><xuip:Path PathType=""Wifi2"" PathWidth=""30"" PathHeight=""15"" Width=""30"" Height=""20"" Foreground=""White"" Margin=""0,0,2,0"" /><xuip:Path PathType=""Wifi1"" Width=""20"" Height=""20"" Foreground=""White"" /></StackPanel>" });
            vm.Pages[3].Layers[1].XamlFragments.Add(new XamlFragment() { Uid = "xx9", Xaml = @"<StackPanel Orientation=""Horizontal"" HorizontalAlignment=""Right"" VerticalAlignment=""Top"" Margin=""0,5,10,0""><xuip:Path PathType=""Sound"" Width=""20"" Height=""20"" Foreground=""White""  /><xuip:Path PathType=""BatteryLow"" Width=""35"" Height=""22"" Foreground=""White""  /></StackPanel>" });
            vm.Pages[3].ExternalPC("Layers");


        }
示例#5
0
        private void layoutRoot_PointerReleased(object sender, Windows.UI.Xaml.Input.PointerRoutedEventArgs e)
        {
            IsMouseDown = false;
            IsMovingPage = false;
            IsResizingPage = false;
            IsResizingStamp = false;
            //IsMovingStamp = false;

            _currentPageLayout = null;
            _currentStamp = null;

            ptDifXStart = ptDifX;
            ptDifYStart = ptDifY;
   
        }
示例#6
0
        private void PageLayout_PerformAction(object sender, EventArgs e)
        {
            if (e is Controls.PageLayoutEventArgs)
            {
                var ea = e as Controls.PageLayoutEventArgs;
                _currentPageLayout = sender as Controls.PageLayout;
                _currentPageLayoutForStamps = sender as Controls.PageLayout;
                if (ea.ActionType == "PageSelected")
                {
                    if (sender is PageLayout)
                        vm.SelectedPage = ((FrameworkElement)sender).DataContext as SketchPage;
                }
                else if (ea.ActionType == "MovePageLayoutStarted") IsMovingPage = true;
                else if (ea.ActionType == "MovePageLayoutFinished") IsMovingPage = false;
                else if (ea.ActionType == "ResizePageLayoutStarted") IsResizingPage = true;
                else if (ea.ActionType == "ResizePageLayoutFinished") IsResizingPage = false;


                ptStartPt.X = (double)_currentPageLayout.GetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty);
                ptStartPt.Y = (double)_currentPageLayout.GetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty);

            }
            else if (e is PageLayerEventArgs)
            {
                var plea = e as PageLayerEventArgs;
                if (plea.ActionType == "EditLayer")
                {
                    foreach (var ci in cvMain.Children)
                    {
                        if (ci is PageLayout)
                        {
                            var pg = ((FrameworkElement)ci).DataContext as SketchPage;
                            ((PageLayout)ci).SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
                            //((PageLayout)ci).SetValue(Canvas.TopProperty, pg.Top);  //<-- for some reason the last page always repositions very low (need to resolve before uncommenting)
                        }
                    }

                }
                else if (plea.ActionType == "EditXamlFragment")
                {
                    //plea.Layer.IsEnabled = !plea.Layer.IsEnabled;
                    //foreach (var frag in plea.Layer.XamlFragments)
                    //{

                    var frag = plea.Fragment;

                    var found = _currentPageLayoutForStamps?.FindContentElementByName(frag.Uid) as FrameworkElement;
                    if (found != null)
                    {
                        var gtFound = cvMainAdorner.TransformToVisual(found);
                        var ptFound = gtFound.TransformPoint(new Windows.Foundation.Point(0, 0));

                        var gtPL = cvMainAdorner.TransformToVisual(_currentPageLayoutForStamps);
                        var ptPL = gtPL.TransformPoint(new Windows.Foundation.Point(0, 0));

                        var width = found.Width * cvMainContainer.Scale;
                        var height = found.Height * cvMainContainer.Scale;
                        var left = ((ptPL.X * -1) + (ptFound.X * -1)) * cvMainContainer.Scale;
                        var top = ((ptPL.Y * -1) + (ptFound.Y * -1) + 80) * cvMainContainer.Scale;  //70 = tabs

                        //var el = new Ellipse() { Width = 10, Height = 10, Fill = new SolidColorBrush(Colors.Red) };
                        //el.SetValue(Canvas.LeftProperty, left);
                        //el.SetValue(Canvas.TopProperty, top);
                        //cvMainAdorner.Children.Add(el);

                        //only if the stamp is being created in the viewable area
                        if (top > 20) CreateStamp(frag.Type, left, top, width, height, template: found, data: frag.Data);
                    }


                    //};
                }
                else if (plea.ActionType == "DeleteXamlFragment")
                {
                    //var frag = plea.Fragment;
                    //foreach (var layer in vm.SelectedPage.Layers) {
                    //    var found = layer.XamlFragments.Where(x => x.Uid == frag.Uid).FirstOrDefault();
                    //    if (found != null) layer.XamlFragments.Remove(found);
                    //}

                    //vm.SelectedPage.ExternalPC("Layers");
                }
            }

        }
示例#7
0
        private Vector4 AddPage(int width, int height, int left = -1, int top = -1)
        {
            var rect = new Vector4();
            var leftToUse = vm.Pages.Count() == 0 ? 150 : vm.Pages[vm.Pages.Count - 1].Left + vm.Pages[vm.Pages.Count - 1].Width + 150;
            rect.X = leftToUse;
            rect.Y = 100;
            rect.W = width;
            rect.Z = height;

            if (left != -1) rect.X = left;
            if (top != -1) rect.Y = top;

            //var nextLeft = vm.Pages[vm.Pages.Count - 1].Left + vm.Pages[vm.Pages.Count - 1].Width + 150;

            var pg = new SketchPage() { Width = width, Height = height, Top = (int)rect.Y, Left = (int)rect.X };
            pg.Layers.Add(new PageLayer());
            var nc = new Controls.PageLayout() { DataContext = pg, Width = pg.Width, Height = pg.Height };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            return rect;
        }
示例#8
0
        private void PageLayout_PerformAction(object sender, EventArgs e)
        {
            if (e is Controls.PageLayoutEventArgs)
            {
                var ea = e as Controls.PageLayoutEventArgs;
                _currentPageLayout          = sender as Controls.PageLayout;
                _currentPageLayoutForStamps = sender as Controls.PageLayout;
                if (ea.ActionType == "PageSelected")
                {
                    if (sender is PageLayout)
                    {
                        vm.SelectedPage = ((FrameworkElement)sender).DataContext as SketchPage;
                    }
                }
                else if (ea.ActionType == "MovePageLayoutStarted")
                {
                    IsMovingPage = true;
                }
                else if (ea.ActionType == "MovePageLayoutFinished")
                {
                    IsMovingPage = false;
                }
                else if (ea.ActionType == "ResizePageLayoutStarted")
                {
                    IsResizingPage = true;
                }
                else if (ea.ActionType == "ResizePageLayoutFinished")
                {
                    IsResizingPage = false;
                }


                ptStartPt.X = (double)_currentPageLayout.GetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty);
                ptStartPt.Y = (double)_currentPageLayout.GetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty);

                CallToAllStamps("PageSelected");
            }
            else if (e is PageLayerEventArgs)
            {
                var plea = e as PageLayerEventArgs;
                if (plea.ActionType == "EditLayer")
                {
                    foreach (var ci in cvMain.Children)
                    {
                        if (ci is PageLayout)
                        {
                            var pg = ((FrameworkElement)ci).DataContext as SketchPage;
                            ((PageLayout)ci).SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
                            //((PageLayout)ci).SetValue(Canvas.TopProperty, pg.Top);  //<-- for some reason the last page always repositions very low (need to resolve before uncommenting)
                        }
                    }
                }
                else if (plea.ActionType == "EditXamlFragment")
                {
                    //plea.Layer.IsEnabled = !plea.Layer.IsEnabled;
                    //foreach (var frag in plea.Layer.XamlFragments)
                    //{

                    var frag  = plea.Fragment;
                    var found = _currentPageLayoutForStamps?.FindContentElementByName(frag.Uid) as FrameworkElement;

                    if (found != null)
                    {
                        var gtFound = cvMainAdorner.TransformToVisual(found);
                        var ptFound = gtFound.TransformPoint(new Point(0, 0));

                        var gtPL = cvMainAdorner.TransformToVisual(_currentPageLayoutForStamps);
                        var ptPL = gtPL.TransformPoint(new Point(0, 0));

                        var width  = found.Width * cvMainContainer.Scale;
                        var height = found.Height * cvMainContainer.Scale;
                        var left   = ((ptPL.X * -1) + (ptFound.X * -1)) * cvMainContainer.Scale;
                        var top    = ((ptPL.Y * -1) + (ptFound.Y * -1) + 80) * cvMainContainer.Scale; //70 = tabs

                        //var el = new Ellipse() { Width = 10, Height = 10, Fill = new SolidColorBrush(Colors.Red) };
                        //el.SetValue(Canvas.LeftProperty, left);
                        //el.SetValue(Canvas.TopProperty, top);
                        //cvMainAdorner.Children.Add(el);

                        //only if the stamp is being created in the viewable area
                        if (top > 20)
                        {
                            switch (frag.Type.Name)
                            {
                            case "EntityProperty":
                            case "EntityMethod":
                                CreateEntity(frag.Type, left, top, width, height, template: found, data: frag.Data);
                                break;

                            default:
                                CreateStamp(frag.Type, left, top, width, height, template: found, data: frag.Data);
                                break;
                            }
                        }
                    }


                    //};
                }
                else if (plea.ActionType == "DeleteXamlFragment")
                {
                    //var frag = plea.Fragment;
                    //foreach (var layer in vm.SelectedPage.Layers) {
                    //    var found = layer.XamlFragments.Where(x => x.Uid == frag.Uid).FirstOrDefault();
                    //    if (found != null) layer.XamlFragments.Remove(found);
                    //}

                    //vm.SelectedPage.ExternalPC("Layers");
                }
            }
        }
        private async void LoadSketch(int sketchId)
        {
            var foundS = StorageService.Instance.Storage.RetrieveById <SketchDataModel>(sketchId);

            if (foundS != null && foundS.Count() > 0)
            {
                var fs      = foundS.First();
                var foundSP = StorageService.Instance.Storage.RetrieveByField <SketchPageDataModel>("SketchId", fs.Id.ToString());
                if (foundSP != null && foundSP.Count() > 0)
                {
                    foreach (var fsp in foundSP)
                    {
                        var pg = new SketchPage(false)
                        {
                            Title = fsp.Title, Width = (int)fsp.Width, Height = (int)fsp.Height, Top = (int)fsp.Top, Left = (int)fsp.Left
                        };

                        var foundSPL = StorageService.Instance.Storage.RetrieveByField <SketchPageLayerDataModel>("SketchPageId", fsp.Id.ToString());
                        if (foundSPL != null && foundSPL.Count() > 0)
                        {
                            foreach (var fspl in foundSPL)
                            {
                                var pl = new PageLayer()
                                {
                                    PersistedId = fspl.Id, HasChildContainerCanvas = fspl.HasChildContainerCanvas
                                };

                                //add xamlfrags
                                var foundSPLXF = StorageService.Instance.Storage.RetrieveByField <SketchPageLayerXamlFragmentDataModel>("SketchPageLayerId", fspl.Id.ToString());
                                if (foundSPLXF != null && foundSPLXF.Count() > 0)
                                {
                                    foreach (var fsplxf in foundSPLXF)
                                    {
                                        var dt = string.IsNullOrEmpty(fsplxf.DataType) ? null : Type.GetType(fsplxf.DataType);
                                        var xf = new XamlFragment()
                                        {
                                            Uid = fsplxf.Uid, Xaml = fsplxf.Xaml, Data = fsplxf.Data, Type = dt
                                        };
                                        pl.XamlFragments.Add(xf);
                                    }
                                }

                                pg.Layers.Add(pl);
                            }
                        }

                        var nc = new Controls.PageLayout()
                        {
                            DataContext = pg, Width = pg.Width, Height = pg.Height
                        };
                        nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
                        nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
                        nc.PerformAction += PageLayout_PerformAction;
                        cvMain.Children.Add(nc);

                        vm.Pages.Add(pg);


                        //// add xaml frags
                        //foreach (var pl in pg.Layers)
                        //{
                        //    var foundSPLXF = StorageService.Instance.Storage.RetrieveByField<SketchPageLayerXamlFragmentDataModel>("SketchPageLayerId", pl.PersistedId.ToString());
                        //    if (foundSPLXF != null && foundSPLXF.Count() > 0)
                        //    {
                        //        foreach (var fsplxf in foundSPLXF)
                        //        {
                        //            var dt =  string.IsNullOrEmpty(fsplxf.DataType) ? null: Type.GetType(fsplxf.DataType);
                        //            var xf = new XamlFragment() { Uid = fsplxf.Uid, Xaml = fsplxf.Xaml, Data = fsplxf.Data, Type = dt };
                        //            pl.XamlFragments.Add(xf);
                        //        }
                        //    }
                        //    pl.ExternalPC("Layers");
                        //}
                    }
                }


                //    foreach (var pgg in vm.Pages)
                //    {
                //        pgg.ExternalPC("Layers");
                //    }
            }
        }
示例#10
0
        private void LoadSampleSketch()
        {
            var pg = new SketchPage()
            {
                Title = "Splash", Width = 360, Height = 640, Top = 100, Left = 100
            };

            pg.Layers.Add(new PageLayer());
            var nc = new Controls.PageLayout()
            {
                DataContext = pg, Width = pg.Width, Height = pg.Height
            };

            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            pg = new SketchPage()
            {
                Title = "Shell", Width = 360, Height = 640, Top = 100, Left = 600
            };
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            nc = new Controls.PageLayout()
            {
                DataContext = pg, Width = pg.Width, Height = pg.Height
            };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            pg = new SketchPage()
            {
                Title = "Landing Page", Width = 360, Height = 640, Top = 100, Left = 1100
            };
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            nc = new Controls.PageLayout()
            {
                DataContext = pg, Width = pg.Width, Height = pg.Height
            };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            pg = new SketchPage()
            {
                Title = "Profile", Width = 360, Height = 640, Top = 100, Left = 1600
            };
            pg.Layers.Add(new PageLayer());
            pg.Layers.Add(new PageLayer());
            nc = new Controls.PageLayout()
            {
                DataContext = pg, Width = pg.Width, Height = pg.Height
            };
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.LeftProperty, pg.Left);
            nc.SetValue(Windows.UI.Xaml.Controls.Canvas.TopProperty, pg.Top);
            nc.PerformAction += PageLayout_PerformAction;
            cvMain.Children.Add(nc);
            vm.Pages.Add(pg);

            vm.Pages[1].Layers[0].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx1", Xaml = @"<Rectangle HorizontalAlignment=""Stretch"" VerticalAlignment=""Stretch"" Fill=""Black""></Rectangle>"
            });
            vm.Pages[1].Layers[1].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx2", Xaml = @"<Rectangle Fill=""#FF252525"" Height=""40"" Opacity=""0.8"" HorizontalAlignment=""Stretch"" VerticalAlignment=""Bottom""/><StackPanel Orientation=""Horizontal"" HorizontalAlignment=""Right"" VerticalAlignment=""Bottom"" Margin=""0,0,5,5"" ><StackPanel Orientation=""Vertical""><TextBlock Text=""4:49 PM"" Margin=""7,0,0,0"" FontSize=""12"" Foreground=""White"" /><TextBlock Text=""3/04/2016"" FontSize=""12"" Foreground=""White"" /></StackPanel><xuip:Path PathType=""More"" Rotation=""90"" Width=""20"" Height=""30"" Foreground=""White"" /></StackPanel>"
            });
            vm.Pages[1].ExternalPC("Layers");

            vm.Pages[2].Layers[0].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx3", Xaml = @"<Rectangle Fill=""Black"" />"
            });
            vm.Pages[2].Layers[1].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx4", Xaml = @"<Rectangle Fill=""#FF252525"" Height=""160"" HorizontalAlignment=""Stretch"" VerticalAlignment=""Top""/>"
            });
            vm.Pages[2].Layers[2].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx5", Xaml = @"<TextBlock x:Name=""textBlock"" HorizontalAlignment=""Center"" TextWrapping=""Wrap"" Text=""Jose Fajardo"" VerticalAlignment=""Top"" Foreground=""White"" Margin=""0,120,0,0"" /><Ellipse Height=""85"" Margin=""0,15,0,0"" VerticalAlignment=""Top"" Width=""85"" HorizontalAlignment=""Center""><Ellipse.Fill><ImageBrush ImageSource=""http://art.ngfiles.com/images/378000/378294_kukatoo_minecraft-aqua-blue-avatar.png"" Stretch=""UniformToFill"" /></Ellipse.Fill></Ellipse>"
            });
            vm.Pages[2].ExternalPC("Layers");

            vm.Pages[3].Layers[0].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx6", Xaml = @"<Rectangle Fill=""Black"" />"
            });
            vm.Pages[3].Layers[0].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx7", Xaml = @"<Rectangle Fill=""#FF252525"" Height=""30"" Opacity=""0.4"" HorizontalAlignment=""Stretch"" VerticalAlignment=""Top""/>"
            });
            vm.Pages[3].Layers[1].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx8", Xaml = @"<StackPanel Orientation=""Horizontal"" HorizontalAlignment=""Left"" VerticalAlignment=""Top"" Margin=""10,5,0,0""><xuip:Path PathType=""Wifi2"" PathWidth=""30"" PathHeight=""15"" Width=""30"" Height=""20"" Foreground=""White"" Margin=""0,0,2,0"" /><xuip:Path PathType=""Wifi1"" Width=""20"" Height=""20"" Foreground=""White"" /></StackPanel>"
            });
            vm.Pages[3].Layers[1].XamlFragments.Add(new XamlFragment()
            {
                Uid = "xx9", Xaml = @"<StackPanel Orientation=""Horizontal"" HorizontalAlignment=""Right"" VerticalAlignment=""Top"" Margin=""0,5,10,0""><xuip:Path PathType=""Sound"" Width=""20"" Height=""20"" Foreground=""White""  /><xuip:Path PathType=""BatteryLow"" Width=""35"" Height=""22"" Foreground=""White""  /></StackPanel>"
            });
            vm.Pages[3].ExternalPC("Layers");
        }