Mini Kabibi Habibi

Current Path : C:/Users/Public/Documents/DXperience 13.1 Demos/Reporting/CS/SilverlightReportViewer/
Upload File :
Current File : C:/Users/Public/Documents/DXperience 13.1 Demos/Reporting/CS/SilverlightReportViewer/Program.cs

using System;
using System.ServiceModel;
using System.Windows;
using DevExpress.DemoData;
using DevExpress.DemoData.Helpers;
using DevExpress.Xpf.DemoBase;
using DevExpress.Xpf.DemoBase.Helpers;
using SilverlightReportViewer.DemoService;

namespace SilverlightReportViewer {
    public class App : Application {
        static DemoServiceClient client;
        static string reportServiceUrl = "../DemoReportService.svc";
        static string demoServiceUrl = "../DemoService.svc";

        internal static string ReportServiceUrl {
            get { return reportServiceUrl; }
        }

        internal static string DemoServiceUrl {
            get { return demoServiceUrl; }
        }

        internal static DemoServiceClient Client {
            get {
                if(client == null) {
                    var serviceAddress = new EndpointAddress(DemoServiceUrl);
                    var securityMode = serviceAddress.Uri.Scheme.ToLower() == "https"
                        ? BasicHttpSecurityMode.Transport
                        : BasicHttpSecurityMode.None;
                    client = new DemoServiceClient(
                        new BasicHttpBinding(securityMode),
                        serviceAddress);
                }
                return client;
            }
        }

        public App() {
            StartupBase.Run<Startup>(this);
        }
    }
    public class Startup : DemoStartup {
        public static void InitDemo() {
#if !EXTMAP
            Loader.DemoDataAssembly = typeof(DevExpress.DemoData.AssemblyMarker).Assembly;
#endif
        }
        protected override bool GetDebug() {
#if DEBUG
            return true;
#else
            return false;
#endif
        }
        protected override Type GetFixtureTypeForXBAPOrSLTesting() {
            return null;
        }

        protected override bool DoStartup() {
            if(string.Compare("file", Application.Host.Source.Scheme, StringComparison.InvariantCultureIgnoreCase) == 0) {
                const string message = "Please make sure that the Web project of this solution is the starting project.";
                MessageBox.Show(message);
                return false;
            }
            return base.DoStartup();
        }
    }
}