From 50a67c6c42ad5b999c1de0959e8e58da92367407 Mon Sep 17 00:00:00 2001 From: Tomasz Cielecki Date: Tue, 10 Jan 2023 16:22:51 +0100 Subject: [PATCH 1/3] Fix nullable warnings with a lot of Mvx.IoCProvider usages (#4543) Co-authored-by: Tomasz Cielecki --- .../MvxRecyclerViewAttributeExtensions.cs | 6 +- .../RecyclerView/MvxRecyclerAdapter.cs | 618 +++++++++--------- .../RecyclerView/MvxRecyclerView.cs | 326 +++++---- MvvmCross.Plugins/Color/BasePlugin.cs | 4 +- .../MvxDefaultColorBindingSet.cs | 3 +- .../Color/Platforms/Android/Plugin.cs | 6 +- .../Color/Platforms/Ios/Plugin.cs | 2 +- .../Platforms/Uap/MvxColorDesignTimeHelper.cs | 2 +- .../Color/Platforms/Uap/Plugin.cs | 2 +- .../WinUi/MvxColorDesignTimeHelper.cs | 2 +- .../Color/Platforms/WinUi/Plugin.cs | 2 +- .../Color/Platforms/Wpf/Plugin.cs | 2 +- MvvmCross.Plugins/FieldBinding/Plugin.cs | 2 +- MvvmCross.Plugins/Json/Plugin.cs | 4 +- MvvmCross.Plugins/Messenger/Plugin.cs | 2 +- MvvmCross.Plugins/MethodBinding/Plugin.cs | 2 +- .../Platforms/Android/Plugin.cs | 2 +- .../ResourceLoader/Platforms/Ios/Plugin.cs | 2 +- .../ResourceLoader/Platforms/Uap/Plugin.cs | 2 +- .../ResourceLoader/Platforms/WinUi/Plugin.cs | 2 +- .../ResourceLoader/Platforms/Wpf/Plugin.cs | 2 +- MvvmCross.Plugins/Visibility/BasePlugin.cs | 2 +- .../Visibility/Platforms/Android/Plugin.cs | 2 +- .../Visibility/Platforms/Console/Plugin.cs | 2 +- .../Visibility/Platforms/Ios/Plugin.cs | 2 +- .../Visibility/Platforms/Uap/Plugin.cs | 2 +- .../Visibility/Platforms/WinUi/Plugin.cs | 2 +- .../Visibility/Platforms/Wpf/Plugin.cs | 2 +- .../MvxUnitTestCommandExtensions.cs | 8 +- MvvmCross/Commands/MvxCommand.cs | 4 +- MvvmCross/IoC/MvxPropertyInjector.cs | 2 +- MvvmCross/Localization/MvxLanguageBinder.cs | 2 +- MvvmCross/Logging/MvxLogHost.cs | 46 +- .../MvxAndroidBindingContextHelpers.cs | 5 +- .../Binding/Views/MvxLayoutInflater.cs | 4 +- .../MvxFragmentPresentationAttribute.cs | 2 +- .../MvxTabLayoutPresentationAttribute.cs | 2 +- ...xViewPagerFragmentPresentationAttribute.cs | 2 +- .../Fragments/MvxBindingFragmentAdapter.cs | 6 +- .../Android/Views/MvxActivityAdapter.cs | 6 +- .../Views/MvxActivityViewExtensions.cs | 13 +- .../Android/Views/MvxSplashScreenActivity.cs | 2 +- .../Ios/Core/MvxApplicationDelegate.cs | 2 +- .../Ios/MvxIosMajorVersionChecker.cs | 6 +- .../Views/MvxBindingViewControllerAdapter.cs | 4 +- .../Ios/Views/MvxTabBarViewController.cs | 2 +- .../Mac/Core/MvxApplicationDelegate.cs | 2 +- .../Tvos/Core/MvxApplicationDelegate.cs | 2 +- .../Tvos/MvxTvosMajorVersionChecker.cs | 2 +- .../Tvos/Views/MvxTabBarViewController.cs | 2 +- MvvmCross/ViewModels/MvxApplication.cs | 8 +- Projects/Playground/Playground.Core/App.cs | 2 +- .../Base/MvxIoCPropertyInjectionTest.cs | 5 + .../MvxStringDictionaryTextSerializerTest.cs | 2 +- 54 files changed, 565 insertions(+), 587 deletions(-) diff --git a/MvvmCross.DroidX/RecyclerView/AttributeHelpers/MvxRecyclerViewAttributeExtensions.cs b/MvvmCross.DroidX/RecyclerView/AttributeHelpers/MvxRecyclerViewAttributeExtensions.cs index 2d246b7105..7c44dacc13 100644 --- a/MvvmCross.DroidX/RecyclerView/AttributeHelpers/MvxRecyclerViewAttributeExtensions.cs +++ b/MvvmCross.DroidX/RecyclerView/AttributeHelpers/MvxRecyclerViewAttributeExtensions.cs @@ -60,21 +60,21 @@ public static IMvxTemplateSelector BuildItemTemplateSelector(Context context, IA "Sorry but type with class name: {TemplateSelectorClassName} does not exist." + "Make sure you have provided full Type name: namespace + class name, AssemblyName." + "Example (check Example.Droid sample!): Example.Droid.Common.TemplateSelectors.MultiItemTemplateModelTemplateSelector, Example.Droid"; - MvxAndroidLog.Instance.Log(LogLevel.Error, message, templateSelectorClassName); + MvxAndroidLog.Instance?.Log(LogLevel.Error, message, templateSelectorClassName); throw new InvalidOperationException(message); } if (!typeof(IMvxTemplateSelector).IsAssignableFrom(type)) { const string message = "Sorry but type: {Type} does not implement {TemplateSelectorType} interface."; - MvxAndroidLog.Instance.Log(LogLevel.Error, message, type, nameof(IMvxTemplateSelector)); + MvxAndroidLog.Instance?.Log(LogLevel.Error, message, type, nameof(IMvxTemplateSelector)); throw new InvalidOperationException(message); } if (type.IsAbstract) { const string message = "Sorry can not instatiate {TemplateSelectorType} as provided type: {Type} is abstract/interface."; - MvxAndroidLog.Instance.Log(LogLevel.Error, message, nameof(IMvxTemplateSelector), type); + MvxAndroidLog.Instance?.Log(LogLevel.Error, message, nameof(IMvxTemplateSelector), type); throw new InvalidOperationException(message); } diff --git a/MvvmCross.DroidX/RecyclerView/MvxRecyclerAdapter.cs b/MvvmCross.DroidX/RecyclerView/MvxRecyclerAdapter.cs index 3ac2d86ef7..f981ac5290 100644 --- a/MvvmCross.DroidX/RecyclerView/MvxRecyclerAdapter.cs +++ b/MvvmCross.DroidX/RecyclerView/MvxRecyclerAdapter.cs @@ -1,423 +1,423 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. - -using System; +#nullable enable using System.Collections; using System.Collections.Specialized; using System.Windows.Input; using Android.OS; using Android.Runtime; using Android.Views; -using Android.Widget; using Microsoft.Extensions.Logging; using MvvmCross.Binding; using MvvmCross.Binding.Attributes; using MvvmCross.Binding.Extensions; using MvvmCross.DroidX.RecyclerView.ItemTemplates; using MvvmCross.DroidX.RecyclerView.Model; -using MvvmCross.Logging; using MvvmCross.Platforms.Android.Binding.BindingContext; using MvvmCross.WeakSubscription; using Object = Java.Lang.Object; using RecyclerViewAdapter = AndroidX.RecyclerView.Widget.RecyclerView.Adapter; using ViewHolder = AndroidX.RecyclerView.Widget.RecyclerView.ViewHolder; -namespace MvvmCross.DroidX.RecyclerView +namespace MvvmCross.DroidX.RecyclerView; + +[Register("mvvmcross.droidx.recyclerview.MvxRecyclerAdapter")] +public class MvxRecyclerAdapter + : RecyclerViewAdapter, IMvxRecyclerAdapter, IMvxRecyclerAdapterBindableHolder { -#nullable enable - [Register("mvvmcross.droidx.recyclerview.MvxRecyclerAdapter")] - public class MvxRecyclerAdapter - : RecyclerViewAdapter, IMvxRecyclerAdapter, IMvxRecyclerAdapterBindableHolder - { - public event Action? MvxViewHolderBound; + public event Action? MvxViewHolderBound; - private ICommand? _itemClick, _itemLongClick; - private IEnumerable? _itemsSource; - private IDisposable? _subscription; - private IMvxTemplateSelector? _itemTemplateSelector; + private ICommand? _itemClick, _itemLongClick; + private IEnumerable? _itemsSource; + private IDisposable? _subscription; + private IMvxTemplateSelector? _itemTemplateSelector; - protected IMvxAndroidBindingContext? BindingContext { get; } + protected IMvxAndroidBindingContext? BindingContext { get; } - public bool ReloadOnAllItemsSourceSets { get; set; } + public bool ReloadOnAllItemsSourceSets { get; set; } - public int ItemTemplateId { get; set; } + public int ItemTemplateId { get; set; } - public MvxRecyclerAdapter() - : this(null) - { - } + public MvxRecyclerAdapter() + : this(null) + { + } - public MvxRecyclerAdapter(IMvxAndroidBindingContext? bindingContext) - { - BindingContext = bindingContext ?? MvxAndroidBindingContextHelpers.Current(); - } + public MvxRecyclerAdapter(IMvxAndroidBindingContext? bindingContext) + { + BindingContext = bindingContext ?? MvxAndroidBindingContextHelpers.Current(); + } - [Android.Runtime.Preserve(Conditional = true)] - protected MvxRecyclerAdapter(IntPtr javaReference, JniHandleOwnership transfer) - : base(javaReference, transfer) - { - } + [Android.Runtime.Preserve(Conditional = true)] + protected MvxRecyclerAdapter(IntPtr javaReference, JniHandleOwnership transfer) + : base(javaReference, transfer) + { + } - /// - /// Get or set the to trigger when an item was clicked. - /// - [MvxSetToNullAfterBinding] - public ICommand? ItemClick + /// + /// Get or set the to trigger when an item was clicked. + /// + [MvxSetToNullAfterBinding] + public ICommand? ItemClick + { + get => _itemClick; + set { - get => _itemClick; - set - { - if (ReferenceEquals(_itemClick, value)) - return; - - if (_itemClick != null && value != null) - MvxAndroidLog.Instance.Log(LogLevel.Warning, "Changing ItemClick may cause inconsistencies where some items still call the old command."); + if (ReferenceEquals(_itemClick, value)) + return; - _itemClick = value; + if (_itemClick != null && value != null) + { + MvxAndroidLog.Instance?.Log(LogLevel.Warning, + "Changing ItemClick may cause inconsistencies where some items still call the old command"); } + + _itemClick = value; } + } - /// - /// Get or set the to trigger when an item was long clicked. - /// - [MvxSetToNullAfterBinding] - public ICommand? ItemLongClick + /// + /// Get or set the to trigger when an item was long clicked. + /// + [MvxSetToNullAfterBinding] + public ICommand? ItemLongClick + { + get => _itemLongClick; + set { - get => _itemLongClick; - set - { - if (ReferenceEquals(_itemLongClick, value)) - return; - - if (_itemLongClick != null && value != null) - MvxAndroidLog.Instance.Log(LogLevel.Warning, "Changing ItemLongClick may cause inconsistencies where some items still call the old command."); + if (ReferenceEquals(_itemLongClick, value)) + return; - _itemLongClick = value; + if (_itemLongClick != null && value != null) + { + MvxAndroidLog.Instance.Log(LogLevel.Warning, + "Changing ItemLongClick may cause inconsistencies where some items still call the old command"); } - } - /// - /// Get or set the ItemSource to use in this adapter. - /// - /// It is recommended to use a type inheriting from , such as - /// , - /// or - /// . - /// - /// - [MvxSetToNullAfterBinding] - public virtual IEnumerable? ItemsSource - { - get => _itemsSource; - set => SetItemsSource(value); + _itemLongClick = value; } + } - /// - /// Get or set the ItemTemplateSelector. - /// - [MvxSetToNullAfterBinding] - public virtual IMvxTemplateSelector? ItemTemplateSelector + /// + /// Get or set the ItemSource to use in this adapter. + /// + /// It is recommended to use a type inheriting from , such as + /// , + /// or + /// . + /// + /// + [MvxSetToNullAfterBinding] + public virtual IEnumerable? ItemsSource + { + get => _itemsSource; + set => SetItemsSource(value); + } + + /// + /// Get or set the ItemTemplateSelector. + /// + [MvxSetToNullAfterBinding] + public virtual IMvxTemplateSelector? ItemTemplateSelector + { + get => _itemTemplateSelector; + set { - get => _itemTemplateSelector; - set - { - if (ReferenceEquals(_itemTemplateSelector, value)) - return; + if (ReferenceEquals(_itemTemplateSelector, value)) + return; - _itemTemplateSelector = value; + _itemTemplateSelector = value; - // since the template selector has changed then let's force the list to redisplay by firing NotifyDataSetChanged() - if (_itemsSource != null) - NotifyDataSetChanged(); - } + // since the template selector has changed then let's force the list to redisplay by firing NotifyDataSetChanged() + if (_itemsSource != null) + NotifyDataSetChanged(); } + } - public override void OnViewAttachedToWindow(Object holder) - { - base.OnViewAttachedToWindow(holder); - - if (holder is IMvxRecyclerViewHolder mvxViewHolder) - { - mvxViewHolder.OnAttachedToWindow(); - } - } + public override void OnViewAttachedToWindow(Object holder) + { + base.OnViewAttachedToWindow(holder); - public override void OnViewDetachedFromWindow(Object holder) + if (holder is IMvxRecyclerViewHolder mvxViewHolder) { - if (holder is IMvxRecyclerViewHolder mvxViewHolder) - { - mvxViewHolder.OnDetachedFromWindow(); - } - - base.OnViewDetachedFromWindow(holder); + mvxViewHolder.OnAttachedToWindow(); } + } - public override int GetItemViewType(int position) + public override void OnViewDetachedFromWindow(Object holder) + { + if (holder is IMvxRecyclerViewHolder mvxViewHolder) { - if (ItemTemplateSelector == null) - throw new InvalidOperationException("ItemTemplateSelector is null or not the default template selector"); - - var itemAtPosition = GetItem(position); - var viewTypeIndex = ItemTemplateSelector.GetItemViewType(itemAtPosition); - var viewType = ItemTemplateSelector.GetItemLayoutId(viewTypeIndex); - return viewType; + mvxViewHolder.OnDetachedFromWindow(); } - public override ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) - { - if (parent == null) - throw new ArgumentNullException(nameof(parent), "parent is null, cannot get Android Context."); - - if (BindingContext == null) - throw new InvalidOperationException("BindingContext is null. Cannot inflate view for ViewHolder"); + base.OnViewDetachedFromWindow(holder); + } - var itemBindingContext = new MvxAndroidBindingContext(parent.Context, BindingContext.LayoutInflaterHolder); - var view = InflateViewForHolder(parent, viewType, itemBindingContext); - var viewHolder = new MvxRecyclerViewHolder(view, itemBindingContext) - { - Id = viewType - }; + public override int GetItemViewType(int position) + { + if (ItemTemplateSelector == null) + throw new InvalidOperationException("ItemTemplateSelector is null or not the default template selector"); - return viewHolder; - } + var itemAtPosition = GetItem(position); + var viewTypeIndex = ItemTemplateSelector.GetItemViewType(itemAtPosition); + var viewType = ItemTemplateSelector.GetItemLayoutId(viewTypeIndex); + return viewType; + } - /// - /// Inflate the View for a ViewHolder - /// - /// Parent the View gets it layout parameters from - /// This is the layout ID to inflate. - /// This will typically come from the assigned to this instance. - /// The used for binding of the inflated layout. - /// Returns a with the view of the ViewHolder. - protected virtual View InflateViewForHolder(ViewGroup parent, int viewType, IMvxAndroidBindingContext bindingContext) - { - if (bindingContext == null) - throw new ArgumentNullException(nameof(bindingContext), "BindingContext is null. Cannot inflate view"); + public override ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) + { + if (parent == null) + throw new ArgumentNullException(nameof(parent), "parent is null, cannot get Android Context."); - return bindingContext.BindingInflate(viewType, parent, false); - } + if (BindingContext == null) + throw new InvalidOperationException("BindingContext is null. Cannot inflate view for ViewHolder"); - public override void OnBindViewHolder(ViewHolder holder, int position) + var itemBindingContext = new MvxAndroidBindingContext(parent.Context, BindingContext.LayoutInflaterHolder); + var view = InflateViewForHolder(parent, viewType, itemBindingContext); + var viewHolder = new MvxRecyclerViewHolder(view, itemBindingContext) { - var dataContext = GetItem(position); - if (holder is IMvxRecyclerViewHolder viewHolder) - { - viewHolder.DataContext = dataContext; + Id = viewType + }; - CheckIfSimpleListItem(holder, viewHolder, dataContext); + return viewHolder; + } - AttachClickListeners(viewHolder); - } + /// + /// Inflate the View for a ViewHolder + /// + /// Parent the View gets it layout parameters from + /// This is the layout ID to inflate. + /// This will typically come from the assigned to this instance. + /// The used for binding of the inflated layout. + /// Returns a with the view of the ViewHolder. + protected virtual View InflateViewForHolder(ViewGroup parent, int viewType, IMvxAndroidBindingContext bindingContext) + { + if (bindingContext == null) + throw new ArgumentNullException(nameof(bindingContext), "BindingContext is null. Cannot inflate view"); - OnMvxViewHolderBound(new MvxViewHolderBoundEventArgs(position, dataContext, holder)); - } + return bindingContext.BindingInflate(viewType, parent, false); + } - public override void OnViewRecycled(Object holder) + public override void OnBindViewHolder(ViewHolder holder, int position) + { + var dataContext = GetItem(position); + if (holder is IMvxRecyclerViewHolder viewHolder) { - if (holder is IMvxRecyclerViewHolder viewHolder) - { - viewHolder.Click -= OnItemViewClick; - viewHolder.LongClick -= OnItemViewLongClick; - viewHolder.OnViewRecycled(); - } + viewHolder.DataContext = dataContext; + + CheckIfSimpleListItem(holder, viewHolder, dataContext); + + AttachClickListeners(viewHolder); } - public override void OnDetachedFromRecyclerView(AndroidX.RecyclerView.Widget.RecyclerView recyclerView) + OnMvxViewHolderBound(new MvxViewHolderBoundEventArgs(position, dataContext, holder)); + } + + public override void OnViewRecycled(Object holder) + { + if (holder is IMvxRecyclerViewHolder viewHolder) { - base.OnDetachedFromRecyclerView(recyclerView); - Clean(false); + viewHolder.Click -= OnItemViewClick; + viewHolder.LongClick -= OnItemViewLongClick; + viewHolder.OnViewRecycled(); } + } - /// - /// By default, force recycling a view if it has animations - /// - public override bool OnFailedToRecycleView(Object holder) => true; + public override void OnDetachedFromRecyclerView(AndroidX.RecyclerView.Widget.RecyclerView recyclerView) + { + base.OnDetachedFromRecyclerView(recyclerView); + Clean(false); + } - protected virtual void OnItemViewClick(object? sender, EventArgs? e) + /// + /// By default, force recycling a view if it has animations + /// + public override bool OnFailedToRecycleView(Object holder) => true; + + protected virtual void OnItemViewClick(object? sender, EventArgs? e) + { + if (sender is IMvxRecyclerViewHolder holder) { - if (sender is IMvxRecyclerViewHolder holder) - { - ExecuteCommandOnItem(ItemClick, holder.DataContext); - } + ExecuteCommandOnItem(ItemClick, holder.DataContext); } + } - protected virtual void OnItemViewLongClick(object? sender, EventArgs? e) + protected virtual void OnItemViewLongClick(object? sender, EventArgs? e) + { + if (sender is IMvxRecyclerViewHolder holder) { - if (sender is IMvxRecyclerViewHolder holder) - { - ExecuteCommandOnItem(ItemLongClick, holder.DataContext); - } + ExecuteCommandOnItem(ItemLongClick, holder.DataContext); } + } - protected virtual void ExecuteCommandOnItem(ICommand? command, object itemDataContext) + protected virtual void ExecuteCommandOnItem(ICommand? command, object? itemDataContext) + { + if (command?.CanExecute(itemDataContext) == true && itemDataContext != null) { - if (command?.CanExecute(itemDataContext) == true && itemDataContext != null) - { - command.Execute(itemDataContext); - } + command.Execute(itemDataContext); } + } - public override int ItemCount => _itemsSource?.Count() ?? 0; + public override int ItemCount => _itemsSource?.Count() ?? 0; - /// - /// Get item from at provided . - /// - /// Position to get item from - /// Returns object at given - public virtual object? GetItem(int viewPosition) + /// + /// Get item from at provided . + /// + /// Position to get item from + /// Returns object at given + public virtual object? GetItem(int viewPosition) + { + var itemsSourcePosition = GetItemsSourcePosition(viewPosition); + + //Do not check if viewPosition is in the range for non IList enumerables. Ie: do not call Count() on the list, as it triggers a full enumeration and kills performance for a streaming source. + if (ItemsSource is IList items) { - var itemsSourcePosition = GetItemsSourcePosition(viewPosition); + if (itemsSourcePosition >= 0 && itemsSourcePosition < items.Count) + return items[itemsSourcePosition]; + MvxAndroidLog.Instance?.Log(LogLevel.Error, + "MvxRecyclerView GetItem index out of range. viewPosition: {ViewPosition}, itemsSourcePosition: {ItemsSourcePosition}, itemCount: {ItemsSourceCount}", + viewPosition, itemsSourcePosition, _itemsSource.Count()); + //We should trigger an exception instead of hiding it here, as it means you have bugs in your code. + return null; + } - //Do not check if viewPosition is in the range for non IList enumerables. Ie: do not call Count() on the list, as it triggers a full enumeration and kills performance for a streaming source. - if (ItemsSource is IList items) - { - if (itemsSourcePosition >= 0 && itemsSourcePosition < items.Count) - return items[itemsSourcePosition]; - MvxAndroidLog.Instance.Log(LogLevel.Error, - "MvxRecyclerView GetItem index out of range. viewPosition: {ViewPosition}, itemsSourcePosition: {ItemsSourcePosition}, itemCount: {ItemsSourceCount}", - viewPosition, itemsSourcePosition, _itemsSource.Count()); - //We should trigger an exception instead of hiding it here, as it means you have bugs in your code. - return null; - } + //May crash if itemsSourcePosition is out or range. Which should never happen anyway, except when you have bugs in your code. + return _itemsSource?.ElementAt(itemsSourcePosition); + } - //May crash if itemsSourcePosition is out or range. Which should never happen anyway, except when you have bugs in your code. - return _itemsSource?.ElementAt(itemsSourcePosition); - } + protected virtual int GetViewPosition(object item) + { + var itemsSourcePosition = _itemsSource.GetPosition(item); + return GetViewPosition(itemsSourcePosition); + } - protected virtual int GetViewPosition(object item) - { - var itemsSourcePosition = _itemsSource.GetPosition(item); - return GetViewPosition(itemsSourcePosition); - } + protected virtual int GetViewPosition(int itemsSourcePosition) + { + return itemsSourcePosition; + } - protected virtual int GetViewPosition(int itemsSourcePosition) - { - return itemsSourcePosition; - } + protected virtual int GetItemsSourcePosition(int viewPosition) + { + return viewPosition; + } - protected virtual int GetItemsSourcePosition(int viewPosition) + protected virtual void SetItemsSource(IEnumerable? value) + { + if (Looper.MainLooper != Looper.MyLooper()) { - return viewPosition; + MvxAndroidLog.Instance.Log(LogLevel.Error, + "ItemsSource property set on a worker thread. This leads to crash in the RecyclerView. It must be set only from the main thread"); } - protected virtual void SetItemsSource(IEnumerable? value) - { - if (Looper.MainLooper != Looper.MyLooper()) - { - MvxAndroidLog.Instance.Log(LogLevel.Error, - "ItemsSource property set on a worker thread. This leads to crash in the RecyclerView. It must be set only from the main thread."); - } + if (ReferenceEquals(_itemsSource, value) && !ReloadOnAllItemsSourceSets) + return; - if (ReferenceEquals(_itemsSource, value) && !ReloadOnAllItemsSourceSets) - return; + _subscription?.Dispose(); + _subscription = null; - _subscription?.Dispose(); - _subscription = null; + if (value != null && value is not IList) + { + MvxBindingLog.Warning("Binding to IEnumerable rather than IList - this can be inefficient, especially for large lists"); + } - if (value != null && !(value is IList)) - { - MvxBindingLog.Warning("Binding to IEnumerable rather than IList - this can be inefficient, especially for large lists"); - } + if (value is INotifyCollectionChanged newObservable) + _subscription = newObservable.WeakSubscribe(OnItemsSourceCollectionChanged); - if (value is INotifyCollectionChanged newObservable) - _subscription = newObservable.WeakSubscribe(OnItemsSourceCollectionChanged); + _itemsSource = value; + NotifyDataSetChanged(); + } - _itemsSource = value; - NotifyDataSetChanged(); - } + protected virtual void OnItemsSourceCollectionChanged(object? sender, NotifyCollectionChangedEventArgs e) + { + if (_subscription == null || _itemsSource == null) //Object disposed + return; - protected virtual void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventArgs e) + if (Looper.MainLooper == Looper.MyLooper()) { - if (_subscription == null || _itemsSource == null) //Object disposed - return; - - if (Looper.MainLooper == Looper.MyLooper()) - { - NotifyDataSetChanged(e); - } - else - { - MvxAndroidLog.Instance.Log(LogLevel.Error, - "ItemsSource collection content changed on a worker thread." + - "This leads to crash in the RecyclerView as it will not be aware of changes" + - "immediatly and may get a deleted item or update an item with a bad item template." + - "All changes must be synchronized on the main thread."); - } + NotifyDataSetChanged(e); } - - public virtual void NotifyDataSetChanged(NotifyCollectionChangedEventArgs e) + else { - if (e == null) - { - NotifyDataSetChanged(); - return; - } - - switch (e.Action) - { - case NotifyCollectionChangedAction.Add: - NotifyItemRangeInserted(GetViewPosition(e.NewStartingIndex), e.NewItems.Count); - break; - case NotifyCollectionChangedAction.Move: - for (var i = 0; i < e.NewItems.Count; i++) - NotifyItemMoved(GetViewPosition(e.OldStartingIndex + i), GetViewPosition(e.NewStartingIndex + i)); - break; - case NotifyCollectionChangedAction.Replace: - NotifyItemRangeChanged(GetViewPosition(e.NewStartingIndex), e.NewItems.Count); - break; - case NotifyCollectionChangedAction.Remove: - NotifyItemRangeRemoved(GetViewPosition(e.OldStartingIndex), e.OldItems.Count); - break; - case NotifyCollectionChangedAction.Reset: - NotifyDataSetChanged(); - break; - } + MvxAndroidLog.Instance.Log(LogLevel.Error, + "ItemsSource collection content changed on a worker thread." + + "This leads to crash in the RecyclerView as it will not be aware of changes" + + "immediately and may get a deleted item or update an item with a bad item template." + + "All changes must be synchronized on the main thread"); } + } - protected virtual void OnMvxViewHolderBound(MvxViewHolderBoundEventArgs obj) + public virtual void NotifyDataSetChanged(NotifyCollectionChangedEventArgs? e) + { + if (e == null) { - MvxViewHolderBound?.Invoke(obj); + NotifyDataSetChanged(); + return; } - private void AttachClickListeners(IMvxRecyclerViewHolder viewHolder) + switch (e.Action) { - viewHolder.Click -= OnItemViewClick; - viewHolder.LongClick -= OnItemViewLongClick; - viewHolder.Click += OnItemViewClick; - viewHolder.LongClick += OnItemViewLongClick; + case NotifyCollectionChangedAction.Add when e.NewItems != null: + NotifyItemRangeInserted(GetViewPosition(e.NewStartingIndex), e.NewItems.Count); + break; + case NotifyCollectionChangedAction.Move when e.NewItems != null: + for (var i = 0; i < e.NewItems.Count; i++) + NotifyItemMoved(GetViewPosition(e.OldStartingIndex + i), GetViewPosition(e.NewStartingIndex + i)); + break; + case NotifyCollectionChangedAction.Replace when e.NewItems != null: + NotifyItemRangeChanged(GetViewPosition(e.NewStartingIndex), e.NewItems.Count); + break; + case NotifyCollectionChangedAction.Remove when e.OldItems != null: + NotifyItemRangeRemoved(GetViewPosition(e.OldStartingIndex), e.OldItems.Count); + break; + case NotifyCollectionChangedAction.Reset: + NotifyDataSetChanged(); + break; } + } - private static void CheckIfSimpleListItem( - ViewHolder holder, IMvxRecyclerViewHolder viewHolder, object? dataContext) - { - if (viewHolder.Id == global::Android.Resource.Layout.SimpleListItem1) - { - ((TextView)holder.ItemView).Text = dataContext?.ToString(); - } - } + protected virtual void OnMvxViewHolderBound(MvxViewHolderBoundEventArgs obj) + { + MvxViewHolderBound?.Invoke(obj); + } + + private void AttachClickListeners(IMvxRecyclerViewHolder viewHolder) + { + viewHolder.Click -= OnItemViewClick; + viewHolder.LongClick -= OnItemViewLongClick; + viewHolder.Click += OnItemViewClick; + viewHolder.LongClick += OnItemViewLongClick; + } - private void Clean(bool disposing) + private static void CheckIfSimpleListItem( + ViewHolder holder, IMvxRecyclerViewHolder viewHolder, object? dataContext) + { + if (viewHolder.Id == global::Android.Resource.Layout.SimpleListItem1) { - if (disposing) - { - _subscription?.Dispose(); - _subscription = null; - _itemClick = null; - _itemLongClick = null; - _itemsSource = null; - _itemTemplateSelector = null; - } + ((TextView)holder.ItemView).Text = dataContext?.ToString(); } + } - /// - /// Always called with disposing = false, as it is only disposed from java - /// - protected override void Dispose(bool disposing) + private void Clean(bool disposing) + { + if (disposing) { - Clean(true); - base.Dispose(disposing); + _subscription?.Dispose(); + _subscription = null; + _itemClick = null; + _itemLongClick = null; + _itemsSource = null; + _itemTemplateSelector = null; } } -#nullable restore + + /// + /// Always called with disposing = false, as it is only disposed from java + /// + protected override void Dispose(bool disposing) + { + Clean(true); + base.Dispose(disposing); + } } diff --git a/MvvmCross.DroidX/RecyclerView/MvxRecyclerView.cs b/MvvmCross.DroidX/RecyclerView/MvxRecyclerView.cs index da11cc7081..2b7a1122e8 100644 --- a/MvvmCross.DroidX/RecyclerView/MvxRecyclerView.cs +++ b/MvvmCross.DroidX/RecyclerView/MvxRecyclerView.cs @@ -1,8 +1,7 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. - -using System; +#nullable enable using System.Collections; using System.Windows.Input; using Android.Content; @@ -13,215 +12,212 @@ using MvvmCross.DroidX.RecyclerView.ItemTemplates; using MvvmCross.Platforms.Android.Binding.Views; -namespace MvvmCross.DroidX.RecyclerView +namespace MvvmCross.DroidX.RecyclerView; + +[Register("mvvmcross.droidx.recyclerview.MvxRecyclerView")] +public class MvxRecyclerView : AndroidX.RecyclerView.Widget.RecyclerView { -#nullable enable - [Register("mvvmcross.droidx.recyclerview.MvxRecyclerView")] - public class MvxRecyclerView : AndroidX.RecyclerView.Widget.RecyclerView + public MvxRecyclerView(Context context, IAttributeSet attrs) + : this(context, attrs, 0, new MvxRecyclerAdapter()) { - public MvxRecyclerView(Context context, IAttributeSet attrs) - : this(context, attrs, 0, new MvxRecyclerAdapter()) - { - } + } - public MvxRecyclerView(Context context, IAttributeSet attrs, int defStyle) - : this(context, attrs, defStyle, new MvxRecyclerAdapter()) - { - } + public MvxRecyclerView(Context context, IAttributeSet attrs, int defStyle) + : this(context, attrs, defStyle, new MvxRecyclerAdapter()) + { + } - [Android.Runtime.Preserve(Conditional = true)] - protected MvxRecyclerView(IntPtr javaReference, JniHandleOwnership transfer) - : base(javaReference, transfer) - { - } + [Android.Runtime.Preserve(Conditional = true)] + protected MvxRecyclerView(IntPtr javaReference, JniHandleOwnership transfer) + : base(javaReference, transfer) + { + } - /// - /// Create an instance of MvxRecyclerView. - /// - /// - /// - /// - /// to use. - /// If this is set to null, then it is up to you setting a . - public MvxRecyclerView(Context context, IAttributeSet attrs, int defStyle, IMvxRecyclerAdapter adapter) - : base(context, attrs, defStyle) - { - // Note: Any calling derived class passing a null adapter is responsible for setting - // it's own ItemTemplateSelector - if (adapter == null) - return; + /// + /// Create an instance of MvxRecyclerView. + /// + /// + /// + /// + /// to use. + /// If this is set to null, then it is up to you setting a . + public MvxRecyclerView(Context context, IAttributeSet attrs, int defStyle, IMvxRecyclerAdapter adapter) + : base(context, attrs, defStyle) + { + // Note: Any calling derived class passing a null adapter is responsible for setting + // it's own ItemTemplateSelector + if (adapter == null) + return; - var currentLayoutManager = GetLayoutManager(); - if (currentLayoutManager == null) + var currentLayoutManager = GetLayoutManager(); + if (currentLayoutManager == null) #pragma warning disable CA2000 // Dispose objects before losing scope - SetLayoutManager(new MvxGuardedLinearLayoutManager(context)); + SetLayoutManager(new MvxGuardedLinearLayoutManager(context)); #pragma warning restore CA2000 // Dispose objects before losing scope - var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs); - var itemTemplateSelector = MvxRecyclerViewAttributeExtensions.BuildItemTemplateSelector(context, attrs, itemTemplateId); + var itemTemplateId = MvxAttributeHelpers.ReadListItemTemplateId(context, attrs); + var itemTemplateSelector = MvxRecyclerViewAttributeExtensions.BuildItemTemplateSelector(context, attrs, itemTemplateId); - adapter.ItemTemplateSelector = itemTemplateSelector; - Adapter = adapter; + adapter.ItemTemplateSelector = itemTemplateSelector; + Adapter = adapter; - if (itemTemplateId == 0) - itemTemplateId = global::Android.Resource.Layout.SimpleListItem1; + if (itemTemplateId == 0) + itemTemplateId = global::Android.Resource.Layout.SimpleListItem1; - if (itemTemplateSelector.GetType() == typeof(MvxDefaultTemplateSelector)) - ItemTemplateId = itemTemplateId; - } + if (itemTemplateSelector.GetType() == typeof(MvxDefaultTemplateSelector)) + ItemTemplateId = itemTemplateId; + } - protected override void OnDetachedFromWindow() - { - base.OnDetachedFromWindow(); - DetachedFromWindow(); - } + protected override void OnDetachedFromWindow() + { + base.OnDetachedFromWindow(); + DetachedFromWindow(); + } - protected virtual void DetachedFromWindow() - { - // Remove all the views that are currently in play. - // This clears out all of the ViewHolder DataContexts by detaching the ViewHolder. - // Eventually the GC will come along and clear out the binding contexts. - // Issue #1405 - //Note: this has a side effect of breaking fragment transitions, as the recyclerview is cleared before the transition starts, which empties the view and displays a "black" screen while transitioning. - GetLayoutManager()?.RemoveAllViews(); - } + protected virtual void DetachedFromWindow() + { + // Remove all the views that are currently in play. + // This clears out all of the ViewHolder DataContexts by detaching the ViewHolder. + // Eventually the GC will come along and clear out the binding contexts. + // Issue #1405 + //Note: this has a side effect of breaking fragment transitions, as the recyclerview is cleared before the transition starts, which empties the view and displays a "black" screen while transitioning. + GetLayoutManager()?.RemoveAllViews(); + } - [MvxSetToNullAfterBinding] + [MvxSetToNullAfterBinding] #pragma warning disable CA1721 // Property names should not match get methods - public new IMvxRecyclerAdapter? Adapter + public new IMvxRecyclerAdapter? Adapter #pragma warning restore CA1721 // Property names should not match get methods + { + get => GetAdapter() as IMvxRecyclerAdapter; + set { - get => GetAdapter() as IMvxRecyclerAdapter; - set + var existing = Adapter; + if (existing == value) + return; + + // Support lib doesn't seem to have anything similar to IListAdapter yet + // hence cast to Adapter. + if (value != null && existing != null) + { + value.ItemsSource = existing.ItemsSource; + value.ItemTemplateSelector = existing.ItemTemplateSelector; + value.ItemClick = existing.ItemClick; + value.ItemLongClick = existing.ItemLongClick; + + SwapAdapter((Adapter)value, false); + } + else { - var existing = Adapter; - if (existing == value) - return; - - // Support lib doesn't seem to have anything similar to IListAdapter yet - // hence cast to Adapter. - if (value != null && existing != null) - { - value.ItemsSource = existing.ItemsSource; - value.ItemTemplateSelector = existing.ItemTemplateSelector; - value.ItemClick = existing.ItemClick; - value.ItemLongClick = existing.ItemLongClick; - - SwapAdapter((Adapter)value, false); - } - else - { - SetAdapter(value as Adapter); - } - - if (existing != null) - { - existing.ItemsSource = null; - } + SetAdapter(value as Adapter); + } + + if (existing != null) + { + existing.ItemsSource = null; } } + } - /// - /// Get or set the ItemSource to use for the RecyclerView Adapter. - /// - /// It is recommended to use a type inheriting from , such as - /// , - /// or - /// . - /// - /// - [MvxSetToNullAfterBinding] - public IEnumerable? ItemsSource + /// + /// Get or set the ItemSource to use for the RecyclerView Adapter. + /// + /// It is recommended to use a type inheriting from , such as + /// , + /// or + /// . + /// + /// + [MvxSetToNullAfterBinding] + public IEnumerable? ItemsSource + { + get => Adapter?.ItemsSource; + set { - get => Adapter?.ItemsSource; - set + var adapter = Adapter; + if (adapter != null) + adapter.ItemsSource = value; + } + } + + /// + /// Get or set the Item Template Id for cases where you only have one type of view in the RecyclerView. + /// + public int ItemTemplateId + { + get + { + if (!(ItemTemplateSelector is MvxDefaultTemplateSelector singleItemDefaultTemplateSelector)) { - var adapter = Adapter; - if (adapter != null) - adapter.ItemsSource = value; + throw new InvalidOperationException( + "If you don't want to use single item-template RecyclerView Adapter you can't change it's" + + $"{nameof(IMvxTemplateSelector)} to anything other than {nameof(MvxDefaultTemplateSelector)}"); } - } - /// - /// Get or set the Item Template Id for cases where you only have one type of view in the RecyclerView. - /// - public int ItemTemplateId + return singleItemDefaultTemplateSelector.ItemTemplateId; + } + set { - get + if (!(ItemTemplateSelector is MvxDefaultTemplateSelector singleItemDefaultTemplateSelector)) { - if (!(ItemTemplateSelector is MvxDefaultTemplateSelector singleItemDefaultTemplateSelector)) - { - throw new InvalidOperationException( - "If you don't want to use single item-template RecyclerView Adapter you can't change it's" + - $"{nameof(IMvxTemplateSelector)} to anything other than {nameof(MvxDefaultTemplateSelector)}"); - } - - return singleItemDefaultTemplateSelector.ItemTemplateId; + throw new InvalidOperationException( + "If you don't want to use single item-template RecyclerView Adapter you can't change it's" + + $"{nameof(IMvxTemplateSelector)} to anything other than {nameof(MvxDefaultTemplateSelector)}"); } - set + + singleItemDefaultTemplateSelector.ItemTemplateId = value; + + if (Adapter != null) { - if (!(ItemTemplateSelector is MvxDefaultTemplateSelector singleItemDefaultTemplateSelector)) - { - throw new InvalidOperationException( - "If you don't want to use single item-template RecyclerView Adapter you can't change it's" + - $"{nameof(IMvxTemplateSelector)} to anything other than {nameof(MvxDefaultTemplateSelector)}"); - } - - singleItemDefaultTemplateSelector.ItemTemplateId = value; - - if (Adapter != null) - { - Adapter.ItemTemplateSelector = singleItemDefaultTemplateSelector; - } + Adapter.ItemTemplateSelector = singleItemDefaultTemplateSelector; } } + } - /// - /// Get or set the ItemTemplateSelector. - /// - public IMvxTemplateSelector? ItemTemplateSelector + /// + /// Get or set the ItemTemplateSelector. + /// + public IMvxTemplateSelector? ItemTemplateSelector + { + get => Adapter?.ItemTemplateSelector; + set { - get => Adapter?.ItemTemplateSelector; - set + if (Adapter != null) { - if (Adapter != null) - { - Adapter.ItemTemplateSelector = value; - } + Adapter.ItemTemplateSelector = value; } } + } - /// - /// Get or set the to trigger when an item was clicked. - /// - [MvxSetToNullAfterBinding] - public ICommand? ItemClick + /// + /// Get or set the to trigger when an item was clicked. + /// + [MvxSetToNullAfterBinding] + public ICommand? ItemClick + { + get => Adapter?.ItemClick; + set { - get => Adapter?.ItemClick; - set + if (Adapter != null) { - if (Adapter != null) - { - Adapter.ItemClick = value; - } + Adapter.ItemClick = value; } } + } - /// - /// Get or set the to trigger when an item was long clicked. - /// - [MvxSetToNullAfterBinding] - public ICommand? ItemLongClick + /// + /// Get or set the to trigger when an item was long clicked. + /// + [MvxSetToNullAfterBinding] + public ICommand? ItemLongClick + { + get => Adapter?.ItemLongClick; + set { - get => Adapter?.ItemLongClick; - set + if (Adapter != null) { - if (Adapter != null) - { - Adapter.ItemLongClick = value; - } + Adapter.ItemLongClick = value; } } } -#nullable restore } diff --git a/MvvmCross.Plugins/Color/BasePlugin.cs b/MvvmCross.Plugins/Color/BasePlugin.cs index 57f7688e3d..d1ee65eaf0 100644 --- a/MvvmCross.Plugins/Color/BasePlugin.cs +++ b/MvvmCross.Plugins/Color/BasePlugin.cs @@ -10,12 +10,12 @@ public abstract class BasePlugin : IMvxPlugin { public virtual void Load() { - Mvx.IoCProvider.CallbackWhenRegistered(RegisterValueConverters); + Mvx.IoCProvider?.CallbackWhenRegistered(RegisterValueConverters); } private void RegisterValueConverters() { - if (Mvx.IoCProvider.TryResolve(out var registry)) + if (Mvx.IoCProvider?.TryResolve(out var registry) == true) { registry.AddOrOverwrite("ARGB", new MvxARGBValueConverter()); registry.AddOrOverwrite("NativeColor", new MvxNativeColorValueConverter()); diff --git a/MvvmCross.Plugins/Color/Platforms/Android/BindingTargets/MvxDefaultColorBindingSet.cs b/MvvmCross.Plugins/Color/Platforms/Android/BindingTargets/MvxDefaultColorBindingSet.cs index 6a5a4c0d6b..573b4be887 100644 --- a/MvvmCross.Plugins/Color/Platforms/Android/BindingTargets/MvxDefaultColorBindingSet.cs +++ b/MvvmCross.Plugins/Color/Platforms/Android/BindingTargets/MvxDefaultColorBindingSet.cs @@ -16,8 +16,7 @@ public class MvxDefaultColorBindingSet { public void RegisterBindings() { - IMvxTargetBindingFactoryRegistry registry; - if (!Mvx.IoCProvider.TryResolve(out registry)) + if (Mvx.IoCProvider?.TryResolve(out IMvxTargetBindingFactoryRegistry registry) != true) { MvxPluginLog.Instance.Log(LogLevel.Warning, "No binding registry available - so color bindings will not be used"); diff --git a/MvvmCross.Plugins/Color/Platforms/Android/Plugin.cs b/MvvmCross.Plugins/Color/Platforms/Android/Plugin.cs index 38b509a8a6..dfb3dee715 100644 --- a/MvvmCross.Plugins/Color/Platforms/Android/Plugin.cs +++ b/MvvmCross.Plugins/Color/Platforms/Android/Plugin.cs @@ -15,11 +15,11 @@ public sealed class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxAndroidColor()); - Mvx.IoCProvider.CallbackWhenRegistered(RegisterDefaultBindings); + Mvx.IoCProvider?.RegisterSingleton(new MvxAndroidColor()); + Mvx.IoCProvider?.CallbackWhenRegistered(RegisterDefaultBindings); } - private void RegisterDefaultBindings() + private static void RegisterDefaultBindings() { var helper = new MvxDefaultColorBindingSet(); helper.RegisterBindings(); diff --git a/MvvmCross.Plugins/Color/Platforms/Ios/Plugin.cs b/MvvmCross.Plugins/Color/Platforms/Ios/Plugin.cs index 802d37c7cb..a37151cdcb 100644 --- a/MvvmCross.Plugins/Color/Platforms/Ios/Plugin.cs +++ b/MvvmCross.Plugins/Color/Platforms/Ios/Plugin.cs @@ -13,7 +13,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxIosColor()); + Mvx.IoCProvider?.RegisterSingleton(new MvxIosColor()); } } } diff --git a/MvvmCross.Plugins/Color/Platforms/Uap/MvxColorDesignTimeHelper.cs b/MvvmCross.Plugins/Color/Platforms/Uap/MvxColorDesignTimeHelper.cs index 1882f24354..ce41793d29 100644 --- a/MvvmCross.Plugins/Color/Platforms/Uap/MvxColorDesignTimeHelper.cs +++ b/MvvmCross.Plugins/Color/Platforms/Uap/MvxColorDesignTimeHelper.cs @@ -15,7 +15,7 @@ public MvxColorDesignTimeHelper() if (!IsInDesignTool) return; - if (Mvx.IoCProvider.CanResolve()) + if (Mvx.IoCProvider?.CanResolve() == true) return; var forceLoaded = new Plugin(); diff --git a/MvvmCross.Plugins/Color/Platforms/Uap/Plugin.cs b/MvvmCross.Plugins/Color/Platforms/Uap/Plugin.cs index 21633d2a22..713280db6a 100644 --- a/MvvmCross.Plugins/Color/Platforms/Uap/Plugin.cs +++ b/MvvmCross.Plugins/Color/Platforms/Uap/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxWindowsColor()); + Mvx.IoCProvider?.RegisterSingleton(new MvxWindowsColor()); } } } diff --git a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs index 655a4924c2..8916cb3c2a 100644 --- a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs +++ b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs @@ -15,7 +15,7 @@ public MvxColorDesignTimeHelper() if (!IsInDesignTool) return; - if (Mvx.IoCProvider.CanResolve()) + if (Mvx.IoCProvider?.CanResolve() == true) return; var forceLoaded = new Plugin(); diff --git a/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs b/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs index fb6edc9758..4c0bbd2bae 100644 --- a/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs +++ b/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxWindowsColor()); + Mvx.IoCProvider?.RegisterSingleton(new MvxWindowsColor()); } } } diff --git a/MvvmCross.Plugins/Color/Platforms/Wpf/Plugin.cs b/MvvmCross.Plugins/Color/Platforms/Wpf/Plugin.cs index d6605570ac..684fe9a0d3 100644 --- a/MvvmCross.Plugins/Color/Platforms/Wpf/Plugin.cs +++ b/MvvmCross.Plugins/Color/Platforms/Wpf/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxWpfColor()); + Mvx.IoCProvider?.RegisterSingleton(new MvxWpfColor()); } } } diff --git a/MvvmCross.Plugins/FieldBinding/Plugin.cs b/MvvmCross.Plugins/FieldBinding/Plugin.cs index eb466ec28d..d450caf13f 100644 --- a/MvvmCross.Plugins/FieldBinding/Plugin.cs +++ b/MvvmCross.Plugins/FieldBinding/Plugin.cs @@ -13,7 +13,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.CallbackWhenRegistered(OnHostRegistered); + Mvx.IoCProvider?.CallbackWhenRegistered(OnHostRegistered); } private void OnHostRegistered(IMvxSourceBindingFactoryExtensionHost host) diff --git a/MvvmCross.Plugins/Json/Plugin.cs b/MvvmCross.Plugins/Json/Plugin.cs index c2b8590f20..2b1016e6aa 100644 --- a/MvvmCross.Plugins/Json/Plugin.cs +++ b/MvvmCross.Plugins/Json/Plugin.cs @@ -15,12 +15,12 @@ public class Plugin : IMvxConfigurablePlugin public void Load() { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); var configuration = _configuration ?? MvxJsonConfiguration.Default; if (configuration.RegisterAsTextSerializer) { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); } } diff --git a/MvvmCross.Plugins/Messenger/Plugin.cs b/MvvmCross.Plugins/Messenger/Plugin.cs index 4b621d5b3c..70802a04cd 100644 --- a/MvvmCross.Plugins/Messenger/Plugin.cs +++ b/MvvmCross.Plugins/Messenger/Plugin.cs @@ -11,7 +11,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.RegisterSingleton(new MvxMessengerHub()); + Mvx.IoCProvider?.RegisterSingleton(new MvxMessengerHub()); } } #nullable restore diff --git a/MvvmCross.Plugins/MethodBinding/Plugin.cs b/MvvmCross.Plugins/MethodBinding/Plugin.cs index ad4ab9fdf2..6691d9039e 100644 --- a/MvvmCross.Plugins/MethodBinding/Plugin.cs +++ b/MvvmCross.Plugins/MethodBinding/Plugin.cs @@ -13,7 +13,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.CallbackWhenRegistered(OnHostRegistered); + Mvx.IoCProvider?.CallbackWhenRegistered(OnHostRegistered); } private void OnHostRegistered(IMvxSourceBindingFactoryExtensionHost host) diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/Android/Plugin.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/Android/Plugin.cs index 2974ea3897..6a08edfe27 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/Android/Plugin.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/Android/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); } } } diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/Ios/Plugin.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/Ios/Plugin.cs index 4ea5a846f6..c708d1025b 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/Ios/Plugin.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/Ios/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); } } } diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/Uap/Plugin.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/Uap/Plugin.cs index 3044f34e7b..442d12dccc 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/Uap/Plugin.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/Uap/Plugin.cs @@ -11,7 +11,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); } } } diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs index a7dcd262f8..353d1d2825 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs @@ -11,7 +11,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); } } } diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/Wpf/Plugin.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/Wpf/Plugin.cs index c975a37dc3..abce7bb5b0 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/Wpf/Plugin.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/Wpf/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : IMvxPlugin { public void Load() { - Mvx.IoCProvider.RegisterType(); + Mvx.IoCProvider?.RegisterType(); } } } diff --git a/MvvmCross.Plugins/Visibility/BasePlugin.cs b/MvvmCross.Plugins/Visibility/BasePlugin.cs index 0c872ba53a..3c3377967f 100644 --- a/MvvmCross.Plugins/Visibility/BasePlugin.cs +++ b/MvvmCross.Plugins/Visibility/BasePlugin.cs @@ -11,7 +11,7 @@ public abstract class BasePlugin : IMvxPlugin { public virtual void Load() { - Mvx.IoCProvider.CallbackWhenRegistered(RegisterValueConverters); + Mvx.IoCProvider?.CallbackWhenRegistered(RegisterValueConverters); } private void RegisterValueConverters() diff --git a/MvvmCross.Plugins/Visibility/Platforms/Android/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/Android/Plugin.cs index b0080a7bb2..13000fb072 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/Android/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/Android/Plugin.cs @@ -13,7 +13,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxDroidVisibility()); + Mvx.IoCProvider?.RegisterSingleton(new MvxDroidVisibility()); } } } diff --git a/MvvmCross.Plugins/Visibility/Platforms/Console/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/Console/Plugin.cs index 07c7c33d14..15e78bae8c 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/Console/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/Console/Plugin.cs @@ -13,7 +13,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxConsoleVisibility()); + Mvx.IoCProvider?.RegisterSingleton(new MvxConsoleVisibility()); } } } diff --git a/MvvmCross.Plugins/Visibility/Platforms/Ios/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/Ios/Plugin.cs index a207ab9ee6..6d95e526a0 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/Ios/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/Ios/Plugin.cs @@ -13,7 +13,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxIosVisibility()); + Mvx.IoCProvider?.RegisterSingleton(new MvxIosVisibility()); } } } diff --git a/MvvmCross.Plugins/Visibility/Platforms/Uap/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/Uap/Plugin.cs index b98246c14c..19da960d6f 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/Uap/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/Uap/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxWinRTVisibility()); + Mvx.IoCProvider?.RegisterSingleton(new MvxWinRTVisibility()); } } } diff --git a/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs index 90e0cc1ebc..0b64292039 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxWinRTVisibility()); + Mvx.IoCProvider?.RegisterSingleton(new MvxWinRTVisibility()); } } } diff --git a/MvvmCross.Plugins/Visibility/Platforms/Wpf/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/Wpf/Plugin.cs index bdfc5b304c..c613b18a01 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/Wpf/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/Wpf/Plugin.cs @@ -12,7 +12,7 @@ public class Plugin : BasePlugin public override void Load() { base.Load(); - Mvx.IoCProvider.RegisterSingleton(new MvxWpfVisibility()); + Mvx.IoCProvider?.RegisterSingleton(new MvxWpfVisibility()); } } } diff --git a/MvvmCross.Tests/MvxUnitTestCommandExtensions.cs b/MvvmCross.Tests/MvxUnitTestCommandExtensions.cs index 93100cda02..41fba44834 100644 --- a/MvvmCross.Tests/MvxUnitTestCommandExtensions.cs +++ b/MvvmCross.Tests/MvxUnitTestCommandExtensions.cs @@ -19,16 +19,16 @@ public static bool RaisedCanExecuteChanged(this IMvxCommand command) private static MvxUnitTestCommandHelper GetCommandHelper() { - if (Mvx.IoCProvider.TryResolve(out IMvxCommandHelper helper)) + if (Mvx.IoCProvider?.TryResolve(out IMvxCommandHelper helper) == true) { - if (helper is MvxUnitTestCommandHelper) + if (helper is MvxUnitTestCommandHelper unitTestHelper) { - return (MvxUnitTestCommandHelper)helper; + return unitTestHelper; } } helper = new MvxUnitTestCommandHelper(); - Mvx.IoCProvider.RegisterSingleton(helper); + Mvx.IoCProvider?.RegisterSingleton(helper); return (MvxUnitTestCommandHelper)helper; } } diff --git a/MvvmCross/Commands/MvxCommand.cs b/MvvmCross/Commands/MvxCommand.cs index ee9630c708..c47e78a5eb 100644 --- a/MvvmCross/Commands/MvxCommand.cs +++ b/MvvmCross/Commands/MvxCommand.cs @@ -107,9 +107,7 @@ public class MvxCommandBase protected MvxCommandBase() { // fallback on MvxWeakCommandHelper if no IoC has been set up - if (Mvx.IoCProvider == null) - _commandHelper = new MvxWeakCommandHelper(); - else if (!Mvx.IoCProvider.TryResolve(out _commandHelper)) + if (Mvx.IoCProvider?.TryResolve(out _commandHelper) != true) _commandHelper = new MvxWeakCommandHelper(); // default to true if no Singleton Cache has been set up diff --git a/MvvmCross/IoC/MvxPropertyInjector.cs b/MvvmCross/IoC/MvxPropertyInjector.cs index 79db3ea94d..a58073b5f5 100644 --- a/MvvmCross/IoC/MvxPropertyInjector.cs +++ b/MvvmCross/IoC/MvxPropertyInjector.cs @@ -35,7 +35,7 @@ public virtual void Inject(object target, IMvxPropertyInjectorOptions options = protected virtual void InjectProperty(object toReturn, PropertyInfo injectableProperty, IMvxPropertyInjectorOptions options) { object propertyValue; - if (Mvx.IoCProvider.TryResolve(injectableProperty.PropertyType, out propertyValue)) + if (Mvx.IoCProvider?.TryResolve(injectableProperty.PropertyType, out propertyValue) == true) { try { diff --git a/MvvmCross/Localization/MvxLanguageBinder.cs b/MvvmCross/Localization/MvxLanguageBinder.cs index 94c731efde..e8fb6b324a 100644 --- a/MvvmCross/Localization/MvxLanguageBinder.cs +++ b/MvvmCross/Localization/MvxLanguageBinder.cs @@ -35,7 +35,7 @@ public MvxLanguageBinder(string? namespaceName = null, string? typeName = null) if (_cachedTextProvider != null) return _cachedTextProvider; - if (!Mvx.IoCProvider.TryResolve(out IMvxTextProvider cachedTextProvider)) + if (Mvx.IoCProvider?.TryResolve(out IMvxTextProvider cachedTextProvider) != true) { throw new MvxException( "Missing text provider - please initialize IoC with a suitable IMvxTextProvider"); diff --git a/MvvmCross/Logging/MvxLogHost.cs b/MvvmCross/Logging/MvxLogHost.cs index fed9890253..9df30c8a09 100644 --- a/MvvmCross/Logging/MvxLogHost.cs +++ b/MvvmCross/Logging/MvxLogHost.cs @@ -1,39 +1,21 @@ -using Microsoft.Extensions.Logging; - -namespace MvvmCross.Logging -{ #nullable enable - public static class MvxLogHost - { - private static ILogger? _defaultLogger; +using Microsoft.Extensions.Logging; - public static ILogger? Default - { - get - { - return _defaultLogger ??= GetLog("Default"); - } - } +namespace MvvmCross.Logging; - public static ILogger? GetLog() - { - if (Mvx.IoCProvider.TryResolve(out var loggerFactory)) - { - return loggerFactory.CreateLogger(); - } +public static class MvxLogHost +{ + private static ILogger? _defaultLogger; - return null; - } + public static ILogger? Default => _defaultLogger ??= GetLog("Default"); - public static ILogger? GetLog(string categoryName) - { - if (Mvx.IoCProvider.TryResolve(out var loggerFactory)) - { - return loggerFactory.CreateLogger(categoryName); - } + public static ILogger? GetLog() => + Mvx.IoCProvider?.TryResolve(out var loggerFactory) == true + ? loggerFactory.CreateLogger() + : null; - return null; - } - } -#nullable restore + public static ILogger? GetLog(string categoryName) => + Mvx.IoCProvider?.TryResolve(out var loggerFactory) == true + ? loggerFactory.CreateLogger(categoryName) + : null; } diff --git a/MvvmCross/Platforms/Android/Binding/BindingContext/MvxAndroidBindingContextHelpers.cs b/MvvmCross/Platforms/Android/Binding/BindingContext/MvxAndroidBindingContextHelpers.cs index 311091b25c..0a7f3373c5 100644 --- a/MvvmCross/Platforms/Android/Binding/BindingContext/MvxAndroidBindingContextHelpers.cs +++ b/MvvmCross/Platforms/Android/Binding/BindingContext/MvxAndroidBindingContextHelpers.cs @@ -16,10 +16,7 @@ public static IMvxAndroidBindingContext Current() public static T Current() where T : class, IMvxBindingContext { - if (Mvx.IoCProvider == null) - return null; - - if (Mvx.IoCProvider.TryResolve>(out var stack)) + if (Mvx.IoCProvider?.TryResolve>(out var stack) == true) return stack?.Current; return null; diff --git a/MvvmCross/Platforms/Android/Binding/Views/MvxLayoutInflater.cs b/MvvmCross/Platforms/Android/Binding/Views/MvxLayoutInflater.cs index fd359c2190..e477fe5789 100644 --- a/MvvmCross/Platforms/Android/Binding/Views/MvxLayoutInflater.cs +++ b/MvvmCross/Platforms/Android/Binding/Views/MvxLayoutInflater.cs @@ -388,7 +388,7 @@ private void RestoreConstructorArgs(Object[]? constructorArgsArr, Object? lastCo return null; } - if (Mvx.IoCProvider.TryResolve(out IMvxAndroidViewFactory viewFactory)) + if (Mvx.IoCProvider?.TryResolve(out IMvxAndroidViewFactory viewFactory) == true) { _androidViewFactory = viewFactory; } @@ -411,7 +411,7 @@ private void RestoreConstructorArgs(Object[]? constructorArgsArr, Object? lastCo return null; } - if (Mvx.IoCProvider.TryResolve(out IMvxLayoutInflaterHolderFactoryFactory factoryFactory)) + if (Mvx.IoCProvider?.TryResolve(out IMvxLayoutInflaterHolderFactoryFactory factoryFactory) == true) { _layoutInflaterHolderFactoryFactory = factoryFactory; } diff --git a/MvvmCross/Platforms/Android/Presenters/Attributes/MvxFragmentPresentationAttribute.cs b/MvvmCross/Platforms/Android/Presenters/Attributes/MvxFragmentPresentationAttribute.cs index d261e34179..4f294482b2 100644 --- a/MvvmCross/Platforms/Android/Presenters/Attributes/MvxFragmentPresentationAttribute.cs +++ b/MvvmCross/Platforms/Android/Presenters/Attributes/MvxFragmentPresentationAttribute.cs @@ -65,7 +65,7 @@ public MvxFragmentPresentationAttribute() bool addFragment = false ) { - if (Mvx.IoCProvider.TryResolve(out IMvxAndroidGlobals globals) && + if (Mvx.IoCProvider?.TryResolve(out IMvxAndroidGlobals globals) == true && globals.ApplicationContext.Resources != null) { var context = globals.ApplicationContext; diff --git a/MvvmCross/Platforms/Android/Presenters/Attributes/MvxTabLayoutPresentationAttribute.cs b/MvvmCross/Platforms/Android/Presenters/Attributes/MvxTabLayoutPresentationAttribute.cs index 375f2ec7a0..87c2603853 100644 --- a/MvvmCross/Platforms/Android/Presenters/Attributes/MvxTabLayoutPresentationAttribute.cs +++ b/MvvmCross/Platforms/Android/Presenters/Attributes/MvxTabLayoutPresentationAttribute.cs @@ -50,7 +50,7 @@ public MvxTabLayoutPresentationAttribute() isCacheableFragment) { if (!string.IsNullOrEmpty(tabLayoutResourceName) && - Mvx.IoCProvider.TryResolve(out IMvxAndroidGlobals globals) && + Mvx.IoCProvider?.TryResolve(out IMvxAndroidGlobals globals) == true && globals.ApplicationContext.Resources != null) { TabLayoutResourceId = globals.ApplicationContext.Resources.GetIdentifier( diff --git a/MvvmCross/Platforms/Android/Presenters/Attributes/MvxViewPagerFragmentPresentationAttribute.cs b/MvvmCross/Platforms/Android/Presenters/Attributes/MvxViewPagerFragmentPresentationAttribute.cs index ef1a6c21a1..e298dafcbd 100644 --- a/MvvmCross/Platforms/Android/Presenters/Attributes/MvxViewPagerFragmentPresentationAttribute.cs +++ b/MvvmCross/Platforms/Android/Presenters/Attributes/MvxViewPagerFragmentPresentationAttribute.cs @@ -63,7 +63,7 @@ public MvxViewPagerFragmentPresentationAttribute() Title = title; if (!string.IsNullOrEmpty(viewPagerResourceName) && - Mvx.IoCProvider.TryResolve(out IMvxAndroidGlobals globals) && + Mvx.IoCProvider?.TryResolve(out IMvxAndroidGlobals globals) == true && globals.ApplicationContext.Resources != null) { ViewPagerResourceId = globals.ApplicationContext.Resources.GetIdentifier( diff --git a/MvvmCross/Platforms/Android/Views/Fragments/MvxBindingFragmentAdapter.cs b/MvvmCross/Platforms/Android/Views/Fragments/MvxBindingFragmentAdapter.cs index 9129fb04d6..8f19ce9dc3 100644 --- a/MvvmCross/Platforms/Android/Views/Fragments/MvxBindingFragmentAdapter.cs +++ b/MvvmCross/Platforms/Android/Views/Fragments/MvxBindingFragmentAdapter.cs @@ -119,7 +119,7 @@ protected override void HandleSaveInstanceStateCalled(object? sender, MvxValueEv var mvxBundle = FragmentView?.CreateSaveStateBundle(); if (mvxBundle != null) { - if (!Mvx.IoCProvider.TryResolve(out IMvxSavedStateConverter converter)) + if (Mvx.IoCProvider?.TryResolve(out IMvxSavedStateConverter converter) != true) { MvxLogHost.GetLog()?.Log(LogLevel.Warning, "Saved state converter not available - saving state will be hard"); @@ -133,8 +133,8 @@ protected override void HandleSaveInstanceStateCalled(object? sender, MvxValueEv if (FragmentView == null) return; - var cache = Mvx.IoCProvider.Resolve(); - cache.Cache(FragmentView.ViewModel, FragmentView.UniqueImmutableCacheTag); + if (Mvx.IoCProvider?.TryResolve(out IMvxMultipleViewModelCache cache) == true) + cache.Cache(FragmentView.ViewModel, FragmentView.UniqueImmutableCacheTag); } protected override void HandleDestroyViewCalled(object? sender, EventArgs e) diff --git a/MvvmCross/Platforms/Android/Views/MvxActivityAdapter.cs b/MvvmCross/Platforms/Android/Views/MvxActivityAdapter.cs index 523e6bf616..8252dc53b9 100644 --- a/MvvmCross/Platforms/Android/Views/MvxActivityAdapter.cs +++ b/MvvmCross/Platforms/Android/Views/MvxActivityAdapter.cs @@ -82,7 +82,7 @@ protected override void EventSourceOnSaveInstanceStateCalled(object sender, MvxV var mvxBundle = AndroidView.CreateSaveStateBundle(); if (mvxBundle != null) { - if (!Mvx.IoCProvider.TryResolve(out var converter)) + if (Mvx.IoCProvider?.TryResolve(out var converter) != true) { MvxLogHost.GetLog()?.Log(LogLevel.Warning, "Saved state converter not available - saving state will be hard"); @@ -93,7 +93,7 @@ protected override void EventSourceOnSaveInstanceStateCalled(object sender, MvxV } } - if (Mvx.IoCProvider.TryResolve(out var cache)) + if (Mvx.IoCProvider?.TryResolve(out var cache) == true) { cache.Cache(AndroidView.ViewModel, eventArgs.Value); } @@ -102,7 +102,7 @@ protected override void EventSourceOnSaveInstanceStateCalled(object sender, MvxV protected override void EventSourceOnActivityResultCalled( object sender, MvxValueEventArgs eventArgs) { - if (Mvx.IoCProvider.TryResolve(out var sink)) + if (Mvx.IoCProvider?.TryResolve(out var sink) == true) { var resultParameters = eventArgs.Value; var intentResult = new MvxIntentResultEventArgs( diff --git a/MvvmCross/Platforms/Android/Views/MvxActivityViewExtensions.cs b/MvvmCross/Platforms/Android/Views/MvxActivityViewExtensions.cs index df973cf49c..4d1a286ada 100644 --- a/MvvmCross/Platforms/Android/Views/MvxActivityViewExtensions.cs +++ b/MvvmCross/Platforms/Android/Views/MvxActivityViewExtensions.cs @@ -41,7 +41,7 @@ public static void OnViewCreate(this IMvxAndroidView androidView, Bundle bundle) androidView.OnLifetimeEvent((listener, activity) => listener.OnCreate(activity, bundle)); IMvxViewModel cached = null; - if (Mvx.IoCProvider.TryResolve(out var cache)) + if (Mvx.IoCProvider?.TryResolve(out var cache) == true) cached = cache.GetAndClear(bundle); var view = (IMvxView)androidView; @@ -54,7 +54,7 @@ private static IMvxBundle GetSavedStateFromBundle(Bundle bundle) if (bundle == null) return null; - if (!Mvx.IoCProvider.TryResolve(out var converter)) + if (Mvx.IoCProvider?.TryResolve(out var converter) != true) { MvxLogHost.Default?.Log(LogLevel.Trace, "No saved state converter available - this is OK if seen during start"); return null; @@ -65,7 +65,7 @@ private static IMvxBundle GetSavedStateFromBundle(Bundle bundle) public static void OnViewNewIntent(this IMvxAndroidView androidView) { - MvxLogHost.Default?.Log(LogLevel.Trace, "OnViewNewIntent called - MvvmCross lifecycle won't run automatically in this case."); + MvxLogHost.Default?.Log(LogLevel.Trace, "OnViewNewIntent called - MvvmCross lifecycle won't run automatically in this case"); } public static void OnViewDestroy(this IMvxAndroidView androidView) @@ -74,8 +74,11 @@ public static void OnViewDestroy(this IMvxAndroidView androidView) var view = androidView as IMvxView; view.OnViewDestroy(); - if (!Mvx.IoCProvider.TryResolve(out var appStart) || !Mvx.IoCProvider.TryResolve(out var topActivity)) + if (Mvx.IoCProvider?.TryResolve(out var appStart) != true || + Mvx.IoCProvider?.TryResolve(out var topActivity) != true) + { return; + } var currentActivity = topActivity.Activity; if (IsActivityTearingDown(currentActivity)) @@ -148,7 +151,7 @@ private static IMvxViewModel LoadViewModel(this IMvxAndroidView androidView, IMv if (viewModelType == null || viewModelType == typeof(IMvxViewModel)) { - MvxLogHost.Default?.Log(LogLevel.Trace, "No ViewModel class specified for {0} in LoadViewModel", + MvxLogHost.Default?.Log(LogLevel.Trace, "No ViewModel class specified for {ViewType} in LoadViewModel", androidView.GetType().Name); } diff --git a/MvvmCross/Platforms/Android/Views/MvxSplashScreenActivity.cs b/MvvmCross/Platforms/Android/Views/MvxSplashScreenActivity.cs index 8734cc01c9..931d08134b 100644 --- a/MvvmCross/Platforms/Android/Views/MvxSplashScreenActivity.cs +++ b/MvvmCross/Platforms/Android/Views/MvxSplashScreenActivity.cs @@ -93,7 +93,7 @@ public virtual async Task InitializationComplete() protected virtual async Task RunAppStartAsync(Bundle bundle) { - if (Mvx.IoCProvider.TryResolve(out IMvxAppStart startup)) + if (Mvx.IoCProvider?.TryResolve(out IMvxAppStart startup) == true) { if (!startup.IsStarted) { diff --git a/MvvmCross/Platforms/Ios/Core/MvxApplicationDelegate.cs b/MvvmCross/Platforms/Ios/Core/MvxApplicationDelegate.cs index ad1395e753..bd6bde01c1 100644 --- a/MvvmCross/Platforms/Ios/Core/MvxApplicationDelegate.cs +++ b/MvvmCross/Platforms/Ios/Core/MvxApplicationDelegate.cs @@ -52,7 +52,7 @@ public override bool FinishedLaunching(UIApplication application, NSDictionary l protected virtual void RunAppStart(object hint = null) { - if (Mvx.IoCProvider.TryResolve(out IMvxAppStart startup) && !startup.IsStarted) + if (Mvx.IoCProvider?.TryResolve(out IMvxAppStart startup) == true && !startup.IsStarted) { startup.Start(GetAppStartHint(hint)); } diff --git a/MvvmCross/Platforms/Ios/MvxIosMajorVersionChecker.cs b/MvvmCross/Platforms/Ios/MvxIosMajorVersionChecker.cs index 3c85e84006..20bc5d473b 100644 --- a/MvvmCross/Platforms/Ios/MvxIosMajorVersionChecker.cs +++ b/MvvmCross/Platforms/Ios/MvxIosMajorVersionChecker.cs @@ -18,12 +18,10 @@ public MvxIosMajorVersionChecker(int major, bool defaultValue = true) private static bool ReadIsIosVersionOrHigher(int target, bool defaultValue) { - IMvxIosSystem iosSystem; - Mvx.IoCProvider.TryResolve(out iosSystem); - if (iosSystem == null) + if (Mvx.IoCProvider?.TryResolve(out IMvxIosSystem iosSystem) != true) { MvxLogHost.Default?.LogWarning( - "IMvxIosSystem not found - so assuming we {target} on iOS {default} or later", target, defaultValue ? "are" : "are not"); + "IMvxIosSystem not found - so assuming we {Target} on iOS {Default} or later", target, defaultValue ? "are" : "are not"); return defaultValue; } diff --git a/MvvmCross/Platforms/Ios/Views/MvxBindingViewControllerAdapter.cs b/MvvmCross/Platforms/Ios/Views/MvxBindingViewControllerAdapter.cs index 971a8a744d..e999b809b2 100644 --- a/MvvmCross/Platforms/Ios/Views/MvxBindingViewControllerAdapter.cs +++ b/MvvmCross/Platforms/Ios/Views/MvxBindingViewControllerAdapter.cs @@ -20,7 +20,7 @@ public MvxBindingViewControllerAdapter(IMvxEventSourceViewController eventSource if (!(eventSource is IMvxIosView)) throw new ArgumentException($"{nameof(eventSource)} should be a {nameof(IMvxIosView)}", nameof(eventSource)); - if (Mvx.IoCProvider.TryResolve(out var bindingContext)) + if (Mvx.IoCProvider?.TryResolve(out var bindingContext) == true) IosView.BindingContext = bindingContext; } @@ -29,7 +29,7 @@ public override void HandleDisposeCalled(object sender, EventArgs e) if (IosView == null) { MvxLogHost.GetLog()?.LogWarning( - "{iosView} is null for clearup of bindings", nameof(IosView)); + "{IosView} is null for clear-up of bindings", nameof(IosView)); return; } IosView.ClearAllBindings(); diff --git a/MvvmCross/Platforms/Ios/Views/MvxTabBarViewController.cs b/MvvmCross/Platforms/Ios/Views/MvxTabBarViewController.cs index b823f3293d..5d6555525c 100644 --- a/MvvmCross/Platforms/Ios/Views/MvxTabBarViewController.cs +++ b/MvvmCross/Platforms/Ios/Views/MvxTabBarViewController.cs @@ -77,7 +77,7 @@ public override void ViewWillDisappear(bool animated) if (IsMovingFromParentViewController) { - if (Mvx.IoCProvider.TryResolve(out IMvxIosViewPresenter iPresenter) + if (Mvx.IoCProvider?.TryResolve(out IMvxIosViewPresenter iPresenter) == true && iPresenter is MvxIosViewPresenter mvxIosViewPresenter) { mvxIosViewPresenter.CloseTabBarViewController(); diff --git a/MvvmCross/Platforms/Mac/Core/MvxApplicationDelegate.cs b/MvvmCross/Platforms/Mac/Core/MvxApplicationDelegate.cs index b8db703d6f..6ea99247f4 100644 --- a/MvvmCross/Platforms/Mac/Core/MvxApplicationDelegate.cs +++ b/MvvmCross/Platforms/Mac/Core/MvxApplicationDelegate.cs @@ -26,7 +26,7 @@ public override void DidFinishLaunching(Foundation.NSNotification notification) protected virtual void RunAppStart(object hint = null) { - if (Mvx.IoCProvider.TryResolve(out IMvxAppStart startup) && !startup.IsStarted) + if (Mvx.IoCProvider?.TryResolve(out IMvxAppStart startup) == true && !startup.IsStarted) { startup.Start(GetAppStartHint(hint)); } diff --git a/MvvmCross/Platforms/Tvos/Core/MvxApplicationDelegate.cs b/MvvmCross/Platforms/Tvos/Core/MvxApplicationDelegate.cs index 86244fd8e9..395d507ecd 100644 --- a/MvvmCross/Platforms/Tvos/Core/MvxApplicationDelegate.cs +++ b/MvvmCross/Platforms/Tvos/Core/MvxApplicationDelegate.cs @@ -36,7 +36,7 @@ public override bool FinishedLaunching(UIApplication application, NSDictionary l protected virtual void RunAppStart(object hint = null) { - if (Mvx.IoCProvider.TryResolve(out IMvxAppStart startup) && !startup.IsStarted) + if (Mvx.IoCProvider?.TryResolve(out IMvxAppStart startup) == true && !startup.IsStarted) { startup.Start(GetAppStartHint(hint)); } diff --git a/MvvmCross/Platforms/Tvos/MvxTvosMajorVersionChecker.cs b/MvvmCross/Platforms/Tvos/MvxTvosMajorVersionChecker.cs index 44d41b0a4b..5e8e0f5452 100644 --- a/MvvmCross/Platforms/Tvos/MvxTvosMajorVersionChecker.cs +++ b/MvvmCross/Platforms/Tvos/MvxTvosMajorVersionChecker.cs @@ -15,7 +15,7 @@ public MvxTvosMajorVersionChecker(int major, bool defaultValue = true) private static bool ReadIsTvosVersionOrHigher(int target, bool defaultValue) { - if (!Mvx.IoCProvider.TryResolve(out var tvosSystem) || tvosSystem == null) + if (Mvx.IoCProvider?.TryResolve(out var tvosSystem) != true || tvosSystem == null) { return defaultValue; } diff --git a/MvvmCross/Platforms/Tvos/Views/MvxTabBarViewController.cs b/MvvmCross/Platforms/Tvos/Views/MvxTabBarViewController.cs index b18a4c4c1c..d8416cb193 100644 --- a/MvvmCross/Platforms/Tvos/Views/MvxTabBarViewController.cs +++ b/MvvmCross/Platforms/Tvos/Views/MvxTabBarViewController.cs @@ -44,7 +44,7 @@ public override void ViewWillDisappear(bool animated) if (IsMovingFromParentViewController) { - if (Mvx.IoCProvider.TryResolve(out IMvxTvosViewPresenter iPresenter) + if (Mvx.IoCProvider?.TryResolve(out IMvxTvosViewPresenter iPresenter) == true && iPresenter is MvxTvosViewPresenter mvxTvosViewPresenter) { mvxTvosViewPresenter.CloseTabBarViewController(); diff --git a/MvvmCross/ViewModels/MvxApplication.cs b/MvvmCross/ViewModels/MvxApplication.cs index dc6f8b6e37..cf21d9514e 100644 --- a/MvvmCross/ViewModels/MvxApplication.cs +++ b/MvvmCross/ViewModels/MvxApplication.cs @@ -72,24 +72,24 @@ public IMvxViewModelLocator FindViewModelLocator(MvxViewModelRequest request) protected void RegisterCustomAppStart() where TMvxAppStart : class, IMvxAppStart { - Mvx.IoCProvider.ConstructAndRegisterSingleton(); + Mvx.IoCProvider?.ConstructAndRegisterSingleton(); } protected void RegisterAppStart() where TViewModel : IMvxViewModel { - Mvx.IoCProvider.ConstructAndRegisterSingleton>(); + Mvx.IoCProvider?.ConstructAndRegisterSingleton>(); } protected void RegisterAppStart(IMvxAppStart appStart) { - Mvx.IoCProvider.RegisterSingleton(appStart); + Mvx.IoCProvider?.RegisterSingleton(appStart); } protected virtual void RegisterAppStart() where TViewModel : IMvxViewModel where TParameter : class { - Mvx.IoCProvider.ConstructAndRegisterSingleton>(); + Mvx.IoCProvider?.ConstructAndRegisterSingleton>(); } protected IEnumerable CreatableTypes() diff --git a/Projects/Playground/Playground.Core/App.cs b/Projects/Playground/Playground.Core/App.cs index 1e7ab31b18..afb0b05f4d 100644 --- a/Projects/Playground/Playground.Core/App.cs +++ b/Projects/Playground/Playground.Core/App.cs @@ -25,7 +25,7 @@ public override void Initialize() .AsInterfaces() .RegisterAsLazySingleton(); - Mvx.IoCProvider.RegisterSingleton(new TextProviderBuilder().TextProvider); + Mvx.IoCProvider?.RegisterSingleton(new TextProviderBuilder().TextProvider); RegisterAppStart(); } diff --git a/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs b/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs index 0b794c6077..4bfdf55865 100644 --- a/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs +++ b/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs @@ -54,6 +54,8 @@ public void TryResolve_WithNoInjection_NothingGetsInjected() MvxSingleton.ClearAllSingletons(); var instance = MvxIoCProvider.Initialize(); + Assert.NotNull(Mvx.IoCProvider); + Mvx.IoCProvider.RegisterType(); Mvx.IoCProvider.RegisterType(); Mvx.IoCProvider.RegisterType(); @@ -82,6 +84,8 @@ public void TryResolve_WithAttrInjection_AttrMarkedProperiesGetInjected() } }; var instance = MvxIoCProvider.Initialize(options); + + Assert.NotNull(Mvx.IoCProvider); Mvx.IoCProvider.RegisterType(); Mvx.IoCProvider.RegisterType(); @@ -112,6 +116,7 @@ public void TryResolve_WithFullInjection_AllInterfaceProperiesGetInjected() } }; var instance = MvxIoCProvider.Initialize(options); + Assert.NotNull(Mvx.IoCProvider); Mvx.IoCProvider.RegisterType(); Mvx.IoCProvider.RegisterType(); diff --git a/UnitTests/MvvmCross.UnitTest/Parse/MvxStringDictionaryTextSerializerTest.cs b/UnitTests/MvvmCross.UnitTest/Parse/MvxStringDictionaryTextSerializerTest.cs index 8416a289b8..0f57e023ab 100644 --- a/UnitTests/MvvmCross.UnitTest/Parse/MvxStringDictionaryTextSerializerTest.cs +++ b/UnitTests/MvvmCross.UnitTest/Parse/MvxStringDictionaryTextSerializerTest.cs @@ -28,7 +28,7 @@ public void Test_Round_Trip_Works_For_Normal_ViewModel_Requests() var viewModelNameLookup = new MvxViewModelByNameLookup(); viewModelNameLookup.AddAll(GetType().Assembly); - Mvx.IoCProvider.RegisterSingleton(viewModelNameLookup); + Mvx.IoCProvider?.RegisterSingleton(viewModelNameLookup); var parameterBundle = new MvxBundle(new Dictionary { { "On'e", "1'\\" }, { "Two", "2" } }); var presentationBundle = From 4f7ad8c51a2e7ab794a5a4a02d4c1f88a2dca147 Mon Sep 17 00:00:00 2001 From: Tomasz Cielecki Date: Tue, 10 Jan 2023 19:15:01 +0100 Subject: [PATCH 2/3] dotnet format --- .../Platforms/WinUi/MvxColorDesignTimeHelper.cs | 2 +- .../Color/Platforms/WinUi/MvxStoreColor.cs | 2 +- .../Platforms/WinUi/MvxStoreColorExtensions.cs | 2 +- .../Color/Platforms/WinUi/Plugin.cs | 2 +- .../Platforms/WinUi/MvxWindowsResourceLoader.cs | 2 +- .../ResourceLoader/Platforms/WinUi/Plugin.cs | 2 +- .../WinUi/MvxVisibilityDesignTimeHelper.cs | 2 +- .../Platforms/WinUi/MvxWinRTVisibility.cs | 2 +- .../Visibility/Platforms/WinUi/Plugin.cs | 2 +- MvvmCross/Platforms/WinUi/Binding/Bi.n.d.cs | 2 +- MvvmCross/Platforms/WinUi/Binding/Import.cs | 2 +- .../Target/MvxDependencyPropertyTargetBinding.cs | 4 ++-- .../MvxBinding/Target/MvxVisibleTargetBinding.cs | 4 ++-- .../Platforms/WinUi/Binding/MvxBindingCreator.cs | 4 ++-- .../WinUi/Binding/MvxDesignTimeChecker.cs | 6 +++--- .../WinUi/Binding/MvxWindowsBindingBuilder.cs | 6 +++--- .../WinUi/Binding/MvxWindowsBindingCreator.cs | 8 ++++---- .../WinUi/Converters/MvxNativeValueConverter.cs | 4 ++-- .../Platforms/WinUi/Core/IMvxWindowsSetup.cs | 4 ++-- .../Platforms/WinUi/Core/MvxWindowsSetup.cs | 6 +++--- .../WinUi/Core/MvxWindowsSetupSingleton.cs | 4 ++-- MvvmCross/Platforms/WinUi/MvxDesignTimeHelper.cs | 2 +- .../MvxDialogViewPresentationAttribute.cs | 4 ++-- .../Attributes/MvxRegionPresentationAttribute.cs | 2 +- .../WinUi/Presenters/MvxWindowsViewPresenter.cs | 16 ++++++++-------- .../WinUi/Views/IMvxWindowsContentDialog.cs | 2 +- .../Platforms/WinUi/Views/MvxApplication.cs | 6 +++--- .../WinUi/Views/MvxWindowsContentDialog.cs | 6 +++--- .../Views/MvxWindowsMainThreadDispatcher.cs | 6 +++--- .../Platforms/WinUi/Views/MvxWindowsPage.cs | 8 ++++---- .../WinUi/Views/MvxWindowsViewDispatcher.cs | 2 +- .../Views/Suspension/IMvxSuspensionManager.cs | 2 +- .../Views/Suspension/MvxSuspensionManager.cs | 4 ++-- MvvmCross/Platforms/Wpf/Binding/Bi.n.d.cs | 2 +- .../Platforms/Wpf/Binding/IMvxBindingCreator.cs | 2 +- .../Wpf/Binding/IMvxWindowsAssemblyCache.cs | 2 +- MvvmCross/Platforms/Wpf/Binding/Import.cs | 2 +- .../MvxBinding/MvxMvvmCrossBindingCreator.cs | 2 +- .../MvxWindowsTargetBindingFactoryRegistry.cs | 2 +- .../Target/MvxCollapsedTargetBinding.cs | 2 +- .../Target/MvxDependencyPropertyTargetBinding.cs | 2 +- .../MvxBinding/Target/MvxVisibleTargetBinding.cs | 2 +- .../Platforms/Wpf/Binding/MvxBindingCreator.cs | 2 +- .../Binding/MvxDependencyPropertyExtensions.cs | 2 +- .../Wpf/Binding/MvxDesignTimeChecker.cs | 2 +- .../Wpf/Binding/MvxWindowsAssemblyCache.cs | 2 +- .../Wpf/Binding/MvxWindowsBindingBuilder.cs | 2 +- .../Wpf/Binding/MvxWindowsPropertyBinding.cs | 2 +- .../MvxWindowsPropertyBindingExtensions.cs | 2 +- .../WindowsBinding/MvxWindowsBindingCreator.cs | 2 +- .../MvxSimpleSelectionChangedEventArgs.cs | 2 +- .../Wpf/Converters/MvxNativeValueConverter.cs | 2 +- MvvmCross/Platforms/Wpf/Core/IMvxWpfSetup.cs | 2 +- MvvmCross/Platforms/Wpf/Core/MvxWpfSetup.cs | 2 +- .../Platforms/Wpf/Core/MvxWpfSetupSingleton.cs | 2 +- MvvmCross/Platforms/Wpf/MvxDesignTimeHelper.cs | 2 +- .../MvxContentPresentationAttribute.cs | 2 +- .../Attributes/MvxWindowPresentationAttribute.cs | 2 +- .../Wpf/Presenters/IMvxWpfViewPresenter.cs | 2 +- .../Wpf/Presenters/MvxWpfViewPresenter.cs | 2 +- MvvmCross/Platforms/Wpf/Views/IMvxWindow.cs | 2 +- MvvmCross/Platforms/Wpf/Views/IMvxWpfView.cs | 2 +- .../Platforms/Wpf/Views/IMvxWpfViewLoader.cs | 2 +- .../Platforms/Wpf/Views/IMvxWpfViewsContainer.cs | 2 +- MvvmCross/Platforms/Wpf/Views/MvxApplication.cs | 2 +- MvvmCross/Platforms/Wpf/Views/MvxWindow.cs | 2 +- .../Wpf/Views/MvxWpfUIThreadDispatcher.cs | 2 +- MvvmCross/Platforms/Wpf/Views/MvxWpfView.cs | 2 +- .../Platforms/Wpf/Views/MvxWpfViewDispatcher.cs | 2 +- .../Platforms/Wpf/Views/MvxWpfViewsContainer.cs | 2 +- .../Base/MvxIoCPropertyInjectionTest.cs | 2 +- 71 files changed, 104 insertions(+), 104 deletions(-) diff --git a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs index 8916cb3c2a..0781809c3f 100644 --- a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs +++ b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxColorDesignTimeHelper.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColor.cs b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColor.cs index e42c625ba5..fed18e5902 100644 --- a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColor.cs +++ b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColor.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColorExtensions.cs b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColorExtensions.cs index 9fbe6ab120..856750e5c3 100644 --- a/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColorExtensions.cs +++ b/MvvmCross.Plugins/Color/Platforms/WinUi/MvxStoreColorExtensions.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs b/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs index 4c0bbd2bae..b25db8a079 100644 --- a/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs +++ b/MvvmCross.Plugins/Color/Platforms/WinUi/Plugin.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/MvxWindowsResourceLoader.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/MvxWindowsResourceLoader.cs index 8093ec4534..969e5a68ea 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/MvxWindowsResourceLoader.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/MvxWindowsResourceLoader.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs b/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs index 353d1d2825..85f46094a1 100644 --- a/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs +++ b/MvvmCross.Plugins/ResourceLoader/Platforms/WinUi/Plugin.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxVisibilityDesignTimeHelper.cs b/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxVisibilityDesignTimeHelper.cs index e7906788cb..722b527013 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxVisibilityDesignTimeHelper.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxVisibilityDesignTimeHelper.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxWinRTVisibility.cs b/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxWinRTVisibility.cs index 2d66cf59e7..0e06259b25 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxWinRTVisibility.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/WinUi/MvxWinRTVisibility.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs b/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs index 0b64292039..a59df4df1c 100644 --- a/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs +++ b/MvvmCross.Plugins/Visibility/Platforms/WinUi/Plugin.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/WinUi/Binding/Bi.n.d.cs b/MvvmCross/Platforms/WinUi/Binding/Bi.n.d.cs index 06c4370d34..940d4c44c4 100644 --- a/MvvmCross/Platforms/WinUi/Binding/Bi.n.d.cs +++ b/MvvmCross/Platforms/WinUi/Binding/Bi.n.d.cs @@ -6,9 +6,9 @@ using System.Collections.Generic; using Microsoft.UI.Xaml; using MvvmCross.Base; -using MvvmCross.Exceptions; using MvvmCross.Binding; using MvvmCross.Binding.Bindings; +using MvvmCross.Exceptions; namespace MvvmCross.Platforms.WinUi.Binding { diff --git a/MvvmCross/Platforms/WinUi/Binding/Import.cs b/MvvmCross/Platforms/WinUi/Binding/Import.cs index 37a5c0d24e..cac49be0a3 100644 --- a/MvvmCross/Platforms/WinUi/Binding/Import.cs +++ b/MvvmCross/Platforms/WinUi/Binding/Import.cs @@ -4,9 +4,9 @@ using System.Reflection; using MvvmCross.Base; +using MvvmCross.Binding.Combiners; using MvvmCross.Converters; using MvvmCross.IoC; -using MvvmCross.Binding.Combiners; namespace MvvmCross.Platforms.WinUi.Binding { diff --git a/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs b/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs index 25c3f1e55b..862ce43250 100644 --- a/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs +++ b/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. @@ -56,7 +56,7 @@ public override void SubscribeToEvents() } public override Type TargetValueType => _actualPropertyType; - + public override MvxBindingMode DefaultMode { get; } = MvxBindingMode.TwoWay; protected virtual object GetValueByReflection() diff --git a/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs b/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs index 4f2bf58c03..ccf3a6f3cc 100644 --- a/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs +++ b/MvvmCross/Platforms/WinUi/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. @@ -16,7 +16,7 @@ public MvxVisibleTargetBinding(object target) } public override MvxBindingMode DefaultMode => MvxBindingMode.OneWay; - + public override void SetValue(object value) { if (value == null) diff --git a/MvvmCross/Platforms/WinUi/Binding/MvxBindingCreator.cs b/MvvmCross/Platforms/WinUi/Binding/MvxBindingCreator.cs index 489d5d8657..40957c8078 100644 --- a/MvvmCross/Platforms/WinUi/Binding/MvxBindingCreator.cs +++ b/MvvmCross/Platforms/WinUi/Binding/MvxBindingCreator.cs @@ -1,12 +1,12 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; +using Microsoft.Extensions.Logging; using Microsoft.UI.Xaml; using MvvmCross.Binding.Bindings; -using Microsoft.Extensions.Logging; using MvvmCross.Logging; namespace MvvmCross.Platforms.WinUi.Binding diff --git a/MvvmCross/Platforms/WinUi/Binding/MvxDesignTimeChecker.cs b/MvvmCross/Platforms/WinUi/Binding/MvxDesignTimeChecker.cs index 4fc4413d79..44ffe9b997 100644 --- a/MvvmCross/Platforms/WinUi/Binding/MvxDesignTimeChecker.cs +++ b/MvvmCross/Platforms/WinUi/Binding/MvxDesignTimeChecker.cs @@ -1,11 +1,11 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. -using Windows.ApplicationModel; using MvvmCross.Base; -using MvvmCross.IoC; using MvvmCross.Binding.Parse.Binding; +using MvvmCross.IoC; +using Windows.ApplicationModel; namespace MvvmCross.Platforms.WinUi.Binding { diff --git a/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingBuilder.cs b/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingBuilder.cs index c2c9477495..218f3ff1c1 100644 --- a/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingBuilder.cs +++ b/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingBuilder.cs @@ -1,18 +1,18 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using Microsoft.UI.Xaml; using MvvmCross.Base; -using MvvmCross.Converters; using MvvmCross.Binding; using MvvmCross.Binding.Binders; using MvvmCross.Binding.Bindings.Target.Construction; using MvvmCross.Binding.Combiners; +using MvvmCross.Converters; +using MvvmCross.IoC; using MvvmCross.Platforms.WinUi.Binding.MvxBinding; using MvvmCross.Platforms.WinUi.Binding.MvxBinding.Target; -using MvvmCross.IoC; namespace MvvmCross.Platforms.WinUi.Binding { diff --git a/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingCreator.cs b/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingCreator.cs index 8f7d07de0c..605f48dd9c 100644 --- a/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingCreator.cs +++ b/MvvmCross/Platforms/WinUi/Binding/MvxWindowsBindingCreator.cs @@ -1,19 +1,19 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; +using Microsoft.Extensions.Logging; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Data; using Microsoft.UI.Xaml.Media; -using MvvmCross.Converters; -using MvvmCross.Logging; using MvvmCross.Binding; using MvvmCross.Binding.Bindings; using MvvmCross.Binding.Bindings.SourceSteps; +using MvvmCross.Converters; +using MvvmCross.Logging; using MvvmCross.Platforms.WinUi.Converters; -using Microsoft.Extensions.Logging; namespace MvvmCross.Platforms.WinUi.Binding { diff --git a/MvvmCross/Platforms/WinUi/Converters/MvxNativeValueConverter.cs b/MvvmCross/Platforms/WinUi/Converters/MvxNativeValueConverter.cs index 2d92af2f66..fb90b25777 100644 --- a/MvvmCross/Platforms/WinUi/Converters/MvxNativeValueConverter.cs +++ b/MvvmCross/Platforms/WinUi/Converters/MvxNativeValueConverter.cs @@ -1,14 +1,14 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Globalization; +using Microsoft.Extensions.Logging; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Data; using MvvmCross.Converters; using MvvmCross.Logging; -using Microsoft.Extensions.Logging; namespace MvvmCross.Platforms.WinUi.Converters { diff --git a/MvvmCross/Platforms/WinUi/Core/IMvxWindowsSetup.cs b/MvvmCross/Platforms/WinUi/Core/IMvxWindowsSetup.cs index 2810cd2125..56e8e50c9c 100644 --- a/MvvmCross/Platforms/WinUi/Core/IMvxWindowsSetup.cs +++ b/MvvmCross/Platforms/WinUi/Core/IMvxWindowsSetup.cs @@ -1,11 +1,11 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. +using Microsoft.UI.Xaml.Controls; using MvvmCross.Core; using MvvmCross.Platforms.WinUi.Views; using Windows.ApplicationModel.Activation; -using Microsoft.UI.Xaml.Controls; namespace MvvmCross.Platforms.WinUi.Core { diff --git a/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetup.cs b/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetup.cs index cd95b08813..afd60c740f 100644 --- a/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetup.cs +++ b/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetup.cs @@ -1,14 +1,15 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Reflection; +using Microsoft.UI.Xaml.Controls; using MvvmCross.Binding; +using MvvmCross.Binding.Binders; using MvvmCross.Binding.BindingContext; using MvvmCross.Binding.Bindings.Target.Construction; -using MvvmCross.Binding.Binders; using MvvmCross.Converters; using MvvmCross.Core; using MvvmCross.Exceptions; @@ -21,7 +22,6 @@ using MvvmCross.ViewModels; using MvvmCross.Views; using Windows.ApplicationModel.Activation; -using Microsoft.UI.Xaml.Controls; namespace MvvmCross.Platforms.WinUi.Core { diff --git a/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetupSingleton.cs b/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetupSingleton.cs index bbd860745d..8be058cb22 100644 --- a/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetupSingleton.cs +++ b/MvvmCross/Platforms/WinUi/Core/MvxWindowsSetupSingleton.cs @@ -1,11 +1,11 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. +using Microsoft.UI.Xaml.Controls; using MvvmCross.Core; using MvvmCross.Platforms.WinUi.Views; using Windows.ApplicationModel.Activation; -using Microsoft.UI.Xaml.Controls; namespace MvvmCross.Platforms.WinUi.Core { diff --git a/MvvmCross/Platforms/WinUi/MvxDesignTimeHelper.cs b/MvvmCross/Platforms/WinUi/MvxDesignTimeHelper.cs index b4c3410fca..853db0da8b 100644 --- a/MvvmCross/Platforms/WinUi/MvxDesignTimeHelper.cs +++ b/MvvmCross/Platforms/WinUi/MvxDesignTimeHelper.cs @@ -2,9 +2,9 @@ // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. -using Windows.ApplicationModel; using MvvmCross.Base; using MvvmCross.IoC; +using Windows.ApplicationModel; namespace MvvmCross.Platforms.WinUi { diff --git a/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxDialogViewPresentationAttribute.cs b/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxDialogViewPresentationAttribute.cs index 6894211317..bc392c1f23 100644 --- a/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxDialogViewPresentationAttribute.cs +++ b/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxDialogViewPresentationAttribute.cs @@ -1,9 +1,9 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. -using MvvmCross.Presenters.Attributes; using Microsoft.UI.Xaml.Controls; +using MvvmCross.Presenters.Attributes; namespace MvvmCross.Platforms.WinUi.Presenters.Attributes { diff --git a/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxRegionPresentationAttribute.cs b/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxRegionPresentationAttribute.cs index d24837af8e..0ad72d935d 100644 --- a/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxRegionPresentationAttribute.cs +++ b/MvvmCross/Platforms/WinUi/Presenters/Attributes/MvxRegionPresentationAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/WinUi/Presenters/MvxWindowsViewPresenter.cs b/MvvmCross/Platforms/WinUi/Presenters/MvxWindowsViewPresenter.cs index ee1347cc9e..301bd15384 100644 --- a/MvvmCross/Platforms/WinUi/Presenters/MvxWindowsViewPresenter.cs +++ b/MvvmCross/Platforms/WinUi/Presenters/MvxWindowsViewPresenter.cs @@ -3,22 +3,22 @@ // See the LICENSE file in the project root for more information. using System; -using Windows.UI.Core; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.Extensions.Logging; +using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Media; using MvvmCross.Exceptions; using MvvmCross.Logging; using MvvmCross.Navigation; using MvvmCross.Platforms.WinUi.Presenters.Attributes; using MvvmCross.Platforms.WinUi.Views; -using MvvmCross.ViewModels; using MvvmCross.Presenters; -using MvvmCross.Views; using MvvmCross.Presenters.Attributes; -using System.Threading.Tasks; -using Microsoft.UI.Xaml.Media; -using Microsoft.UI.Xaml; -using System.Linq; -using Microsoft.Extensions.Logging; +using MvvmCross.ViewModels; +using MvvmCross.Views; +using Windows.UI.Core; namespace MvvmCross.Platforms.WinUi.Presenters { diff --git a/MvvmCross/Platforms/WinUi/Views/IMvxWindowsContentDialog.cs b/MvvmCross/Platforms/WinUi/Views/IMvxWindowsContentDialog.cs index 68b2971018..1d822845a9 100644 --- a/MvvmCross/Platforms/WinUi/Views/IMvxWindowsContentDialog.cs +++ b/MvvmCross/Platforms/WinUi/Views/IMvxWindowsContentDialog.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/WinUi/Views/MvxApplication.cs b/MvvmCross/Platforms/WinUi/Views/MvxApplication.cs index 9c9244633a..0c8137927e 100644 --- a/MvvmCross/Platforms/WinUi/Views/MvxApplication.cs +++ b/MvvmCross/Platforms/WinUi/Views/MvxApplication.cs @@ -1,10 +1,8 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System.Threading.Tasks; -using Windows.ApplicationModel; -using Windows.ApplicationModel.Activation; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; using Microsoft.UI.Xaml.Navigation; @@ -13,6 +11,8 @@ using MvvmCross.Platforms.WinUi.Core; using MvvmCross.Platforms.WinUi.Views.Suspension; using MvvmCross.ViewModels; +using Windows.ApplicationModel; +using Windows.ApplicationModel.Activation; using LaunchActivatedEventArgs = Microsoft.UI.Xaml.LaunchActivatedEventArgs; namespace MvvmCross.Platforms.WinUi.Views diff --git a/MvvmCross/Platforms/WinUi/Views/MvxWindowsContentDialog.cs b/MvvmCross/Platforms/WinUi/Views/MvxWindowsContentDialog.cs index 2ebc0de899..fdd24ebf58 100644 --- a/MvvmCross/Platforms/WinUi/Views/MvxWindowsContentDialog.cs +++ b/MvvmCross/Platforms/WinUi/Views/MvxWindowsContentDialog.cs @@ -1,12 +1,12 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; -using MvvmCross.ViewModels; -using MvvmCross.Views; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using MvvmCross.ViewModels; +using MvvmCross.Views; namespace MvvmCross.Platforms.WinUi.Views { diff --git a/MvvmCross/Platforms/WinUi/Views/MvxWindowsMainThreadDispatcher.cs b/MvvmCross/Platforms/WinUi/Views/MvxWindowsMainThreadDispatcher.cs index b9c8100320..a191f18f0a 100644 --- a/MvvmCross/Platforms/WinUi/Views/MvxWindowsMainThreadDispatcher.cs +++ b/MvvmCross/Platforms/WinUi/Views/MvxWindowsMainThreadDispatcher.cs @@ -1,11 +1,11 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; -using Windows.UI.Core; -using MvvmCross.Base; using Microsoft.UI.Dispatching; +using MvvmCross.Base; +using Windows.UI.Core; namespace MvvmCross.Platforms.WinUi.Views { diff --git a/MvvmCross/Platforms/WinUi/Views/MvxWindowsPage.cs b/MvvmCross/Platforms/WinUi/Views/MvxWindowsPage.cs index bb622b4e89..e392145dd4 100644 --- a/MvvmCross/Platforms/WinUi/Views/MvxWindowsPage.cs +++ b/MvvmCross/Platforms/WinUi/Views/MvxWindowsPage.cs @@ -1,17 +1,17 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. using System; using System.Collections.Generic; using System.Linq; +using Microsoft.UI.Xaml; +using Microsoft.UI.Xaml.Controls; +using Microsoft.UI.Xaml.Navigation; using MvvmCross.Platforms.WinUi.Views.Suspension; using MvvmCross.ViewModels; using MvvmCross.Views; using Windows.UI.Core; -using Microsoft.UI.Xaml; -using Microsoft.UI.Xaml.Controls; -using Microsoft.UI.Xaml.Navigation; namespace MvvmCross.Platforms.WinUi.Views { diff --git a/MvvmCross/Platforms/WinUi/Views/MvxWindowsViewDispatcher.cs b/MvvmCross/Platforms/WinUi/Views/MvxWindowsViewDispatcher.cs index 4652d37506..a9434d85e3 100644 --- a/MvvmCross/Platforms/WinUi/Views/MvxWindowsViewDispatcher.cs +++ b/MvvmCross/Platforms/WinUi/Views/MvxWindowsViewDispatcher.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/WinUi/Views/Suspension/IMvxSuspensionManager.cs b/MvvmCross/Platforms/WinUi/Views/Suspension/IMvxSuspensionManager.cs index fcda2de1c3..71402c5531 100644 --- a/MvvmCross/Platforms/WinUi/Views/Suspension/IMvxSuspensionManager.cs +++ b/MvvmCross/Platforms/WinUi/Views/Suspension/IMvxSuspensionManager.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/WinUi/Views/Suspension/MvxSuspensionManager.cs b/MvvmCross/Platforms/WinUi/Views/Suspension/MvxSuspensionManager.cs index d52acab58d..41156b22aa 100644 --- a/MvvmCross/Platforms/WinUi/Views/Suspension/MvxSuspensionManager.cs +++ b/MvvmCross/Platforms/WinUi/Views/Suspension/MvxSuspensionManager.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. @@ -7,9 +7,9 @@ using System.IO; using System.Runtime.Serialization; using System.Threading.Tasks; -using Windows.Storage; using Microsoft.UI.Xaml; using Microsoft.UI.Xaml.Controls; +using Windows.Storage; namespace MvvmCross.Platforms.WinUi.Views.Suspension { diff --git a/MvvmCross/Platforms/Wpf/Binding/Bi.n.d.cs b/MvvmCross/Platforms/Wpf/Binding/Bi.n.d.cs index cfabf55ad3..9a97d2486b 100644 --- a/MvvmCross/Platforms/Wpf/Binding/Bi.n.d.cs +++ b/MvvmCross/Platforms/Wpf/Binding/Bi.n.d.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/IMvxBindingCreator.cs b/MvvmCross/Platforms/Wpf/Binding/IMvxBindingCreator.cs index a6b37f7d40..6da7dce49d 100644 --- a/MvvmCross/Platforms/Wpf/Binding/IMvxBindingCreator.cs +++ b/MvvmCross/Platforms/Wpf/Binding/IMvxBindingCreator.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/IMvxWindowsAssemblyCache.cs b/MvvmCross/Platforms/Wpf/Binding/IMvxWindowsAssemblyCache.cs index 603cf964e2..f4a27fec75 100644 --- a/MvvmCross/Platforms/Wpf/Binding/IMvxWindowsAssemblyCache.cs +++ b/MvvmCross/Platforms/Wpf/Binding/IMvxWindowsAssemblyCache.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/Import.cs b/MvvmCross/Platforms/Wpf/Binding/Import.cs index 808b94ffeb..5aaedf1a0d 100644 --- a/MvvmCross/Platforms/Wpf/Binding/Import.cs +++ b/MvvmCross/Platforms/Wpf/Binding/Import.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxMvvmCrossBindingCreator.cs b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxMvvmCrossBindingCreator.cs index 09fbb8123c..2840b68ce5 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxMvvmCrossBindingCreator.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxMvvmCrossBindingCreator.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxWindowsTargetBindingFactoryRegistry.cs b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxWindowsTargetBindingFactoryRegistry.cs index f3c4e13202..efc667660e 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxWindowsTargetBindingFactoryRegistry.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/MvxWindowsTargetBindingFactoryRegistry.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxCollapsedTargetBinding.cs b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxCollapsedTargetBinding.cs index 93c04ce9d6..32b4b30f1a 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxCollapsedTargetBinding.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxCollapsedTargetBinding.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs index 5f0efb6e07..97cdb7c932 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxDependencyPropertyTargetBinding.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs index dca742e156..ea82a96907 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxBinding/Target/MvxVisibleTargetBinding.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxBindingCreator.cs b/MvvmCross/Platforms/Wpf/Binding/MvxBindingCreator.cs index 1316f39fc4..8a05bf673f 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxBindingCreator.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxBindingCreator.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxDependencyPropertyExtensions.cs b/MvvmCross/Platforms/Wpf/Binding/MvxDependencyPropertyExtensions.cs index 2d22bcb297..1131a657bc 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxDependencyPropertyExtensions.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxDependencyPropertyExtensions.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxDesignTimeChecker.cs b/MvvmCross/Platforms/Wpf/Binding/MvxDesignTimeChecker.cs index 8c46aadc9f..4a60f098f9 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxDesignTimeChecker.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxDesignTimeChecker.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsAssemblyCache.cs b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsAssemblyCache.cs index 0f7f6163fc..262e54cda7 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsAssemblyCache.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsAssemblyCache.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsBindingBuilder.cs b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsBindingBuilder.cs index 668de24bde..3c08a425c2 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsBindingBuilder.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsBindingBuilder.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBinding.cs b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBinding.cs index 3598ddf8cd..3d1c50b534 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBinding.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBinding.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBindingExtensions.cs b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBindingExtensions.cs index 63bb375fea..26bc3b0e78 100644 --- a/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBindingExtensions.cs +++ b/MvvmCross/Platforms/Wpf/Binding/MvxWindowsPropertyBindingExtensions.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Binding/WindowsBinding/MvxWindowsBindingCreator.cs b/MvvmCross/Platforms/Wpf/Binding/WindowsBinding/MvxWindowsBindingCreator.cs index 1090128570..ff74e8827b 100644 --- a/MvvmCross/Platforms/Wpf/Binding/WindowsBinding/MvxWindowsBindingCreator.cs +++ b/MvvmCross/Platforms/Wpf/Binding/WindowsBinding/MvxWindowsBindingCreator.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Commands/MvxSimpleSelectionChangedEventArgs.cs b/MvvmCross/Platforms/Wpf/Commands/MvxSimpleSelectionChangedEventArgs.cs index 925c9a5fcd..329313727d 100644 --- a/MvvmCross/Platforms/Wpf/Commands/MvxSimpleSelectionChangedEventArgs.cs +++ b/MvvmCross/Platforms/Wpf/Commands/MvxSimpleSelectionChangedEventArgs.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Converters/MvxNativeValueConverter.cs b/MvvmCross/Platforms/Wpf/Converters/MvxNativeValueConverter.cs index 472056ae48..3f3f38112a 100644 --- a/MvvmCross/Platforms/Wpf/Converters/MvxNativeValueConverter.cs +++ b/MvvmCross/Platforms/Wpf/Converters/MvxNativeValueConverter.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Core/IMvxWpfSetup.cs b/MvvmCross/Platforms/Wpf/Core/IMvxWpfSetup.cs index 1deb921555..da6e9a1e3d 100644 --- a/MvvmCross/Platforms/Wpf/Core/IMvxWpfSetup.cs +++ b/MvvmCross/Platforms/Wpf/Core/IMvxWpfSetup.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Core/MvxWpfSetup.cs b/MvvmCross/Platforms/Wpf/Core/MvxWpfSetup.cs index eac4268331..0a9eaf0dda 100644 --- a/MvvmCross/Platforms/Wpf/Core/MvxWpfSetup.cs +++ b/MvvmCross/Platforms/Wpf/Core/MvxWpfSetup.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Core/MvxWpfSetupSingleton.cs b/MvvmCross/Platforms/Wpf/Core/MvxWpfSetupSingleton.cs index 03ad296f76..89b500bc3e 100644 --- a/MvvmCross/Platforms/Wpf/Core/MvxWpfSetupSingleton.cs +++ b/MvvmCross/Platforms/Wpf/Core/MvxWpfSetupSingleton.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/MvxDesignTimeHelper.cs b/MvvmCross/Platforms/Wpf/MvxDesignTimeHelper.cs index c75a871ee3..b2323253be 100644 --- a/MvvmCross/Platforms/Wpf/MvxDesignTimeHelper.cs +++ b/MvvmCross/Platforms/Wpf/MvxDesignTimeHelper.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxContentPresentationAttribute.cs b/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxContentPresentationAttribute.cs index 386770c5bc..ee53471462 100644 --- a/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxContentPresentationAttribute.cs +++ b/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxContentPresentationAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxWindowPresentationAttribute.cs b/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxWindowPresentationAttribute.cs index 531de21af5..22594f81ad 100644 --- a/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxWindowPresentationAttribute.cs +++ b/MvvmCross/Platforms/Wpf/Presenters/Attributes/MvxWindowPresentationAttribute.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Presenters/IMvxWpfViewPresenter.cs b/MvvmCross/Platforms/Wpf/Presenters/IMvxWpfViewPresenter.cs index bd9e3d78ed..a5eb72914d 100644 --- a/MvvmCross/Platforms/Wpf/Presenters/IMvxWpfViewPresenter.cs +++ b/MvvmCross/Platforms/Wpf/Presenters/IMvxWpfViewPresenter.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Presenters/MvxWpfViewPresenter.cs b/MvvmCross/Platforms/Wpf/Presenters/MvxWpfViewPresenter.cs index fe0f9c7793..1374f37508 100644 --- a/MvvmCross/Platforms/Wpf/Presenters/MvxWpfViewPresenter.cs +++ b/MvvmCross/Platforms/Wpf/Presenters/MvxWpfViewPresenter.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/IMvxWindow.cs b/MvvmCross/Platforms/Wpf/Views/IMvxWindow.cs index 3fb7004f31..a3959a6364 100644 --- a/MvvmCross/Platforms/Wpf/Views/IMvxWindow.cs +++ b/MvvmCross/Platforms/Wpf/Views/IMvxWindow.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/IMvxWpfView.cs b/MvvmCross/Platforms/Wpf/Views/IMvxWpfView.cs index 596ff3692f..aab7471e8f 100644 --- a/MvvmCross/Platforms/Wpf/Views/IMvxWpfView.cs +++ b/MvvmCross/Platforms/Wpf/Views/IMvxWpfView.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewLoader.cs b/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewLoader.cs index 76bc9dbe49..3e4c0e0751 100644 --- a/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewLoader.cs +++ b/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewLoader.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewsContainer.cs b/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewsContainer.cs index bebc1a60ce..233ba06074 100644 --- a/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewsContainer.cs +++ b/MvvmCross/Platforms/Wpf/Views/IMvxWpfViewsContainer.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/MvxApplication.cs b/MvvmCross/Platforms/Wpf/Views/MvxApplication.cs index 08a7dcd271..038ba3bff5 100644 --- a/MvvmCross/Platforms/Wpf/Views/MvxApplication.cs +++ b/MvvmCross/Platforms/Wpf/Views/MvxApplication.cs @@ -1,4 +1,4 @@ -using System.Windows; +using System.Windows; using MvvmCross.Core; using MvvmCross.Platforms.Wpf.Core; using MvvmCross.ViewModels; diff --git a/MvvmCross/Platforms/Wpf/Views/MvxWindow.cs b/MvvmCross/Platforms/Wpf/Views/MvxWindow.cs index 29855cb938..ce75b1c55f 100644 --- a/MvvmCross/Platforms/Wpf/Views/MvxWindow.cs +++ b/MvvmCross/Platforms/Wpf/Views/MvxWindow.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/MvxWpfUIThreadDispatcher.cs b/MvvmCross/Platforms/Wpf/Views/MvxWpfUIThreadDispatcher.cs index 6cb3aca749..0b78193fe9 100644 --- a/MvvmCross/Platforms/Wpf/Views/MvxWpfUIThreadDispatcher.cs +++ b/MvvmCross/Platforms/Wpf/Views/MvxWpfUIThreadDispatcher.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/MvxWpfView.cs b/MvvmCross/Platforms/Wpf/Views/MvxWpfView.cs index 314941081e..68057a09e2 100644 --- a/MvvmCross/Platforms/Wpf/Views/MvxWpfView.cs +++ b/MvvmCross/Platforms/Wpf/Views/MvxWpfView.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/MvxWpfViewDispatcher.cs b/MvvmCross/Platforms/Wpf/Views/MvxWpfViewDispatcher.cs index a3d46151e0..3c58ddbd95 100644 --- a/MvvmCross/Platforms/Wpf/Views/MvxWpfViewDispatcher.cs +++ b/MvvmCross/Platforms/Wpf/Views/MvxWpfViewDispatcher.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/MvvmCross/Platforms/Wpf/Views/MvxWpfViewsContainer.cs b/MvvmCross/Platforms/Wpf/Views/MvxWpfViewsContainer.cs index 0bf5411d9e..b7f1255c4c 100644 --- a/MvvmCross/Platforms/Wpf/Views/MvxWpfViewsContainer.cs +++ b/MvvmCross/Platforms/Wpf/Views/MvxWpfViewsContainer.cs @@ -1,4 +1,4 @@ -// Licensed to the .NET Foundation under one or more agreements. +// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MS-PL license. // See the LICENSE file in the project root for more information. diff --git a/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs b/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs index 4bfdf55865..5c15d41397 100644 --- a/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs +++ b/UnitTests/MvvmCross.UnitTest/Base/MvxIoCPropertyInjectionTest.cs @@ -84,7 +84,7 @@ public void TryResolve_WithAttrInjection_AttrMarkedProperiesGetInjected() } }; var instance = MvxIoCProvider.Initialize(options); - + Assert.NotNull(Mvx.IoCProvider); Mvx.IoCProvider.RegisterType(); From 459fd01561af27f7fbd403eda56ba5667993201c Mon Sep 17 00:00:00 2001 From: Tomasz Cielecki Date: Thu, 12 Jan 2023 10:31:30 +0100 Subject: [PATCH 3/3] Update changelog --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdf3239693..5bde310e60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,17 @@ # Changelog +## [9.0.6](https://github.com/MvvmCross/MvvmCross/tree/9.0.6) (2023-01-12) + +[Full Changelog](https://github.com/MvvmCross/MvvmCross/compare/9.0.5...9.0.6) + +**Fixed bugs:** + +- Fix nullable warnings with a lot of Mvx.IoCProvider usages [\#4543](https://github.com/MvvmCross/MvvmCross/pull/4543) ([Cheesebaron](https://github.com/Cheesebaron)) + +**Merged pull requests:** + +- Bump Microsoft.NET.Test.Sdk from 17.4.0 to 17.4.1 [\#4535](https://github.com/MvvmCross/MvvmCross/pull/4535) ([dependabot[bot]](https://github.com/apps/dependabot)) + ## [9.0.5](https://github.com/MvvmCross/MvvmCross/tree/9.0.5) (2023-01-09) [Full Changelog](https://github.com/MvvmCross/MvvmCross/compare/9.0.4...9.0.5)