From 874e3501262bbd3f972fe4eebee0b444d77748aa Mon Sep 17 00:00:00 2001 From: Jason Jarvis Date: Thu, 14 Apr 2016 23:53:21 -0700 Subject: [PATCH] Fixed up tab and name styling issues. --- samples/BindingTest/App.xaml.cs | 14 +- samples/BindingTest/MainWindow.xaml.cs | 4 +- samples/ControlCatalog/App.xaml.cs | 8 +- samples/ControlCatalog/MainWindow.xaml.cs | 4 +- samples/ControlCatalog/Program.cs | 232 +++++++++--------- samples/TestApplication/Program.cs | 38 +-- samples/XamlTestApplication/App.cs | 2 +- samples/XamlTestApplication/Program.cs | 30 +-- samples/XamlTestApplicationPcl/XamlTestApp.cs | 2 +- src/Gtk/Perspex.Cairo/CairoPlatform.cs | 16 +- src/Gtk/Perspex.Gtk/GtkPlatform.cs | 16 +- .../Perspex.Markup.Xaml/PerspexXamlLoader.cs | 16 +- src/Perspex.Controls/Window.cs | 4 +- src/Skia/Perspex.Skia/SkiaPlatform.cs | 18 +- .../Perspex.Direct2D1/Direct2D1Platform.cs | 16 +- src/Windows/Perspex.Win32/Win32Platform.cs | 16 +- 16 files changed, 218 insertions(+), 218 deletions(-) diff --git a/samples/BindingTest/App.xaml.cs b/samples/BindingTest/App.xaml.cs index 38b9aea430..ef5f7ba4d9 100644 --- a/samples/BindingTest/App.xaml.cs +++ b/samples/BindingTest/App.xaml.cs @@ -17,16 +17,16 @@ namespace BindingTest private static void Main() { - InitializeLogging(); + InitializeLogging(); - new App() - .UseWin32Subsystem() - .UseDirect2D() - .LoadFromXaml() - .RunWithMainWindow(); + new App() + .UseWin32() + .UseDirect2D() + .LoadFromXaml() + .RunWithMainWindow(); } - private static void InitializeLogging() + private static void InitializeLogging() { #if DEBUG SerilogLogger.Initialize(new LoggerConfiguration() diff --git a/samples/BindingTest/MainWindow.xaml.cs b/samples/BindingTest/MainWindow.xaml.cs index 61b1e0ffb8..00b46faecf 100644 --- a/samples/BindingTest/MainWindow.xaml.cs +++ b/samples/BindingTest/MainWindow.xaml.cs @@ -11,12 +11,12 @@ namespace BindingTest { this.InitializeComponent(); this.DataContext = new MainWindowViewModel(); - this.AttachDevTools(); + this.AttachDevTools(); } private void InitializeComponent() { - this.LoadFromXaml(); + this.LoadFromXaml(); } } } diff --git a/samples/ControlCatalog/App.xaml.cs b/samples/ControlCatalog/App.xaml.cs index f5cc993e2c..5ee9373edb 100644 --- a/samples/ControlCatalog/App.xaml.cs +++ b/samples/ControlCatalog/App.xaml.cs @@ -9,14 +9,14 @@ using Serilog; namespace ControlCatalog { - // Eventually we should move this into a PCL library so we can access - // from mobile platforms - // + // Eventually we should move this into a PCL library so we can access + // from mobile platforms + // class App : Application { public App() { RegisterServices(); } - } + } } diff --git a/samples/ControlCatalog/MainWindow.xaml.cs b/samples/ControlCatalog/MainWindow.xaml.cs index 67b88dc71f..62949a9abd 100644 --- a/samples/ControlCatalog/MainWindow.xaml.cs +++ b/samples/ControlCatalog/MainWindow.xaml.cs @@ -9,12 +9,12 @@ namespace ControlCatalog public MainWindow() { this.InitializeComponent(); - this.AttachDevTools(); + this.AttachDevTools(); } private void InitializeComponent() { - this.LoadFromXaml(); + this.LoadFromXaml(); } } } diff --git a/samples/ControlCatalog/Program.cs b/samples/ControlCatalog/Program.cs index 0627e77019..d01a6aa11b 100644 --- a/samples/ControlCatalog/Program.cs +++ b/samples/ControlCatalog/Program.cs @@ -6,122 +6,122 @@ using Perspex; namespace ControlCatalog { - internal class Program - { - static void Main(string[] args) - { - InitializeLogging(); - - new App() - .ConfigureRenderSystem(args) - .LoadFromXaml() - .RunWithMainWindow(); - } - - // This will be made into a runtime configuration extension soon! - private static void InitializeLogging() - { + internal class Program + { + static void Main(string[] args) + { + InitializeLogging(); + + new App() + .ConfigureRenderSystem(args) + .LoadFromXaml() + .RunWithMainWindow(); + } + + // This will be made into a runtime configuration extension soon! + private static void InitializeLogging() + { #if DEBUG - SerilogLogger.Initialize(new LoggerConfiguration() - .MinimumLevel.Warning() - .WriteTo.Trace(outputTemplate: "{Area}: {Message}") - .CreateLogger()); + SerilogLogger.Initialize(new LoggerConfiguration() + .MinimumLevel.Warning() + .WriteTo.Trace(outputTemplate: "{Area}: {Message}") + .CreateLogger()); #endif - } - - } - - ///////////////////////////////////////////////////////////////////////////////////////////////////////////// - // Experimental: Would like to move this into a shared location once I figure out the best place for it - // considering all common libraries are PCL and do not have access to Environment.OSVersion.Platform - // nor do they have access to the platform specific render/subsystem extensions. - // - // Perhaps via DI we register each system with a priority/rank - // - public static class RenderSystemExtensions - { - [Flags] - enum RenderSystem - { - None = 0, - GTK = 1, - Skia = 2, - Direct2D = 4 - }; - - /// - /// Default (Optimal) render system for a particular platform - /// - /// - private static RenderSystem DefaultRenderSystem() - { - switch (Environment.OSVersion.Platform) - { - case PlatformID.MacOSX: - return RenderSystem.GTK; - - case PlatformID.Unix: - return RenderSystem.GTK; - - case PlatformID.Win32Windows: - return RenderSystem.Direct2D; - } - - return RenderSystem.None; - } - - /// - /// Returns an array of avalidable rendering systems in priority order - /// - /// - private static RenderSystem[] AvailableRenderSystems() - { - switch (Environment.OSVersion.Platform) - { - case PlatformID.MacOSX: - return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia }; - - case PlatformID.Unix: - return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia }; - - case PlatformID.Win32Windows: - return new RenderSystem[] { RenderSystem.Direct2D, RenderSystem.Skia, RenderSystem.GTK }; - } - - return new RenderSystem[0]; - } - - /// - /// Selects the optimal render system for desktop platforms. Supports cmd line overrides - /// - /// - /// - public static AppT ConfigureRenderSystem(this AppT app, string[] args) where AppT : Application - { - // So this all works great under Windows where it can support - // ALL configurations. But on OSX/Unix we cannot use Direct2D - // - if (args.Contains("--gtk") || DefaultRenderSystem() == RenderSystem.GTK) - { - app.UseGtkSubsystem(); - app.UseCairo(); - } - else - { - app.UseWin32Subsystem(); - - // not available until we do the SkiaSharp merge - //if (args.Contains("--skia") || DefaultRenderSystem() == RenderSystem.Skia) - //{ - // app.UseSkia(); - //} - //else - { - app.UseDirect2D(); - } - } - - return app; - } - } + } + + } + + ///////////////////////////////////////////////////////////////////////////////////////////////////////////// + // Experimental: Would like to move this into a shared location once I figure out the best place for it + // considering all common libraries are PCL and do not have access to Environment.OSVersion.Platform + // nor do they have access to the platform specific render/subsystem extensions. + // + // Perhaps via DI we register each system with a priority/rank + // + public static class RenderSystemExtensions + { + [Flags] + enum RenderSystem + { + None = 0, + GTK = 1, + Skia = 2, + Direct2D = 4 + }; + + /// + /// Default (Optimal) render system for a particular platform + /// + /// + private static RenderSystem DefaultRenderSystem() + { + switch (Environment.OSVersion.Platform) + { + case PlatformID.MacOSX: + return RenderSystem.GTK; + + case PlatformID.Unix: + return RenderSystem.GTK; + + case PlatformID.Win32Windows: + return RenderSystem.Direct2D; + } + + return RenderSystem.None; + } + + /// + /// Returns an array of avalidable rendering systems in priority order + /// + /// + private static RenderSystem[] AvailableRenderSystems() + { + switch (Environment.OSVersion.Platform) + { + case PlatformID.MacOSX: + return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia }; + + case PlatformID.Unix: + return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia }; + + case PlatformID.Win32Windows: + return new RenderSystem[] { RenderSystem.Direct2D, RenderSystem.Skia, RenderSystem.GTK }; + } + + return new RenderSystem[0]; + } + + /// + /// Selects the optimal render system for desktop platforms. Supports cmd line overrides + /// + /// + /// + public static TApp ConfigureRenderSystem(this TApp app, string[] args) where TApp : Application + { + // So this all works great under Windows where it can support + // ALL configurations. But on OSX/Unix we cannot use Direct2D + // + if (args.Contains("--gtk") || DefaultRenderSystem() == RenderSystem.GTK) + { + app.UseGtk(); + app.UseCairo(); + } + else + { + app.UseWin32(); + + // not available until we do the SkiaSharp merge + //if (args.Contains("--skia") || DefaultRenderSystem() == RenderSystem.Skia) + //{ + // app.UseSkia(); + //} + //else + { + app.UseDirect2D(); + } + } + + return app; + } + } } diff --git a/samples/TestApplication/Program.cs b/samples/TestApplication/Program.cs index f7169290a7..38b059afff 100644 --- a/samples/TestApplication/Program.cs +++ b/samples/TestApplication/Program.cs @@ -34,27 +34,27 @@ namespace TestApplication var app = new App(); - if (args.Contains("--gtk")) - { - app.UseGtkSubsystem(); - app.UseCairo(); - } - else - { - app.UseWin32Subsystem(); + if (args.Contains("--gtk")) + { + app.UseGtk(); + app.UseCairo(); + } + else + { + app.UseWin32(); - // not available until we do the SkiaSharp merge - //if (args.Contains("--skia")) - //{ - // app.UseSkia(); - //} - //else - { - app.UseDirect2D(); - } - } + // not available until we do the SkiaSharp merge + //if (args.Contains("--skia")) + //{ + // app.UseSkia(); + //} + //else + { + app.UseDirect2D(); + } + } - app.Run(); + app.Run(); } } } diff --git a/samples/XamlTestApplication/App.cs b/samples/XamlTestApplication/App.cs index 8841a02c46..9d5df3236c 100644 --- a/samples/XamlTestApplication/App.cs +++ b/samples/XamlTestApplication/App.cs @@ -7,5 +7,5 @@ using Serilog; namespace XamlTestApplication { - // No longer needed! + // No longer needed! } diff --git a/samples/XamlTestApplication/Program.cs b/samples/XamlTestApplication/Program.cs index 339cd1ae30..a6dc2a5501 100644 --- a/samples/XamlTestApplication/Program.cs +++ b/samples/XamlTestApplication/Program.cs @@ -14,26 +14,26 @@ namespace XamlTestApplication { private static void Main(string[] args) { - // this sucks. Can we fix this? Do we even need it anymore? + // this sucks. Can we fix this? Do we even need it anymore? var foo = Dispatcher.CurrentDispatcher; - InitializeLogging(); + InitializeLogging(); - new XamlTestApp() - .UseWin32Subsystem() - .UseDirect2D() - .LoadFromXaml() - .RunWithMainWindow(); + new XamlTestApp() + .UseWin32() + .UseDirect2D() + .LoadFromXaml() + .RunWithMainWindow(); } - private static void InitializeLogging() - { + private static void InitializeLogging() + { #if DEBUG - SerilogLogger.Initialize(new LoggerConfiguration() - .MinimumLevel.Warning() - .WriteTo.Trace(outputTemplate: "{Area}: {Message}") - .CreateLogger()); + SerilogLogger.Initialize(new LoggerConfiguration() + .MinimumLevel.Warning() + .WriteTo.Trace(outputTemplate: "{Area}: {Message}") + .CreateLogger()); #endif - } - } + } + } } \ No newline at end of file diff --git a/samples/XamlTestApplicationPcl/XamlTestApp.cs b/samples/XamlTestApplicationPcl/XamlTestApp.cs index 936b35699b..15f9ddb30e 100644 --- a/samples/XamlTestApplicationPcl/XamlTestApp.cs +++ b/samples/XamlTestApplicationPcl/XamlTestApp.cs @@ -10,5 +10,5 @@ namespace XamlTestApplication { RegisterServices(); } - } + } } diff --git a/src/Gtk/Perspex.Cairo/CairoPlatform.cs b/src/Gtk/Perspex.Cairo/CairoPlatform.cs index 36078a1196..4e2c6727a5 100644 --- a/src/Gtk/Perspex.Cairo/CairoPlatform.cs +++ b/src/Gtk/Perspex.Cairo/CairoPlatform.cs @@ -9,14 +9,14 @@ using Perspex.Platform; namespace Perspex { - public static class GtkApplicationExtensions - { - public static AppT UseCairo(this AppT app) where AppT : Application - { - Perspex.Cairo.CairoPlatform.Initialize(); - return app; - } - } + public static class GtkApplicationExtensions + { + public static TApp UseCairo(this TApp app) where TApp : Application + { + Perspex.Cairo.CairoPlatform.Initialize(); + return app; + } + } } namespace Perspex.Cairo diff --git a/src/Gtk/Perspex.Gtk/GtkPlatform.cs b/src/Gtk/Perspex.Gtk/GtkPlatform.cs index b3de47f4eb..6a1d269dba 100644 --- a/src/Gtk/Perspex.Gtk/GtkPlatform.cs +++ b/src/Gtk/Perspex.Gtk/GtkPlatform.cs @@ -12,14 +12,14 @@ using Perspex.Shared.PlatformSupport; namespace Perspex { - public static class GtkApplicationExtensions - { - public static AppT UseGtkSubsystem(this AppT app) where AppT : Application - { - Perspex.Gtk.GtkPlatform.Initialize(); - return app; - } - } + public static class GtkApplicationExtensions + { + public static TApp UseGtk(this TApp app) where TApp : Application + { + Perspex.Gtk.GtkPlatform.Initialize(); + return app; + } + } } namespace Perspex.Gtk diff --git a/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs b/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs index 1bbff1c886..68ae90d60f 100644 --- a/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs +++ b/src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs @@ -190,12 +190,12 @@ namespace Perspex.Markup.Xaml namespace Perspex { - public static class XamlObjectExtensions - { - public static ObjectT LoadFromXaml(this ObjectT obj) - { - Markup.Xaml.PerspexXamlLoader.Load(obj); - return obj; - } - } + public static class XamlObjectExtensions + { + public static TObject LoadFromXaml(this TObject obj) + { + Markup.Xaml.PerspexXamlLoader.Load(obj); + return obj; + } + } } diff --git a/src/Perspex.Controls/Window.cs b/src/Perspex.Controls/Window.cs index 3d59ce24a3..3a527ebb35 100644 --- a/src/Perspex.Controls/Window.cs +++ b/src/Perspex.Controls/Window.cs @@ -330,9 +330,9 @@ namespace Perspex { public static class WindowApplicationExtensions { - public static void RunWithMainWindow(this Application app) where WindowT : Perspex.Controls.Window, new() + public static void RunWithMainWindow(this Application app) where TWindow : Perspex.Controls.Window, new() { - var window = new WindowT(); + var window = new TWindow(); window.Show(); app.Run(window); } diff --git a/src/Skia/Perspex.Skia/SkiaPlatform.cs b/src/Skia/Perspex.Skia/SkiaPlatform.cs index 2161397dd9..e3bfa1bf25 100644 --- a/src/Skia/Perspex.Skia/SkiaPlatform.cs +++ b/src/Skia/Perspex.Skia/SkiaPlatform.cs @@ -5,14 +5,14 @@ using Perspex.Platform; namespace Perspex { - public static class SkiaApplicationExtensions - { - public static AppT UseSkia(this AppT app) where AppT : Application - { - Perspex.Skia.SkiaPlatform.Initialize(); - return app; - } - } + public static class SkiaApplicationExtensions + { + public static TApp UseSkia(this TApp app) where TApp : Application + { + Perspex.Skia.SkiaPlatform.Initialize(); + return app; + } + } } namespace Perspex.Skia @@ -21,7 +21,7 @@ namespace Perspex.Skia { private static bool s_forceSoftwareRendering; - public static void Initialize() + public static void Initialize() => PerspexLocator.CurrentMutable.Bind().ToConstant(new PlatformRenderInterface()); public static bool ForceSoftwareRendering diff --git a/src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs b/src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs index fa6be34844..fca41e0f64 100644 --- a/src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs +++ b/src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs @@ -9,14 +9,14 @@ using Perspex.Platform; namespace Perspex { - public static class Direct2DApplicationExtensions - { - public static AppT UseDirect2D(this AppT app) where AppT : Application - { - Perspex.Direct2D1.Direct2D1Platform.Initialize(); - return app; - } - } + public static class Direct2DApplicationExtensions + { + public static TApp UseDirect2D(this TApp app) where TApp : Application + { + Perspex.Direct2D1.Direct2D1Platform.Initialize(); + return app; + } + } } namespace Perspex.Direct2D1 diff --git a/src/Windows/Perspex.Win32/Win32Platform.cs b/src/Windows/Perspex.Win32/Win32Platform.cs index c2f4943e28..480c7f859e 100644 --- a/src/Windows/Perspex.Win32/Win32Platform.cs +++ b/src/Windows/Perspex.Win32/Win32Platform.cs @@ -18,14 +18,14 @@ using Perspex.Win32.Interop; namespace Perspex { - public static class Win32ApplicationExtensions - { - public static AppT UseWin32Subsystem(this AppT app) where AppT : Application - { - Perspex.Win32.Win32Platform.Initialize(); - return app; - } - } + public static class Win32ApplicationExtensions + { + public static TApp UseWin32(this TApp app) where TApp : Application + { + Perspex.Win32.Win32Platform.Initialize(); + return app; + } + } } namespace Perspex.Win32