protected override XDocument LoadDashboard(string dashboardID)
        {
            Dictionary <string, string> storage = ReadFromSession();
            XDocument document = XDocument.Parse(storage[dashboardID]);

            if (dashboardID == "ProductDetails" && HttpContext != null)
            {
                Dashboard dashboard = new Dashboard();
                dashboard.LoadFromXDocument(document);
                string applicationPath = HttpContext.Request.PathBase.ToUriComponent().TrimEnd('/') + "/";

                BoundImageDashboardItem primaryImage = dashboard.Items["primaryImage"] as BoundImageDashboardItem;
                if (primaryImage != null)
                {
                    primaryImage.UriPattern = applicationPath + "Content/ProductDetailsImages/{0}.jpg";
                }

                BoundImageDashboardItem secondaryImage = dashboard.Items["secondaryImage"] as BoundImageDashboardItem;
                if (secondaryImage != null)
                {
                    secondaryImage.UriPattern = applicationPath + "Content/ProductDetailsImages/{0} Secondary.jpg";
                }

                document = dashboard.SaveToXDocument();
            }
            return(document);
        }
Exemplo n.º 2
0
        public Form1()
        {
            InitializeComponent();
            Dashboard dashboard = new Dashboard();

            XmlFileConnectionParameters xmlParams = new XmlFileConnectionParameters();

            xmlParams.FileName = @"..\..\Data\DashboardProductDetails.xml";

            DashboardSqlDataSource xmlDataSource = new DashboardSqlDataSource("Data Source 1", xmlParams);
            SelectQuery            selectQuery   = SelectQueryFluentBuilder
                                                   .AddTable("Products")
                                                   .SelectColumns("Id", "Name", "Description")
                                                   .Build("Query 1");

            xmlDataSource.Queries.Add(selectQuery);
            xmlDataSource.Fill();
            dashboard.DataSources.Add(xmlDataSource);

            BoundImageDashboardItem boundImage = new BoundImageDashboardItem();

            boundImage.DataSource      = xmlDataSource; boundImage.DataMember = "Query 1";
            boundImage.DataBindingMode = ImageDataBindingMode.Uri;
            boundImage.ImageDimension  = new Dimension("Name");
            boundImage.UriPattern      = @"..\..\ProductDetailsImages\{0}.jpg";
            boundImage.SizeMode        = ImageSizeMode.Stretch;

            ListBoxDashboardItem comboBox = new ListBoxDashboardItem();

            comboBox.ShowCaption = false;
            comboBox.DataSource  = xmlDataSource; comboBox.DataMember = "Query 1";
            comboBox.FilterDimensions.Add(new Dimension("Name"));
            comboBox.ListBoxType  = ListBoxDashboardItemType.Radio;
            comboBox.ShowAllValue = false;

            dashboard.Items.AddRange(comboBox, boundImage);
            dashboardViewer1.Dashboard = dashboard;
        }
Exemplo n.º 3
0
    protected override XDocument LoadDashboard(string dashboardID)
    {
        XDocument   document    = Storage[dashboardID];
        HttpContext httpContext = HttpContext.Current;

        if (dashboardID == "ProductDetails" && httpContext != null)
        {
            Dashboard dashboard = new Dashboard();
            dashboard.LoadFromXDocument(document);
            string applicationPath = httpContext.Request.ApplicationPath.TrimEnd('/') + "/";
            BoundImageDashboardItem primaryImage = dashboard.Items["primaryImage"] as BoundImageDashboardItem;
            if (primaryImage != null)
            {
                primaryImage.UriPattern = applicationPath + "Content/ProductDetailsImages/{0}.jpg";
            }
            BoundImageDashboardItem secondaryImage = dashboard.Items["secondaryImage"] as BoundImageDashboardItem;
            if (secondaryImage != null)
            {
                secondaryImage.UriPattern = applicationPath + "Content/ProductDetailsImages/{0} Secondary.jpg";
            }
            document = dashboard.SaveToXDocument();
        }
        return(document);
    }