コード例 #1
0
ファイル: App.xaml.cs プロジェクト: thincster/Orc.Controls
        protected override void OnStartup(StartupEventArgs e)
        {
            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            // Some test logging, but important to load the assembly first
            var externalTypeToForceAssemblyLoad = typeof(LogViewerLogListener);

            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.Controls.Examples;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultFontFamily = "FontAwesome";


            Log.Info("Starting application");
            Log.Info("This log message should show up as debug");

            this.ApplyTheme();

            base.OnStartup(e);
        }
コード例 #2
0
        private void InitializeFonts()
        {
            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.Snapshots.Example;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultBrush      = new SolidColorBrush(Color.FromArgb(255, 87, 87, 87));
            FontImage.DefaultFontFamily = "FontAwesome";
        }
コード例 #3
0
        public override void Render(FontImage img)
        {
            var x0 = start.X;
            var y0 = start.Y;
            var x1 = end.X;
            var y1 = end.Y;

            var dx = Math.Abs(x1 - x0);
            var dy = -Math.Abs(y1 - y0);

            var sx = x0 < x1 ? 1 : -1;
            var sy = y0 < y1 ? 1 : -1;

            var err = dx + dy;

            for (;;)
            {
                img.SetPixel(new Point(x0, y0));
                if (Math.Abs(x1 - x0) < 1 && Math.Abs(y1 - y0) < 1)
                {
                    break;
                }

                var e2 = 2 * err;
                if (e2 >= dy)
                {
                    err += dy; x0 += sx;
                }
                if (e2 <= dx)
                {
                    err += dx; y0 += sy;
                }
            }
        }
コード例 #4
0
        private List <FontItem> GetFontItems()
        {
            var items     = new List <FontItem>();
            var ambulance = new FontImage(FontAwesome.Ambulance)
            {
                FontFamily = nameof(FontAwesome)
            };
            var cab = new FontImage(FontAwesome.Cab)
            {
                FontFamily = nameof(FontAwesome)
            };
            var plane = new FontImage(FontAwesome.Plane)
            {
                FontFamily = nameof(FontAwesome)
            };
            var wheelchair = new FontImage(FontAwesome.Wheelchair)
            {
                FontFamily = nameof(FontAwesome)
            };
            var car = new FontImage(FontAwesome.Automobile)
            {
                FontFamily = nameof(FontAwesome)
            };
            var rocket = new FontImage(FontAwesome.Rocket)
            {
                FontFamily = nameof(FontAwesome)
            };
            var taxi = new FontImage(FontAwesome.Taxi)
            {
                FontFamily = nameof(FontAwesome)
            };
            var bicycle = new FontImage(FontAwesome.Bicycle)
            {
                FontFamily = nameof(FontAwesome)
            };
            var bus = new FontImage(FontAwesome.Bus)
            {
                FontFamily = nameof(FontAwesome)
            };
            var truck = new FontImage(FontAwesome.Truck)
            {
                FontFamily = nameof(FontAwesome)
            };

            for (int i = 0; i < 3; i++)
            {
                items.Add(new FontItem(ambulance.GetImageSource(), nameof(FontAwesome.Ambulance)));
                items.Add(new FontItem(cab.GetImageSource(), nameof(FontAwesome.Cab)));
                items.Add(new FontItem(plane.GetImageSource(), nameof(FontAwesome.Plane)));
                items.Add(new FontItem(wheelchair.GetImageSource(), nameof(FontAwesome.Wheelchair)));
                items.Add(new FontItem(car.GetImageSource(), nameof(FontAwesome.Automobile)));
                items.Add(new FontItem(rocket.GetImageSource(), nameof(FontAwesome.Rocket)));
                items.Add(new FontItem(taxi.GetImageSource(), nameof(FontAwesome.Taxi)));
                items.Add(new FontItem(bicycle.GetImageSource(), nameof(FontAwesome.Bicycle)));
                items.Add(new FontItem(bus.GetImageSource(), nameof(FontAwesome.Bus)));
                items.Add(new FontItem(truck.GetImageSource(), nameof(FontAwesome.Truck)));
            }

            return(items);
        }
コード例 #5
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener(true);
#endif

            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orchestra.Examples.Ribbon.Fluent;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultFontFamily = "FontAwesome";

            var serviceLocator = ServiceLocator.Default;
            var shellService   = serviceLocator.ResolveType <IShellService>();
            shellService.CreateAsync <ShellWindow>();

            _stopwatch.Stop();

            Log.Info("Elapsed startup stopwatch time: {0}", _stopwatch.Elapsed);
        }
コード例 #6
0
        public override void Render(FontImage img)
        {
            var points = bezier.Points;
            IEnumerable <RenderInstruction> instructions = Enumerable.Empty <RenderInstruction>();

            for (var i = 0; i < points.Count - 2; i += 2)
            {
                var p0 = points[i];
                var p1 = points[i + 1];
                var p2 = points[i + 2];

                var x0 = (int)p0.X;
                var y0 = (int)p0.Y;
                var x1 = (int)p1.X;
                var y1 = (int)p1.Y;
                var x2 = (int)p2.X;
                var y2 = (int)p2.Y;

                instructions = instructions.Concat(PlotQuadBezier(x0, y0, x1, y1, x2, y2));
            }

            var instructionList = instructions.ToList();

            foreach (var instruction in instructionList)
            {
                instruction.Render(img);
            }
        }
コード例 #7
0
        private async Task InitializeFonts()
        {
            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/LogViewer;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultFontFamily = "FontAwesome";

            FontImage.DefaultBrush = new SolidColorBrush(Color.FromArgb(255, 87, 87, 87));
        }
        private Task InitializeFonts()
        {
            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.FilterBuilder.Example;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultBrush      = new SolidColorBrush(Color.FromArgb(255, 87, 87, 87));
            FontImage.DefaultFontFamily = "FontAwesome";

            return(TaskHelper.Completed);
        }
コード例 #9
0
        protected override void OnStartup(StartupEventArgs e)
        {
            //var sqLiteProviderInfo = new DbProviderInfo
            //{
            //    Name = "SQLite Data Provider",
            //    InvariantName = "System.Data.SQLite",
            //    Description = ".NET Framework Data Provider for SQLite",
            //    AssemblyQualifiedName = "System.Data.SQLite.SQLiteFactory, System.Data.SQLite, Version=1.0.110.0, Culture=neutral, PublicKeyToken=db937bc2d44ff139"
            //};
            //DbProvider.RegisterProvider(sqLiteProviderInfo);

            //var oracleProviderInfo = new DbProviderInfo
            //{
            //    Name = "ODP.NET, Managed Driver",
            //    InvariantName = "Oracle.ManagedDataAccess.Client",
            //    Description = "Oracle Data Provider for .NET, Managed Driver",
            //    AssemblyQualifiedName = "Oracle.ManagedDataAccess.Client.OracleClientFactory, Oracle.ManagedDataAccess, Version=4.122.18.3, Culture=neutral, PublicKeyToken=89b483f429c47342"
            //};
            //DbProvider.RegisterProvider(oracleProviderInfo);

            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            // Some test logging, but important to load the assembly first
            var externalTypeToForceAssemblyLoad = typeof(LogViewerLogListener);

            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.Controls.Example.NET;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultFontFamily = "FontAwesome";

            Log.Info("Starting application");
            Log.Info("This log message should show up as debug");

            this.ApplyTheme(true);

            base.OnStartup(e);
        }
コード例 #10
0
        protected override void OnStartup(StartupEventArgs e)
        {
#if DEBUG
            LogManager.AddDebugListener(true);
#endif

            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orchestra.Examples.Ribbon;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));

            FontImage.DefaultFontFamily = "FontAwesome";

            var serviceLocator = ServiceLocator.Default;
            var shellService   = serviceLocator.ResolveType <IShellService>();
            shellService.CreateWithSplash <ShellWindow>();

            _end = DateTime.Now;
            _stopwatch.Stop();

            Log.Info("Elapsed startup stopwatch time: {0}", _stopwatch.Elapsed);
            Log.Info("Elapsed startup time: {0}", _end - _start);
        }
コード例 #11
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var languageService = ServiceLocator.Default.ResolveType <ILanguageService>();

            // Note: it's best to use .CurrentUICulture in actual apps since it will use the preferred language
            // of the user. But in order to demo multilingual features for devs (who mostly have en-US as .CurrentUICulture),
            // we use .CurrentCulture for the sake of the demo
            languageService.PreferredCulture = CultureInfo.CurrentCulture;
            languageService.FallbackCulture  = new CultureInfo("en-US");

            FontImage.RegisterFont("FontAwesome", new FontFamily(new Uri("pack://application:,,,/Orc.Theming.Example;component/Resources/Fonts/", UriKind.RelativeOrAbsolute), "./#FontAwesome"));
            FontImage.DefaultFontFamily = "FontAwesome";

            // This shows the StyleHelper, but uses a *copy* of the Orchestra themes. The default margins for controls are not defined in
            // Orc.Theming since it's a low-level library. The final default styles should be in the shell (thus Orchestra makes sense)
            StyleHelper.CreateStyleForwardersForDefaultStyles();

            Log.Info("Starting application");
            Log.Info("This log message should show up as debug");

            base.OnStartup(e);
        }
コード例 #12
0
 public override void Render(FontImage img)
 {
     img.SetPixel(point);
 }
コード例 #13
0
 public override void Render(FontImage img)
 {
     throw new System.NotImplementedException();
 }
コード例 #14
0
 public abstract void Render(FontImage img);