[Tizen] Cleanup Code (#4080)
authorWonYoung Choi <wy80.choi@samsung.com>
Mon, 15 Oct 2018 15:42:54 +0000 (00:42 +0900)
committerRui Marinho <me@ruimarinho.net>
Mon, 15 Oct 2018 15:42:54 +0000 (16:42 +0100)
19 files changed:
Xamarin.Forms.Platform.Tizen/Cells/ImageCellRenderer.cs
Xamarin.Forms.Platform.Tizen/Forms.cs
Xamarin.Forms.Platform.Tizen/FormsApplication.cs
Xamarin.Forms.Platform.Tizen/GestureDetector.cs
Xamarin.Forms.Platform.Tizen/GestureHandler.cs
Xamarin.Forms.Platform.Tizen/Log/Log.cs
Xamarin.Forms.Platform.Tizen/Native/Dialog.cs
Xamarin.Forms.Platform.Tizen/Native/Entry.cs
Xamarin.Forms.Platform.Tizen/Native/ListView.cs
Xamarin.Forms.Platform.Tizen/Native/Scroller.cs
Xamarin.Forms.Platform.Tizen/Native/Span.cs
Xamarin.Forms.Platform.Tizen/NativeValueConverterService.cs
Xamarin.Forms.Platform.Tizen/Platform.cs
Xamarin.Forms.Platform.Tizen/Renderers/MasterDetailContainer.cs
Xamarin.Forms.Platform.Tizen/Renderers/NavigationPageRenderer.cs
Xamarin.Forms.Platform.Tizen/Renderers/VisualElementRenderer.cs
Xamarin.Forms.Platform.Tizen/ResourcesProvider.cs
Xamarin.Forms.Platform.Tizen/TizenIsolatedStorageFile.cs
Xamarin.Forms.Platform.Tizen/TizenPlatformServices.cs

index dfeeee0..b9865d2 100644 (file)
@@ -6,7 +6,6 @@ namespace Xamarin.Forms.Platform.Tizen
        public class ImageCellRenderer : TextCellRenderer
        {
                const int _defaultHeight = 55;
-               Dictionary<EvasObject, Native.Image> _realizedViews = new Dictionary<EvasObject, Native.Image>();
 
                public ImageCellRenderer() : this(Device.Idiom == TargetIdiom.Watch ? "1icon_2text" : "default")
                {
index 7d3b9df..97dfc78 100644 (file)
@@ -209,10 +209,9 @@ namespace Xamarin.Forms.Platform.Tizen
                        // In .NETCore, AppDomain feature is not supported.
                        // The list of assemblies returned by AppDomain.GetAssemblies() method should be registered manually.
                        // The assembly of the executing application and referenced assemblies of it are added into the list here.
-                       // TODO: AppDomain is comming back in NETStandard2.0. This logic should be changed at that time.
                        TizenPlatformServices.AppDomain.CurrentDomain.RegisterAssemblyRecursively(application.GetType().GetTypeInfo().Assembly);
 
-                       Device.PlatformServices = new TizenPlatformServices(); ;
+                       Device.PlatformServices = new TizenPlatformServices();
                        if (Device.info != null)
                        {
                                ((TizenDeviceInfo)Device.info).Dispose();
@@ -233,7 +232,6 @@ namespace Xamarin.Forms.Platform.Tizen
                                });
                        }
 
-                       // TODO: We should consider various tizen profiles such as TV, Wearable and so on.
                        string profile = ((TizenDeviceInfo)Device.Info).Profile;
                        if (profile == "mobile")
                        {
index 5999e5f..c8d1442 100644 (file)
@@ -102,12 +102,12 @@ namespace Xamarin.Forms.Platform.Tizen
 
                        if (null == MainWindow)
                        {
-                               throw new NullReferenceException("MainWindow is not prepared. This method should be called in OnCreated().");
+                               throw new InvalidOperationException("MainWindow is not prepared. This method should be called in OnCreated().");
                        }
 
                        if (null == application)
                        {
-                               throw new ArgumentNullException("application");
+                               throw new ArgumentNullException(nameof(application));
                        }
                        _application = application;
                        Application.Current = application;
index cdf6bd1..896f4b0 100644 (file)
@@ -11,16 +11,14 @@ namespace Xamarin.Forms.Platform.Tizen
 {
        internal class GestureDetector
        {
-               IDictionary<EGestureType, List<GestureHandler>> _handlerCache = new Dictionary<EGestureType, List<GestureHandler>>();
+               readonly IDictionary<EGestureType, List<GestureHandler>> _handlerCache = new Dictionary<EGestureType, List<GestureHandler>>();
 
                readonly IVisualElementRenderer _renderer;
                GestureLayer _gestureLayer;
                double _doubleTapTime = 0;
                double _longTapTime = 0;
-               int _horizontalSwipeTime = 0;
-               int _verticalSwipeTime = 0;
                bool _inputTransparent = false;
-               bool _isEnabled = true;
+               bool _isEnabled;
 
                View View => _renderer.Element as View;
 
@@ -74,7 +72,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        {
                                foreach (var handler in handlers)
                                {
-                                       (handler as GestureHandler).PropertyChanged -= OnGestureRecognizerPropertyChanged;
+                                       handler.PropertyChanged -= OnGestureRecognizerPropertyChanged;
                                }
                        }
                        _handlerCache.Clear();
@@ -474,34 +472,6 @@ namespace Xamarin.Forms.Platform.Tizen
                        }
                }
 
-               void OnFlickStarted(EGestureType type, object data)
-               {
-                       var lineData = (GestureLayer.LineData)data;
-                       _horizontalSwipeTime = Convert.ToInt32(lineData.HorizontalSwipeTimestamp);
-                       _verticalSwipeTime = Convert.ToInt32(lineData.VerticalSwipeTimestamp);
-                       OnGestureStarted(type, data);
-               }
-
-               void OnFlickCompleted(EGestureType type, object data)
-               {
-                       var lineData = (GestureLayer.LineData)data;
-                       _horizontalSwipeTime = Convert.ToInt32(lineData.HorizontalSwipeTimestamp - _horizontalSwipeTime);
-                       _verticalSwipeTime = Convert.ToInt32(lineData.VerticalSwipeTimestamp - _verticalSwipeTime);
-                       var cache = _handlerCache;
-
-                       if (cache.ContainsKey(type))
-                       {
-                               foreach (var handler in cache[type])
-                               {
-                                       if ((handler.Timeout * 1000) >= _horizontalSwipeTime ||
-                                               (handler.Timeout * 1000) >= _verticalSwipeTime)
-                                               (handler as IGestureController)?.SendCompleted(View, data);
-                                       else
-                                               (handler as IGestureController)?.SendCanceled(View, data);
-                               }
-                       }
-               }
-
                #endregion GestureCallback
 
                GestureHandler CreateHandler(IGestureRecognizer recognizer)
index d89bea5..52d504e 100644 (file)
@@ -18,7 +18,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        Recognizer.PropertyChanged += OnRecognizerPropertyChanged;
                }
 
-               public virtual event PropertyChangedEventHandler PropertyChanged;
+               public event PropertyChangedEventHandler PropertyChanged;
 
                protected abstract void OnStarted(View sender, object data);
 
index 63305e2..087394f 100644 (file)
@@ -8,40 +8,17 @@ namespace Xamarin.Forms.Platform.Tizen
        /// </summary>
        public static class Log
        {
-               static String _tag = "Xamarin";
-
-               static ILogger _logger = IsTizen() ? (ILogger)new DlogLogger() : (ILogger)new ConsoleLogger();
 
                /// <summary>
                /// Gets or sets the log tag.
                /// </summary>
-               public static String Tag
-               {
-                       get
-                       {
-                               return _tag;
-                       }
-                       set
-                       {
-                               _tag = value;
-                       }
-               }
+               public static string Tag { get; set; } = "Xamarin";
 
-               /// <summary>
-               /// Gets or sets the logger used to report messages.
-               /// It's DlogLogger on a Tizen platform, ConsoleLogger on any other.
-               /// </summary>
-               public static ILogger Logger
-               {
-                       get
-                       {
-                               return _logger;
-                       }
-                       set
-                       {
-                               _logger = value;
-                       }
-               }
+        /// <summary>
+        /// Gets or sets the logger used to report messages.
+        /// It's DlogLogger on a Tizen platform, ConsoleLogger on any other.
+        /// </summary>
+        public static ILogger Logger { get; set; } = IsTizen() ? (ILogger)new DlogLogger() : (ILogger)new ConsoleLogger();
 
                public static void Debug(string message,
                                                                 Guardian _ = default(Guardian),
@@ -49,7 +26,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                                                 [CallerMemberName] string func = "",
                                                                 [CallerLineNumber] int line = 0)
                {
-                       _logger.Debug(_tag, message, file, func, line);
+                       Logger.Debug(Tag, message, file, func, line);
                }
 
                public static void Debug<T0>(string message,
@@ -203,7 +180,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                                                   [CallerMemberName] string func = "",
                                                                   [CallerLineNumber] int line = 0)
                {
-                       _logger.Verbose(_tag, message, file, func, line);
+                       Logger.Verbose(Tag, message, file, func, line);
                }
 
                public static void Verbose<T0>(string message,
@@ -357,7 +334,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                                                [CallerMemberName] string func = "",
                                                                [CallerLineNumber] int line = 0)
                {
-                       _logger.Info(_tag, message, file, func, line);
+                       Logger.Info(Tag, message, file, func, line);
                }
 
                public static void Info<T0>(string message,
@@ -511,7 +488,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                                                [CallerMemberName] string func = "",
                                                                [CallerLineNumber] int line = 0)
                {
-                       _logger.Warn(_tag, message, file, func, line);
+                       Logger.Warn(Tag, message, file, func, line);
                }
 
                public static void Warn<T0>(string message,
@@ -665,7 +642,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                                                 [CallerMemberName] string func = "",
                                                                 [CallerLineNumber] int line = 0)
                {
-                       _logger.Error(_tag, message, file, func, line);
+                       Logger.Error(Tag, message, file, func, line);
                }
 
                public static void Error<T0>(string message,
@@ -819,7 +796,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                                                 [CallerMemberName] string func = "",
                                                                 [CallerLineNumber] int line = 0)
                {
-                       _logger.Fatal(_tag, message, file, func, line);
+                       Logger.Fatal(Tag, message, file, func, line);
                }
 
                public static void Fatal<T0>(string message,
index 668bb64..15f70cd 100644 (file)
@@ -244,7 +244,6 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                                        part = "button2";
                                        break;
 
-                               case ButtonPosition.Negative:
                                default:
                                        part = "button1";
                                        break;
index 1a08aff..27670e3 100644 (file)
@@ -12,8 +12,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
        /// </summary>
        public class Entry : EEntry, IMeasurable, IBatchable
        {
-               static readonly int s_VariationNormal = 0;
-               static readonly int s_VariationSignedAndDecimal = 3;
+               const int VariationNormal = 0;
+               const int VariationSignedAndDecimal = 3;
 
                /// <summary>
                /// Holds the formatted text of the entry.
@@ -395,7 +395,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                /// <param name="keyboard">Keyboard type to be used.</param>
                void ApplyKeyboard(Keyboard keyboard)
                {
-                       SetInternalKeyboard(_keyboard = keyboard);
+                       _keyboard = keyboard;
+                       SetInternalKeyboard(keyboard);
                }
 
                /// <summary>
@@ -414,13 +415,13 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                                SetInputPanelEnabled(true);
                                SetInputPanelLayout(InputPanelLayout.NumberOnly);
                                // InputPanelVariation is used to allow using deciaml point.
-                               InputPanelVariation = s_VariationSignedAndDecimal;
+                               InputPanelVariation = VariationSignedAndDecimal;
                        }
                        else
                        {
                                SetInputPanelEnabled(true);
                                SetInputPanelLayout((InputPanelLayout)keyboard);
-                               InputPanelVariation = s_VariationNormal;
+                               InputPanelVariation = VariationNormal;
                        }
                }
 
index 0da3c88..c60c186 100644 (file)
@@ -134,13 +134,13 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                /// <summary>
                /// Adds elements to the list and defines its presentation based on Cell type.
                /// </summary>
-               /// <param name="_source">IEnumerable on Cell collection.</param>
+               /// <param name="source">IEnumerable on Cell collection.</param>
                /// <param name="beforeCell">Cell before which new items will be placed. 
                /// Null value may also be passed as this parameter, which results in appending new items to the end.
                /// </param>
-               public void AddSource(IEnumerable _source, Cell beforeCell = null)
+               public void AddSource(IEnumerable source, Cell beforeCell = null)
                {
-                       foreach (var data in _source)
+                       foreach (var data in source)
                        {
                                GroupList groupList = data as GroupList;
                                if (groupList != null)
@@ -148,7 +148,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                                        AddGroupItem(groupList, beforeCell);
                                        foreach (var item in groupList)
                                        {
-                                               AddItem(item as Cell, groupList.HeaderContent);
+                                               AddItem(item, groupList.HeaderContent);
                                        }
                                }
                                else
@@ -451,7 +451,7 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                        if (renderer == null)
                        {
                                Log.Error("Cell type is not handled: {0}", cell.GetType());
-                               throw new ArgumentNullException("Unsupported cell type");
+                               throw new ArgumentException("Unsupported cell type");
                        }
 
                        renderer.SetGroupMode(isGroup);
index 57191ff..aef32a4 100644 (file)
@@ -7,7 +7,6 @@ namespace Xamarin.Forms.Platform.Tizen.Native
        public class Scroller : EScroller
        {
                TaskCompletionSource<bool> _animationTaskComplateSource;
-               SmartEvent _scrollAnimationStart, _scrollAnimationStop;
                bool _isAnimation = false;
 
                public Scroller(EvasObject parent) : base(parent)
@@ -17,10 +16,8 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                protected override void OnRealized()
                {
                        base.OnRealized();
-                       _scrollAnimationStart = new SmartEvent(this, RealHandle, "scroll,anim,start");
-                       _scrollAnimationStop = new SmartEvent(this, RealHandle, "scroll,anim,stop");
-                       _scrollAnimationStart.On += (s, e) => _isAnimation = true;
-                       _scrollAnimationStop.On += (s, e) =>
+                       new SmartEvent(this, RealHandle, "scroll,anim,start").On += (s, e) => _isAnimation = true;
+                       new SmartEvent(this, RealHandle, "scroll,anim,stop").On += (s, e) =>
                        {
                                if (_animationTaskComplateSource != null)
                                {
index 4e32682..6ed930e 100644 (file)
@@ -134,17 +134,11 @@ namespace Xamarin.Forms.Platform.Tizen.Native
                internal string GetMarkupText()
                {
                        StringBuilder sb = new StringBuilder();
-
-                       sb.AppendFormat("<span ");
-
+                       sb.Append("<span ");
                        sb = PrepareFormattingString(sb);
-
                        sb.Append(">");
-
                        sb.Append(GetDecoratedText());
-
                        sb.Append("</span>");
-
                        return sb.ToString();
                }
 
index 72d124d..52919cb 100644 (file)
@@ -11,7 +11,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public bool ConvertTo(object value, Type toType, out object nativeValue)
                {
                        nativeValue = null;
-                       if (typeof(EObject).IsInstanceOfType(value) && toType.IsAssignableFrom(typeof(View)))
+                       if ((value is EObject) && toType.IsAssignableFrom(typeof(View)))
                        {
                                nativeValue = ((EObject)value).ToView();
                                return true;
index d7a09f9..2f78f26 100644 (file)
@@ -86,9 +86,9 @@ namespace Xamarin.Forms.Platform.Tizen
                bool _disposed;
                Native.Dialog _pageBusyDialog;
                int _pageBusyCount;
-               Naviframe _internalNaviframe;
+               readonly Naviframe _internalNaviframe;
 
-               HashSet<EvasObject> _alerts = new HashSet<EvasObject>();
+               readonly HashSet<EvasObject> _alerts = new HashSet<EvasObject>();
 
                public event EventHandler<RootNativeViewChangedEventArgs> RootNativeViewChanged;
 
@@ -120,8 +120,6 @@ namespace Xamarin.Forms.Platform.Tizen
 
                public bool HasAlpha { get; set; }
 
-               Action BackPressedAction { get; set; }
-
                Task CurrentModalNavigationTask { get; set; }
                TaskCompletionSource<bool> CurrentTaskCompletionSource { get; set; }
                IPageController CurrentPageController => _navModel.CurrentPage as IPageController;
index e77fcc1..19ae542 100644 (file)
@@ -2,12 +2,13 @@
 
 namespace Xamarin.Forms.Platform.Tizen.Renderers
 {
-       public class MasterDetailContainer : ElmSharp.Box
+       public class MasterDetailContainer : ElmSharp.Box, IDisposable
        {
-               MasterDetailPage _parent;
+               readonly MasterDetailPage _parent;
+               readonly bool _isMaster;
+
                VisualElement _childView;
                bool _disposed;
-               bool _isMaster;
                bool _hasAppearedToParent;
 
                IPageController PageController => ChildView as IPageController;
index 9a91f70..d5ae8a4 100644 (file)
@@ -469,9 +469,9 @@ namespace Xamarin.Forms.Platform.Tizen
                void OnInsertPageBeforeRequested(object sender, NavigationRequestedEventArgs nre)
                {
                        if (nre.BeforePage == null)
-                               throw new ArgumentNullException("before");
+                               throw new ArgumentException("BeforePage is null");
                        if (nre.Page == null)
-                               throw new ArgumentNullException("page");
+                               throw new ArgumentException("Page is null");
 
                        _naviItemMap[nre.Page] = _naviFrame.InsertBefore(GetNaviItemForPage(nre.BeforePage), CreateNavItem(nre.Page), SpanTitle(nre.Page.Title));
                        UpdateHasNavigationBar(nre.Page);
@@ -494,7 +494,7 @@ namespace Xamarin.Forms.Platform.Tizen
 
                EvasObject CreateNavItem(Page page)
                {
-                       View titleView = NavigationPage.GetTitleView(page) as View;
+                       View titleView = NavigationPage.GetTitleView(page);
                        EvasObject nativeView = null;
                        if (titleView != null)
                        {
index 672a6e4..bc3bf74 100644 (file)
@@ -18,26 +18,15 @@ namespace Xamarin.Forms.Platform.Tizen
        /// </summary>
        public abstract class VisualElementRenderer<TElement> : IVisualElementRenderer, IEffectControlProvider where TElement : VisualElement
        {
-               /// <summary>
-               /// Holds registered element changed handlers.
-               /// </summary>
                readonly List<EventHandler<VisualElementChangedEventArgs>> _elementChangedHandlers = new List<EventHandler<VisualElementChangedEventArgs>>();
 
-               /// <summary>
-               /// Flags which control status of renderer.
-               /// </summary>
-               VisualElementRendererFlags _flags = VisualElementRendererFlags.None;
-
-               /// <summary>
-               /// Holds the native view.
-               /// </summary>
-               EvasObject _view;
+               readonly Dictionary<string, Action<bool>> _propertyHandlersWithInit = new Dictionary<string, Action<bool>>();
 
-               Dictionary<string, Action<bool>> _propertyHandlersWithInit = new Dictionary<string, Action<bool>>();
+               readonly Dictionary<string, Action> _propertyHandlers = new Dictionary<string, Action>();
 
-               Dictionary<string, Action> _propertyHandlers = new Dictionary<string, Action>();
+               readonly HashSet<string> _batchedProperties = new HashSet<string>();
 
-               HashSet<string> _batchedProperties = new HashSet<string>();
+               VisualElementRendererFlags _flags = VisualElementRendererFlags.None;
 
                bool _movedCallbackEnabled = false;
 
@@ -119,13 +108,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        }
                }
 
-               public EvasObject NativeView
-               {
-                       get
-                       {
-                               return _view;
-                       }
-               }
+               public EvasObject NativeView { get; private set; }
 
                protected bool IsDisposed => _flags.HasFlag(VisualElementRendererFlags.Disposed);
 
@@ -140,10 +123,6 @@ namespace Xamarin.Forms.Platform.Tizen
                /// the memory that the <see cref="Xamarin.Forms.Platform.Tizen.VisualElementRenderer"/> was occupying.</remarks>
                public void Dispose()
                {
-                       // This is the reason why I call SendDisappearing() here.
-                       // When OnChildRemove is called first like how it is called in Navigation.PopToRootAsync(),
-                       // you can not controll using SendDisappearing() on the lower class.
-                       (Element as IPageController)?.SendDisappearing();
                        Dispose(true);
                        GC.SuppressFinalize(this);
                }
@@ -186,7 +165,7 @@ namespace Xamarin.Forms.Platform.Tizen
                {
                        if (newElement == null)
                        {
-                               throw new ArgumentNullException("newElement");
+                               throw new ArgumentNullException(nameof(newElement));
                        }
 
                        TElement oldElement = Element;
@@ -228,7 +207,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        TElement tElement = element as TElement;
                        if (tElement == null)
                        {
-                               throw new ArgumentException("Element is not of type " + typeof(TElement), "Element");
+                               throw new ArgumentException("Element is not of type " + typeof(TElement), nameof(element));
                        }
                        SetElement(tElement);
                }
@@ -278,6 +257,11 @@ namespace Xamarin.Forms.Platform.Tizen
 
                        if (disposing)
                        {
+                               // This is the reason why I call SendDisappearing() here.
+                               // When OnChildRemove is called first like how it is called in Navigation.PopToRootAsync(),
+                               // you can not controll using SendDisappearing() on the lower class.
+                               (Element as IPageController)?.SendDisappearing();
+
                                if (Element != null)
                                {
                                        Element.PropertyChanged -= OnElementPropertyChanged;
@@ -310,7 +294,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                {
                                        NativeView.Deleted -= NativeViewDeleted;
                                        NativeView.Unrealize();
-                                       _view = null;
+                                       NativeView = null;
                                }
 
                                if (_customFocusManager.IsValueCreated)
@@ -365,8 +349,6 @@ namespace Xamarin.Forms.Platform.Tizen
                                        controller.EffectControlProvider = this;
                                }
                        }
-
-                       // TODO: handle the event
                }
 
                /// <summary>
@@ -438,7 +420,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                widget.Focused -= OnFocused;
                                widget.Unfocused -= OnUnfocused;
                        }
-                       _view = control;
+                       NativeView = control;
                        if (NativeView != null)
                        {
                                NativeView.Deleted += NativeViewDeleted;
index e042d08..8b77520 100644 (file)
@@ -25,7 +25,6 @@ namespace Xamarin.Forms.Platform.Tizen
                        _dictionary[Device.Styles.ListItemDetailTextStyleKey] = GetStyleByKey(Device.Styles.ListItemDetailTextStyleKey);
                }
 
-               //TODO: need Tizen API to get system values
                Style GetStyleByKey(string key)
                {
                        Style style = null;
index a1c15be..e1f4674 100644 (file)
@@ -8,7 +8,7 @@ namespace Xamarin.Forms.Platform.Tizen
 {
        internal class TizenIsolatedStorageFile : IIsolatedStorageFile
        {
-               string _rootPath;
+               readonly string _rootPath;
 
                internal TizenIsolatedStorageFile()
                {
@@ -18,7 +18,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public void CreateDirectory(string path)
                {
                        if (path == null)
-                               throw new ArgumentNullException("path");
+                               throw new ArgumentNullException(nameof(path));
                        Directory.CreateDirectory(Path.Combine(_rootPath, path));
                }
 
@@ -31,9 +31,9 @@ namespace Xamarin.Forms.Platform.Tizen
                public void MoveFile(string source, string dest)
                {
                        if (source == null)
-                               throw new ArgumentNullException("source");
+                               throw new ArgumentNullException(nameof(source));
                        if (dest == null)
-                               throw new ArgumentNullException("dest");
+                               throw new ArgumentNullException(nameof(dest));
 
                        File.Move(Path.Combine(_rootPath, source), Path.Combine(_rootPath, dest));
                }
@@ -41,7 +41,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public void DeleteFile(string path)
                {
                        if (path == null)
-                               throw new ArgumentNullException("path");
+                               throw new ArgumentNullException(nameof(path));
                        if (path.Trim().Length == 0)
                                throw new ArgumentException("An empty path is not valid.");
 
@@ -51,7 +51,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public bool DirectoryExists(string path)
                {
                        if (path == null)
-                               throw new ArgumentNullException("path");
+                               throw new ArgumentNullException(nameof(path));
                        return Directory.Exists(Path.Combine(_rootPath, path));
                }
 
@@ -63,7 +63,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public bool FileExists(string path)
                {
                        if (path == null)
-                               throw new ArgumentNullException("path");
+                               throw new ArgumentNullException(nameof(path));
                        return File.Exists(Path.Combine(_rootPath, path));
                }
 
@@ -75,7 +75,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public DateTimeOffset GetLastWriteTime(string path)
                {
                        if (path == null)
-                               throw new ArgumentNullException("path");
+                               throw new ArgumentNullException(nameof(path));
                        if (path.Trim().Length == 0)
                                throw new ArgumentException("An empty path is not valid.");
 
@@ -104,7 +104,7 @@ namespace Xamarin.Forms.Platform.Tizen
                public Stream OpenFile(string path, FileMode mode, FileAccess access, FileShare share)
                {
                        if (path == null)
-                               throw new ArgumentNullException("path");
+                               throw new ArgumentNullException(nameof(path));
                        if (path.Trim().Length == 0)
                                throw new ArgumentException("An empty path is not valid.");
 
index 247735f..f635b3a 100644 (file)
@@ -70,7 +70,7 @@ namespace Xamarin.Forms.Platform.Tizen
                                        pt = Device.Idiom == TargetIdiom.TV ? 84 : (Device.Idiom == TargetIdiom.Watch ? 36 : 31);
                                        break;
                                default:
-                                       throw new ArgumentOutOfRangeException();
+                                       throw new ArgumentOutOfRangeException(nameof(size));
                        }
                        return Forms.ConvertToDPFont(pt);
                }
@@ -83,7 +83,7 @@ namespace Xamarin.Forms.Platform.Tizen
                        }
                        TAppControl tAppControl = new TAppControl() { Operation = "%", Uri = uri.AbsoluteUri };
                        var matchedApplications = TAppControl.GetMatchedApplicationIds(tAppControl);
-                       if (matchedApplications.Count() > 0)
+                       if (matchedApplications.Any())
                        {
                                TAppControl.SendLaunchRequest(tAppControl);
                                return;
@@ -178,7 +178,7 @@ namespace Xamarin.Forms.Platform.Tizen
                {
                        public static AppDomain CurrentDomain { get; private set; }
 
-                       List<Assembly> _assemblies;
+                       readonly List<Assembly> _assemblies;
 
                        static AppDomain()
                        {