diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WP8')
-rw-r--r-- | Xamarin.Forms.Platform.WP8/ButtonRenderer.cs | 2 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/Converters/ImageConverter.cs | 2 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/Deserializer.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/EntryRenderer.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/Extensions.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/FontExtensions.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/Forms.cs | 6 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/FormsApplicationPage.cs | 2 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/ImageRenderer.cs | 2 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/NavigationMenuRenderer.cs | 5 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/Properties/AssemblyInfo.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/ResourcesProvider.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/TableViewRenderer.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs | 4 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/VisualElementTracker.cs | 1 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/WP8PlatformServices.cs | 4 | ||||
-rw-r--r-- | Xamarin.Forms.Platform.WP8/WebViewRenderer.cs | 26 |
17 files changed, 38 insertions, 23 deletions
diff --git a/Xamarin.Forms.Platform.WP8/ButtonRenderer.cs b/Xamarin.Forms.Platform.WP8/ButtonRenderer.cs index e44d244c..d31d3ba0 100644 --- a/Xamarin.Forms.Platform.WP8/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/ButtonRenderer.cs @@ -111,7 +111,7 @@ namespace Xamarin.Forms.Platform.WinPhone bmp.ImageOpened += (sender, args) => { image.Width = bmp.PixelWidth; image.Height = bmp.PixelHeight; - Element.InvalidateMeasureInternal(InvalidationTrigger.RendererReady); + Element.InvalidateMeasureNonVirtual(InvalidationTrigger.RendererReady); }; // No text, just the image diff --git a/Xamarin.Forms.Platform.WP8/Converters/ImageConverter.cs b/Xamarin.Forms.Platform.WP8/Converters/ImageConverter.cs index 2e8bdef6..d1f650b0 100644 --- a/Xamarin.Forms.Platform.WP8/Converters/ImageConverter.cs +++ b/Xamarin.Forms.Platform.WP8/Converters/ImageConverter.cs @@ -11,7 +11,7 @@ namespace Xamarin.Forms.Platform.WinPhone var source = (ImageSource)value; IImageSourceHandler handler; - if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) + if (source != null && (handler = Internals.Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) { Task<System.Windows.Media.ImageSource> task = handler.LoadImageAsync(source); return new AsyncValue<System.Windows.Media.ImageSource>(task, null); diff --git a/Xamarin.Forms.Platform.WP8/Deserializer.cs b/Xamarin.Forms.Platform.WP8/Deserializer.cs index 29c0e374..8782e72e 100644 --- a/Xamarin.Forms.Platform.WP8/Deserializer.cs +++ b/Xamarin.Forms.Platform.WP8/Deserializer.cs @@ -5,6 +5,7 @@ using System.IO.IsolatedStorage; using System.Runtime.Serialization; using System.Threading.Tasks; using System.Xml; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { diff --git a/Xamarin.Forms.Platform.WP8/EntryRenderer.cs b/Xamarin.Forms.Platform.WP8/EntryRenderer.cs index 2a92d667..20fb7533 100644 --- a/Xamarin.Forms.Platform.WP8/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/EntryRenderer.cs @@ -4,6 +4,7 @@ using System.Diagnostics; using System.Windows; using System.Windows.Input; using System.Windows.Media; +using Xamarin.Forms.Internals; using static System.String; using WControl = System.Windows.Controls.Control; diff --git a/Xamarin.Forms.Platform.WP8/Extensions.cs b/Xamarin.Forms.Platform.WP8/Extensions.cs index 844c75ab..d3eb9209 100644 --- a/Xamarin.Forms.Platform.WP8/Extensions.cs +++ b/Xamarin.Forms.Platform.WP8/Extensions.cs @@ -1,4 +1,5 @@ using Microsoft.Phone.Controls; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { diff --git a/Xamarin.Forms.Platform.WP8/FontExtensions.cs b/Xamarin.Forms.Platform.WP8/FontExtensions.cs index dc4690ea..9ac5baf5 100644 --- a/Xamarin.Forms.Platform.WP8/FontExtensions.cs +++ b/Xamarin.Forms.Platform.WP8/FontExtensions.cs @@ -3,6 +3,7 @@ using System.Windows; using System.Windows.Controls; using System.Windows.Documents; using System.Windows.Media; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { diff --git a/Xamarin.Forms.Platform.WP8/Forms.cs b/Xamarin.Forms.Platform.WP8/Forms.cs index d2a40d12..241b5004 100644 --- a/Xamarin.Forms.Platform.WP8/Forms.cs +++ b/Xamarin.Forms.Platform.WP8/Forms.cs @@ -46,7 +46,7 @@ namespace Xamarin.Forms var accent = System.Windows.Application.Current.Resources["PhoneAccentBrush"] as SolidColorBrush; System.Windows.Media.Color color = accent.Color; - Color.Accent = Color.FromRgba(color.R, color.G, color.B, color.A); + Color.SetAccent(Color.FromRgba(color.R, color.G, color.B, color.A)); Log.Listeners.Add(new DelegateLogListener((c, m) => Console.WriteLine("[{0}] {1}", m, c))); @@ -55,9 +55,9 @@ namespace Xamarin.Forms Registrar.RegisterAll(new[] { typeof(ExportRendererAttribute), typeof(ExportCellAttribute), typeof(ExportImageSourceHandlerAttribute) }); - Ticker.Default = new WinPhoneTicker(); + Ticker.SetDefault(new WinPhoneTicker()); - Device.Idiom = TargetIdiom.Phone; + Device.SetIdiom(TargetIdiom.Phone); ExpressionSearch.Default = new WinPhoneExpressionSearch(); diff --git a/Xamarin.Forms.Platform.WP8/FormsApplicationPage.cs b/Xamarin.Forms.Platform.WP8/FormsApplicationPage.cs index 3fb3ddc0..e5b5dec7 100644 --- a/Xamarin.Forms.Platform.WP8/FormsApplicationPage.cs +++ b/Xamarin.Forms.Platform.WP8/FormsApplicationPage.cs @@ -23,7 +23,7 @@ namespace Xamarin.Forms.Platform.WinPhone protected void LoadApplication(Application application) { - Application.Current = application; + Application.SetCurrentApplication(application); application.PropertyChanged += ApplicationOnPropertyChanged; _application = application; diff --git a/Xamarin.Forms.Platform.WP8/ImageRenderer.cs b/Xamarin.Forms.Platform.WP8/ImageRenderer.cs index ebc50adc..a3d4cacd 100644 --- a/Xamarin.Forms.Platform.WP8/ImageRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/ImageRenderer.cs @@ -82,7 +82,7 @@ namespace Xamarin.Forms.Platform.WinPhone ImageSource source = Element.Source; IImageSourceHandler handler; - if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) + if (source != null && (handler = Internals.Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null) { System.Windows.Media.ImageSource imagesource; try diff --git a/Xamarin.Forms.Platform.WP8/NavigationMenuRenderer.cs b/Xamarin.Forms.Platform.WP8/NavigationMenuRenderer.cs index 83af320b..3613a180 100644 --- a/Xamarin.Forms.Platform.WP8/NavigationMenuRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/NavigationMenuRenderer.cs @@ -2,6 +2,7 @@ using System.ComponentModel; using System.Windows.Media.Imaging; using Microsoft.Phone.Controls; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { @@ -9,6 +10,8 @@ namespace Xamarin.Forms.Platform.WinPhone { const int Spacing = 12; + INavigationMenuController ElementController => Element; + protected override void OnElementChanged(ElementChangedEventArgs<NavigationMenu> e) { base.OnElementChanged(e); @@ -63,7 +66,7 @@ namespace Xamarin.Forms.Platform.WinPhone hubTile.Background = target.BackgroundColor.ToBrush(); Page tmp = target; - hubTile.Tap += (sender, args) => Element.SendTargetSelected(tmp); + hubTile.Tap += (sender, args) => ElementController.SendTargetSelected(tmp); hubTile.SetValue(System.Windows.Controls.Grid.RowProperty, y); hubTile.SetValue(System.Windows.Controls.Grid.ColumnProperty, x); diff --git a/Xamarin.Forms.Platform.WP8/Properties/AssemblyInfo.cs b/Xamarin.Forms.Platform.WP8/Properties/AssemblyInfo.cs index e081584b..0f4e23e0 100644 --- a/Xamarin.Forms.Platform.WP8/Properties/AssemblyInfo.cs +++ b/Xamarin.Forms.Platform.WP8/Properties/AssemblyInfo.cs @@ -3,6 +3,7 @@ using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Xamarin.Forms; +using Xamarin.Forms.Internals; using Xamarin.Forms.Platform.WinPhone; using TableView = Xamarin.Forms.TableView; diff --git a/Xamarin.Forms.Platform.WP8/ResourcesProvider.cs b/Xamarin.Forms.Platform.WP8/ResourcesProvider.cs index 3eaf2a1f..effcb76f 100644 --- a/Xamarin.Forms.Platform.WP8/ResourcesProvider.cs +++ b/Xamarin.Forms.Platform.WP8/ResourcesProvider.cs @@ -1,4 +1,5 @@ using System.Windows.Controls; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { diff --git a/Xamarin.Forms.Platform.WP8/TableViewRenderer.cs b/Xamarin.Forms.Platform.WP8/TableViewRenderer.cs index 4c685613..22e16a67 100644 --- a/Xamarin.Forms.Platform.WP8/TableViewRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/TableViewRenderer.cs @@ -5,6 +5,7 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media; using Microsoft.Phone.Shell; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { diff --git a/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs b/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs index 93788adf..0437bcad 100644 --- a/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/VisualElementRenderer.cs @@ -239,8 +239,8 @@ namespace Xamarin.Forms.Platform.WinPhone protected virtual void OnRegisterEffect(PlatformEffect effect) { - effect.Container = this; - effect.Control = Control; + effect.SetContainer(this); + effect.SetControl(Control); } protected void SetNativeControl(TNativeElement element) diff --git a/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs b/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs index 45b51a95..b206af58 100644 --- a/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs +++ b/Xamarin.Forms.Platform.WP8/VisualElementTracker.cs @@ -6,6 +6,7 @@ using System.Linq; using System.Windows; using System.Windows.Input; using System.Windows.Media; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinPhone { diff --git a/Xamarin.Forms.Platform.WP8/WP8PlatformServices.cs b/Xamarin.Forms.Platform.WP8/WP8PlatformServices.cs index 66126631..788c5f2d 100644 --- a/Xamarin.Forms.Platform.WP8/WP8PlatformServices.cs +++ b/Xamarin.Forms.Platform.WP8/WP8PlatformServices.cs @@ -169,13 +169,13 @@ namespace Xamarin.Forms return Task.FromResult(_isolatedStorageFile.GetLastWriteTime(path)); } - public Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access) + public Task<Stream> OpenFileAsync(string path, Internals.FileMode mode, Internals.FileAccess access) { Stream stream = _isolatedStorageFile.OpenFile(path, (System.IO.FileMode)mode, (System.IO.FileAccess)access); return Task.FromResult(stream); } - public Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access, FileShare share) + public Task<Stream> OpenFileAsync(string path, Internals.FileMode mode, Internals.FileAccess access, Internals.FileShare share) { Stream stream = _isolatedStorageFile.OpenFile(path, (System.IO.FileMode)mode, (System.IO.FileAccess)access, (System.IO.FileShare)share); return Task.FromResult(stream); diff --git a/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs b/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs index d120cff8..33f73397 100644 --- a/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs +++ b/Xamarin.Forms.Platform.WP8/WebViewRenderer.cs @@ -14,6 +14,8 @@ namespace Xamarin.Forms.Platform.WinPhone WebNavigationEvent _eventState; bool _updating; + IWebViewController ElementController => Element; + public async void LoadHtml(string html, string baseUrl) { string fileName = string.Format("formslocal_{0}.html", DateTime.Now.Ticks); @@ -43,17 +45,19 @@ namespace Xamarin.Forms.Platform.WinPhone if (e.OldElement != null) { - e.OldElement.EvalRequested -= OnEvalRequested; - e.OldElement.GoBackRequested -= OnGoBackRequested; - e.OldElement.GoForwardRequested -= OnGoForwardRequested; + var oldElementController = e.OldElement as IWebViewController; + oldElementController.EvalRequested -= OnEvalRequested; + oldElementController.GoBackRequested -= OnGoBackRequested; + oldElementController.GoForwardRequested -= OnGoForwardRequested; Control.DataContext = null; } if (e.NewElement != null) { - e.NewElement.EvalRequested += OnEvalRequested; - e.NewElement.GoBackRequested += OnGoBackRequested; - e.NewElement.GoForwardRequested += OnGoForwardRequested; + var newElementController = e.NewElement as IWebViewController; + newElementController.EvalRequested += OnEvalRequested; + newElementController.GoBackRequested += OnGoBackRequested; + newElementController.GoForwardRequested += OnGoForwardRequested; Control.DataContext = e.NewElement; } @@ -110,7 +114,7 @@ namespace Xamarin.Forms.Platform.WinPhone async Task SaveToIsoStore(string fileName, string html) { IIsolatedStorageFile store = Device.PlatformServices.GetUserStoreForApplication(); - using (Stream file = await store.OpenFileAsync(fileName, FileMode.CreateNew, FileAccess.Write).ConfigureAwait(false)) + using (Stream file = await store.OpenFileAsync(fileName, Internals.FileMode.CreateNew, Internals.FileAccess.Write).ConfigureAwait(false)) { byte[] bytes = Encoding.UTF8.GetBytes(html); await file.WriteAsync(bytes, 0, bytes.Length).ConfigureAwait(false); @@ -123,7 +127,7 @@ namespace Xamarin.Forms.Platform.WinPhone ((IElementController)Element).SetValueFromRenderer(WebView.SourceProperty, source); _updating = false; - Element.SendNavigated(new WebNavigatedEventArgs(evnt, source, source.Url, result)); + ElementController.SendNavigated(new WebNavigatedEventArgs(evnt, source, source.Url, result)); UpdateCanGoBackForward(); _eventState = WebNavigationEvent.NewPage; @@ -132,8 +136,8 @@ namespace Xamarin.Forms.Platform.WinPhone // Nasty hack because we cant bind this because OneWayToSource isn't a thing in WP8, yay void UpdateCanGoBackForward() { - Element.CanGoBack = Control.CanGoBack; - Element.CanGoForward = Control.CanGoForward; + ElementController.CanGoBack = Control.CanGoBack; + ElementController.CanGoForward = Control.CanGoForward; } void WebBrowserOnNavigated(object sender, System.Windows.Navigation.NavigationEventArgs navigationEventArgs) @@ -149,7 +153,7 @@ namespace Xamarin.Forms.Platform.WinPhone string url = navigatingEventArgs.Uri.IsAbsoluteUri ? navigatingEventArgs.Uri.AbsoluteUri : navigatingEventArgs.Uri.OriginalString; var args = new WebNavigatingEventArgs(_eventState, new UrlWebViewSource { Url = url }, url); - Element.SendNavigating(args); + ElementController.SendNavigating(args); navigatingEventArgs.Cancel = args.Cancel; |