Move Xamarin.Forms renderer initialization (#632)

Also mark Forms.Init() obsolete.
This commit is contained in:
Oystein Bjorke 2015-10-29 22:26:04 +01:00
Родитель 5b99276a73
Коммит 63a9955691
19 изменённых файлов: 104 добавлений и 29 удалений

Просмотреть файл

@ -49,6 +49,9 @@ All notable changes to this project will be documented in this file.
- Change to semantic versioning (#595)
- Change GTKSharp3 project to x86 (#599)
- Change OxyPlot.Xamarin.Android to API Level 15 (#614)
- Add Xamarin.Forms renderer initialization to PlotViewRenderer (#632)
- Marked OxyPlot.Xamarin.Forms.Platform.*.Forms.Init() obsolete (#632)
- Throw exception if Xamarin.Forms renderer is not 'initialized' (#492)
### Removed
- StyleCop tasks (#556)
@ -108,7 +111,6 @@ All notable changes to this project will be documented in this file.
- Rendering math text with syntax error gets stuck in an endless loop (#624)
- Fix issue with MinimumRange not taking Minimum and Maximum values into account (#550)
- Do not set default Controller in PlotView ctor (#436)
- Throw exception if Xamarin.Forms renderer is not 'initialized' (#492)
## [2014.1.546] - 2014-10-22
### Added

Просмотреть файл

@ -17,7 +17,7 @@ namespace IssueDemos.Droid
base.OnCreate(bundle);
global::Xamarin.Forms.Forms.Init(this, bundle);
OxyPlot.Xamarin.Forms.Platform.Android.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
LoadApplication(new App());
}
}

Просмотреть файл

@ -18,7 +18,7 @@ namespace IssueDemos.WinPhone
SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
global::Xamarin.Forms.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.WP8.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.WP8.PlotViewRenderer.Init();
LoadApplication(new IssueDemos.App());
}
}

Просмотреть файл

@ -23,7 +23,7 @@ namespace IssueDemos.iOS
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.iOS.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init();
LoadApplication(new App());
return base.FinishedLaunching(app, options);

Просмотреть файл

@ -19,8 +19,8 @@ namespace SimpleDemo.Droid
{
base.OnCreate(bundle);
OxyPlot.Xamarin.Forms.Platform.Android.Forms.Init();
Xamarin.Forms.Forms.Init(this, bundle);
OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
this.LoadApplication(new App());
}
}

Просмотреть файл

@ -23,8 +23,8 @@ namespace SimpleDemo.WinPhone
this.InitializeComponent();
this.SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
OxyPlot.Xamarin.Forms.Platform.WP8.Forms.Init();
Xamarin.Forms.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.WP8.PlotViewRenderer.Init();
this.LoadApplication(new SimpleDemo.App());
}
}

Просмотреть файл

@ -37,8 +37,8 @@ namespace SimpleDemo.iOS
/// </returns>
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
OxyPlot.Xamarin.Forms.Platform.iOS.Forms.Init();
Xamarin.Forms.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init();
this.LoadApplication(new App());
return base.FinishedLaunching(app, options);

Просмотреть файл

@ -17,7 +17,7 @@ namespace SimpleDemo2.Droid
base.OnCreate (bundle);
global::Xamarin.Forms.Forms.Init (this, bundle);
OxyPlot.Xamarin.Forms.Platform.Android.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();
LoadApplication (new SimpleDemo2.App ());
}
}

Просмотреть файл

@ -18,7 +18,7 @@ namespace SimpleDemo2.WinPhone
SupportedOrientations = SupportedPageOrientation.PortraitOrLandscape;
global::Xamarin.Forms.Forms.Init ();
OxyPlot.Xamarin.Forms.Platform.WP8.Forms.Init();
OxyPlot.Xamarin.Forms.Platform.WP8.PlotViewRenderer.Init();
LoadApplication(new SimpleDemo2.App ());
}
}

Просмотреть файл

@ -23,7 +23,7 @@ namespace SimpleDemo2.iOS
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init ();
OxyPlot.Xamarin.Forms.Platform.iOS.Forms.Init ();
OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init ();
LoadApplication (new SimpleDemo2.App ());
return base.FinishedLaunching (app, options);

Просмотреть файл

@ -9,6 +9,8 @@
namespace OxyPlot.Xamarin.Forms.Platform.Android
{
using System;
/// <summary>
/// Initializes OxyPlot renderers for use with Xamarin.Forms.
/// </summary>
@ -17,12 +19,10 @@ namespace OxyPlot.Xamarin.Forms.Platform.Android
/// <summary>
/// Initializes OxyPlot for Xamarin.Forms.
/// </summary>
/// <remarks>This method must be called before Forms.Init().</remarks>
[Obsolete("Use PlotViewRenderer.Init() instead.")]
public static void Init()
{
// Just bring this assembly into the current appdomain.
// Forms.Init() should now find it!
PlotView.IsRendererInitialized = true;
PlotViewRenderer.Init();
}
}
}

Просмотреть файл

@ -18,11 +18,29 @@ namespace OxyPlot.Xamarin.Forms.Platform.Android
/// </summary>
public class PlotViewRenderer : ViewRenderer<Xamarin.Forms.PlotView, PlotView>
{
/// <summary>
/// Initializes static members of the <see cref="PlotViewRenderer"/> class.
/// </summary>
static PlotViewRenderer()
{
Init();
}
/// <summary>
/// Initializes a new instance of the <see cref="PlotViewRenderer"/> class.
/// </summary>
public PlotViewRenderer()
{
// Do not delete
}
/// <summary>
/// Initializes the renderer.
/// </summary>
/// <remarks>This method must be called before a <see cref="T:PlotView" /> is used.</remarks>
public static void Init()
{
OxyPlot.Xamarin.Forms.PlotView.IsRendererInitialized = true;
}
/// <summary>

Просмотреть файл

@ -9,6 +9,8 @@
namespace OxyPlot.Xamarin.Forms.Platform.WP8
{
using System;
/// <summary>
/// Initializes OxyPlot renderers for use with Xamarin.Forms.
/// </summary>
@ -17,12 +19,10 @@ namespace OxyPlot.Xamarin.Forms.Platform.WP8
/// <summary>
/// Initializes OxyPlot for Xamarin.Forms.
/// </summary>
/// <remarks>This method must be called before Forms.Init().</remarks>
[Obsolete("Use PlotViewRenderer.Init() instead.")]
public static void Init()
{
// Just bring this assembly into the current appdomain.
// Forms.Init() should now find it!
PlotView.IsRendererInitialized = true;
PlotViewRenderer.Init();
}
}
}

Просмотреть файл

@ -18,11 +18,29 @@ namespace OxyPlot.Xamarin.Forms.Platform.WP8
/// </summary>
public class PlotViewRenderer : ViewRenderer<Xamarin.Forms.PlotView, PlotView>
{
/// <summary>
/// Initializes static members of the <see cref="PlotViewRenderer"/> class.
/// </summary>
static PlotViewRenderer()
{
Init();
}
/// <summary>
/// Initializes a new instance of the <see cref="PlotViewRenderer"/> class.
/// </summary>
public PlotViewRenderer()
{
// Do not delete
}
/// <summary>
/// Initializes the renderer.
/// </summary>
/// <remarks>This method must be called before a <see cref="T:PlotView" /> is used.</remarks>
public static void Init()
{
OxyPlot.Xamarin.Forms.PlotView.IsRendererInitialized = true;
}
/// <summary>

Просмотреть файл

@ -9,6 +9,8 @@
namespace OxyPlot.Xamarin.Forms.Platform.iOS.Classic
{
using System;
/// <summary>
/// Initializes OxyPlot renderers for use with Xamarin.Forms.
/// </summary>
@ -17,12 +19,11 @@ namespace OxyPlot.Xamarin.Forms.Platform.iOS.Classic
/// <summary>
/// Initializes OxyPlot for Xamarin.Forms.
/// </summary>
/// <remarks>This method must be called before Forms.Init().</remarks>
/// <remarks>This method must be called before a <see cref="T:PlotView" /> is used.</remarks>
[Obsolete("Use PlotViewRenderer.Init() instead.")]
public static void Init()
{
// Just bring this assembly into the current appdomain.
// Forms.Init() should now find it!
PlotView.IsRendererInitialized = true;
PlotViewRenderer.Init();
}
}
}

Просмотреть файл

@ -18,11 +18,29 @@ namespace OxyPlot.Xamarin.Forms.Platform.iOS.Classic
/// </summary>
public class PlotViewRenderer : ViewRenderer<Xamarin.Forms.PlotView, PlotView>
{
/// <summary>
/// Initializes static members of the <see cref="PlotViewRenderer"/> class.
/// </summary>
static PlotViewRenderer()
{
Init();
}
/// <summary>
/// Initializes a new instance of the <see cref="PlotViewRenderer"/> class.
/// </summary>
public PlotViewRenderer()
{
// Do not delete
}
/// <summary>
/// Initializes the renderer.
/// </summary>
/// <remarks>This method must be called before a <see cref="T:PlotView" /> is used.</remarks>
public static new void Init()
{
OxyPlot.Xamarin.Forms.PlotView.IsRendererInitialized = true;
}
/// <summary>

Просмотреть файл

@ -9,6 +9,8 @@
namespace OxyPlot.Xamarin.Forms.Platform.iOS
{
using System;
/// <summary>
/// Initializes OxyPlot renderers for use with Xamarin.Forms.
/// </summary>
@ -17,12 +19,10 @@ namespace OxyPlot.Xamarin.Forms.Platform.iOS
/// <summary>
/// Initializes OxyPlot for Xamarin.Forms.
/// </summary>
/// <remarks>This method must be called before Forms.Init().</remarks>
[Obsolete("Use PlotViewRenderer.Init() instead.")]
public static void Init()
{
// Just bring this assembly into the current appdomain.
// Forms.Init() should now find it!
PlotView.IsRendererInitialized = true;
PlotViewRenderer.Init();
}
}
}

Просмотреть файл

@ -15,11 +15,29 @@ namespace OxyPlot.Xamarin.Forms.Platform.iOS
/// </summary>
public class PlotViewRenderer : ViewRenderer<Xamarin.Forms.PlotView, PlotView>
{
/// <summary>
/// Initializes static members of the <see cref="PlotViewRenderer"/> class.
/// </summary>
static PlotViewRenderer()
{
Init();
}
/// <summary>
/// Initializes a new instance of the <see cref="PlotViewRenderer"/> class.
/// </summary>
public PlotViewRenderer()
{
// Do not delete
}
/// <summary>
/// Initializes the renderer.
/// </summary>
/// <remarks>This method must be called before a <see cref="T:PlotView" /> is used.</remarks>
public static new void Init()
{
OxyPlot.Xamarin.Forms.PlotView.IsRendererInitialized = true;
}
/// <summary>

Просмотреть файл

@ -43,15 +43,15 @@ namespace OxyPlot.Xamarin.Forms
{
case TargetPlatform.WinPhone:
message +=
"\nRemember to add `OxyPlot.Xamarin.Forms.Platform.WP8.Forms.Init();` after `Xamarin.Forms.Forms.Init();` in the Windows Phone app project.";
"\nRemember to add `OxyPlot.Xamarin.Forms.Platform.WP8.PlotViewRenderer.Init();` after `Xamarin.Forms.Forms.Init();` in the Windows Phone app project.";
break;
case TargetPlatform.Android:
message +=
"\nRemember to add `OxyPlot.Xamarin.Forms.Platform.Android.Forms.Init();` after `Xamarin.Forms.Forms.Init();` in the Android app project.";
"\nRemember to add `OxyPlot.Xamarin.Forms.Platform.Android.PlotViewRenderer.Init();` after `Xamarin.Forms.Forms.Init();` in the Android app project.";
break;
case TargetPlatform.iOS:
message +=
"\nRemember to add `OxyPlot.Xamarin.Forms.Platform.iOS.Forms.Init();` after `Xamarin.Forms.Forms.Init();` in the iOS app project.";
"\nRemember to add `OxyPlot.Xamarin.Forms.Platform.iOS.PlotViewRenderer.Init();` after `Xamarin.Forms.Forms.Init();` in the iOS app project.";
break;
}
throw new InvalidOperationException(message);