Add StyleCop & fixe all issues.
authorLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Sat, 1 Aug 2020 20:25:48 +0000 (22:25 +0200)
committerLukasz Stanislawski <lukasz.stanislawski@gmail.com>
Sat, 1 Aug 2020 23:20:37 +0000 (01:20 +0200)
Change-Id: I0e216145a1ee96bf983db920d3804696698a5a76

62 files changed:
Oobe/Oobe.Common/Controls/CarouselPicker.cs
Oobe/Oobe.Common/Controls/CarouselPickerStyle.cs
Oobe/Oobe.Common/Controls/ScrollableBase.cs
Oobe/Oobe.Common/Interfaces/ProcessStep.cs
Oobe/Oobe.Common/Layouts/BasePageLayout.cs
Oobe/Oobe.Common/Layouts/OneButtonLayout.cs
Oobe/Oobe.Common/Layouts/TwoButtonLayout.cs
Oobe/Oobe.Common/Oobe.Common.csproj
Oobe/Oobe.Common/Services/Interop/Interop.VConf.cs
Oobe/Oobe.Common/Services/Settings.cs
Oobe/Oobe.Common/Services/Vconf.cs
Oobe/Oobe.Common/Styles/ButtonStyles.cs
Oobe/Oobe.Common/Styles/ButtonsExtensions.cs
Oobe/Oobe.Common/Styles/CarouselPickerStyles.cs
Oobe/Oobe.Common/Styles/FontsStyles.cs [moved from Oobe/Oobe.Common/Styles/FontStyles.cs with 100% similarity]
Oobe/Oobe.Common/Styles/ScrollbarStyles.cs
Oobe/Oobe.Common/Utils/ColorUtils.cs
Oobe/Oobe.Common/Utils/Config.cs
Oobe/Oobe.Common/Utils/ExceptionFactory.cs
Oobe/Oobe.Common/Utils/Popup.cs
Oobe/Oobe.Language/LanguageStep.cs
Oobe/Oobe.Language/Model/LanguageInfo.cs
Oobe/Oobe.Language/Model/LanguageInfoList.cs
Oobe/Oobe.Language/Model/LanguageManger.cs
Oobe/Oobe.Language/Oobe.Language.csproj
Oobe/Oobe.Region/Model/RegionInfo.cs
Oobe/Oobe.Region/Model/RegionInfoList.cs
Oobe/Oobe.Region/Model/RegionManager.cs
Oobe/Oobe.Region/Oobe.Region.csproj
Oobe/Oobe.Region/RegionStep.cs
Oobe/Oobe.Terms/Model/TermsProvider.cs
Oobe/Oobe.Terms/Oobe.Terms.csproj
Oobe/Oobe.Terms/Styles/SwitchStyles.cs
Oobe/Oobe.Terms/Styles/TextLabelStyles.cs
Oobe/Oobe.Terms/TermsStep.cs
Oobe/Oobe.Terms/Views/TermsView.cs
Oobe/Oobe.Welcome/Oobe.Welcome.csproj
Oobe/Oobe.Welcome/WelcomeStep.cs
Oobe/Oobe.Wifi/Controls/ListView.cs
Oobe/Oobe.Wifi/Controls/SequenceLinearLayout.cs
Oobe/Oobe.Wifi/Controls/Wifi/AddNewNetworkPupup.cs
Oobe/Oobe.Wifi/Controls/Wifi/ApManager.cs
Oobe/Oobe.Wifi/Controls/Wifi/ApView.cs
Oobe/Oobe.Wifi/Controls/Wifi/ButtonStyles.cs
Oobe/Oobe.Wifi/Controls/Wifi/ChangeSecurityTypePopup.cs
Oobe/Oobe.Wifi/Controls/Wifi/PasswordEntry.cs
Oobe/Oobe.Wifi/Controls/Wifi/SecurityTypeView.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiPasswordPopup.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiState.cs
Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityTypeExtensions.cs [moved from Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityType.cs with 94% similarity]
Oobe/Oobe.Wifi/Controls/Wifi/WifiView.cs
Oobe/Oobe.Wifi/Oobe.Wifi.csproj
Oobe/Oobe.Wifi/WifiStep.cs
Oobe/Oobe/Controls/ViewStack.cs
Oobe/Oobe/Managers/MultiResourceManager.cs
Oobe/Oobe/Managers/ProcessManager.cs
Oobe/Oobe/Oobe.csproj
Oobe/Oobe/OobeApp.cs [moved from Oobe/Oobe/Oobe.cs with 91% similarity]
Oobe/Oobe/Views/MainView.cs
Oobe/Oobe/Views/Page.cs
Oobe/Settings.StyleCop [new file with mode: 0644]
Oobe/stylecop.json [new file with mode: 0644]

index ee529d2..77b13ad 100644 (file)
 
 using System;
 using System.Collections.Generic;
+using Oobe.Common.Utils;
 using Tizen.NUI;
-using Tizen.NUI.Binding;
 using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Binding;
 using Tizen.NUI.Components;
-using Oobe.Common.Utils;
 
 namespace Oobe.Common.Controls
 {
     public class CarouselPicker : Control
     {
-        public event EventHandler SelectedItemChanged;
-
         private Oobe.Common.Controls.ScrollableBase scrollableBase;
         private View itemsListView;
-        private View upperLine, lowerLine;
+        private View upperLine;
+        private View lowerLine;
 
         private Vector3 textCenterColorHSV = new Vector3();
         private Vector3 textOuterColorHSV = new Vector3();
 
         private float textCenterOpacity;
         private float textOuterOpacity;
+        private int selectedItemIndex = 0;
 
         private List<CarouselPickerItemData> items = new List<CarouselPickerItemData>();
 
-        public CarouselPicker() : base()
+        public CarouselPicker()
+            : base()
         {
         }
 
-        public CarouselPicker(CarouselPickerStyle style) : base(style)
+        public CarouselPicker(CarouselPickerStyle style)
+            : base(style)
         {
-            //TODO fix a bug with style not properly applied by base class
+            // TODO fix a bug with style not properly applied by base class
             ApplyStyle(style);
         }
 
-        public void AddItem(CarouselPickerItemData item)
-        {
-            var view = CreateItemView(item);
-            itemsListView.Add(view);
-            items.Add(item);
-        }
+        public event EventHandler SelectedItemChanged;
 
-        public void RemoveItem(CarouselPickerItemData item)
-        {
-            var index = items.IndexOf(item);
-            items.Remove(item);
-            itemsListView.Children.RemoveAt(index);
-        }
+        public new CarouselPickerStyle Style => ViewStyle as CarouselPickerStyle;
 
-        private int selectedItemIndex = 0;
         public int SelectedItemIndex
         {
             get
             {
                 return selectedItemIndex;
             }
+
             set
             {
-                //always scroll
+                // always scroll
                 scrollableBase.ScrollToIndex(value);
                 if (selectedItemIndex != value)
                 {
@@ -83,6 +75,20 @@ namespace Oobe.Common.Controls
             }
         }
 
+        public void AddItem(CarouselPickerItemData item)
+        {
+            var view = CreateItemView(item);
+            itemsListView.Add(view);
+            items.Add(item);
+        }
+
+        public void RemoveItem(CarouselPickerItemData item)
+        {
+            var index = items.IndexOf(item);
+            items.Remove(item);
+            itemsListView.Children.RemoveAt(index);
+        }
+
         public override void ApplyStyle(ViewStyle viewStyle)
         {
             base.ApplyStyle(viewStyle);
@@ -105,7 +111,6 @@ namespace Oobe.Common.Controls
                 textOuterColorHSV = Style.OuterText?.TextColor?.All?.ToHSV() ?? new Vector3();
                 textOuterOpacity = Style.OuterText?.Opacity?.All ?? 1.0f;
 
-
                 if (itemsListView != null)
                 {
                     scrollableBase?.Remove(itemsListView);
@@ -191,37 +196,6 @@ namespace Oobe.Common.Controls
             }
         }
 
-        private float CalculateScrollerSize()
-        {
-            float size = 0.0f;
-
-            size += Style.CenterText?.Size2D?.Height ?? 0.0f;
-            size += (float)Style.CenterText?.Margin?.Top;
-            size += (float)Style.CenterText?.Margin?.Bottom;
-
-            return size;
-        }
-
-        private View CreateItemView(CarouselPickerItemData item)
-        {
-            var view = new TextLabel();
-            // TODO for some reason TextLabel(Style.CenterText)
-            // or view.ApplyStyle(Style.CenterText) do not work here so set
-            // everything manually
-            // var view = new TextLabel(Style.CenterText);
-            // view.ApplyStyle(Style.CenterText);
-            view.Text = item.Text;
-            view.TranslatableText = item.TranslatableText;
-            view.Size2D = Style.CenterText?.Size2D ?? new Size2D();
-            view.PixelSize = Style.CenterText?.PixelSize ?? 10.0f;
-            view.Margin = Style.CenterText?.Margin ?? new Extents();
-            view.HorizontalAlignment = Style.CenterText?.HorizontalAlignment ?? HorizontalAlignment.Center;
-            view.VerticalAlignment = Style.CenterText?.VerticalAlignment ?? VerticalAlignment.Center;
-            view.Opacity = Style.CenterText?.Opacity?.All ?? 1.0f;
-            //TODO other properties?
-            return view;
-        }
-
         protected override void OnUpdate()
         {
             base.OnUpdate();
@@ -246,14 +220,45 @@ namespace Oobe.Common.Controls
             base.Dispose(type);
         }
 
-        public new CarouselPickerStyle Style => ViewStyle as CarouselPickerStyle;
-
         protected override ViewStyle GetViewStyle()
         {
             var ret = new CarouselPickerStyle();
             return ret;
         }
 
+        private float CalculateScrollerSize()
+        {
+            float size = 0.0f;
+
+            size += Style.CenterText?.Size2D?.Height ?? 0.0f;
+            size += (float)Style.CenterText?.Margin?.Top;
+            size += (float)Style.CenterText?.Margin?.Bottom;
+
+            return size;
+        }
+
+        private View CreateItemView(CarouselPickerItemData item)
+        {
+            var view = new TextLabel();
+
+            // TODO for some reason TextLabel(Style.CenterText)
+            // or view.ApplyStyle(Style.CenterText) do not work here so set
+            // everything manually
+            // var view = new TextLabel(Style.CenterText);
+            // view.ApplyStyle(Style.CenterText);
+            view.Text = item.Text;
+            view.TranslatableText = item.TranslatableText;
+            view.Size2D = Style.CenterText?.Size2D ?? new Size2D();
+            view.PixelSize = Style.CenterText?.PixelSize ?? 10.0f;
+            view.Margin = Style.CenterText?.Margin ?? new Extents();
+            view.HorizontalAlignment = Style.CenterText?.HorizontalAlignment ?? HorizontalAlignment.Center;
+            view.VerticalAlignment = Style.CenterText?.VerticalAlignment ?? VerticalAlignment.Center;
+            view.Opacity = Style.CenterText?.Opacity?.All ?? 1.0f;
+
+            // TODO other properties?
+            return view;
+        }
+
         private void CreateMainList()
         {
         }
@@ -262,9 +267,9 @@ namespace Oobe.Common.Controls
         {
             percent = Math.Clamp(percent, 0.0f, 1.0f);
 
-            float a = from[0] + (to[0] - from[0]) * percent;
-            float b = from[1] + (to[1] - from[1]) * percent;
-            float c = from[2] + (to[2] - from[2]) * percent;
+            float a = from[0] + ((to[0] - from[0]) * percent);
+            float b = from[1] + ((to[1] - from[1]) * percent);
+            float c = from[2] + ((to[2] - from[2]) * percent);
 
             return new Vector3(a, b, c);
         }
@@ -272,7 +277,7 @@ namespace Oobe.Common.Controls
         private float ScaleScalar(float from, float to, float percent)
         {
             percent = Math.Clamp(percent, 0.0f, 1.0f);
-            return from + (to - from) * percent;
+            return from + ((to - from) * percent);
         }
 
         private void UpdateItems()
@@ -283,9 +288,12 @@ namespace Oobe.Common.Controls
             foreach (View view in itemsListView.Children)
             {
                 TextLabel itemView = view as TextLabel;
-                if (itemView == null) continue;
+                if (itemView == null)
+                {
+                    continue;
+                }
 
-                float viewMid = view.PositionY + view.Size2D.Height / 2.0f;
+                float viewMid = view.PositionY + (view.Size2D.Height / 2.0f);
                 float percent = Math.Abs(viewMid + mid) / threshold;
 
                 itemView.Opacity = ScaleScalar(textCenterOpacity, textOuterOpacity, percent);
index 8ea18d5..5da3ad8 100644 (file)
 
 using System;
 using Tizen.NUI;
-using Tizen.NUI.Components;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Binding;
+using Tizen.NUI.Components;
 
 namespace Oobe.Common.Controls
 {
     public class CarouselPickerStyle : ControlStyle
     {
-        public CarouselPickerStyle() : base()
+        public CarouselPickerStyle()
+            : base()
         {
             InitSubStyle();
         }
@@ -35,6 +36,20 @@ namespace Oobe.Common.Controls
 
         public Color LinesColor { get; set; }
 
+        public override void CopyFrom(BindableObject bindableObject)
+        {
+            base.CopyFrom(bindableObject);
+
+            CarouselPickerStyle carouselSelectorStyle = bindableObject as CarouselPickerStyle;
+
+            if (carouselSelectorStyle != null)
+            {
+                CenterText?.CopyFrom(carouselSelectorStyle.CenterText);
+                OuterText?.CopyFrom(carouselSelectorStyle.OuterText);
+                LinesColor = carouselSelectorStyle.LinesColor;
+            }
+        }
+
         private void InitSubStyle()
         {
             CenterText = new TextLabelStyle
@@ -45,7 +60,7 @@ namespace Oobe.Common.Controls
                 WidthResizePolicy = ResizePolicyType.FillToParent,
                 HeightResizePolicy = ResizePolicyType.FillToParent,
                 HorizontalAlignment = HorizontalAlignment.Center,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             OuterText = new TextLabelStyle
             {
@@ -55,23 +70,9 @@ namespace Oobe.Common.Controls
                 WidthResizePolicy = ResizePolicyType.FillToParent,
                 HeightResizePolicy = ResizePolicyType.FillToParent,
                 HorizontalAlignment = HorizontalAlignment.Center,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             LinesColor = Tizen.NUI.Color.Black;
         }
-
-        public override void CopyFrom(BindableObject bindableObject)
-        {
-            base.CopyFrom(bindableObject);
-
-            CarouselPickerStyle carouselSelectorStyle = bindableObject as CarouselPickerStyle;
-
-            if (carouselSelectorStyle != null)
-            {
-                CenterText?.CopyFrom(carouselSelectorStyle.CenterText);
-                OuterText?.CopyFrom(carouselSelectorStyle.OuterText);
-                LinesColor = carouselSelectorStyle.LinesColor;
-            }
-        }
     }
 }
index 89c3005..5c2059e 100644 (file)
@@ -1,3 +1,4 @@
+// <auto-generated/>
 /*
  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
index abb1cab..e961bdd 100644 (file)
  */
 
 using System;
-using Tizen.NUI.BaseComponents;
 using Oobe.Common.Interfaces;
+using Tizen.NUI.BaseComponents;
 
 namespace Oobe.Common.Interfaces
 {
-     public abstract class ProcessStep
-     {
-        protected IProcessNavigation Navigation { get; private set; }
+    public abstract class ProcessStep
+    {
         private bool initialized;
 
+        protected IProcessNavigation Navigation { get; private set; }
+
         public void Initialize()
         {
             if (initialized)
+            {
                 return;
+            }
 
             this.OnInitialized();
             initialized = true;
@@ -37,7 +40,9 @@ namespace Oobe.Common.Interfaces
         public virtual void Shutdown()
         {
             if (!initialized)
+            {
                 return;
+            }
 
             this.OnShutdown();
             initialized = false;
@@ -64,5 +69,5 @@ namespace Oobe.Common.Interfaces
         {
             return null;
         }
-     }
- }
+    }
+}
index 0b151fb..1bbda5f 100644 (file)
  * limitations under the License.
  */
 
+using Oobe.Common.Styles;
 using Tizen.NUI;
-using Tizen.NUI.Components;
 using Tizen.NUI.BaseComponents;
-using Oobe.Common.Styles;
+using Tizen.NUI.Components;
 
 namespace Oobe.Common.Layouts
 {
@@ -31,7 +31,8 @@ namespace Oobe.Common.Layouts
         /// <summary>
         /// Constructs new BasePageLayout object
         /// </summary>
-        public BasePageLayout() : base()
+        public BasePageLayout()
+            : base()
         {
             Layout = new AbsoluteLayout();
             Title = new TextLabel
@@ -68,12 +69,17 @@ namespace Oobe.Common.Layouts
                 if (value != content)
                 {
                     if (content != null)
+                    {
                         Remove(content);
-                    // dispose?
+                    }
+
                     content?.Dispose();
                     content = value;
                     if (content == null)
+                    {
                         return;
+                    }
+
                     content.PositionUsesPivotPoint = true;
                     content.PivotPoint = new Position(0.5f, 0.5f);
                     content.ParentOrigin = new Position(0.5f, 0.5f);
index 8889427..ad866be 100644 (file)
  * limitations under the License.
  */
 
+using Oobe.Common.Styles;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
 
 namespace Oobe.Common.Layouts
 {
@@ -29,7 +29,8 @@ namespace Oobe.Common.Layouts
         /// <summary>
         /// Constructs new OneButtonLayout object
         /// </summary>
-        public OneButtonLayout() : base()
+        public OneButtonLayout()
+            : base()
         {
             NextButton = new Button(ButtonStyles.Next);
             NextButton.PositionUsesPivotPoint = true;
index 161952b..fa9b4c6 100644 (file)
  * limitations under the License.
  */
 
+using Oobe.Common.Styles;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
 
 namespace Oobe.Common.Layouts
 {
     /// <summary>
     /// OOBE Layout with two Buttons, positioned at left and right bottom.
     /// </summary>
-    public class TwoButtonLayout : BasePageLayout
+    public class TwoButtonLayout
+        : BasePageLayout
     {
         /// <summary>
         /// Constructs new TwoButtonLayout object
         /// </summary>
-        public TwoButtonLayout() : base()
+        public TwoButtonLayout()
+            : base()
         {
             NextButton = new Button(ButtonStyles.Next);
             NextButton.PositionUsesPivotPoint = true;
@@ -58,4 +60,3 @@ namespace Oobe.Common.Layouts
         public Button PreviousButton { get; private set; }
     }
 }
-
index 6fdb75a..12e1e89 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Library</OutputType>
     <TargetFramework>tizen80</TargetFramework>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <ItemGroup>
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
 
   <ItemGroup>
@@ -33,4 +38,8 @@
       <LastGenOutput>Translations.Designer.cs</LastGenOutput>
     </EmbeddedResource>
   </ItemGroup>
+  <ItemGroup>
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
+  </ItemGroup>
 </Project>
index 73e3cfa..dac4bba 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Runtime.InteropServices;
 using static Oobe.Common.Services.Vconf;
 
@@ -24,30 +24,30 @@ namespace Oobe.Common.Services.Interoperability
     {
         internal static partial class Vconf
         {
-            private const string LIBRARY_VCONF = "libvconf.so.0";
+            private const string LibraryVconf = "libvconf.so.0";
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_get_bool")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_get_bool")]
             internal static extern int VconfGetBool(string key, out bool val);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_set_bool")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_set_bool")]
             internal static extern int VconfSetBool(string key, bool intval);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_get_int")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_get_int")]
             internal static extern int VconfGetInt(string key, out int val);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_set_int")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_set_int")]
             internal static extern int VconfSetInt(string key, int intval);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_get_str")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_get_str")]
             internal static extern string VconfGetStr(string key);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_set_str")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_set_str")]
             internal static extern int VconfSetStr(string key, string value);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_notify_key_changed")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_notify_key_changed")]
             internal static extern void VconfNotifyKeyChanged(string key, NotificationCallback callback, IntPtr userData);
 
-            [DllImport(LIBRARY_VCONF, EntryPoint = "vconf_ignore_key_changed")]
+            [DllImport(LibraryVconf, EntryPoint = "vconf_ignore_key_changed")]
             internal static extern void VconfIgnoreKeyChanged(string key, NotificationCallback callback);
         }
     }
index d7e8ddb..30fd0b5 100644 (file)
@@ -15,8 +15,8 @@
  */
 
 using System;
-using Tizen.System;
 using Tizen.Applications;
+using Tizen.System;
 
 namespace Oobe.Common.Services
 {
@@ -53,7 +53,8 @@ namespace Oobe.Common.Services
                 {
                     return Preference.Get<string>(CountryCodeKey);
                 }
-                return String.Empty;
+
+                return string.Empty;
             }
 
             set
index 87b2ba1..99e8ba4 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Runtime.InteropServices;
 using Oobe.Common.Utils;
 using static Oobe.Common.Services.Interoperability.Interop.Vconf;
index 1b4b888..385a679 100644 (file)
  * limitations under the License.
  */
 
-using Tizen.NUI.Components;
-using Tizen.NUI.BaseComponents;
 using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
 
 namespace Oobe.Common.Styles
 {
     public class ButtonStyles
     {
-        public static ButtonStyle Next = GetNextButtonStyle();
-        public static ButtonStyle Previous = GetPreviousButtonStyle();
-        public static ButtonStyle Skip = GetSkipButtonStyle();
+        private static ButtonStyle next = GetNextButtonStyle();
+
+        private static ButtonStyle previous = GetPreviousButtonStyle();
+
+        private static ButtonStyle skip = GetSkipButtonStyle();
+
+        public static ButtonStyle Next { get => next; }
+
+        public static ButtonStyle Previous { get => previous; }
+
+        public static ButtonStyle Skip { get => skip; }
 
         private static ButtonStyle GetPreviousButtonStyle() => new ButtonStyle
         {
@@ -39,7 +47,7 @@ namespace Oobe.Common.Styles
                 PointSize = new Selector<float?>
                 {
                     Normal = 22.0f,
-                    Pressed = 24.0f
+                    Pressed = 24.0f,
                 },
                 EnableMarkup = true,
                 TranslatableText = "PREVIOUS",
@@ -73,7 +81,7 @@ namespace Oobe.Common.Styles
                 PointSize = new Selector<float?>
                 {
                     Normal = 22.0f,
-                    Pressed = 24.0f
+                    Pressed = 24.0f,
                 },
                 TextColor = Color.White,
                 TranslatableText = "CONTINUE",
index 26c2243..144cecc 100644 (file)
@@ -15,9 +15,9 @@
  */
 
 using System;
-using Tizen.NUI.Components;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
 
 namespace Oobe.Common.Styles
 {
@@ -34,6 +34,7 @@ namespace Oobe.Common.Styles
                     return label.FontStyle;
                 }
             }
+
             return null;
         }
 
index ed8b17b..b615222 100644 (file)
  * limitations under the License.
  */
 
-using Tizen.NUI.Components;
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI;
 using Oobe.Common.Controls;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
 
 namespace Oobe.Common.Styles
 {
     public class CarouselPickerStyles
     {
-        public static CarouselPickerStyle Default = new CarouselPickerStyle{
-            CenterText = new TextLabelStyle{
+        private static CarouselPickerStyle defaultStyle = new CarouselPickerStyle
+        {
+            CenterText = new TextLabelStyle
+            {
                 Size2D = new Size2D(312, 26),
                 PixelSize = 20.0f,
                 Margin = new Extents(24, 24, 16, 16),
@@ -32,7 +34,8 @@ namespace Oobe.Common.Styles
                 TextColor = new Color(0, 20.0f / 255.0f, 71.0f / 255.0f, 1.0f),
                 Opacity = 1.0f,
             },
-            OuterText = new TextLabelStyle{
+            OuterText = new TextLabelStyle
+            {
                 Size2D = new Size2D(312, 26),
                 PixelSize = 20.0f,
                 Margin = new Extents(24, 24, 16, 16),
@@ -42,5 +45,7 @@ namespace Oobe.Common.Styles
             },
             LinesColor = new Color(0, 20.0f / 255.0f, 71.0f / 255.0f, 1.0f),
         };
+
+        public static CarouselPickerStyle Default { get => defaultStyle; }
     }
 }
index 0e7c536..9ccbc1c 100644 (file)
@@ -21,9 +21,12 @@ namespace Oobe.Common.Styles
 {
     public static class ScrollbarStyles
     {
-        public static ScrollbarStyle Default = new ScrollbarStyle{
-            ThumbColor = new Color(10.0f/255.0f, 13.0f/255.0f, 73.0f/255.0f, 0.5f),
+        private static ScrollbarStyle defaultStyle = new ScrollbarStyle
+        {
+            ThumbColor = new Color(10.0f / 255.0f, 13.0f / 255.0f, 73.0f / 255.0f, 0.5f),
             TrackColor = new Color(0.0f, 0.0f, 0.0f, 0.0f),
         };
+
+        public static ScrollbarStyle Default { get => defaultStyle; }
     }
 }
index 5531511..8fbbf3b 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-using Tizen.NUI;
 using System;
+using Tizen.NUI;
 
 namespace Oobe.Common.Utils
 {
@@ -38,18 +38,26 @@ namespace Oobe.Common.Utils
             }
 
             delta = max - min;
-            s = delta / max;           // s
+            s = delta / max;        // s
 
-            if( color.R == max )
-                h = ( color.G - color.B ) / delta;             // between yellow & magenta
-            else if( color.G == max )
-                h = 2 + ( color.B - color.R ) / delta; // between cyan & yellow
+            if (color.R == max)
+            {
+                h = (color.G - color.B) / delta;        // between yellow & magenta
+            }
+            else if (color.G == max)
+            {
+                h = ((color.B - color.R) / delta) + 2;    // between cyan & yellow
+            }
             else
-                h = 4 + ( color.R - color.G ) / delta; // between magenta & cyan
+            {
+                h = ((color.R - color.G) / delta) + 4;    // between magenta & cyan
+            }
 
-            h *= 60;                           // degrees
-            if( h < 0 )
+            h *= 60;                // degrees
+            if (h < 0)
+            {
                 h += 360;
+            }
 
             return new Vector3(h, s, v);
         }
@@ -63,20 +71,22 @@ namespace Oobe.Common.Utils
             float s = hsv[1];
             float v = hsv[2];
 
-            if (s == 0) {
+            if (s == 0)
+            {
                 // achromatic (grey)
                 r = g = b = v;
                 return new Color(r, g, b, 1.0f);
             }
 
-            h /= 60;                   // sector 0 to 5
-            i = (int)Math.Floor( h );
-            f = h - i;                 // factorial part of h
-            p = v * ( 1 - s );
-            q = v * ( 1 - s * f );
-            t = v * ( 1 - s * ( 1 - f ) );
+            h /= 60; // sector 0 to 5
+            i = (int)Math.Floor(h);
+            f = h - i; // factorial part of h
+            p = v * (1 - s);
+            q = v * (1 - (s * f));
+            t = v * (1 - (s * (1 - f)));
 
-            switch( i ) {
+            switch (i)
+            {
                 case 0:
                     r = v;
                     g = t;
@@ -102,12 +112,13 @@ namespace Oobe.Common.Utils
                     g = p;
                     b = v;
                     break;
-                default:               // case 5:
+                default: // case 5:
                     r = v;
                     g = p;
                     b = q;
                     break;
             }
+
             return new Color(r, g, b, 1.0f);
         }
     }
index 252bebb..7130669 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-using Tizen.NUI.BaseComponents;
 using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
 
 namespace Oobe.Common.Utils
 {
@@ -27,12 +27,12 @@ namespace Oobe.Common.Utils
         /// <summary>
         /// Horizontal scaling factor
         /// </summary>
-        private static readonly float WIDTH_SCALE_FACTOR = Tizen.NUI.Window.Instance.WindowSize.Width / 1280.0f;
+        private static readonly float WidthScaleFactor = Tizen.NUI.Window.Instance.WindowSize.Width / 1280.0f;
 
         /// <summary>
         /// Vertical scaling factor
         /// </summary>
-        private static readonly float HEIGHT_SCALE_FACTOR = Tizen.NUI.Window.Instance.WindowSize.Height / 720.0f;
+        private static readonly float HeightScaleFactor = Tizen.NUI.Window.Instance.WindowSize.Height / 720.0f;
 
         /// <summary>
         /// Scale Size2D accoring to device screen size.
@@ -40,7 +40,7 @@ namespace Oobe.Common.Utils
         /// </summary>
         public static Size2D ScaledSize(Size2D size)
         {
-            return new Size2D((int)(size.Width * WIDTH_SCALE_FACTOR), (int)(size.Height * HEIGHT_SCALE_FACTOR));
+            return new Size2D((int)(size.Width * WidthScaleFactor), (int)(size.Height * HeightScaleFactor));
         }
     }
 }
index 235cccd..fc99781 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using Tizen.Internals.Errors;
 
 namespace Oobe.Common.Utils
index 075195d..76779cf 100644 (file)
  * limitations under the License.
  */
 
-using Tizen.NUI;
+using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
-using Tizen.NUI.Components;\r
-\r
+using Tizen.NUI.Components;
+
 namespace Oobe.Common.Utils
 {
     public class Popup
     {
         private View view;
         private Layer layer = null;
-        private bool dismissible; //can be dissmissed when clicked outside
-        private float backgroundOpacity;\r
+        private bool dismissible; // can be dissmissed when clicked outside
+        private float backgroundOpacity;
 
         public Popup(View view, float backgroundOpacity = 0.1f, bool dismissible = false, bool centered = false)
         {
-            this.dismissible = dismissible;\r
-            this.backgroundOpacity = backgroundOpacity;\r
+            this.dismissible = dismissible;
+            this.backgroundOpacity = backgroundOpacity;
             this.view = view;
             if (centered)
             {
@@ -76,30 +76,32 @@ namespace Oobe.Common.Utils
             layer = new Layer();
             layer.Add(CreateGray());
             layer.Add(view);
-            view.TouchEvent += (s, e) => false; //prevent gray view reacting\r
+            view.TouchEvent += (s, e) => false; // prevent gray view reacting
             Window.Instance.AddLayer(layer);
-        }\r
-\r
-        private Control CreateGray()\r
-        {\r
+        }
+
+        private Control CreateGray()
+        {
             var gray = new Tizen.NUI.Components.Control()
             {
                 WidthResizePolicy = ResizePolicyType.FillToParent,
                 HeightResizePolicy = ResizePolicyType.FillToParent,
                 BackgroundColor = new Color(0f, 0f, 0f, backgroundOpacity),
             };
-            if (dismissible)\r
-            {\r
-                gray.TouchEvent += (s, e) =>\r
-                {\r
-                    if (e.Touch.GetState(0) == PointStateType.Up)\r
-                    {\r
-                        Dismiss();\r
-                    }\r
-                    return true;\r
-                };\r
-            }\r
-            return gray;\r
-        }\r
+            if (dismissible)
+            {
+                gray.TouchEvent += (s, e) =>
+                {
+                    if (e.Touch.GetState(0) == PointStateType.Up)
+                    {
+                        Dismiss();
+                    }
+
+                    return true;
+                };
+            }
+
+            return gray;
+        }
     }
 }
index bbeccb9..818bd84 100644 (file)
  * limitations under the License.
  */
 
-using Oobe.Common.Interfaces;
+using System;
+using System.Globalization;
+using System.Linq;
+using Oobe.Common.Controls;
+using Oobe.Common.Interfaces;
+using Oobe.Common.Layouts;
+using Oobe.Common.Resources;
 using Oobe.Common.Styles;
+using Oobe.Common.Utils;
+using Oobe.Language.Model;
 using Tizen.NUI;
-using Tizen.NUI.Components;
 using Tizen.NUI.BaseComponents;
-using Oobe.Language.Model;
-using Oobe.Common.Controls;
-using Oobe.Common.Utils;
-using Oobe.Common.Resources;
-using System.Linq;
-using System.Globalization;
-using System;
-using Oobe.Common.Layouts;
+using Tizen.NUI.Components;
 
 namespace Oobe.Language
 {
@@ -34,7 +34,8 @@ namespace Oobe.Language
     {
         private LanguageManger manager;
 
-        public LanguageStep() : base()
+        public LanguageStep()
+            : base()
         {
         }
 
@@ -69,6 +70,7 @@ namespace Oobe.Language
                     var lang = manager.Languages[carousel.SelectedItemIndex];
                     manager.CurrentLanguage = lang;
                 }
+
                 nav.Next();
             };
 
index 3a4bfc4..5008e69 100644 (file)
@@ -22,6 +22,7 @@ namespace Oobe.Language.Model
     {
         [XmlAttribute("code")]
         public string Code { get; set; }
+
         [XmlAttribute("name_local")]
         public string LocalName { get; set; }
     }
index 2b404ac..2b2c610 100644 (file)
@@ -25,4 +25,4 @@ namespace Oobe.Language.Model
         [XmlElement("language")]
         public List<LanguageInfo> Languages { get; set; }
     }
-}
\ No newline at end of file
+}
index 1f760ac..8b13e78 100644 (file)
@@ -15,8 +15,8 @@
  */
 
 using System.Collections.Generic;
-using System.Linq;
 using System.IO;
+using System.Linq;
 using System.Xml.Serialization;
 using Oobe.Common.Services;
 
@@ -44,6 +44,7 @@ namespace Oobe.Language.Model
             {
                 return Languages.FirstOrDefault(s => s.Code == Settings.Language) ?? Languages.FirstOrDefault();
             }
+
             set
             {
                 if (value != null)
index 023f227..9b4cb57 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Library</OutputType>
     <TargetFramework>tizen80</TargetFramework>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <ItemGroup>
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
 
   <ItemGroup>
@@ -20,4 +25,8 @@
   <ItemGroup>
     <Folder Include="res\" />
   </ItemGroup>
+  <ItemGroup>
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
+  </ItemGroup>
 </Project>
index d32730b..7308b0d 100644 (file)
@@ -22,6 +22,7 @@ namespace Oobe.Region.Model
     {
         [XmlAttribute("code")]
         public string CountryCode { get; set; }
+
         [XmlAttribute("name_en")]
         public string Name { get; set; }
     }
index 7b6ddff..03a2db5 100644 (file)
@@ -25,4 +25,4 @@ namespace Oobe.Region.Model
         [XmlElement("region")]
         public List<RegionInfo> Regions { get; set; }
     }
-}
\ No newline at end of file
+}
index c40cf7c..c74fd2a 100644 (file)
  * limitations under the License.
  */
 
+using System;
 using System.Collections.Generic;
 using System.IO;
 using System.Linq;
 using System.Xml.Serialization;
 using Oobe.Common.Services;
-using System;
 
 namespace Oobe.Region.Model
 {
@@ -45,6 +45,7 @@ namespace Oobe.Region.Model
             {
                 return Regions.FirstOrDefault(s => s.CountryCode == Settings.Country) ?? Regions.FirstOrDefault();
             }
+
             set
             {
                 if (value != null)
index 0e157fd..ab2b48b 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Library</OutputType>
     <TargetFramework>tizen80</TargetFramework>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <ItemGroup>
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Oobe.Common\Oobe.Common.csproj" />
@@ -19,4 +24,8 @@
   <ItemGroup>
     <Folder Include="res\" />
   </ItemGroup>
+  <ItemGroup>
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
+  </ItemGroup>
 </Project>
index 31c1b63..da47a0d 100644 (file)
  * limitations under the License.
  */
 
-using Oobe.Common.Styles;
+using Oobe.Common.Controls;
+using Oobe.Common.Interfaces;
+using Oobe.Common.Layouts;
+using Oobe.Common.Styles;
+using Oobe.Region.Model;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
-using Oobe.Common.Interfaces;
 using Tizen.NUI.Components;
-using Oobe.Region.Model;
-using Oobe.Common.Controls;
-using Oobe.Common.Layouts;
 
 namespace Oobe.Region
 {
-     public class RegionStep : ProcessStep
-     {
-         private RegionManager manager;
+    public class RegionStep : ProcessStep
+    {
+        private RegionManager manager;
 
-        public RegionStep() : base()
+        public RegionStep()
+            : base()
         {
         }
 
@@ -54,22 +55,25 @@ namespace Oobe.Region
                 carousel.AddItem(item);
             }
 
-            container.NextButton.Clicked += (obj, args) => {
+            container.NextButton.Clicked += (obj, args) =>
+            {
                 if (carousel.SelectedItemIndex >= 0 && carousel.SelectedItemIndex < manager.Regions.Count)
                 {
                     var region = manager.Regions[carousel.SelectedItemIndex];
                     manager.CurrentRegion = region;
                 }
+
                 nav.Next();
             };
 
-            container.PreviousButton.Clicked += (obj, args) => {
+            container.PreviousButton.Clicked += (obj, args) =>
+            {
                 nav.Previous();
             };
 
             container.Content = carousel;
 
             return container;
-         }
-     }
+        }
+    }
 }
index b97d4f2..701facf 100644 (file)
@@ -27,23 +27,27 @@ namespace Oobe.Terms.Model
             TermsAccepted = false;
         }
 
+        public bool TermsAccepted { get; private set; }
+
         public string LoadTerms()
         {
             string terms = null;
             var locale = Settings.Country;
-            var filename = Path.Combine(Tizen.Applications.CoreApplication.Current.DirectoryInfo.Resource , "terms" , locale + ".txt");
+            var filename = Path.Combine(Tizen.Applications.CoreApplication.Current.DirectoryInfo.Resource, "terms", locale + ".txt");
 
-            try {
+            try
+            {
                 terms = File.ReadAllText(filename);
-            } catch (Exception e) {
+            }
+            catch (Exception e)
+            {
                 Tizen.Log.Debug("oobe", $"Unable to load terms: {e.Message}");
                 return null;
             }
+
             return terms;
         }
 
-        public bool TermsAccepted { get; private set; }
-
         public void AcceptTerms()
         {
             TermsAccepted = true;
index 023f227..dec0b94 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Library</OutputType>
     <TargetFramework>tizen80</TargetFramework>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <ItemGroup>
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
 
   <ItemGroup>
@@ -19,5 +24,7 @@
 
   <ItemGroup>
     <Folder Include="res\" />
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
   </ItemGroup>
 </Project>
index 050c7dd..9838ae0 100644 (file)
@@ -22,7 +22,7 @@ namespace Oobe.Terms.Styles
 {
     public class SwitchStyles
     {
-        public static SwitchStyle IHaveReadAndAgreeSwitchStyle = new SwitchStyle
+        private static SwitchStyle iHaveReadAndAgreeSwitchStyle = new SwitchStyle
         {
             Thumb = new ImageViewStyle
             {
@@ -35,5 +35,7 @@ namespace Oobe.Terms.Styles
                 },
             },
         };
+
+        public static SwitchStyle IHaveReadAndAgreeSwitchStyle { get => iHaveReadAndAgreeSwitchStyle; }
     }
 }
index feb7f8a..21591b3 100644 (file)
@@ -21,11 +21,12 @@ namespace Oobe.Terms.Styles
 {
     public class TextLabelStyles
     {
-        public static TextLabelStyle IHaveReadAndAgreeTextStyle = new TextLabelStyle{
-
-            TextColor = new Selector<Color>{
-                Normal = new Color(0, 20.0f/255.0f, 71.0f/255.0f, 1.0f),
-                Disabled = new Color(112.0f/255.0f, 112.0f/255.0f, 112.0f/255.0f, 1.0f),
+        private static TextLabelStyle iHaveReadAndAgreeTextStyle = new TextLabelStyle
+        {
+            TextColor = new Selector<Color>
+            {
+                Normal = new Color(0, 20.0f / 255.0f, 71.0f / 255.0f, 1.0f),
+                Disabled = new Color(112.0f / 255.0f, 112.0f / 255.0f, 112.0f / 255.0f, 1.0f),
             },
             Size2D = new Size2D(639, 26),
             PixelSize = 22.0f,
@@ -33,11 +34,13 @@ namespace Oobe.Terms.Styles
             FontFamily = "BreezeSans",
             Ellipsis = false,
         };
-        // workaround for issue with TextLabelStyle State not being applied
-        public static TextLabelStyle IHaveReadAndAgreeTextStyleDisabled = new TextLabelStyle{
 
-            TextColor = new Selector<Color>{
-                Normal = new Color(112.0f/255.0f, 112.0f/255.0f, 112.0f/255.0f, 1.0f),
+        // workaround for issue with TextLabelStyle State not being applied
+        private static TextLabelStyle iHaveReadAndAgreeTextStyleDisabled = new TextLabelStyle
+        {
+            TextColor = new Selector<Color>
+            {
+                Normal = new Color(112.0f / 255.0f, 112.0f / 255.0f, 112.0f / 255.0f, 1.0f),
             },
             Size2D = new Size2D(839, 26),
             PixelSize = 22.0f,
@@ -45,16 +48,22 @@ namespace Oobe.Terms.Styles
             FontFamily = "BreezeSans",
             Ellipsis = false,
         };
-        public static TextLabelStyle GuideTextLabelStyle = new TextLabelStyle{
+
+        private static TextLabelStyle guideTextLabelStyle = new TextLabelStyle
+        {
             PixelSize = 18,
             Ellipsis = false,
             Size2D = new Size2D(639, 22),
-            TextColor = new Selector<Color>{
-                Normal = new Color(112.0f / 255.0f, 112.0f / 255.0f, 112.0f / 255.0f, 1.0f)
+            TextColor = new Selector<Color>
+            {
+                Normal = new Color(112.0f / 255.0f, 112.0f / 255.0f, 112.0f / 255.0f, 1.0f),
             },
         };
-        public static TextLabelStyle ContentTextLabelStyle = new TextLabelStyle{
-            TextColor = new Selector<Color>{
+
+        private static TextLabelStyle contentTextLabelStyle = new TextLabelStyle
+        {
+            TextColor = new Selector<Color>
+            {
                 Normal = new Color(0, 12.0f / 255.0f, 43.0f / 255.0f, 1.0f),
             },
             PointSize = 16.0f,
@@ -64,5 +73,13 @@ namespace Oobe.Terms.Styles
             Focusable = false,
             MultiLine = true,
         };
+
+        public static TextLabelStyle IHaveReadAndAgreeTextStyle { get => iHaveReadAndAgreeTextStyle; }
+
+        public static TextLabelStyle IHaveReadAndAgreeTextStyleDisabled { get => iHaveReadAndAgreeTextStyleDisabled; }
+
+        public static TextLabelStyle GuideTextLabelStyle { get => guideTextLabelStyle; }
+
+        public static TextLabelStyle ContentTextLabelStyle { get => contentTextLabelStyle; }
     }
 }
index c79534c..13d108e 100644 (file)
  * limitations under the License.
  */
 
-using Oobe.Common.Interfaces;\r
-using Tizen.NUI.BaseComponents;\r
+using Oobe.Common.Interfaces;\r
 using Oobe.Terms.Model;\r
 using Oobe.Terms.Views;\r
+using Tizen.NUI.BaseComponents;\r
 \r
 namespace Oobe.Terms\r
 {\r
@@ -32,7 +32,7 @@ namespace Oobe.Terms
 \r
         public override View CreateView(IProcessNavigation nav)\r
         {\r
-            return new TermsView(nav, provider);\r
-         }\r
+            return new TermsView(nav, provider);
+        }\r
     }\r
 }\r
index c4727eb..b7d5290 100644 (file)
  * limitations under the License.
  */
 
-using Oobe.Common.Styles;
 using Oobe.Common.Interfaces;
+using Oobe.Common.Layouts;
+using Oobe.Common.Styles;
+using Oobe.Common.Utils;
+using Oobe.Terms.Model;
+using Oobe.Terms.Styles;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Terms.Model;
-using Oobe.Terms.Styles;
-using Oobe.Common.Layouts;
-using Oobe.Common.Utils;
 
 namespace Oobe.Terms.Views
 {
@@ -180,10 +180,10 @@ namespace Oobe.Terms.Views
                 {
                     AgreementCheckable = true;
                 }
+
                 return false;
             };
             timer.Start();
-
         }
 
         private bool NextEnabled
@@ -192,9 +192,14 @@ namespace Oobe.Terms.Views
             {
                 return nextEnabled;
             }
+
             set
             {
-                if (nextEnabled == value) return;
+                if (nextEnabled == value)
+                {
+                    return;
+                }
+
                 if (value)
                 {
                     NextButton.State = States.Normal;
@@ -207,6 +212,7 @@ namespace Oobe.Terms.Views
                     NextButton.IsEnabled = false;
                     agreeSwitch.IsSelected = false;
                 }
+
                 nextEnabled = value;
             }
         }
@@ -217,15 +223,21 @@ namespace Oobe.Terms.Views
             {
                 return agreementCheckable;
             }
+
             set
             {
-                if (value == agreementCheckable) return;
+                if (value == agreementCheckable)
+                {
+                    return;
+                }
+
                 if (value)
                 {
                     agreeLabel.State = States.Normal;
-                    //TODO workaround issue with TextLabel when Disabled style is not applied
-                    //when changing control state. Fix it by reapplying special style
-                    //remove below line when issue get fixed
+
+                    // TODO workaround issue with TextLabel when Disabled style is not applied
+                    // when changing control state. Fix it by reapplying special style
+                    // remove below line when issue get fixed
                     agreeLabel.ApplyStyle(TextLabelStyles.IHaveReadAndAgreeTextStyle);
                     agreeSwitch.IsEnabled = true;
                     agreeSwitch.State = States.Normal;
@@ -235,15 +247,17 @@ namespace Oobe.Terms.Views
                 else
                 {
                     agreeLabel.State = States.Disabled;
-                    //TODO workaround issue with TextLabel when Disabled style is not applied
-                    //when changing control state. Fix it by reapplying special style
-                    //remove below line when issue get fixed
+
+                    // TODO workaround issue with TextLabel when Disabled style is not applied
+                    // when changing control state. Fix it by reapplying special style
+                    // remove below line when issue get fixed
                     agreeLabel.ApplyStyle(TextLabelStyles.IHaveReadAndAgreeTextStyleDisabled);
                     agreeSwitch.IsEnabled = false;
                     agreeSwitch.State = States.Disabled;
                     tapGestureDetector.Detected -= OnTapGestureDetected;
                     tapGestureDetector.Detach(agreeLabel);
                 }
+
                 agreementCheckable = value;
             }
         }
@@ -257,6 +271,7 @@ namespace Oobe.Terms.Views
                     return true;
                 }
             }
+
             return false;
         }
 
@@ -279,5 +294,4 @@ namespace Oobe.Terms.Views
             return Config.ScaledSize(referenceTermsSize);
         }
     }
-
 }
index 8f091d8..7983727 100644 (file)
@@ -4,6 +4,7 @@
     <OutputType>Library</OutputType>
     <TargetFramework>tizen80</TargetFramework>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <ItemGroup>
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
   <ItemGroup>
     <ProjectReference Include="..\Oobe.Common\Oobe.Common.csproj" />
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
   </ItemGroup>
 </Project>
index 528d772..df5fded 100644 (file)
  * limitations under the License.
  */
 
-using Oobe.Common.Interfaces;\r
+using Oobe.Common.Interfaces;\r
+using Oobe.Common.Layouts;
 using Oobe.Common.Styles;\r
 using Tizen.NUI;\r
 using Tizen.NUI.BaseComponents;\r
 using Tizen.NUI.Components;\r
-using Oobe.Common.Layouts;
 \r
 namespace Oobe.Welcome\r
 {\r
@@ -33,7 +33,7 @@ namespace Oobe.Welcome
 \r
             TextLabel content = new TextLabel();\r
             content.Size2D = new Size2D(1026, 166);\r
-            content.TextColor = new Color(0, 12.0f/255.0f, 43.0f/255.0f, 1.0f);\r
+            content.TextColor = new Color(0, 12.0f / 255.0f, 43.0f / 255.0f, 1.0f);\r
             content.PixelSize = 22.0f;\r
             content.HorizontalAlignment = HorizontalAlignment.Center;\r
             content.FontFamily = "BreezeSansLight";\r
@@ -41,7 +41,8 @@ namespace Oobe.Welcome
             content.Text = "There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT. There should be some description or information about Tizen IoT.";\r
 \r
             container.NextButton.TranslatableText = "GET_STARTED";\r
-            container.NextButton.Clicked += (obj, args) => {\r
+            container.NextButton.Clicked += (obj, args) =>
+            {\r
                 nav.Finish();\r
             };\r
 \r
index 2643235..8897796 100644 (file)
@@ -20,10 +20,10 @@ using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Linq;
 using System.Threading.Tasks;
+using Oobe.Common.Styles;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
 
 namespace Oobe.Wifi.Controls
 {
@@ -42,7 +42,7 @@ namespace Oobe.Wifi.Controls
             this.height = height;
         }
 
-        //code does not handle the case with separators but without footer
+        // code does not handle the case with separators but without footer
         public Func<View> SeparatorFactory { get; set; } = null;
 
         public View Footer
@@ -54,6 +54,7 @@ namespace Oobe.Wifi.Controls
                 {
                     LayoutView.Remove(footer);
                 }
+
                 footer = value;
                 if (footer != null)
                 {
@@ -77,10 +78,29 @@ namespace Oobe.Wifi.Controls
                         HideScrollbar = false,
                     };
                 }
+
                 return scrollableBase;
             }
         }
 
+        public ObservableCollection<View> Items
+        {
+            get
+            {
+                return items;
+            }
+
+            set
+            {
+                if (value != items)
+                {
+                    DetachItems();
+                    items = value;
+                    AttachItems();
+                }
+            }
+        }
+
         private View LayoutView
         {
             get
@@ -97,24 +117,8 @@ namespace Oobe.Wifi.Controls
                         HeightResizePolicy = ResizePolicyType.FitToChildren,
                     });
                 }
-                return View.Children.First();
-            }
-        }
 
-        public ObservableCollection<View> Items
-        {
-            get
-            {
-                return items;
-            }
-            set
-            {
-                if (value != items)
-                {
-                    DetachItems();
-                    items = value;
-                    AttachItems();
-                }
+                return View.Children.First();
             }
         }
 
@@ -128,7 +132,7 @@ namespace Oobe.Wifi.Controls
             }
         }
 
-        //not thread safe
+        // not thread safe
         private void AttachItems()
         {
             if (items != null)
@@ -137,6 +141,7 @@ namespace Oobe.Wifi.Controls
                 {
                     AddRegularItem(item);
                 }
+
                 items.CollectionChanged += OnCollectionChanged;
             }
         }
@@ -157,14 +162,16 @@ namespace Oobe.Wifi.Controls
                 if (item != null)
                 {
                     RemoveRegularItem(item);
-                    //if scroll was at the end, make sure it is still properly aligned to the end
-                    //Tizen.Log.Debug("demo", $"{View.CurrentPage}");
+
+                    // if scroll was at the end, make sure it is still properly aligned to the end
+                    // Tizen.Log.Debug("demo", $"{View.CurrentPage}");
                 }
             }
             else if (e.Action == System.Collections.Specialized.NotifyCollectionChangedAction.Reset)
             {
                 RemoveItems();
             }
+
             LayoutView.HeightResizePolicy = ResizePolicyType.FitToChildren;
         }
 
@@ -173,7 +180,7 @@ namespace Oobe.Wifi.Controls
             LayoutView.Add(item);
             if (SeparatorFactory != null)
             {
-                if (itemToSeparator.ContainsKey(item)==false)
+                if (itemToSeparator.ContainsKey(item) == false)
                 {
                     var separator = SeparatorFactory();
                     itemToSeparator.Add(item, separator);
@@ -185,7 +192,7 @@ namespace Oobe.Wifi.Controls
         private void RemoveRegularItem(View item)
         {
             LayoutView.Remove(item);
-            if(itemToSeparator.ContainsKey(item))
+            if (itemToSeparator.ContainsKey(item))
             {
                 LayoutView.Remove(itemToSeparator[item]);
                 itemToSeparator.Remove(item);
@@ -198,6 +205,7 @@ namespace Oobe.Wifi.Controls
             {
                 LayoutView.Remove(child);
             }
+
             itemToSeparator.Clear();
         }
     }
index b5ca032..c90d2ab 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System.Linq;
+using System.Linq;
 using Tizen.NUI;
 
 namespace Oobe.Wifi.Controls
@@ -41,7 +41,8 @@ namespace Oobe.Wifi.Controls
             base.OnChildAdd(child);
             if (lastItem != null)
             {
-                if (LayoutChildren.Remove(lastItem))//remove by position, or find from the end
+                // remove by position, or find from the end
+                if (LayoutChildren.Remove(lastItem))
                 {
                     LayoutChildren.Add(lastItem);
                 }
index b4146fb..3d88cd1 100644 (file)
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Oobe.Common.Styles;
+using Oobe.Common.Utils;
+using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
-using Tizen.Network.WiFi;
-using Oobe.Common.Utils;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
-    class AddNewNetworkPupup : View
+    public class AddNewNetworkPupup : View
     {
-        public event Action OnDismiss;
-        enum NewNetworkViewMode
-        {
-            NoPassword,
-            PasswordOnly,
-            UserPassword
-        };
-        NewNetworkViewMode currentViewMode;
-        TextLabel titleLabel;
-        TextField ssidTextField;
-        View ssidUnderline;
-        TextLabel selectedSecurityTypeLabel;
-        TapGestureDetector securityTypeDetector;
-        TextLabel usernameLabel;
-        TextField usernameTextField;
-        View usernameUnderline;
-        PasswordEntry passwordEntry;
-        View passwordUnderline;
-        Button revealButton;
-        Button cancelButton;
-        Button addButton;
-        TextLabel failureLabel;
-        WifiUISecurityType currentSecurityType;
+        private NewNetworkViewMode currentViewMode;
+        private TextLabel titleLabel;
+        private TextField ssidTextField;
+        private View ssidUnderline;
+        private TextLabel selectedSecurityTypeLabel;
+        private TapGestureDetector securityTypeDetector;
+        private TextLabel usernameLabel;
+        private TextField usernameTextField;
+        private View usernameUnderline;
+        private PasswordEntry passwordEntry;
+        private View passwordUnderline;
+        private Button revealButton;
+        private Button cancelButton;
+        private Button addButton;
+        private TextLabel failureLabel;
+        private WifiUISecurityType currentSecurityType;
         private string backgroundImagePath = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "08_popup_body.png");
         private string arrowImagePath = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_back_active.png");
 
-        static Color largeTextColor => new Color(0.0f, 0x14 / 255.0f, 0x47 / 255.0f, 1.0f);
-        static Color smallTextColor => new Color(0.0f, 0xC / 255.0f, 0x2B / 255.0f, 1.0f);
-        static Size labelSize => new Size(600, 19);
-        static Size textControlSize => new Size(680, 27);
-        static Size passwordControlSize => new Size(583, 27);
-        int labelFontSize = 14;
-        int textFontSize = 22;
-        int passwordFontSize = 22;
+        private int labelFontSize = 14;
+        private int textFontSize = 22;
+        private int passwordFontSize = 22;
 
         public AddNewNetworkPupup()
         {
@@ -74,42 +62,61 @@ namespace Oobe.Wifi.Controls.Wifi
             Tizen.Log.Debug("oobe", "Finished creating Add New Network Popup");
         }
 
-        TextLabel CreateTextLabel(string translatableText, Position2D position = null)
+        public event Action OnDismiss;
+
+        public enum NewNetworkViewMode
+        {
+            NoPassword,
+            PasswordOnly,
+            UserPassword,
+        }
+
+        private static Color LargeTextColor => new Color(0.0f, 0x14 / 255.0f, 0x47 / 255.0f, 1.0f);
+
+        private static Color SmallTextColor => new Color(0.0f, 0xC / 255.0f, 0x2B / 255.0f, 1.0f);
+
+        private static Size LabelSize => new Size(600, 19);
+
+        private static Size TextControlSize => new Size(680, 27);
+
+        private static Size PasswordControlSize => new Size(583, 27);
+
+        private TextLabel CreateTextLabel(string translatableText, Position2D position = null)
         {
             position ??= new Position2D();
             return new TextLabel
             {
                 Position = position,
-                Size = labelSize,
+                Size = LabelSize,
                 PixelSize = labelFontSize,
                 TranslatableText = translatableText,
                 FontFamily = "BreezeSans",
                 FontStyle = new PropertyMap().AddRegularFontStyle(),
-                TextColor = smallTextColor,
+                TextColor = SmallTextColor,
                 HorizontalAlignment = HorizontalAlignment.Begin,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
         }
 
-        TextField CreateTextField(string placeholderTranslatableText, Position2D position = null)
+        private TextField CreateTextField(string placeholderTranslatableText, Position2D position = null)
         {
             position ??= new Position2D();
             var textField = new TextField
             {
                 Position = position,
-                Size = textControlSize,
+                Size = TextControlSize,
                 PixelSize = textFontSize,
                 FontFamily = "BreezeSans",
                 FontStyle = new PropertyMap().AddRegularFontStyle(),
-                TextColor = largeTextColor,
+                TextColor = LargeTextColor,
                 TranslatablePlaceholderText = placeholderTranslatableText,
                 HorizontalAlignment = HorizontalAlignment.Begin,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             return textField;
         }
 
-        View CreateUnderline(Position2D position = null, Size2D size = null)
+        private View CreateUnderline(Position2D position = null, Size2D size = null)
         {
             position ??= new Position2D();
             size ??= new Size2D(728, 1);
@@ -117,30 +124,30 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Position = position,
                 Size = size,
-                BackgroundColor = new Color(0xC3 / 255.0f, 0xCA / 255.0f, 0xD2 / 255.0f, 1.0f)
+                BackgroundColor = new Color(0xC3 / 255.0f, 0xCA / 255.0f, 0xD2 / 255.0f, 1.0f),
             };
         }
 
-        PasswordEntry CreatePasswordEntry(Position2D position = null)
+        private PasswordEntry CreatePasswordEntry(Position2D position = null)
         {
             position ??= new Position2D();
             var passwordEntry = new PasswordEntry
             {
                 Position = position,
-                Size = passwordControlSize,
+                Size = PasswordControlSize,
                 PixelSize = passwordFontSize,
                 FontFamily = "BreezeSans",
                 FontStyle = new PropertyMap().AddRegularFontStyle(),
-                TextColor = largeTextColor,
+                TextColor = LargeTextColor,
                 TranslatablePlaceholderText = "WIFI_PASSWORD",
                 HorizontalAlignment = HorizontalAlignment.Begin,
                 VerticalAlignment = VerticalAlignment.Center,
-                Revealed = false
+                Revealed = false,
             };
             return passwordEntry;
         }
 
-        Button CreateRevealButton(Position2D position = null)
+        private Button CreateRevealButton(Position2D position = null)
         {
             position ??= new Position2D();
             var button = new Button(ButtonStyles.Reveal)
@@ -156,7 +163,7 @@ namespace Oobe.Wifi.Controls.Wifi
             return button;
         }
 
-        void InitializeStaticElements()
+        private void InitializeStaticElements()
         {
             this.BackgroundImage = backgroundImagePath;
             titleLabel = new TextLabel
@@ -167,9 +174,9 @@ namespace Oobe.Wifi.Controls.Wifi
                 TranslatableText = "WIFI_ADD_NETWORK",
                 FontFamily = "BreezeSans",
                 FontStyle = new PropertyMap().AddLightFontStyle(),
-                TextColor = largeTextColor,
+                TextColor = LargeTextColor,
                 HorizontalAlignment = HorizontalAlignment.Center,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             this.Add(titleLabel);
 
@@ -183,7 +190,7 @@ namespace Oobe.Wifi.Controls.Wifi
 
             cancelButton = new Button(ButtonStyles.Cancel)
             {
-                Size = new Size(240, 72)
+                Size = new Size(240, 72),
             };
             cancelButton.Clicked += (s, e) => OnDismiss?.Invoke();
             this.Add(cancelButton);
@@ -191,7 +198,7 @@ namespace Oobe.Wifi.Controls.Wifi
             addButton = new Button(ButtonStyles.OK)
             {
                 Size = new Size(240, 72),
-                TranslatableText = "WIFI_ADD"
+                TranslatableText = "WIFI_ADD",
             };
             addButton.Clicked += async (s, e) =>
             {
@@ -208,22 +215,27 @@ namespace Oobe.Wifi.Controls.Wifi
                     ShowFailureSsidLabel();
                     return;
                 }
+
                 bool success = false;
                 if (aps is null || aps.Count() == 0)
                 {
                     ShowFailureSsidLabel();
                     return;
                 }
+
                 foreach (var wifiAp in aps)
                 {
-                    Tizen.Log.Debug("oobe", $"Trying to add new network: SSID: {wifiAp.NetworkInformation.Bssid} ({wifiAp.NetworkInformation.Essid}), " +
+                    string message = $"Trying to add new network: SSID: " +
+                        $"{wifiAp.NetworkInformation.Bssid} ({wifiAp.NetworkInformation.Essid}), " +
                         $"Password: {(passwordEntry is null ? "not set" : "XXXXXXXX")}, " +
-                        $"Security type: {currentSecurityType.GetUIName()}");
+                        $"Security type: {currentSecurityType.GetUIName()}";
+                    Tizen.Log.Debug("oobe", message);
                     wifiAp.SecurityInformation.SecurityType = currentSecurityType.GetApSecurityType();
                     if (!(passwordEntry is null))
                     {
                         wifiAp.SecurityInformation.SetPassphrase(passwordEntry.Password);
                     }
+
                     Task<bool> task = null;
                     try
                     {
@@ -232,18 +244,21 @@ namespace Oobe.Wifi.Controls.Wifi
                     }
                     catch (Exception connectionException)
                     {
-                        Tizen.Log.Error("oobe", $"Failed to connect to WiFI {wifiAp.NetworkInformation.Bssid} ({wifiAp.NetworkInformation.Essid})" +
+                        string errorMessage = $"Failed to connect to WiFI {wifiAp.NetworkInformation.Bssid} ({wifiAp.NetworkInformation.Essid})" +
                             $"Password: {(passwordEntry is null ? "not set" : "XXXXXXXX")}, " +
                             $"Security type: {currentSecurityType.GetUIName()} " +
-                            connectionException.Message);
+                            connectionException.Message;
+                        Tizen.Log.Error("oobe", errorMessage);
                         continue;
                     }
+
                     if (task is null)
                     {
                         Tizen.Log.Error("oobe", "Failed to cast connection task");
                         OnDismiss?.Invoke();
                         continue;
                     }
+
                     try
                     {
                         if (await task)
@@ -254,14 +269,15 @@ namespace Oobe.Wifi.Controls.Wifi
                     }
                     catch (Exception connectionException)
                     {
-                        Tizen.Log.Error("oobe", $"Failed to connect to WiFI {wifiAp.NetworkInformation.Bssid} ({wifiAp.NetworkInformation.Essid})" +
+                        string errorMessage = $"Failed to connect to WiFI {wifiAp.NetworkInformation.Bssid} ({wifiAp.NetworkInformation.Essid})" +
                             $"Password: {(passwordEntry is null ? "not set" : "XXXXXXXX")}, " +
                             $"Security type: {currentSecurityType.GetUIName()} " +
-                            connectionException.Message);
+                            connectionException.Message;
+                        Tizen.Log.Error("oobe", errorMessage);
                         continue;
                     }
-
                 }
+
                 if (success)
                 {
                     OnDismiss?.Invoke();
@@ -281,7 +297,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 FontStyle = new PropertyMap().AddRegularFontStyle(),
                 TextColor = new Color(0xAA / 255.0f, 0x18 / 255.0f, 0x18 / 255.0f, 1.0f),
                 HorizontalAlignment = HorizontalAlignment.Begin,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             failureLabel.Hide();
             this.Add(failureLabel);
@@ -303,7 +319,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 TranslatableText = currentSecurityType.GetUIName(),\r
                 FontStyle = new PropertyMap().AddRegularFontStyle(),\r
                 FontFamily = "BreezeSans",\r
-                TextColor = largeTextColor,\r
+                TextColor = LargeTextColor,\r
                 HorizontalAlignment = HorizontalAlignment.Begin,
                 VerticalAlignment = VerticalAlignment.Center,\r
             };\r
@@ -319,7 +335,7 @@ namespace Oobe.Wifi.Controls.Wifi
             return view;\r
         }\r
 \r
-        void OpenSecurityTypePopup()
+        private void OpenSecurityTypePopup()
         {
             var view = new ChangeSecurityTypePopup(currentSecurityType);
             var popup = new Oobe.Common.Utils.Popup(view, backgroundOpacity: 0f);
@@ -331,7 +347,7 @@ namespace Oobe.Wifi.Controls.Wifi
             popup.Show();
         }
 
-        void ResetViewToNoPassword()
+        private void ResetViewToNoPassword()
         {
             Size = new Size(808, 343);
             Position = new Position2D(236, 118);
@@ -384,7 +400,7 @@ namespace Oobe.Wifi.Controls.Wifi
             currentViewMode = NewNetworkViewMode.NoPassword;
         }
 
-        void ResetViewToPasswordOnly()
+        private void ResetViewToPasswordOnly()
         {
             Size = new Size2D(808, 412);
             Position = new Position2D(236, 59);
@@ -438,7 +454,7 @@ namespace Oobe.Wifi.Controls.Wifi
             currentViewMode = NewNetworkViewMode.PasswordOnly;
         }
 
-        void ResetViewToUserPassword()
+        private void ResetViewToUserPassword()
         {
             Size = new Size2D(808, 440);
             Position = new Position2D(236, 0);
@@ -492,7 +508,7 @@ namespace Oobe.Wifi.Controls.Wifi
             currentViewMode = NewNetworkViewMode.UserPassword;
         }
 
-        void ResetViewTo(WifiUISecurityType securityType)
+        private void ResetViewTo(WifiUISecurityType securityType)
         {
             Tizen.Log.Debug("oobe", $"Reseting view to {securityType.GetUIName()}");
             failureLabel.Hide();
@@ -514,14 +530,14 @@ namespace Oobe.Wifi.Controls.Wifi
             }
         }
 
-        void ShowFailureSsidLabel()
+        private void ShowFailureSsidLabel()
         {
             failureLabel.Show();
             failureLabel.TranslatableText = "WIFI_SSID_FAILURE";
             failureLabel.Position2D = ssidTextField.Position2D + new Position2D(0, (int)ssidTextField.Size.Height);
         }
 
-        void ShowFailurePasswordLabel()
+        private void ShowFailurePasswordLabel()
         {
             failureLabel.Show();
             if (currentViewMode == NewNetworkViewMode.NoPassword)
index cafd8e0..c0488f9 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Linq;
@@ -33,8 +33,6 @@ namespace Oobe.Wifi.Controls.Wifi
         private Dictionary<WiFiAP, ApView> apToViewMap = new Dictionary<WiFiAP, ApView>();
         private CancellationTokenSource updatingCancellation = new CancellationTokenSource();
 
-        public ObservableCollection<View> Views { get; private set; } = new ObservableCollection<View>();
-
         public ApManager(Action<WiFiAP> onTapped)
         {
             this.onTapped = onTapped;
@@ -42,13 +40,7 @@ namespace Oobe.Wifi.Controls.Wifi
             _ = RunUpdatingAps();
         }
 
-        private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
-        {
-            if (apToViewMap.TryGetValue(e.AP, out ApView view))
-            {
-                view.Update(e.AP);
-            }
-        }
+        public ObservableCollection<View> Views { get; private set; } = new ObservableCollection<View>();
 
         public void UpdateTo(IEnumerable<WiFiAP> aps)
         {
@@ -61,6 +53,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 ap.Dispose();
             }
+
             apToViewMap.Clear();
             Views.Clear();
 
@@ -95,6 +88,14 @@ namespace Oobe.Wifi.Controls.Wifi
             }
         }
 
+        private void OnConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
+        {
+            if (apToViewMap.TryGetValue(e.AP, out ApView view))
+            {
+                view.Update(e.AP);
+            }
+        }
+
         private async Task RunUpdatingAps()
         {
             while (await Delay())
@@ -127,6 +128,7 @@ namespace Oobe.Wifi.Controls.Wifi
             catch (Exception)
             {
             }
+
             return updatingCancellation.IsCancellationRequested == false;
         }
     }
index ec83cae..f87a6c8 100644 (file)
  * limitations under the License.
  */
 
-using System;
+using System;
+using Oobe.Common.Styles;
 using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
-using Oobe.Common.Styles;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
     public class ApView : View
     {
-        public event Action Tapped;
         private TextLabel detail = null;
         private View range = null;
-        //detectors have to be kept separately because of GC, there is no link by ref between View and Detector
+
+        // detectors have to be kept separately because of GC, there is no link by ref between View and Detector
         private TapGestureDetector detector;
 
         public ApView()
@@ -36,6 +36,8 @@ namespace Oobe.Wifi.Controls.Wifi
             Layout = new AbsoluteLayout();
         }
 
+        public event Action Tapped;
+
         public void Update(WiFiAP wifiAp)
         {
             if (range == null)
@@ -81,16 +83,16 @@ namespace Oobe.Wifi.Controls.Wifi
 
         private static string GetDetailInfo(WiFiAP wifiAp)
         {
-            //state
+            // state
             if (wifiAp.NetworkInformation.ConnectionState == WiFiConnectionState.Connected)
             {
                 return "Connected";
             }
+
             if (wifiAp.NetworkInformation.ConnectionState == WiFiConnectionState.Association)
             {
                 return "Connecting...";
-            }
-            //security
+            } // security
             else if (wifiAp.SecurityInformation.SecurityType == Tizen.Network.Connection.WiFiSecurityType.None)
             {
                 return "Open";
@@ -107,8 +109,9 @@ namespace Oobe.Wifi.Controls.Wifi
 
         private static string GetRangeImage(WiFiAP wifiAp)
         {
-            return System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource
-                , $"12_icon_wifi{(int)wifiAp.NetworkInformation.RssiLevel}.png");
+            return System.IO.Path.Combine(
+                    NUIApplication.Current.DirectoryInfo.Resource,
+                    $"12_icon_wifi{(int)wifiAp.NetworkInformation.RssiLevel}.png");
         }
     }
 }
index a227fd1..356e353 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -27,12 +27,17 @@ namespace Oobe.Wifi.Controls.Wifi
 {
     public class ButtonStyles
     {
-        public static ButtonStyle Cancel = GetCancelButtonStyle();
-        public static ButtonStyle OK = GetOKButtonStyle();
-        public static ButtonStyle Scan = GetScanButtonStyle();
-        public static ButtonStyle TurnOnOff = GetTurnOnOffButtonStyle();
-        public static ButtonStyle Reveal = GetRevealButtonStyle();
-        public static ButtonStyle AddNetwork = GetAddNetworkButtonStyle();
+        public static ButtonStyle Cancel { get => GetCancelButtonStyle(); }
+
+        public static ButtonStyle OK { get => GetOKButtonStyle(); }
+
+        public static ButtonStyle Scan { get => GetScanButtonStyle(); }
+
+        public static ButtonStyle TurnOnOff { get => GetTurnOnOffButtonStyle(); }
+
+        public static ButtonStyle Reveal { get => GetRevealButtonStyle(); }
+
+        public static ButtonStyle AddNetwork { get => GetAddNetworkButtonStyle(); }
 
         private static ButtonStyle GetCancelButtonStyle() => new ButtonStyle
         {
@@ -47,7 +52,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 PointSize = new Selector<float?>
                 {
                     Normal = 22.0f,
-                    Pressed = 24.0f
+                    Pressed = 24.0f,
                 },
                 EnableMarkup = true,
                 TranslatableText = "WIFI_CANCEL",
@@ -116,7 +121,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 PointSize = new Selector<float?>
                 {
                     Normal = 22.0f,
-                    Pressed = 24.0f
+                    Pressed = 24.0f,
                 },
                 TextColor = Color.White,
                 TranslatableText = "WIFI_OK",
index c9955d3..3be9075 100644 (file)
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Collections.ObjectModel;
 using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
+using Oobe.Common.Styles;
+using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
-using Tizen.Network.WiFi;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
-    class ChangeSecurityTypePopup : View
+    public class ChangeSecurityTypePopup : View
     {
-        public event Action OnDismiss;
-
-        public WifiUISecurityType WifiUISecurityType { get; private set; }
         private WifiUISecurityType originalWifUISecurityType;
         private ListView listView;
         private ObservableCollection<View> choiceViews = new ObservableCollection<View>();
@@ -50,6 +47,10 @@ namespace Oobe.Wifi.Controls.Wifi
             InitializeRadioButtons();
         }
 
+        public event Action OnDismiss;
+
+        public WifiUISecurityType WifiUISecurityType { get; private set; }
+
         public void InitializeStaticElements()
         {
             var titleLabel = new TextLabel()
@@ -62,7 +63,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 FontStyle = new PropertyMap().AddLightFontStyle(),
                 TextColor = new Color(0.0f, 0x14 / 255.0f, 0x47 / 255.0f, 1.0f),
                 HorizontalAlignment = HorizontalAlignment.Center,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             this.Add(titleLabel);
 
@@ -82,7 +83,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Position = new Position(488, 344),
                 Size = new Size(240, 72),
-                TranslatableText = "WIFI_OK"
+                TranslatableText = "WIFI_OK",
             };
 
             addButton.Clicked += (s, e) =>
@@ -99,9 +100,10 @@ namespace Oobe.Wifi.Controls.Wifi
                 var view = CreateOption(type);
                 choiceViews.Add(view);
             }
+
             listView = new ListView(768, 238)
             {
-                Items = choiceViews
+                Items = choiceViews,
             };
             listView.View.Position = new Position(0, 82);
             this.Add(listView.View);
@@ -114,6 +116,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 view.Button.IsSelected = true;
             }
+
             radioButtonGroup.Add(view.Button);
             view.Button.Clicked += (s, e) => this.WifiUISecurityType = view.WifiUISecurityType;
             return view;
index 94d8546..fa6963e 100644 (file)
  * limitations under the License.
  */
 
-using Tizen.NUI;
+using Tizen.NUI;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
     public class PasswordEntry : Tizen.NUI.BaseComponents.TextField
     {
         private bool revealed = false;
+
         public string Password => Text;
 
         public bool Revealed
@@ -30,22 +31,28 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 revealed = value;
                 if (revealed)
-                    revealPassword();
+                {
+                    RevealPassword();
+                }
                 else
-                    hidePassword();
+                {
+                    HidePassword();
+                }
+
 #pragma warning disable S1656
-                Text = Text; //for refreshing - causes resetting cursor
+                Text = Text; // for refreshing - causes resetting cursor
 #pragma warning restore S1656
             }
         }
 
-        private void revealPassword()
+        private void RevealPassword()
         {
             var map = new PropertyMap();
             map.Add("mode", new PropertyValue(0));
             HiddenInputSettings = map;
         }
-        private void hidePassword()
+
+        private void HidePassword()
         {
             var map = new PropertyMap();
             map.Add("mode", new PropertyValue(4));
index 3dfa0f5..4d76587 100644 (file)
  * limitations under the License.
  */
 
-using System;
+using System;
+using Oobe.Common.Styles;
 using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
-    class SecurityTypeView : View
+    public class SecurityTypeView : View
     {
-        public RadioButton Button;
-        public readonly WifiUISecurityType WifiUISecurityType;
-
         private TextLabel descriptionTextLabel = null;
-        /*//detectors have to be kept separately because of GC, there is no link by ref between View and Detector
-        private TapGestureDetector detector;*/
 
         public SecurityTypeView(WifiUISecurityType wifiUISecurityType)
         {
@@ -41,7 +36,11 @@ namespace Oobe.Wifi.Controls.Wifi
             InitializeSubelements();
         }
 
-        void InitializeSubelements()
+        public WifiUISecurityType WifiUISecurityType { get; set; }
+
+        public RadioButton Button { get; set; }
+
+        private void InitializeSubelements()
         {
             Button = new RadioButton
             {
@@ -49,7 +48,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 Position = new Position(40, 20),
                 Size = new Size(24, 24),
                 CellHorizontalAlignment = HorizontalAlignmentType.Center,
-                CellVerticalAlignment = VerticalAlignmentType.Center
+                CellVerticalAlignment = VerticalAlignmentType.Center,
             };
             this.Add(Button);
 
@@ -63,7 +62,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 FontStyle = new PropertyMap().AddLightFontStyle(),
                 TextColor = new Color(0.0f, 0x14 / 255.0f, 0x47 / 255.0f, 1.0f),
                 HorizontalAlignment = HorizontalAlignment.Begin,
-                VerticalAlignment = VerticalAlignment.Center
+                VerticalAlignment = VerticalAlignment.Center,
             };
             this.Add(descriptionTextLabel);
         }
index 1724e08..2722e2f 100644 (file)
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Threading.Tasks;
+using Oobe.Common.Styles;
+using Oobe.Wifi.Controls.Wifi;
+using Tizen.Network.WiFi;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Tizen.Network.WiFi;
-using Oobe.Common.Styles;
-using Oobe.Wifi.Controls.Wifi;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
-    class WifiPasswordPopup : View
+    public class WifiPasswordPopup : View
     {
-        public event Action OnDismiss;
+        private const int MinPasswordLength = 8;
+        private const int MaxPasswordLength = 63;
         private PasswordEntry passwordEntry = null;
         private Button okButton;
         private Button cancelButton;
         private Button revealButton;
         private TextLabel connectionFailure;
-        private const int minPasswordLength = 8;
-        private const int maxPasswordLength = 63;
         private string backgroundImagePath = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "08_popup_body.png");
         private WiFiAP wifiAp;
         private bool isConnecting = false;
 
-        public string Password => passwordEntry.Password;
-
         public WifiPasswordPopup(Tizen.Network.WiFi.WiFiAP wifiAp)
         {
             BackgroundImage = backgroundImagePath;
@@ -48,7 +45,7 @@ namespace Oobe.Wifi.Controls.Wifi
             Position = new Position(new Position2D(236, 116));
             this.wifiAp = wifiAp;
 
-            this.Add(new View() //underline
+            this.Add(new View() // underline
             {
                 Size = new Size(672, 1),
                 Position = new Position(40, 117),
@@ -59,7 +56,8 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Size = new Size(728, 33),
                 Position = new Position(40, 24),
-                //no translatableText because of dynamic content
+
+                // no translatableText because of dynamic content
                 Text = string.Format(Translations.WIFI_ENTER_PASSWORD_TO_JOIN, wifiAp.NetworkInformation.Essid),
                 PixelSize = 26,
                 TextColor = new Color(0, 0x14 / 255.0f, 0x47 / 255.0f, 1.0f),
@@ -74,7 +72,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Size = new Size(624, 27),
                 Position = new Position(40, 91),
-                MaxLength = maxPasswordLength,
+                MaxLength = MaxPasswordLength,
                 PixelSize = 22,
                 TextColor = new Color(0, 0x0C / 255.0f, 0x2B / 255.0f, 1.0f),
                 FontFamily = "BreezeSans",
@@ -112,7 +110,7 @@ namespace Oobe.Wifi.Controls.Wifi
             cancelButton = new Button(ButtonStyles.Cancel)
             {
                 Size = new Size(240, 72),
-                Position = new Position(80, 175)
+                Position = new Position(80, 175),
             };
             cancelButton.Clicked += (s, e) =>
             {
@@ -124,7 +122,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 Size = new Size(240, 72),
                 Position = new Position(488, 175),
-                IsEnabled = false
+                IsEnabled = false,
             };
             okButton.Clicked += async (s, e) =>
             {
@@ -159,6 +157,10 @@ namespace Oobe.Wifi.Controls.Wifi
             this.Add(okButton);
         }
 
+        public event Action OnDismiss;
+
+        public string Password => passwordEntry.Password;
+
         private void TogglePasswordVisibility()
         {
             passwordEntry.Revealed = !passwordEntry.Revealed;
@@ -167,7 +169,7 @@ namespace Oobe.Wifi.Controls.Wifi
 
         private void UpdateOKButton()
         {
-            okButton.IsEnabled = (Password.Length >= minPasswordLength) && (isConnecting == false);
+            okButton.IsEnabled = (Password.Length >= MinPasswordLength) && (isConnecting == false);
         }
     }
 }
index 9d80287..eb74be4 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Threading.Tasks;
 using Tizen.Network.WiFi;
@@ -23,19 +23,23 @@ namespace Oobe.Wifi.Controls.Wifi
 {
     internal class WifiState : IDisposable
     {
+        public WifiState()
+        {
+            WiFiManager.DeviceStateChanged += WiFiManager_DeviceStateChanged;
+        }
+
         public event Action OnTurningOnFailed;
+
         public event Action OnTurnedOn;
+
         public event Action OnTurnedOff;
+
         public event Action OnScanStarted;
+
         public event Action OnScanFinished;
 
         public bool IsTurnedOn => WiFiManager.IsActive;
 
-        public WifiState()
-        {
-            WiFiManager.DeviceStateChanged += WiFiManager_DeviceStateChanged;
-        }
-        
         public async Task TurnWifi()
         {
             try
@@ -75,6 +79,7 @@ namespace Oobe.Wifi.Controls.Wifi
             {
                 OnScanFinished?.Invoke();
             }
+
             return new List<WiFiAP>();
         }
 
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Text;
@@ -23,16 +23,16 @@ using Tizen.Network.Connection;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
-    enum WifiUISecurityType
+    public enum WifiUISecurityType
     {
         None,
         EAP,
         WEP,
         WPAPSK,
-        WPA2PSK
+        WPA2PSK,
     }
 
-    static class WifiUISecurityTypeExtensions
+    public static class WifiUISecurityTypeExtensions
     {
         public static string GetUIName(this WifiUISecurityType type)
         {
index a5974a6..06063c4 100644 (file)
  */
 
 using System;
+using Oobe.Common.Styles;
 using Tizen.NUI;
 using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using Oobe.Common.Styles;
 
 namespace Oobe.Wifi.Controls.Wifi
 {
     public class WifiView : IDisposable
     {
-        private View view = null;
         public const int ListItemWidth = 460;
-        public const int ListItemHeight = 79;//89;
+        public const int ListItemHeight = 79;
 
-        private WifiState State { get; set; } = new WifiState();
-        private ApManager ApManager { get; set; } = new ApManager(OnApTapped);
+        private View view = null;
 
         public View View
         {
@@ -44,8 +42,6 @@ namespace Oobe.Wifi.Controls.Wifi
                             LinearOrientation = LinearLayout.Orientation.Vertical,
                         },
                         BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "Rectangle_918.png"),
-                        //BackgroundColor = Color.Red,
-                        //Size = new Size(480, 401),
                         Size = new Size(480, 416),
                     };
                     view.Add(CreateHeader(480, 91));
@@ -54,10 +50,75 @@ namespace Oobe.Wifi.Controls.Wifi
 
                     view.Add(CreateListViewPlaceHolder());
                 }
+
                 return view;
             }
         }
 
+        private WifiState State { get; set; } = new WifiState();
+
+        private ApManager ApManager { get; set; } = new ApManager(OnApTapped);
+
+        public void Dispose()
+        {
+            view = null;
+            ApManager.Dispose();
+            State.Dispose();
+        }
+
+        private static View CreateScanningView()
+        {
+            var view = new View()
+            {
+                Layout = new LinearLayout()
+                {
+                    LinearOrientation = LinearLayout.Orientation.Horizontal,
+                },
+            };
+
+            var progress = new View()
+            {
+                Size = new Size(22, 23),
+                Margin = new Extents(0, 0, 1, 0),
+                BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_scanning.png"),
+            };
+            view.Add(progress);
+
+            Animation animation = null;
+            progress.VisibilityChanged += (s, e) =>
+            {
+                if (e.Visibility == false)
+                {
+                    animation?.Stop();
+                    animation?.Clear();
+                    animation?.Dispose();
+                    animation = null;
+                    progress.Orientation = new Rotation(new Radian(new Degree(0)), new Vector3(0, 0, -1));
+                }
+                else if (animation == null)
+                {
+                    animation = new Animation(1_000);
+                    animation.Looping = true;
+                    animation.AnimateTo(progress, "Orientation", new Rotation(new Radian(new Degree(180)), new Vector3(0, 0, -1)), new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
+                    animation.Play();
+                }
+            };
+
+            view.Add(new TextLabel()
+            {
+                Size = new Size(190, 25),
+                TranslatableText = "WIFI_SCANNING",
+                Margin = new Extents(17, 0, 0, 0),
+                VerticalAlignment = VerticalAlignment.Center,
+                HorizontalAlignment = HorizontalAlignment.Begin,
+                PixelSize = 20f,
+                TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
+                FontFamily = "BreezeSans",
+                FontStyle = new PropertyMap().AddRegularFontStyle(),
+            });
+            return view;
+        }
+
         private static View CreateSeparator()
         {
             return new View()
@@ -82,7 +143,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 Size = new Size(42, 42),
             };
 
-            addNewButton.Clicked += (s, e) => ShowAddNetworkPopup(); 
+            addNewButton.Clicked += (s, e) => ShowAddNetworkPopup();
             manualWifi.Add(addNewButton);
 
             manualWifi.Add(new TextLabel()
@@ -96,7 +157,7 @@ namespace Oobe.Wifi.Controls.Wifi
             });
             return manualWifi;
         }
-        
+
         private static void ShowAddNetworkPopup()
         {
             var view = new AddNewNetworkPupup();
@@ -120,6 +181,7 @@ namespace Oobe.Wifi.Controls.Wifi
                 Tizen.Log.Debug("oobe", $"Already connected to {wifiAp.NetworkInformation.Essid}");
                 return;
             }
+
             ShowPasswordPopup(wifiAp);
         }
 
@@ -178,7 +240,6 @@ namespace Oobe.Wifi.Controls.Wifi
         private View CreateListViewPlaceHolder()
         {
             var view = new View();
-            //var listView = new ListView(480, 324)//314)//480, 335
             var listView = new ListView(480, 319)
             {
                 Footer = CreateManualWifiView(),
@@ -197,77 +258,31 @@ namespace Oobe.Wifi.Controls.Wifi
             };
             view.Add(prompt);
 
-            void turnOn()
+            void TurnOn()
             {
                 prompt.Hide();
                 listView.Show();
             }
-            void turnOff(string message)
+
+            void TurnOff(string message)
             {
                 listView.Hide();
                 prompt.TranslatableText = message;
                 prompt.Show();
             }
-            if (State.IsTurnedOn)
-                turnOn();
-            else
-                turnOff("WIFI_TURN_ON_WIFI");
-            State.OnTurnedOff += () => turnOff("WIFI_TURN_ON_WIFI");
-            State.OnTurnedOn += () => turnOn();
-            State.OnTurningOnFailed += () => turnOff("WIFI_CONNECTION_FAILED");
-            return view;
-        }
-
-        private static View CreateScanningView()
-        {
-            var view = new View()
-            {
-                Layout = new LinearLayout()
-                {
-                    LinearOrientation = LinearLayout.Orientation.Horizontal,
-                }
-            };
 
-            var progress = new View()
+            if (State.IsTurnedOn)
             {
-                Size = new Size(22, 23),
-                Margin = new Extents(0, 0, 1, 0),
-                BackgroundImage = System.IO.Path.Combine(NUIApplication.Current.DirectoryInfo.Resource, "12_icon_scanning.png"),
-            };
-            view.Add(progress);
-
-            Animation animation = null;
-            progress.VisibilityChanged += (s, e) =>
+                TurnOn();
+            }
+            else
             {
-                if (e.Visibility == false)
-                {
-                    animation?.Stop();
-                    animation?.Clear();
-                    animation?.Dispose();
-                    animation = null;
-                    progress.Orientation = new Rotation(new Radian(new Degree(0)), new Vector3(0, 0, -1));
-                }
-                else if (animation == null)
-                {
-                    animation = new Animation(1_000);
-                    animation.Looping = true;
-                    animation.AnimateTo(progress, "Orientation", new Rotation(new Radian(new Degree(180)), new Vector3(0, 0, -1)), new AlphaFunction(AlphaFunction.BuiltinFunctions.Linear));
-                    animation.Play();
-                }
-            };
+                TurnOff("WIFI_TURN_ON_WIFI");
+            }
 
-            view.Add(new TextLabel()
-            {
-                Size = new Size(190, 25),
-                TranslatableText = "WIFI_SCANNING",
-                Margin = new Extents(17, 0, 0, 0),
-                VerticalAlignment = VerticalAlignment.Center,
-                HorizontalAlignment = HorizontalAlignment.Begin,
-                PixelSize = 20f,
-                TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
-                FontFamily = "BreezeSans",
-                FontStyle = new PropertyMap().AddRegularFontStyle(),
-            });
+            State.OnTurnedOff += () => TurnOff("WIFI_TURN_ON_WIFI");
+            State.OnTurnedOn += () => TurnOn();
+            State.OnTurningOnFailed += () => TurnOff("WIFI_CONNECTION_FAILED");
             return view;
         }
 
@@ -280,7 +295,6 @@ namespace Oobe.Wifi.Controls.Wifi
 
             var wifi = new TextLabel("Wi-Fi")
             {
-                //Size = new Size(49, 24),
                 PixelSize = 20f,
                 TextColor = new Color(0, 0x0C / 255f, 0x2B / 255f, 1.0f),
                 FontFamily = "BreezeSans",
@@ -291,27 +305,22 @@ namespace Oobe.Wifi.Controls.Wifi
             var scanning = CreateScanningView();
             view.Add(scanning);
 
-            void startScan()
+            void StartScan()
             {
                 wifi.Hide();
                 scanning.Show();
             }
-            void finishScan()
+
+            void FinishScan()
             {
                 scanning.Hide();
                 wifi.Show();
             }
-            finishScan();
-            State.OnScanStarted += startScan;
-            State.OnScanFinished += finishScan;
-            return view;
-        }
 
-        public void Dispose()
-        {
-            view = null;
-            ApManager.Dispose();
-            State.Dispose();
+            FinishScan();
+            State.OnScanStarted += StartScan;
+            State.OnScanFinished += FinishScan;
+            return view;
         }
     }
 }
index 82219f0..375bcad 100644 (file)
@@ -5,11 +5,16 @@
     <TargetFramework>tizen80</TargetFramework>
     <LangVersion>8.0</LangVersion>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <ItemGroup>
     <PackageReference Include="Tizen.NET" Version="8.0.0.15430" />
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
 
   <ItemGroup>
@@ -35,5 +40,7 @@
       <Generator>PublicResXFileCodeGenerator</Generator>
       <LastGenOutput>Translations.Designer.cs</LastGenOutput>
     </EmbeddedResource>
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
   </ItemGroup>
 </Project>
index c5d1b89..cf160df 100644 (file)
  * limitations under the License.
  */
 
-using Oobe.Common.Interfaces;
-using Tizen.NUI.Components;
-using Tizen.NUI;
-using Tizen.NUI.BaseComponents;
-using Oobe.Wifi.Controls.Wifi;
-using Tizen.Network.WiFi;
 using System;
 using System.Collections.Generic;
-using Oobe.Common.Styles;
+using Oobe.Common.Interfaces;
 using Oobe.Common.Layouts;
+using Oobe.Common.Styles;
+using Oobe.Wifi.Controls.Wifi;
+using Tizen.Network.WiFi;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
 
 namespace Oobe.Wifi
 {
@@ -49,12 +49,12 @@ namespace Oobe.Wifi
             view.PreviousButton.Clicked += (s, e) => nav.Previous();
             view.NextButton.Clicked += (s, e) => nav.Next();
 
-            void applyStyle(bool isConnected) => view.NextButton.ApplyStyle(isConnected
+            void ApplyStyle(bool isConnected) => view.NextButton.ApplyStyle(isConnected
                 ? Common.Styles.ButtonStyles.Next
                 : Common.Styles.ButtonStyles.Skip);
-            applyStyle(WiFiManager.ConnectionState == WiFiConnectionState.Connected);
+            ApplyStyle(WiFiManager.ConnectionState == WiFiConnectionState.Connected);
 
-            connectionChanged = (s, e) => applyStyle(e.State == WiFiConnectionState.Connected);
+            connectionChanged = (s, e) => ApplyStyle(e.State == WiFiConnectionState.Connected);
             WiFiManager.ConnectionStateChanged += connectionChanged;
             return view;
         }
index 811d54c..d7eda33 100644 (file)
  */
 
 using System;
-using Tizen.NUI.Components;
-using Tizen.NUI.BaseComponents;
 using System.Collections.Generic;
 using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
+using Tizen.NUI.Components;
 
 namespace Oobe.Controls
 {
@@ -28,58 +28,22 @@ namespace Oobe.Controls
     /// </summary>
     public class ViewStack : View
     {
-        private class ViewStackBaseCustomLayout : LayoutGroup
-        {
-            protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
-            {
-                ViewStack stack = this.Owner as ViewStack;
-
-                if (!stack) return;
-
-                int totalWidth = stack.Size2D.Width;
-                int totalHeight = stack.Size2D.Height;
-
-                SetMeasuredDimensions(ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK),
-                                      ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK));
-            }
-
-            protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
-            {
-                ViewStack stack = this.Owner as ViewStack;
-
-                if (!changed || !stack) return;
-
-                int totalWidth = stack.Size2D.Width;
-                int totalHeight = stack.Size2D.Height;
-
-                foreach (LayoutItem childLayout in LayoutChildren)
-                {
-                    if (childLayout.Owner == stack.Current)
-                    {
-                        childLayout.Layout(
-                            new LayoutLength(0),
-                            new LayoutLength(0),
-                            new LayoutLength(totalWidth),
-                            new LayoutLength(totalHeight));
-                    }
-                    else
-                    {
-                        childLayout.Layout(
-                            new LayoutLength(-stack.PagesLeftPadding),
-                            new LayoutLength(0),
-                            new LayoutLength(totalWidth - stack.PagesLeftPadding),
-                            new LayoutLength(totalHeight));
-                    }
-                }
-            }
-        }
-
         private List<View> views = new List<View>();
         private List<View> viewsToRemove = new List<View>();
 
         private Animation pageEnterAnimation;
         private Animation pageLeaveAnimation;
 
+        public ViewStack()
+            : base()
+        {
+            ClippingMode = ClippingModeType.ClipToBoundingBox;
+            pageEnterAnimation = new Animation();
+            pageLeaveAnimation = new Animation();
+            pageEnterAnimation.Finished += OnPageEntered;
+            pageLeaveAnimation.Finished += OnPageLeave;
+        }
+
         /// <summary>
         /// Informs about transition animation end
         /// </summary>
@@ -106,21 +70,23 @@ namespace Oobe.Controls
         /// <summary>
         /// Get view currently stacked on Top of ViewStack
         /// </summary>
-        public View Current { get { return views.Count > 0 ? views[views.Count-1] : null; } }
+        public View Current
+        {
+            get
+            {
+                return views.Count > 0 ? views[views.Count - 1] : null;
+            }
+        }
 
         /// <summary>
         /// Get view currently stacked under Current
         /// </summary>
-        public View Previous { get { return views.Count > 1 ? views[views.Count - 2] : null; } }
-
-        public ViewStack() : base()
+        public View Previous
         {
-            ClippingMode = ClippingModeType.ClipToBoundingBox;
-            //Layout = new ViewStackBaseCustomLayout();
-            pageEnterAnimation = new Animation();
-            pageLeaveAnimation = new Animation();
-            pageEnterAnimation.Finished += OnPageEntered;
-            pageLeaveAnimation.Finished += OnPageLeave;
+            get
+            {
+                return views.Count > 1 ? views[views.Count - 2] : null;
+            }
         }
 
         /// <summary>
@@ -150,6 +116,35 @@ namespace Oobe.Controls
             StartPageEnterAnimation(Previous, Current);
         }
 
+        protected override void Dispose(Tizen.NUI.DisposeTypes type)
+        {
+            if (disposed)
+            {
+                return;
+            }
+
+            if (type == DisposeTypes.Explicit)
+            {
+                pageEnterAnimation.Dispose();
+                pageLeaveAnimation.Dispose();
+            }
+
+            base.Dispose(type);
+        }
+
+        private static void FinishAnimation(Animation anim)
+        {
+            if (anim != null)
+            {
+                if (anim.State == Animation.States.Playing)
+                {
+                    anim.Stop(Animation.EndActions.StopFinal);
+                }
+
+                anim.Clear();
+            }
+        }
+
         private void AddViewToDelayRemove(View view)
         {
             if (view)
@@ -167,6 +162,7 @@ namespace Oobe.Controls
                 Remove(view);
                 view.Dispose();
             }
+
             viewsToRemove.Clear();
         }
 
@@ -176,18 +172,6 @@ namespace Oobe.Controls
             FinishAnimation(pageEnterAnimation);
         }
 
-        static private void FinishAnimation(Animation anim)
-        {
-            if (anim != null)
-            {
-                if (anim.State == Animation.States.Playing)
-                {
-                    anim.Stop(Animation.EndActions.StopFinal);
-                }
-                anim.Clear();
-            }
-        }
-
         private void StartPageLeaveAnimation(View back, View front)
         {
             pageLeaveAnimation.Duration = ScrollDuration;
@@ -199,14 +183,17 @@ namespace Oobe.Controls
                 // run animation to place 'back' in viewport
                 pageLeaveAnimation.AnimateTo(back, "PositionX", 0, null);
             }
+
             if (front != null)
             {
                 // place 'front' in viewport (should be already there)
                 // run animation to place 'front' out of viewport
                 pageLeaveAnimation.AnimateTo(front, "PositionX", Size2D.Width + PagesRightPadding);
             }
+
             pageLeaveAnimation.Play();
         }
+
         private void StartPageEnterAnimation(View back, View front)
         {
             pageEnterAnimation.Duration = ScrollDuration;
@@ -219,6 +206,7 @@ namespace Oobe.Controls
                 int diff = Position2D.X - PagesLeftPadding;
                 pageEnterAnimation.AnimateTo(back, "PositionX", diff);
             }
+
             if (front != null)
             {
                 // place 'front' out of viewport
@@ -227,6 +215,7 @@ namespace Oobe.Controls
                 // run anim to place 'front' on viewport
                 pageEnterAnimation.AnimateTo(front, "PositionX", 0, null);
             }
+
             pageEnterAnimation.Play();
         }
 
@@ -241,16 +230,57 @@ namespace Oobe.Controls
             TransitionFinished?.Invoke(this, new EventArgs());
         }
 
-        protected override void Dispose(Tizen.NUI.DisposeTypes type)
+        private class ViewStackBaseCustomLayout : LayoutGroup
         {
-            if (disposed)
-                return;
-            if(type == DisposeTypes.Explicit)
+            protected override void OnMeasure(MeasureSpecification widthMeasureSpec, MeasureSpecification heightMeasureSpec)
             {
-                pageEnterAnimation.Dispose();
-                pageLeaveAnimation.Dispose();
+                ViewStack stack = this.Owner as ViewStack;
+
+                if (!stack)
+                {
+                    return;
+                }
+
+                int totalWidth = stack.Size2D.Width;
+                int totalHeight = stack.Size2D.Height;
+
+                SetMeasuredDimensions(
+                        ResolveSizeAndState(new LayoutLength(totalWidth), widthMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK),
+                        ResolveSizeAndState(new LayoutLength(totalHeight), heightMeasureSpec, MeasuredSize.StateType.MeasuredSizeOK));
+            }
+
+            protected override void OnLayout(bool changed, LayoutLength left, LayoutLength top, LayoutLength right, LayoutLength bottom)
+            {
+                ViewStack stack = this.Owner as ViewStack;
+
+                if (!changed || !stack)
+                {
+                    return;
+                }
+
+                int totalWidth = stack.Size2D.Width;
+                int totalHeight = stack.Size2D.Height;
+
+                foreach (LayoutItem childLayout in LayoutChildren)
+                {
+                    if (childLayout.Owner == stack.Current)
+                    {
+                        childLayout.Layout(
+                            new LayoutLength(0),
+                            new LayoutLength(0),
+                            new LayoutLength(totalWidth),
+                            new LayoutLength(totalHeight));
+                    }
+                    else
+                    {
+                        childLayout.Layout(
+                            new LayoutLength(-stack.PagesLeftPadding),
+                            new LayoutLength(0),
+                            new LayoutLength(totalWidth - stack.PagesLeftPadding),
+                            new LayoutLength(totalHeight));
+                    }
+                }
             }
-            base.Dispose(type);
         }
     }
 }
index 849d204..a4f6fbd 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using System.Collections.Generic;
 using System.Globalization;
 using System.Linq;
@@ -32,13 +32,13 @@ namespace Oobe.Managers
         {
         }
 
-        public override string? GetString(string name)
+        public override string GetString(string name)
         {
             return base.GetString(name)
                 ?? Oobe.Wifi.Controls.Wifi.Translations.ResourceManager.GetString(name);
         }
 
-        public override string? GetString(string name, CultureInfo culture)
+        public override string GetString(string name, CultureInfo culture)
         {
             return base.GetString(name, culture)
                 ?? Oobe.Wifi.Controls.Wifi.Translations.ResourceManager.GetString(name, culture);
index dc7746a..e4d2a85 100644 (file)
  * limitations under the License.
  */
 
+using System;
 using System.Collections.Generic;
+using System.IO;
 using Oobe.Common.Interfaces;
 using Oobe.Language;
+using Oobe.Region;
+using Oobe.Terms;
 using Oobe.Views;
 using Oobe.Welcome;
-using Tizen.NUI;
-using Oobe.Region;
-using System;
 using Oobe.Wifi;
-using System.IO;
-using Oobe.Terms;
+using Tizen.NUI;
 
 namespace Oobe
 {
     public sealed class ProcessManager : IProcessNavigation
     {
+        private static ProcessManager instance;
+        private static string doneFile = Tizen.Applications.CoreUIApplication.Current.DirectoryInfo.Data + "oobe_done";
         private MainView ui;
         private LinkedList<Lazy<ProcessStep>> steps;
         private LinkedListNode<Lazy<ProcessStep>> current;
         private bool started;
-        static private ProcessManager instance;
-
-        static private string doneFile = Tizen.Applications.CoreUIApplication.Current.DirectoryInfo.Data + "oobe_done";
 
-        internal class NavigationController : IProcessNavigation
+        private ProcessManager()
         {
-            private ProcessStep step;
-            private ProcessManager manager;
-
-            public NavigationController(ProcessManager manager, ProcessStep step)
-            {
-                this.step = step;
-                this.manager = manager;
-            }
-
-            public void Next()
-            {
-                if (manager.CurrentStep == step)
-                {
-                    manager.Next();
-                }
-            }
-
-            public void Previous()
-            {
-                if (manager.CurrentStep == step)
-                {
-                    manager.Previous();
-                }
-            }
-
-            public void Finish()
-            {
-                if (manager.CurrentStep == step)
-                {
-                    manager.Finish();
-                }
-            }
+            // TODO consider loading this from xaml or xml
+            steps = new LinkedList<Lazy<ProcessStep>>(new[]
+                    {
+                        new Lazy<ProcessStep>(() => new LanguageStep()),
+                        new Lazy<ProcessStep>(() => new RegionStep()),
+                        new Lazy<ProcessStep>(() => new TermsStep()),
+                        new Lazy<ProcessStep>(() => new WifiStep()),
+                        new Lazy<ProcessStep>(() => new WelcomeStep()),
+                    });
         }
 
-        static public ProcessManager Instance
+        public static ProcessManager Instance
         {
             get
             {
@@ -87,19 +63,6 @@ namespace Oobe
             }
         }
 
-        private ProcessManager()
-        {
-            //TODO consider loading this from xaml, xml or something...
-            steps = new LinkedList<Lazy<ProcessStep>>(new[]{
-                new Lazy<ProcessStep>(() => new LanguageStep()),
-                new Lazy<ProcessStep>(() => new RegionStep()),
-                new Lazy<ProcessStep>(() => new TermsStep()),
-                new Lazy<ProcessStep>(() => new WifiStep()),
-                new Lazy<ProcessStep>(() => new WelcomeStep()),
-                }
-            );
-        }
-
         public ProcessStep CurrentStep { get => current.Value.Value; }
 
         public void Start()
@@ -131,9 +94,12 @@ namespace Oobe
                 current = current.Next;
                 ui.Push(current.Value.Value.CreateView(new NavigationController(this, current.Value.Value)));
                 current.Next?.Value.Value.Initialize();
+
                 // do not show pagination on last page
                 if (current.Next == null)
+                {
                     ui.PaginationVisible = false;
+                }
             }
         }
 
@@ -146,6 +112,7 @@ namespace Oobe
             {
                 step.Value.Shutdown();
             }
+
             SetDone();
             NUIApplication.Current.Exit();
         }
@@ -162,14 +129,6 @@ namespace Oobe
             }
         }
 
-        private void SetDone()
-        {
-            if (!File.Exists(doneFile))
-            {
-                File.Create(doneFile).Dispose();
-            }
-        }
-
         /// <summary>
         /// Indicates if oobe process has been previously finished
         /// </summary>
@@ -186,8 +145,53 @@ namespace Oobe
             {
                 step.Value.Reset();
             }
+
             File.Delete(doneFile);
             current = steps.First;
         }
+
+        private void SetDone()
+        {
+            if (!File.Exists(doneFile))
+            {
+                File.Create(doneFile).Dispose();
+            }
+        }
+
+        internal class NavigationController : IProcessNavigation
+        {
+            private ProcessStep step;
+            private ProcessManager manager;
+
+            public NavigationController(ProcessManager manager, ProcessStep step)
+            {
+                this.step = step;
+                this.manager = manager;
+            }
+
+            public void Next()
+            {
+                if (manager.CurrentStep == step)
+                {
+                    manager.Next();
+                }
+            }
+
+            public void Previous()
+            {
+                if (manager.CurrentStep == step)
+                {
+                    manager.Previous();
+                }
+            }
+
+            public void Finish()
+            {
+                if (manager.CurrentStep == step)
+                {
+                    manager.Finish();
+                }
+            }
+        }
     }
 }
index 2a90985..e6f6958 100644 (file)
@@ -5,6 +5,7 @@
     <TargetFramework>tizen80</TargetFramework>
     <LangVersion>8.0</LangVersion>
     <TargetFrameworkIdentifier>Tizen</TargetFrameworkIdentifier>
+    <CodeAnalysisRuleSet>../Settings.StyleCop</CodeAnalysisRuleSet>
   </PropertyGroup>
 
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
@@ -17,6 +18,8 @@
   <ItemGroup>
     <Folder Include="lib\" />
     <Folder Include="res\" />
+    <AdditionalFiles Include="../stylecop.json" />
+    <AdditionalFiles Include="../Settings.StyleCop" />
   </ItemGroup>
 
   <ItemGroup>
       <ExcludeAssets>Runtime</ExcludeAssets>
     </PackageReference>
     <PackageReference Include="Tizen.NET.Sdk" Version="1.1.2" />
+    <PackageReference Include="StyleCop.Analyzers" Version="1.1.118">
+      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+      <PrivateAssets>all</PrivateAssets>
+    </PackageReference>
   </ItemGroup>
 
   <ItemGroup>
similarity index 91%
rename from Oobe/Oobe/Oobe.cs
rename to Oobe/Oobe/OobeApp.cs
index d6ec4e1..c16bfff 100644 (file)
  * limitations under the License.
  */
 
-using Tizen.NUI;
-using Tizen.NUI.Components;
 using System;
 using System.Globalization;
 using Oobe.Common.Resources;
 using Oobe.Managers;
+using Tizen.NUI;
+using Tizen.NUI.Components;
 
 namespace Oobe
 {
-    class Program : NUIApplication
+    public class OobeApp : NUIApplication
     {
         private const string ResetOperation = "http://tizen.org/appcontrol/operation/reset";
 
+        public static void Main(string[] args)
+        {
+            var app = new OobeApp();
+            app.Run(args);
+        }
+
         protected override void OnCreate()
         {
             Tizen.Log.Debug("oobe", "OnCreate");
@@ -51,7 +57,7 @@ namespace Oobe
             }
         }
 
-        void Initialize()
+        private void Initialize()
         {
             SetupLanguage();
 
@@ -61,7 +67,7 @@ namespace Oobe
             ProcessManager.Instance.Start();
         }
 
-        void Start()
+        private void Start()
         {
             if (ProcessManager.Instance.IsDone())
             {
@@ -73,12 +79,12 @@ namespace Oobe
             Initialize();
         }
 
-        void Reset()
+        private void Reset()
         {
             ProcessManager.Instance.Reset();
         }
 
-        void SetupLanguage()
+        private void SetupLanguage()
         {
             void SetLanguage()
             {
@@ -95,15 +101,10 @@ namespace Oobe
                     Tizen.Log.Debug("oobe", "Setting Language failed:" + e.Message);
                 }
             }
+
             NUIApplication.MultilingualResourceManager = new MultiResourceManager("Oobe.Common.Resources.Translations", typeof(Translations).Assembly);
             Tizen.System.SystemSettings.LocaleLanguageChanged += (s, e) => SetLanguage();
             SetLanguage();
         }
-
-        static void Main(string[] args)
-        {
-            var app = new Program();
-            app.Run(args);
-        }
     }
 }
index a273f0c..6f942fc 100644 (file)
  * limitations under the License.
  */
 
-using Tizen.NUI.BaseComponents;
-using Tizen.NUI;
+using System;
 using Oobe.Controls;
+using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
-using System;
 
 namespace Oobe.Views
 {
@@ -27,11 +27,11 @@ namespace Oobe.Views
     /// </summary>
     public class MainView : IDisposable
     {
+        private const int TransitionTime = 750;
+        private readonly Extents stackMargin = new Extents(48, 48, 48, 48);
         private ViewStack stack;
         private Animation dimEffectAnimation;
         private Pagination pagination;
-        private const int TransitionTime = 750;
-        private readonly Extents stackMargin = new Extents(48, 48, 48, 48);
 
         public MainView(Window win)
         {
@@ -45,14 +45,15 @@ namespace Oobe.Views
 
             Size2D stackSize = new Size2D(
                     win.WindowSize.Width - stackMargin.Start - stackMargin.End,
-                    win.WindowSize.Height - stackMargin.Top - stackMargin.Bottom
-                    );
+                    win.WindowSize.Height - stackMargin.Top - stackMargin.Bottom);
 
-            // For testing other resolutions
-            // stackSize.Width = 1280 - stackMargin.Start - stackMargin.End;
-            // stackSize.Height = 720 - stackMargin.Top - stackMargin.Bottom;
+            /* For testing other resolutions
+            stackSize.Width = 1280 - stackMargin.Start - stackMargin.End;
+            stackSize.Height = 720 - stackMargin.Top - stackMargin.Bottom;
+            */
 
-            stack = new ViewStack(){
+            stack = new ViewStack()
+            {
                 ScrollDuration = TransitionTime,
                 Position2D = new Position2D(stackMargin.Start, stackMargin.Top),
                 Size2D = stackSize,
@@ -92,8 +93,14 @@ namespace Oobe.Views
             get => pagination.Visibility;
             set
             {
-                if (value) pagination.Show();
-                else pagination.Hide();
+                if (value)
+                {
+                    pagination.Show();
+                }
+                else
+                {
+                    pagination.Hide();
+                }
             }
         }
 
@@ -122,10 +129,18 @@ namespace Oobe.Views
             {
                 StartUndimAnimation(previous);
             }
+
             pagination.SelectedIndex = pagination.SelectedIndex - 1;
             stack.Pop();
         }
 
+        public void Dispose()
+        {
+            dimEffectAnimation.Dispose();
+            stack.Dispose();
+            pagination.Dispose();
+        }
+
         private void StartDimAnimation(Views.Page view)
         {
             view.Opacity = 1.0f;
@@ -146,14 +161,8 @@ namespace Oobe.Views
             {
                 dimEffectAnimation.Stop(Animation.EndActions.StopFinal);
             }
-            dimEffectAnimation.Clear();
-        }
 
-        public void Dispose()
-        {
-            dimEffectAnimation.Dispose();
-            stack.Dispose();
-            pagination.Dispose();
+            dimEffectAnimation.Clear();
         }
     }
 }
index 7313e58..5152085 100644 (file)
@@ -14,8 +14,8 @@
  * limitations under the License.
  */
 
-using Tizen.NUI.BaseComponents;
 using Tizen.NUI;
+using Tizen.NUI.BaseComponents;
 using Tizen.NUI.Components;
 
 namespace Oobe.Views
@@ -27,12 +27,25 @@ namespace Oobe.Views
     {
         private View content;
 
+        public Page()
+        {
+            BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "0_BG_WHITEsmall.png";
+        }
+
         public View Content
-         {
+        {
+            get
+            {
+                return content;
+            }
+
             set
             {
                 if (value == content)
+                {
                     return;
+                }
+
                 if (value)
                 {
                     Remove(content);
@@ -42,15 +55,6 @@ namespace Oobe.Views
                     content = value;
                 }
             }
-            get {
-                return content;
-            }
         }
-
-        public Page()
-        {
-            BackgroundImage = NUIApplication.Current.DirectoryInfo.Resource + "0_BG_WHITEsmall.png";
-        }
-
     }
 }
diff --git a/Oobe/Settings.StyleCop b/Oobe/Settings.StyleCop
new file mode 100644 (file)
index 0000000..7e8984d
--- /dev/null
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RuleSet Name="Rules for ConsoleApp" Description="Code analysis rules" ToolsVersion="16.0">
+  <IncludeAll Action="Warning" />
+  <Rules AnalyzerId="StyleCop.CSharp" RuleNamespace="StyleCop.CSharp">
+    <!-- SA1101PrefixLocalCallsWithThis -->
+    <!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1101.md -->
+    <Rule Id="SA1101" Action="None" />
+    <!-- UsingDirectivesMustBePlacedCorrectly -->
+    <!-- https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1200.md -->
+    <Rule Id="SA1200" Action="None" />
+    <!-- Check XML style -->
+    <Rule Id="SA0001" Action="None" />
+  </Rules>
+</RuleSet>
diff --git a/Oobe/stylecop.json b/Oobe/stylecop.json
new file mode 100644 (file)
index 0000000..c2488f3
--- /dev/null
@@ -0,0 +1,15 @@
+{
+  "settings": {
+    "indentation": {
+        "indentationSize": 4,
+        "useTabs": false
+    },
+    "layoutRules": {
+        "newlineAtEndOfFile": "require"
+    },
+    "documentationRules": {
+      "copyrightText": "Copyright (c) 2020 Samsung Electronics Co., Ltd.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.",
+      "xmlHeader": false
+    }
+  }
+}