Esempio n. 1
0
        public static Layout PageTemplate(ITemplateContent pageContent)
        {
            //https://github.com/jasonCodesAway/XamJam/tree/master/XamJam.Screen
            //var maxArea = size.Width * size.Height;
            //var isGuaranteedMax = size.IsMaximum;

            var layout = new AbsoluteLayout
            {
                AnchorX           = 0,
                AnchorY           = 0,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Children          =
                {
                    GenerateHeader(pageContent),
                    pageContent.Content,
                    GenerateFooter()
                }
            };

            if (pageContent.UseFooterCoinIcon)
            {
                //we can pass the layout around and add to it - but I think this method is cleaner.
                layout.Children.Add(CoinIconContainer());
                layout.Children.Add(PlaceCoinIcon(pageContent));
            }
            return(layout);
        }
Esempio n. 2
0
 private async Task <TemplateCreationResult> SaveTemplate(ITemplateContent info)
 {
     foreach (var templateContentProvider in CinotamCmsCore.TemplateContentProviders)
     {
         try
         {
             await templateContentProvider.CreateEditTemplate(new CTemplate()
             {
                 Content   = info.Content,
                 Name      = info.Name,
                 IsPartial = info.IsPartial,
             });
         }
         catch (Exception ex)
         {
             if (ex is NotImplementedException)
             {
                 continue;
             }
             throw;
         }
     }
     return(new TemplateCreationResult()
     {
         HasError = false
     });
 }
Esempio n. 3
0
        public static View PlaceCoinIcon(ITemplateContent pageContent)
        {
            var iconBGImage = new Image()
            {
                Source = FileImageSource.FromFile(pageContent.CoinIcon)
            };
            //the icon width should be 1/3 of the width of the footer.
            //so if we want it centered we have to subtract half of teh width since the icon starts with the first pixel on teh center line.
            var halficonwidth = ((Shared.ScreenSize.Width / 3.5) / 2);

            AbsoluteLayout.SetLayoutBounds(iconBGImage, new Rectangle((Shared.ScreenSize.Width / 2) - halficonwidth, Shared.ScreenSize.Height - 110, Shared.ScreenSize.Width / 3.5, 100));
            return(iconBGImage);
        }
Esempio n. 4
0
        public static AbsoluteLayout GenerateHeader(ITemplateContent pageContent)
        {
            var myImage = new Image()
            {
                Source = FileImageSource.FromFile("headerbg.png")
            };
            var layout = new AbsoluteLayout()
            {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                AnchorX           = 0,
                AnchorY           = 0
            };

            //AbsoluteLayout.SetLayoutBounds(myImage, new Rectangle(0, 0, 1, 1));
            myImage.HorizontalOptions = LayoutOptions.CenterAndExpand;

            layout.Children.Add(myImage);
            AbsoluteLayout.SetLayoutBounds(layout, new Rectangle(0, 0, 1, 1));
            AbsoluteLayout.SetLayoutFlags(layout, AbsoluteLayoutFlags.All);
            return(layout);
        }