Browse Source

Fixed up tab and name styling issues.

pull/504/head
Jason Jarvis 10 years ago
parent
commit
874e350126
  1. 14
      samples/BindingTest/App.xaml.cs
  2. 4
      samples/BindingTest/MainWindow.xaml.cs
  3. 8
      samples/ControlCatalog/App.xaml.cs
  4. 4
      samples/ControlCatalog/MainWindow.xaml.cs
  5. 232
      samples/ControlCatalog/Program.cs
  6. 38
      samples/TestApplication/Program.cs
  7. 2
      samples/XamlTestApplication/App.cs
  8. 30
      samples/XamlTestApplication/Program.cs
  9. 2
      samples/XamlTestApplicationPcl/XamlTestApp.cs
  10. 16
      src/Gtk/Perspex.Cairo/CairoPlatform.cs
  11. 16
      src/Gtk/Perspex.Gtk/GtkPlatform.cs
  12. 16
      src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs
  13. 4
      src/Perspex.Controls/Window.cs
  14. 18
      src/Skia/Perspex.Skia/SkiaPlatform.cs
  15. 16
      src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs
  16. 16
      src/Windows/Perspex.Win32/Win32Platform.cs

14
samples/BindingTest/App.xaml.cs

@ -17,16 +17,16 @@ namespace BindingTest
private static void Main() private static void Main()
{ {
InitializeLogging(); InitializeLogging();
new App() new App()
.UseWin32Subsystem() .UseWin32()
.UseDirect2D() .UseDirect2D()
.LoadFromXaml() .LoadFromXaml()
.RunWithMainWindow<MainWindow>(); .RunWithMainWindow<MainWindow>();
} }
private static void InitializeLogging() private static void InitializeLogging()
{ {
#if DEBUG #if DEBUG
SerilogLogger.Initialize(new LoggerConfiguration() SerilogLogger.Initialize(new LoggerConfiguration()

4
samples/BindingTest/MainWindow.xaml.cs

@ -11,12 +11,12 @@ namespace BindingTest
{ {
this.InitializeComponent(); this.InitializeComponent();
this.DataContext = new MainWindowViewModel(); this.DataContext = new MainWindowViewModel();
this.AttachDevTools(); this.AttachDevTools();
} }
private void InitializeComponent() private void InitializeComponent()
{ {
this.LoadFromXaml(); this.LoadFromXaml();
} }
} }
} }

8
samples/ControlCatalog/App.xaml.cs

@ -9,14 +9,14 @@ using Serilog;
namespace ControlCatalog namespace ControlCatalog
{ {
// Eventually we should move this into a PCL library so we can access // Eventually we should move this into a PCL library so we can access
// from mobile platforms // from mobile platforms
// //
class App : Application class App : Application
{ {
public App() public App()
{ {
RegisterServices(); RegisterServices();
} }
} }
} }

4
samples/ControlCatalog/MainWindow.xaml.cs

@ -9,12 +9,12 @@ namespace ControlCatalog
public MainWindow() public MainWindow()
{ {
this.InitializeComponent(); this.InitializeComponent();
this.AttachDevTools(); this.AttachDevTools();
} }
private void InitializeComponent() private void InitializeComponent()
{ {
this.LoadFromXaml(); this.LoadFromXaml();
} }
} }
} }

232
samples/ControlCatalog/Program.cs

@ -6,122 +6,122 @@ using Perspex;
namespace ControlCatalog namespace ControlCatalog
{ {
internal class Program internal class Program
{ {
static void Main(string[] args) static void Main(string[] args)
{ {
InitializeLogging(); InitializeLogging();
new App() new App()
.ConfigureRenderSystem(args) .ConfigureRenderSystem(args)
.LoadFromXaml() .LoadFromXaml()
.RunWithMainWindow<MainWindow>(); .RunWithMainWindow<MainWindow>();
} }
// This will be made into a runtime configuration extension soon! // This will be made into a runtime configuration extension soon!
private static void InitializeLogging() private static void InitializeLogging()
{ {
#if DEBUG #if DEBUG
SerilogLogger.Initialize(new LoggerConfiguration() SerilogLogger.Initialize(new LoggerConfiguration()
.MinimumLevel.Warning() .MinimumLevel.Warning()
.WriteTo.Trace(outputTemplate: "{Area}: {Message}") .WriteTo.Trace(outputTemplate: "{Area}: {Message}")
.CreateLogger()); .CreateLogger());
#endif #endif
} }
} }
///////////////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////////////////
// Experimental: Would like to move this into a shared location once I figure out the best place for it // 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 // 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. // nor do they have access to the platform specific render/subsystem extensions.
// //
// Perhaps via DI we register each system with a priority/rank // Perhaps via DI we register each system with a priority/rank
// //
public static class RenderSystemExtensions public static class RenderSystemExtensions
{ {
[Flags] [Flags]
enum RenderSystem enum RenderSystem
{ {
None = 0, None = 0,
GTK = 1, GTK = 1,
Skia = 2, Skia = 2,
Direct2D = 4 Direct2D = 4
}; };
/// <summary> /// <summary>
/// Default (Optimal) render system for a particular platform /// Default (Optimal) render system for a particular platform
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static RenderSystem DefaultRenderSystem() private static RenderSystem DefaultRenderSystem()
{ {
switch (Environment.OSVersion.Platform) switch (Environment.OSVersion.Platform)
{ {
case PlatformID.MacOSX: case PlatformID.MacOSX:
return RenderSystem.GTK; return RenderSystem.GTK;
case PlatformID.Unix: case PlatformID.Unix:
return RenderSystem.GTK; return RenderSystem.GTK;
case PlatformID.Win32Windows: case PlatformID.Win32Windows:
return RenderSystem.Direct2D; return RenderSystem.Direct2D;
} }
return RenderSystem.None; return RenderSystem.None;
} }
/// <summary> /// <summary>
/// Returns an array of avalidable rendering systems in priority order /// Returns an array of avalidable rendering systems in priority order
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
private static RenderSystem[] AvailableRenderSystems() private static RenderSystem[] AvailableRenderSystems()
{ {
switch (Environment.OSVersion.Platform) switch (Environment.OSVersion.Platform)
{ {
case PlatformID.MacOSX: case PlatformID.MacOSX:
return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia }; return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia };
case PlatformID.Unix: case PlatformID.Unix:
return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia }; return new RenderSystem[] { RenderSystem.GTK, RenderSystem.Skia };
case PlatformID.Win32Windows: case PlatformID.Win32Windows:
return new RenderSystem[] { RenderSystem.Direct2D, RenderSystem.Skia, RenderSystem.GTK }; return new RenderSystem[] { RenderSystem.Direct2D, RenderSystem.Skia, RenderSystem.GTK };
} }
return new RenderSystem[0]; return new RenderSystem[0];
} }
/// <summary> /// <summary>
/// Selects the optimal render system for desktop platforms. Supports cmd line overrides /// Selects the optimal render system for desktop platforms. Supports cmd line overrides
/// </summary> /// </summary>
/// <param name="app"></param> /// <param name="app"></param>
/// <param name="args"></param> /// <param name="args"></param>
public static AppT ConfigureRenderSystem<AppT>(this AppT app, string[] args) where AppT : Application public static TApp ConfigureRenderSystem<TApp>(this TApp app, string[] args) where TApp : Application
{ {
// So this all works great under Windows where it can support // So this all works great under Windows where it can support
// ALL configurations. But on OSX/Unix we cannot use Direct2D // ALL configurations. But on OSX/Unix we cannot use Direct2D
// //
if (args.Contains("--gtk") || DefaultRenderSystem() == RenderSystem.GTK) if (args.Contains("--gtk") || DefaultRenderSystem() == RenderSystem.GTK)
{ {
app.UseGtkSubsystem(); app.UseGtk();
app.UseCairo(); app.UseCairo();
} }
else else
{ {
app.UseWin32Subsystem(); app.UseWin32();
// not available until we do the SkiaSharp merge // not available until we do the SkiaSharp merge
//if (args.Contains("--skia") || DefaultRenderSystem() == RenderSystem.Skia) //if (args.Contains("--skia") || DefaultRenderSystem() == RenderSystem.Skia)
//{ //{
// app.UseSkia(); // app.UseSkia();
//} //}
//else //else
{ {
app.UseDirect2D(); app.UseDirect2D();
} }
} }
return app; return app;
} }
} }
} }

38
samples/TestApplication/Program.cs

@ -34,27 +34,27 @@ namespace TestApplication
var app = new App(); var app = new App();
if (args.Contains("--gtk")) if (args.Contains("--gtk"))
{ {
app.UseGtkSubsystem(); app.UseGtk();
app.UseCairo(); app.UseCairo();
} }
else else
{ {
app.UseWin32Subsystem(); app.UseWin32();
// not available until we do the SkiaSharp merge // not available until we do the SkiaSharp merge
//if (args.Contains("--skia")) //if (args.Contains("--skia"))
//{ //{
// app.UseSkia(); // app.UseSkia();
//} //}
//else //else
{ {
app.UseDirect2D(); app.UseDirect2D();
} }
} }
app.Run(); app.Run();
} }
} }
} }

2
samples/XamlTestApplication/App.cs

@ -7,5 +7,5 @@ using Serilog;
namespace XamlTestApplication namespace XamlTestApplication
{ {
// No longer needed! // No longer needed!
} }

30
samples/XamlTestApplication/Program.cs

@ -14,26 +14,26 @@ namespace XamlTestApplication
{ {
private static void Main(string[] args) 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; var foo = Dispatcher.CurrentDispatcher;
InitializeLogging(); InitializeLogging();
new XamlTestApp() new XamlTestApp()
.UseWin32Subsystem() .UseWin32()
.UseDirect2D() .UseDirect2D()
.LoadFromXaml() .LoadFromXaml()
.RunWithMainWindow<Views.MainWindow>(); .RunWithMainWindow<Views.MainWindow>();
} }
private static void InitializeLogging() private static void InitializeLogging()
{ {
#if DEBUG #if DEBUG
SerilogLogger.Initialize(new LoggerConfiguration() SerilogLogger.Initialize(new LoggerConfiguration()
.MinimumLevel.Warning() .MinimumLevel.Warning()
.WriteTo.Trace(outputTemplate: "{Area}: {Message}") .WriteTo.Trace(outputTemplate: "{Area}: {Message}")
.CreateLogger()); .CreateLogger());
#endif #endif
} }
} }
} }

2
samples/XamlTestApplicationPcl/XamlTestApp.cs

@ -10,5 +10,5 @@ namespace XamlTestApplication
{ {
RegisterServices(); RegisterServices();
} }
} }
} }

16
src/Gtk/Perspex.Cairo/CairoPlatform.cs

@ -9,14 +9,14 @@ using Perspex.Platform;
namespace Perspex namespace Perspex
{ {
public static class GtkApplicationExtensions public static class GtkApplicationExtensions
{ {
public static AppT UseCairo<AppT>(this AppT app) where AppT : Application public static TApp UseCairo<TApp>(this TApp app) where TApp : Application
{ {
Perspex.Cairo.CairoPlatform.Initialize(); Perspex.Cairo.CairoPlatform.Initialize();
return app; return app;
} }
} }
} }
namespace Perspex.Cairo namespace Perspex.Cairo

16
src/Gtk/Perspex.Gtk/GtkPlatform.cs

@ -12,14 +12,14 @@ using Perspex.Shared.PlatformSupport;
namespace Perspex namespace Perspex
{ {
public static class GtkApplicationExtensions public static class GtkApplicationExtensions
{ {
public static AppT UseGtkSubsystem<AppT>(this AppT app) where AppT : Application public static TApp UseGtk<TApp>(this TApp app) where TApp : Application
{ {
Perspex.Gtk.GtkPlatform.Initialize(); Perspex.Gtk.GtkPlatform.Initialize();
return app; return app;
} }
} }
} }
namespace Perspex.Gtk namespace Perspex.Gtk

16
src/Markup/Perspex.Markup.Xaml/PerspexXamlLoader.cs

@ -190,12 +190,12 @@ namespace Perspex.Markup.Xaml
namespace Perspex namespace Perspex
{ {
public static class XamlObjectExtensions public static class XamlObjectExtensions
{ {
public static ObjectT LoadFromXaml<ObjectT>(this ObjectT obj) public static TObject LoadFromXaml<TObject>(this TObject obj)
{ {
Markup.Xaml.PerspexXamlLoader.Load(obj); Markup.Xaml.PerspexXamlLoader.Load(obj);
return obj; return obj;
} }
} }
} }

4
src/Perspex.Controls/Window.cs

@ -330,9 +330,9 @@ namespace Perspex
{ {
public static class WindowApplicationExtensions public static class WindowApplicationExtensions
{ {
public static void RunWithMainWindow<WindowT>(this Application app) where WindowT : Perspex.Controls.Window, new() public static void RunWithMainWindow<TWindow>(this Application app) where TWindow : Perspex.Controls.Window, new()
{ {
var window = new WindowT(); var window = new TWindow();
window.Show(); window.Show();
app.Run(window); app.Run(window);
} }

18
src/Skia/Perspex.Skia/SkiaPlatform.cs

@ -5,14 +5,14 @@ using Perspex.Platform;
namespace Perspex namespace Perspex
{ {
public static class SkiaApplicationExtensions public static class SkiaApplicationExtensions
{ {
public static AppT UseSkia<AppT>(this AppT app) where AppT : Application public static TApp UseSkia<TApp>(this TApp app) where TApp : Application
{ {
Perspex.Skia.SkiaPlatform.Initialize(); Perspex.Skia.SkiaPlatform.Initialize();
return app; return app;
} }
} }
} }
namespace Perspex.Skia namespace Perspex.Skia
@ -21,7 +21,7 @@ namespace Perspex.Skia
{ {
private static bool s_forceSoftwareRendering; private static bool s_forceSoftwareRendering;
public static void Initialize() public static void Initialize()
=> PerspexLocator.CurrentMutable.Bind<IPlatformRenderInterface>().ToConstant(new PlatformRenderInterface()); => PerspexLocator.CurrentMutable.Bind<IPlatformRenderInterface>().ToConstant(new PlatformRenderInterface());
public static bool ForceSoftwareRendering public static bool ForceSoftwareRendering

16
src/Windows/Perspex.Direct2D1/Direct2D1Platform.cs

@ -9,14 +9,14 @@ using Perspex.Platform;
namespace Perspex namespace Perspex
{ {
public static class Direct2DApplicationExtensions public static class Direct2DApplicationExtensions
{ {
public static AppT UseDirect2D<AppT>(this AppT app) where AppT : Application public static TApp UseDirect2D<TApp>(this TApp app) where TApp : Application
{ {
Perspex.Direct2D1.Direct2D1Platform.Initialize(); Perspex.Direct2D1.Direct2D1Platform.Initialize();
return app; return app;
} }
} }
} }
namespace Perspex.Direct2D1 namespace Perspex.Direct2D1

16
src/Windows/Perspex.Win32/Win32Platform.cs

@ -18,14 +18,14 @@ using Perspex.Win32.Interop;
namespace Perspex namespace Perspex
{ {
public static class Win32ApplicationExtensions public static class Win32ApplicationExtensions
{ {
public static AppT UseWin32Subsystem<AppT>(this AppT app) where AppT : Application public static TApp UseWin32<TApp>(this TApp app) where TApp : Application
{ {
Perspex.Win32.Win32Platform.Initialize(); Perspex.Win32.Win32Platform.Initialize();
return app; return app;
} }
} }
} }
namespace Perspex.Win32 namespace Perspex.Win32

Loading…
Cancel
Save