using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SamplesCommon
{
    public static class SamplesUtil
    {
        // hosts a sample page with a common header
        public static UIElement Host(string title, FrameworkElement page)
        {
            Grid.SetRow(page, 1);
            return new Grid
            {
                RowDefinitions = {
                    new RowDefinition { Height = GridLength.Auto },
                    new RowDefinition()
                },
                Children = { new SamplesHeader { Text = title }, page }
            };
        }

        //// convert relative url into absolute
        //public static Uri GetAbsoluteUri(string relativeUri)
        //{
        //    // get current absolute Uri; this depends on where/how the app is deployed
        //    // e.g. "http://labs.componentone.com/silverlight/stockportfolio/foo.aspx"
        //    //      "http://localhost:1337/mysamples/stockportfolio/foo.aspx"
        //    Uri uri = System.Windows.Browser.HtmlPage.Document.DocumentUri;
        //    string uriString = uri.AbsoluteUri;

        //    // replace page name with relative service Uri
        //    int ls = uriString.LastIndexOf('/');
        //    return new Uri(uriString.Substring(0, ls + 1) + relativeUri);
        //}
    }
}
