Add StyleCop & fixe all issues. 33/240033/1
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

65 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/FontStyles.cs [deleted file]
Oobe/Oobe.Common/Styles/FontsStyles.cs [new file with mode: 0644]
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/WifiUISecurityType.cs [deleted file]
Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityTypeExtensions.cs [new file with mode: 0644]
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.cs [deleted file]
Oobe/Oobe/Oobe.csproj
Oobe/Oobe/OobeApp.cs [new file with mode: 0644]
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 ee529d230bb4cd7d3c177f57a89040d58da994f8..77b13ad70878c48c65cf4ee1d309e8a3a5831837 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 8ea18d56cb212d74c1ebee7a31e04589dea6fc0c..5da3ad81c46bfba0363e9d2e60da4bfc2aff2f79 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 89c3005467864419b0227d5c8bff3e4f1b6d6aa9..5c2059e18a7617e1c8d608fab0566633ba418672 100644 (file)
@@ -1,3 +1,4 @@
+// <auto-generated/>
 /*
  * Copyright (c) 2020 Samsung Electronics Co., Ltd.
  *
index abb1cabef721b59b368be7ee2b0b2389e321ad8b..e961bddc933a3546c6a51f709df63d5eeb7a4f24 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 0b151fb10735bdb98b7994252e4857bf95f2d426..1bbda5f2fc711839a2f7138406d7d18611565310 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 8889427f5318c82d61bfb11ed54275f3b155e68f..ad866be30139c504f705f3283395d547b763cda9 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 161952bfdf2205ddad29a6a7086672341de5655a..fa9b4c6af4573b09916d4a27718cd6f86b9a1c4c 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 6fdb75a18c77bb825927c23f4c5dd03b2f8d7edb..12e1e8924ab3676bde0be4c9f4740a0df54dbe0f 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 73e3cfab7abac4c21ee2a326023db183d4daa0e3..dac4bba158c34a1e8a14dc6703f36ced5773a051 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 d7e8ddb04e540d78a4afea1f5c14820e1a9bb825..30fd0b5c5c686b0b76a989516b0a8420c3194880 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 87b2ba158662942687085f4c2a192e797fcf0882..99e8ba4c7b35aa38611b6f6e1496c83a98f075de 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 1b4b888a8c235f63d611e0aa5d571308c1a38aa9..385a679f91583b4d0a3259d02859c2847a3174ae 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 26c224343d949cedcbb9bccb9f38556d3b99acfc..144cecc7ec7a154568be33e73754a14ac0f13a00 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 ed8b17b9bbc8c6cb1eae5f22d78b94bd979862c0..b615222e87832778ef1e479b90f174d20d928cda 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; }
     }
 }
diff --git a/Oobe/Oobe.Common/Styles/FontStyles.cs b/Oobe/Oobe.Common/Styles/FontStyles.cs
deleted file mode 100644 (file)
index 3ac9210..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using Tizen.NUI;
-
-namespace Oobe.Common.Styles
-{
-    public static class FontsStyles
-    {
-        public static PropertyMap AddLightFontStyle(this PropertyMap propertyMap)
-        {
-            return propertyMap.Add("weight", new PropertyValue("light"));
-        }
-
-        public static PropertyMap AddRegularFontStyle(this PropertyMap propertyMap)
-        {
-            return propertyMap.Add("weight", new PropertyValue("regular"));
-        }
-
-        public static PropertyMap AddBoldFontStyle(this PropertyMap propertyMap)
-        {
-            return propertyMap.Add("weight", new PropertyValue("bold"));
-        }
-    }
-}
diff --git a/Oobe/Oobe.Common/Styles/FontsStyles.cs b/Oobe/Oobe.Common/Styles/FontsStyles.cs
new file mode 100644 (file)
index 0000000..3ac9210
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using Tizen.NUI;
+
+namespace Oobe.Common.Styles
+{
+    public static class FontsStyles
+    {
+        public static PropertyMap AddLightFontStyle(this PropertyMap propertyMap)
+        {
+            return propertyMap.Add("weight", new PropertyValue("light"));
+        }
+
+        public static PropertyMap AddRegularFontStyle(this PropertyMap propertyMap)
+        {
+            return propertyMap.Add("weight", new PropertyValue("regular"));
+        }
+
+        public static PropertyMap AddBoldFontStyle(this PropertyMap propertyMap)
+        {
+            return propertyMap.Add("weight", new PropertyValue("bold"));
+        }
+    }
+}
index 0e7c53617345beefada29558c019e64eaa265cf5..9ccbc1c039733fe30fe6409795b950128a1eee26 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 55315112108cb38cb8e64ae872d5912c6999d27d..8fbbf3b6e187cec17b6ae5dabcc9cd2645c49468 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 252bebb6d78f82cb01ec716cada110c957088e8e..713066957f8888b97db8207675e0c15e120870f3 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 235cccdba003b91cc6c3fc1cc2b8d7c5e6085d47..fc9978120e47bfdd92bd8846811ff1650c244f5b 100644 (file)
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-using System;
+using System;
 using Tizen.Internals.Errors;
 
 namespace Oobe.Common.Utils
index 075195dcd14cb9b897363433d23007522d8e2275..76779cf4498c2ebcfb5e25d1850c4da99a9bf35b 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 bbeccb98fa530c9b555278aa8cd9f524335c3da8..818bd84db6b677e6ff64cbe11292dcababa111c5 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 3a4bfc41dc61a2efc44ac92299bd0f67b314c0b2..5008e692f07dc03863a6e63d2c799daaaf4b4a18 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 2b404ac53e65992c6a2a3227cc005cfbe20fb341..2b2c61046a49a09c8967e0c31a79946abed18278 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 1f760acc45002658e0202c0f3038ec211ca4be3e..8b13e78d76e5163eb2ee36ebd8ddb002726b3242 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 023f22721a664c93add4e9666a402d4669ac640b..9b4cb57a7cae3d37cea927c9a83b43a187f4bd06 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 d32730b4cf3b2a65d4da731799560517e297f118..7308b0de216e263b5a7f0089264e90c15df43b4d 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 7b6ddffa86376c70908cc15c8c98d6887aed7b0c..03a2db54ecb416f44edc74fcb3e2889221ed5209 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 c40cf7c0dede3cc5e89dd845890a216a50122817..c74fd2a7faffb5cb81db21a18540f065c31791a8 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 0e157fddfde0e87f48c563f18d098f2153c0d146..ab2b48b073e25e658e9cef1b608b30bb76e1bfb5 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 31c1b636a4fc3a6a84128847966b7e1b2924232e..da47a0d7b447e1e526010444229cb14d49fb30ce 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 b97d4f2fa711a112ef340f81a940835e14910ef8..701facf3db48b27b463f4a286fcb41b2697b93f9 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 023f22721a664c93add4e9666a402d4669ac640b..dec0b94099064464475b73256e688e2a55a83baa 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 050c7dde55b043fc9fedb392a1aea3b07851b1f9..9838ae0aab895bdf0f027dfd8e4786e551d240a6 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 feb7f8a990375f566a4d579a124dbabeb176385b..21591b37219c5a89064d3ba783f1ceb9e23a31d8 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 c79534c73b2219d9685477ea098edbb4a05e4c01..13d108ebaf32afe597a2a80e5d293a38df8ac170 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 c4727eb9fde457739da9c493519739fe1ae736e9..b7d52903d69971b003653623e5ac20ecbfa4cb2a 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 8f091d87542f64f7d6c39fe4350b0b361be8de6d..7983727a3b6ad69dd9478995d91dce041b1baac7 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 528d772187097e15715869a9c8d47f687770b23c..df5fded2244cc258fefe285228710b01902df2f1 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 2643235f099513dbba4c9730f41d52f2eb68ffdb..88977964bce2c67c575c9dc09b217271db9563ee 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 b5ca032c317244e6c8332eb2e3d2d5ac2fa3cafe..c90d2ab1e71322b8f40bbfcc23acbea10b776286 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 b4146fb2b42c63744be827440815d3421f299bfb..3d88cd13eedb030a81996c8a025247d4774e71c5 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 cafd8e01c2f501c828dc6da1c6b82bbe3e8d8a8c..c0488f97f07eb00f7d2437de7624a010e71d1b8a 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 ec83cae451688d725adc64c74bd1c7980f99757d..f87a6c8bcdc0906a99d382265cfc6e541a334414 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 a227fd19582a4cd43f04a22a6a0f43b7fa6f393d..356e3534179a097e0c482f1f898f68143ab2a331 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 c9955d337fd6d115838c59bbb14575c3b0984d7b..3be907538891cde834c03a78a194dc693f22a52e 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 94d8546e803f742c2074a189c698b3f110ef4a5b..fa6963e1d6803b07b484d7b0caa25307e67d9e54 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 3dfa0f5c6072d06c4778e2978d6f497242e11a39..4d7658709e0c90e34835eae3605fa3b797d648d4 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 1724e08d23ea40ab537d0d36d71e9f94afcf8c9c..2722e2fead4e45f19e7f8c1ea3da4dfc3063e0d2 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 9d802874491e627b9e6a5410e41185a9b730548c..eb74be49e12c70db07bcaa7af6fb0bb1c16e431f 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>();
         }
 
diff --git a/Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityType.cs b/Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityType.cs
deleted file mode 100644 (file)
index d489eb8..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using Tizen.Network.Connection;
-
-namespace Oobe.Wifi.Controls.Wifi
-{
-    enum WifiUISecurityType
-    {
-        None,
-        EAP,
-        WEP,
-        WPAPSK,
-        WPA2PSK
-    }
-
-    static class WifiUISecurityTypeExtensions
-    {
-        public static string GetUIName(this WifiUISecurityType type)
-        {
-            switch (type)
-            {
-                case WifiUISecurityType.None: return "WIFI_SECURITY_TYPE_OPEN";
-                case WifiUISecurityType.EAP: return "WIFI_SECURITY_TYPE_EAP";
-                case WifiUISecurityType.WEP: return "WIFI_SECURITY_TYPE_WEP";
-                case WifiUISecurityType.WPAPSK: return "WIFI_SECURITY_TYPE_WPAPSK";
-                case WifiUISecurityType.WPA2PSK: return "WIFI_SECURITY_TYPE_WPA2PSK";
-                default:
-                    throw new ArgumentException("Unknown security type");
-            }
-        }
-
-        public static WiFiSecurityType GetApSecurityType(this WifiUISecurityType type)
-        {
-            switch (type)
-            {
-                case WifiUISecurityType.None: return WiFiSecurityType.None;
-                case WifiUISecurityType.EAP: return WiFiSecurityType.Eap;
-                case WifiUISecurityType.WEP: return WiFiSecurityType.Wep;
-                case WifiUISecurityType.WPAPSK: return WiFiSecurityType.WpaPsk;
-                case WifiUISecurityType.WPA2PSK: return WiFiSecurityType.Wpa2Psk;
-                default:
-                    throw new ArgumentException("Unknown security type");
-            }
-        }
-    }
-}
diff --git a/Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityTypeExtensions.cs b/Oobe/Oobe.Wifi/Controls/Wifi/WifiUISecurityTypeExtensions.cs
new file mode 100644 (file)
index 0000000..66736a5
--- /dev/null
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Tizen.Network.Connection;
+
+namespace Oobe.Wifi.Controls.Wifi
+{
+    public enum WifiUISecurityType
+    {
+        None,
+        EAP,
+        WEP,
+        WPAPSK,
+        WPA2PSK,
+    }
+
+    public static class WifiUISecurityTypeExtensions
+    {
+        public static string GetUIName(this WifiUISecurityType type)
+        {
+            switch (type)
+            {
+                case WifiUISecurityType.None: return "WIFI_SECURITY_TYPE_OPEN";
+                case WifiUISecurityType.EAP: return "WIFI_SECURITY_TYPE_EAP";
+                case WifiUISecurityType.WEP: return "WIFI_SECURITY_TYPE_WEP";
+                case WifiUISecurityType.WPAPSK: return "WIFI_SECURITY_TYPE_WPAPSK";
+                case WifiUISecurityType.WPA2PSK: return "WIFI_SECURITY_TYPE_WPA2PSK";
+                default:
+                    throw new ArgumentException("Unknown security type");
+            }
+        }
+
+        public static WiFiSecurityType GetApSecurityType(this WifiUISecurityType type)
+        {
+            switch (type)
+            {
+                case WifiUISecurityType.None: return WiFiSecurityType.None;
+                case WifiUISecurityType.EAP: return WiFiSecurityType.Eap;
+                case WifiUISecurityType.WEP: return WiFiSecurityType.Wep;
+                case WifiUISecurityType.WPAPSK: return WiFiSecurityType.WpaPsk;
+                case WifiUISecurityType.WPA2PSK: return WiFiSecurityType.Wpa2Psk;
+                default:
+                    throw new ArgumentException("Unknown security type");
+            }
+        }
+    }
+}
index a5974a65fe14a053ac22f40020c4ee77c4e03fc2..06063c45cd1b7e004a37085f7b1d5bdbc89ae96b 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 82219f06455087f5f7bdbabde459e2467aea5958..375bcad23a09cecdaf447d69be9f4e0c8831eaa8 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 c5d1b89a8bb3f872daf5952f6c981633988622f4..cf160df6f52d34db5e717f3beaa5882c37741ae8 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 811d54cd751ac56de3ac0688c23f8b5dac67a304..d7eda33fb11eedb14e37c534d8c5ba1075f17e40 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 849d204d6e6756c548d3a2b7677e1878848be1c5..a4f6fbd606a4f6d3c717b911d04d5f3d71214fe3 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 dc7746a6f295fde2db7162cdf1fe81201775c0fd..e4d2a856035a4dd96a1f77ac9ed56d545b2b5fe5 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();
+                }
+            }
+        }
     }
 }
diff --git a/Oobe/Oobe/Oobe.cs b/Oobe/Oobe/Oobe.cs
deleted file mode 100644 (file)
index d6ec4e1..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-using Tizen.NUI;
-using Tizen.NUI.Components;
-using System;
-using System.Globalization;
-using Oobe.Common.Resources;
-using Oobe.Managers;
-
-namespace Oobe
-{
-    class Program : NUIApplication
-    {
-        private const string ResetOperation = "http://tizen.org/appcontrol/operation/reset";
-
-        protected override void OnCreate()
-        {
-            Tizen.Log.Debug("oobe", "OnCreate");
-            base.OnCreate();
-            Window.Instance.Hide();
-        }
-
-        protected override void OnAppControlReceived(Tizen.Applications.AppControlReceivedEventArgs e)
-        {
-            Tizen.Log.Debug("oobe", "OnAppControlReceived: " + e.ReceivedAppControl.Operation);
-
-            var operation = e.ReceivedAppControl.Operation;
-
-            if (operation == ResetOperation)
-            {
-                Reset();
-                Exit();
-            }
-            else
-            {
-                Start();
-            }
-        }
-
-        void Initialize()
-        {
-            SetupLanguage();
-
-            Window.Instance.Type = WindowType.Notification;
-            Window.Instance.SetNotificationLevel(NotificationLevel.High);
-
-            ProcessManager.Instance.Start();
-        }
-
-        void Start()
-        {
-            if (ProcessManager.Instance.IsDone())
-            {
-                NUIApplication.Current.Exit();
-                return;
-            }
-
-            Window.Instance.Show();
-            Initialize();
-        }
-
-        void Reset()
-        {
-            ProcessManager.Instance.Reset();
-        }
-
-        void SetupLanguage()
-        {
-            void SetLanguage()
-            {
-                try
-                {
-                    string language = Tizen.System.SystemSettings.LocaleLanguage.Replace("_", "-");
-                    var culture = CultureInfo.CreateSpecificCulture(language);
-                    CultureInfo.CurrentCulture = culture;
-                    Translations.Culture = culture;
-                    Oobe.Wifi.Controls.Wifi.Translations.Culture = culture;
-                }
-                catch (Exception e)
-                {
-                    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 2a909854c2488cdb22293cba75b349d84f9bc7ff..e6f69585b5d110fdd1cf4fd0a676885e63cbf1c6 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>
diff --git a/Oobe/Oobe/OobeApp.cs b/Oobe/Oobe/OobeApp.cs
new file mode 100644 (file)
index 0000000..c16bfff
--- /dev/null
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+using System;
+using System.Globalization;
+using Oobe.Common.Resources;
+using Oobe.Managers;
+using Tizen.NUI;
+using Tizen.NUI.Components;
+
+namespace Oobe
+{
+    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");
+            base.OnCreate();
+            Window.Instance.Hide();
+        }
+
+        protected override void OnAppControlReceived(Tizen.Applications.AppControlReceivedEventArgs e)
+        {
+            Tizen.Log.Debug("oobe", "OnAppControlReceived: " + e.ReceivedAppControl.Operation);
+
+            var operation = e.ReceivedAppControl.Operation;
+
+            if (operation == ResetOperation)
+            {
+                Reset();
+                Exit();
+            }
+            else
+            {
+                Start();
+            }
+        }
+
+        private void Initialize()
+        {
+            SetupLanguage();
+
+            Window.Instance.Type = WindowType.Notification;
+            Window.Instance.SetNotificationLevel(NotificationLevel.High);
+
+            ProcessManager.Instance.Start();
+        }
+
+        private void Start()
+        {
+            if (ProcessManager.Instance.IsDone())
+            {
+                NUIApplication.Current.Exit();
+                return;
+            }
+
+            Window.Instance.Show();
+            Initialize();
+        }
+
+        private void Reset()
+        {
+            ProcessManager.Instance.Reset();
+        }
+
+        private void SetupLanguage()
+        {
+            void SetLanguage()
+            {
+                try
+                {
+                    string language = Tizen.System.SystemSettings.LocaleLanguage.Replace("_", "-");
+                    var culture = CultureInfo.CreateSpecificCulture(language);
+                    CultureInfo.CurrentCulture = culture;
+                    Translations.Culture = culture;
+                    Oobe.Wifi.Controls.Wifi.Translations.Culture = culture;
+                }
+                catch (Exception e)
+                {
+                    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();
+        }
+    }
+}
index a273f0ce1a4fef4fa6fb5ed6e63428ad1d71b7d1..6f942fc7e1a47e1de9acb69820845e68718b108f 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 7313e58de162c545dfaa3f3bc66a23cfb931e4cc..51520850c00a95922860a1164ed004029214a79f 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
+    }
+  }
+}