diff options
Diffstat (limited to 'Xamarin.Forms.Platform.WinRT')
19 files changed, 46 insertions, 30 deletions
diff --git a/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs b/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs index acc41db3..1b3960e0 100644 --- a/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/ButtonRenderer.cs @@ -155,7 +155,7 @@ namespace Xamarin.Forms.Platform.WinRT 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.WinRT/EditorRenderer.cs b/Xamarin.Forms.Platform.WinRT/EditorRenderer.cs index c69debd2..e67b9d91 100644 --- a/Xamarin.Forms.Platform.WinRT/EditorRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/EditorRenderer.cs @@ -2,6 +2,7 @@ using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; +using Xamarin.Forms.Internals; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/EntryRenderer.cs b/Xamarin.Forms.Platform.WinRT/EntryRenderer.cs index c6e439ea..a02b11cc 100644 --- a/Xamarin.Forms.Platform.WinRT/EntryRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/EntryRenderer.cs @@ -5,6 +5,7 @@ using Windows.Foundation.Metadata; using Windows.System; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; +using Xamarin.Forms.Internals; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/FontExtensions.cs b/Xamarin.Forms.Platform.WinRT/FontExtensions.cs index 069a9975..bdd72775 100644 --- a/Xamarin.Forms.Platform.WinRT/FontExtensions.cs +++ b/Xamarin.Forms.Platform.WinRT/FontExtensions.cs @@ -3,6 +3,7 @@ using Windows.UI.Text; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Documents; using Windows.UI.Xaml.Media; +using Xamarin.Forms.Internals; using WApplication = Windows.UI.Xaml.Application; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs index 6affa169..a16c6345 100644 --- a/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs +++ b/Xamarin.Forms.Platform.WinRT/FrameworkElementExtensions.cs @@ -6,6 +6,7 @@ using System.Reflection; using Windows.UI.Xaml; using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Media; +using Xamarin.Forms.Internals; using WBinding = Windows.UI.Xaml.Data.Binding; using WBindingExpression = Windows.UI.Xaml.Data.BindingExpression; @@ -117,7 +118,7 @@ namespace Xamarin.Forms.Platform.WinRT DependencyProperty foregroundProperty; if (!ForegroundProperties.Value.TryGetValue(type, out foregroundProperty)) { - FieldInfo field = type.GetFields().FirstOrDefault(f => f.Name == "ForegroundProperty"); + FieldInfo field = ReflectionExtensions.GetFields(type).FirstOrDefault(f => f.Name == "ForegroundProperty"); if (field == null) throw new ArgumentException("type is not a Foregroundable type"); diff --git a/Xamarin.Forms.Platform.WinRT/ImageConverter.cs b/Xamarin.Forms.Platform.WinRT/ImageConverter.cs index e111be4c..014c479f 100644 --- a/Xamarin.Forms.Platform.WinRT/ImageConverter.cs +++ b/Xamarin.Forms.Platform.WinRT/ImageConverter.cs @@ -16,7 +16,7 @@ namespace Xamarin.Forms.Platform.WinRT 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<Windows.UI.Xaml.Media.ImageSource> task = handler.LoadImageAsync(source); return new AsyncValue<Windows.UI.Xaml.Media.ImageSource>(task, null); diff --git a/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs b/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs index cc88c87e..a3c9261f 100644 --- a/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs +++ b/Xamarin.Forms.Platform.WinRT/NativeBindingExtensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.ComponentModel; using Windows.UI.Xaml; +using Xamarin.Forms.Internals; using static System.String; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs b/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs index e28ca0eb..d810d79a 100644 --- a/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs +++ b/Xamarin.Forms.Platform.WinRT/NativeEventWrapper.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using System.Runtime.InteropServices.WindowsRuntime; using Windows.UI.Xaml; +using Xamarin.Forms.Internals; #if WINDOWS_UWP namespace Xamarin.Forms.Platform.UWP diff --git a/Xamarin.Forms.Platform.WinRT/PickerRenderer.cs b/Xamarin.Forms.Platform.WinRT/PickerRenderer.cs index 432b1d4f..a7aa16f0 100644 --- a/Xamarin.Forms.Platform.WinRT/PickerRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/PickerRenderer.cs @@ -53,7 +53,7 @@ namespace Xamarin.Forms.Platform.WinRT Control.Loaded += ControlOnLoaded; } - Control.ItemsSource = ((Picker.LockableObservableListWrapper)Element.Items)._list; + Control.ItemsSource = ((LockableObservableListWrapper)Element.Items)._list; UpdateTitle(); UpdateSelectedIndex(); diff --git a/Xamarin.Forms.Platform.WinRT/PlatformWinRT.cs b/Xamarin.Forms.Platform.WinRT/PlatformWinRT.cs index 5e11c8d8..df43345b 100644 --- a/Xamarin.Forms.Platform.WinRT/PlatformWinRT.cs +++ b/Xamarin.Forms.Platform.WinRT/PlatformWinRT.cs @@ -7,6 +7,7 @@ using Windows.UI.Xaml.Controls; using Windows.UI.Xaml.Controls.Primitives; using Windows.UI.Xaml.Media; using Windows.UI.Xaml.Media.Animation; +using Xamarin.Forms.Internals; namespace Xamarin.Forms.Platform.WinRT { diff --git a/Xamarin.Forms.Platform.WinRT/UriImageSourceHandler.cs b/Xamarin.Forms.Platform.WinRT/UriImageSourceHandler.cs index 1263c355..9050c6e7 100644 --- a/Xamarin.Forms.Platform.WinRT/UriImageSourceHandler.cs +++ b/Xamarin.Forms.Platform.WinRT/UriImageSourceHandler.cs @@ -5,6 +5,7 @@ using System.Threading; using System.Threading.Tasks; using Windows.Storage.Streams; using Windows.UI.Xaml.Media.Imaging; +using Xamarin.Forms.Internals; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs b/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs index 402d1da8..9c3a4c94 100644 --- a/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/VisualElementRenderer.cs @@ -309,8 +309,8 @@ namespace Xamarin.Forms.Platform.WinRT protected virtual void OnRegisterEffect(PlatformEffect effect) { - effect.Container = this; - effect.Control = Control; + effect.SetContainer(this); + effect.SetControl(Control); } protected virtual void SetAutomationId(string id) diff --git a/Xamarin.Forms.Platform.WinRT/VisualElementTracker.cs b/Xamarin.Forms.Platform.WinRT/VisualElementTracker.cs index 760b9b30..e8684ff4 100644 --- a/Xamarin.Forms.Platform.WinRT/VisualElementTracker.cs +++ b/Xamarin.Forms.Platform.WinRT/VisualElementTracker.cs @@ -7,6 +7,7 @@ using System.Linq; using Windows.UI.Xaml; using Windows.UI.Xaml.Input; using Windows.UI.Xaml.Media; +using Xamarin.Forms.Internals; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/WebViewRenderer.cs b/Xamarin.Forms.Platform.WinRT/WebViewRenderer.cs index e3fcb898..c768bb5f 100644 --- a/Xamarin.Forms.Platform.WinRT/WebViewRenderer.cs +++ b/Xamarin.Forms.Platform.WinRT/WebViewRenderer.cs @@ -31,6 +31,7 @@ var bases = head.getElementsByTagName('base'); if(bases.length == 0){ head.innerHTML = 'baseTag' + head.innerHTML; }"; + IWebViewController ElementController => Element; public void LoadHtml(string html, string baseUrl) { @@ -98,9 +99,10 @@ if(bases.length == 0){ 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; } if (e.NewElement != null) @@ -114,9 +116,10 @@ if(bases.length == 0){ SetNativeControl(webView); } - e.NewElement.EvalRequested += OnEvalRequested; - e.NewElement.GoForwardRequested += OnGoForwardRequested; - e.NewElement.GoBackRequested += OnGoBackRequested; + var newElementController = e.NewElement as IWebViewController; + newElementController.EvalRequested += OnEvalRequested; + newElementController.GoForwardRequested += OnGoForwardRequested; + newElementController.GoBackRequested += OnGoBackRequested; Load(); } @@ -190,7 +193,7 @@ if(bases.length == 0){ { var args = new WebNavigatingEventArgs(_eventState, new UrlWebViewSource { Url = uri.AbsoluteUri }, uri.AbsoluteUri); - Element.SendNavigating(args); + ElementController.SendNavigating(args); e.Cancel = args.Cancel; // reset in this case because this is the last event we will get @@ -205,7 +208,7 @@ if(bases.length == 0){ ((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; @@ -213,8 +216,8 @@ if(bases.length == 0){ void UpdateCanGoBackForward() { - Element.CanGoBack = Control.CanGoBack; - Element.CanGoForward = Control.CanGoForward; + ElementController.CanGoBack = Control.CanGoBack; + ElementController.CanGoForward = Control.CanGoForward; } } }
\ No newline at end of file diff --git a/Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs b/Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs index e1700a85..c8b3bdaf 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsBasePage.cs @@ -30,7 +30,7 @@ namespace Xamarin.Forms.Platform.WinRT if (application == null) throw new ArgumentNullException("application"); - Application.Current = application; + Application.SetCurrentApplication(application); Platform = CreatePlatform(); Platform.SetPage(Application.Current.MainPage); application.PropertyChanged += OnApplicationPropertyChanged; diff --git a/Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs b/Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs index 235fe2db..07cb847f 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsDeviceInfo.cs @@ -2,6 +2,7 @@ using Windows.Foundation; using Windows.Graphics.Display; using Windows.UI.Xaml; +using Xamarin.Forms.Internals; #if WINDOWS_UWP diff --git a/Xamarin.Forms.Platform.WinRT/WindowsExpressionSearch.cs b/Xamarin.Forms.Platform.WinRT/WindowsExpressionSearch.cs index 778cc135..417b23e5 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsExpressionSearch.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsExpressionSearch.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Reflection; +using Xamarin.Forms.Internals; #if WINDOWS_UWP @@ -159,7 +160,7 @@ namespace Xamarin.Forms.Platform.WinRT object container = ((ConstantExpression)member.Expression).Value; object value = ((FieldInfo)member.Member).GetValue(container); - if (_targeType.IsInstanceOfType(value)) + if (ReflectionExtensions.IsInstanceOfType(_targeType, value)) { _results.Add(value); } diff --git a/Xamarin.Forms.Platform.WinRT/WindowsIsolatedStorage.cs b/Xamarin.Forms.Platform.WinRT/WindowsIsolatedStorage.cs index a6e48fea..42bdc3b8 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsIsolatedStorage.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsIsolatedStorage.cs @@ -4,6 +4,7 @@ using System.Threading.Tasks; using Windows.Storage; using Windows.Storage.FileProperties; using Windows.Storage.Streams; +using Xamarin.Forms.Internals; #if WINDOWS_UWP @@ -63,27 +64,27 @@ namespace Xamarin.Forms.Platform.WinRT return properties.DateModified; } - public async Task<Stream> OpenFileAsync(string path, FileMode mode, FileAccess access) + public async Task<Stream> OpenFileAsync(string path, Internals.FileMode mode, Internals.FileAccess access) { StorageFile file; switch (mode) { - case FileMode.CreateNew: + case Internals.FileMode.CreateNew: file = await _folder.CreateFileAsync(path, CreationCollisionOption.FailIfExists).AsTask().ConfigureAwait(false); break; - case FileMode.Create: - case FileMode.Truncate: // TODO See if ReplaceExisting already truncates + case Internals.FileMode.Create: + case Internals.FileMode.Truncate: // TODO See if ReplaceExisting already truncates file = await _folder.CreateFileAsync(path, CreationCollisionOption.ReplaceExisting).AsTask().ConfigureAwait(false); break; - case FileMode.OpenOrCreate: - case FileMode.Append: + case Internals.FileMode.OpenOrCreate: + case Internals.FileMode.Append: file = await _folder.CreateFileAsync(path, CreationCollisionOption.OpenIfExists).AsTask().ConfigureAwait(false); break; - case FileMode.Open: + case Internals.FileMode.Open: file = await _folder.GetFileAsync(path); break; @@ -93,16 +94,16 @@ namespace Xamarin.Forms.Platform.WinRT switch (access) { - case FileAccess.Read: + case Internals.FileAccess.Read: return await file.OpenStreamForReadAsync().ConfigureAwait(false); - case FileAccess.Write: + case Internals.FileAccess.Write: Stream stream = await file.OpenStreamForWriteAsync().ConfigureAwait(false); - if (mode == FileMode.Append) + if (mode == Internals.FileMode.Append) stream.Position = stream.Length; return stream; - case FileAccess.ReadWrite: + case Internals.FileAccess.ReadWrite: IRandomAccessStream randStream = await file.OpenAsync(FileAccessMode.ReadWrite).AsTask().ConfigureAwait(false); return randStream.AsStream(); @@ -111,7 +112,7 @@ namespace Xamarin.Forms.Platform.WinRT } } - 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) { return OpenFileAsync(path, mode, access); } diff --git a/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs b/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs index 0eeb2f8f..834483d9 100644 --- a/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs +++ b/Xamarin.Forms.Platform.WinRT/WindowsSerializer.cs @@ -5,6 +5,7 @@ using System.IO; using System.Runtime.Serialization; using System.Threading.Tasks; using Windows.Storage; +using Xamarin.Forms.Internals; #if WINDOWS_UWP |