public void CanLoadResource(string resourceName)
        {
            string css = StyleLoader.LoadResource(resourceName);

            Assert.That(css, Is.Not.Null);
            Assert.That(css, Is.Not.Empty);
            Assert.That(css, Does.Contain("body").IgnoreCase);
        }
        public void CanLoadCss([Values] IssueTheme theme)
        {
            var options = Factory.Get <IOptionsProvider>();

            Assert.That(options, Is.Not.Null);
            Assert.That(options.Options, Is.Not.Null);

            options.Options.IssueTheme = theme;

            string css = StyleLoader.LoadCss();

            Assert.That(css, Is.Not.Null);
            Assert.That(css, Is.Not.Empty);
            Assert.That(css, Does.Contain("body").IgnoreCase);
        }
Exemple #3
0
        void CreateGaugeFromCode(Theme theme)
        {
            gaugeControl      = new GaugeControl();
            gaugeControl.Size = new System.Drawing.Size(200, 200);

            circularGauge = gaugeControl.AddCircularGauge();
            circularGauge.AddDefaultElements();

            var style = StyleLoader.Load("Circular", theme.Name, "Full");

            if (style != null)
            {
                style.Apply(circularGauge);
            }
        }
Exemple #4
0
        protected override void OnStartup(System.Windows.StartupEventArgs e)
        {
            DispatcherUnhandledException += Application_DispatcherUnhandledException;

            // Call the OnStartup event on our base class
            base.OnStartup(e);

            var v = this.GetType().Assembly.GetName().Version;

            string preproduction = " ?";

            if (v.Build == 0)
            {
                preproduction = "";
            }
            else if (v.Build % 2 != 0)
            {
                preproduction = " αlpha" + (v.Build + 1) / 2 + " (rev." + v.Revision + ")";
            }
            else if (v.Build % 2 == 0)
            {
                preproduction = " βeta" + v.Build / 2 + " (rev." + v.Revision + ")";
            }

            this.Properties["Version"]      = string.Format("v{0}.{1}{2}", v.Major, v.Minor, preproduction);
            this.Properties["VersionShort"] = string.Format("v{0}.{1}", v.Major, v.Minor);

            Exit += new ExitEventHandler(App_Exit);
            Thread preloader = new Thread(PreloadAssemblies);

            preloader.IsBackground = true;
            preloader.Priority     = ThreadPriority.BelowNormal;
            preloader.Start();

            this.Resources = Application.LoadComponent(new Uri("App.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary;

            var w = new Window1();

            ServiceLocator.RegisterService <IMainView>(w);
            var dlgsrv = new AppDialogService();

            ServiceLocator.RegisterService <IDialogService>(dlgsrv);
            ServiceLocator.RegisterService <IMainWindow>(w);

            var vm = new Main {
                Themes = new ObservableCollection <ThemeInfo>(StyleLoader.GetAllStyles())
            };

            w.DataContext = vm;
            ServiceLocator.RegisterOverrideService <IKeyboardHandler>((IKeyboardHandler)vm);
            ServiceLocator.RegisterOverrideService <IActionExecutor>((IActionExecutor)vm);

            this.Resources.BeginInit();

            var sl         = new StyleLoader(Resources);
            var startTheme = new ThemeInfo {
                Path = "default"
            };

            startTheme = sl.LoadStyle(startTheme);
            StyleLoader.CurrentStyleFolder = startTheme.Path;
            vm.CurrentTheme = vm.Themes.FirstOrDefault(t => t.Path == startTheme.Path);

            //this.Resources.MergedDictionaries.Add(Application.LoadComponent(new Uri("/Themes/default/style.xaml", UriKind.RelativeOrAbsolute)) as ResourceDictionary);
            this.Resources.EndInit();

            sl.PerformInit = true;

            var b = new System.Windows.Controls.Button();

            ServiceLocator.RegisterService <IStyleLoader>(sl);
            ServiceLocator.RegisterService <IFramePictureProvider>(w);
            ServiceLocator.RegisterService <IInputTeller>(w);
            ServiceLocator.RegisterService <IPlateProcessor>(vm);
            ServiceLocator.RegisterService <ISettings>(vm);

            //sl.LoadStyle("default");

            string[] args = Environment.GetCommandLineArgs();
            if (args.Length > 1)
            {
                (MainWindow as Window1).StartupFile = args[1];
            }

            InterceptKeys.Start((MainWindow as Window1));

            w.Show();
        }
 protected override void Render(HtmlTextWriter writer)
 {
     writer.Write(StyleLoader.Render(Directive));
 }
        private string GetHtmlHeader()
        {
            var css = StyleLoader.LoadCss();

            return(string.Format(Properties.Resources.IssueHtmlHeader, css));
        }