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()
{
InitializeLogging();
InitializeLogging();
new App()
.UseWin32Subsystem()
.UseDirect2D()
.LoadFromXaml()
.RunWithMainWindow<MainWindow>();
new App()
.UseWin32()
.UseDirect2D()
.LoadFromXaml()
.RunWithMainWindow<MainWindow>();
}
private static void InitializeLogging()
private static void InitializeLogging()
{
#if DEBUG
SerilogLogger.Initialize(new LoggerConfiguration()

4
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();
}
}
}

8
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();
}
}
}
}

4
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();
}
}
}

232
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<MainWindow>();
}
// 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<MainWindow>();
}
// 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
};
/// <summary>
/// Default (Optimal) render system for a particular platform
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Returns an array of avalidable rendering systems in priority order
/// </summary>
/// <returns></returns>
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];
}
/// <summary>
/// Selects the optimal render system for desktop platforms. Supports cmd line overrides
/// </summary>
/// <param name="app"></param>
/// <param name="args"></param>
public static AppT ConfigureRenderSystem<AppT>(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
};
/// <summary>
/// Default (Optimal) render system for a particular platform
/// </summary>
/// <returns></returns>
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;
}
/// <summary>
/// Returns an array of avalidable rendering systems in priority order
/// </summary>
/// <returns></returns>
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];
}
/// <summary>
/// Selects the optimal render system for desktop platforms. Supports cmd line overrides
/// </summary>
/// <param name="app"></param>
/// <param name="args"></param>
public static TApp ConfigureRenderSystem<TApp>(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;
}
}
}

38
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();
}
}
}

2
samples/XamlTestApplication/App.cs

@ -7,5 +7,5 @@ using Serilog;
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)
{
// 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<Views.MainWindow>();
new XamlTestApp()
.UseWin32()
.UseDirect2D()
.LoadFromXaml()
.RunWithMainWindow<Views.MainWindow>();
}
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
}
}
}
}
}

2
samples/XamlTestApplicationPcl/XamlTestApp.cs

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

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

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

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

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

16
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<ObjectT>(this ObjectT obj)
{
Markup.Xaml.PerspexXamlLoader.Load(obj);
return obj;
}
}
public static class XamlObjectExtensions
{
public static TObject LoadFromXaml<TObject>(this TObject obj)
{
Markup.Xaml.PerspexXamlLoader.Load(obj);
return obj;
}
}
}

4
src/Perspex.Controls/Window.cs

@ -330,9 +330,9 @@ namespace Perspex
{
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();
app.Run(window);
}

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

@ -5,14 +5,14 @@ using Perspex.Platform;
namespace Perspex
{
public static class SkiaApplicationExtensions
{
public static AppT UseSkia<AppT>(this AppT app) where AppT : Application
{
Perspex.Skia.SkiaPlatform.Initialize();
return app;
}
}
public static class SkiaApplicationExtensions
{
public static TApp UseSkia<TApp>(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<IPlatformRenderInterface>().ToConstant(new PlatformRenderInterface());
public static bool ForceSoftwareRendering

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

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

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

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

Loading…
Cancel
Save