private void SetLayout(LayoutTypeEnum type)
 {
     ServiceProvider.Settings.SelectedLayout = type.ToString();
     switch (type)
     {
         case LayoutTypeEnum.Normal:
             {
                 StackLayout.Children.Clear();
                 LayoutNormal control = new LayoutNormal();
                 StackLayout.Children.Add(control);
             }
             break;
         case LayoutTypeEnum.Grid:
             {
                 StackLayout.Children.Clear();
                 LayoutGrid control = new LayoutGrid();
                 StackLayout.Children.Add(control);
             }
             break;
         case LayoutTypeEnum.GridRight:
             {
                 StackLayout.Children.Clear();
                 LayoutGridRight control = new LayoutGridRight();
                 StackLayout.Children.Add(control);
             }
             break;
     }
 }
 private void SetLayout(LayoutTypeEnum type)
 {
     ServiceProvider.Settings.SelectedLayout = type.ToString();
     if (StackLayout.Children.Count > 0)
     {
         var cnt = StackLayout.Children[0] as LayoutBase;
         if (cnt != null)
             cnt.UnInit();
     }
     switch (type)
     {
         case LayoutTypeEnum.Normal:
             {
                 StackLayout.Children.Clear();
                 LayoutNormal control = new LayoutNormal();
                 StackLayout.Children.Add(control);
             }
             break;
         case LayoutTypeEnum.Grid:
             {
                 StackLayout.Children.Clear();
                 LayoutGrid control = new LayoutGrid();
                 StackLayout.Children.Add(control);
             }
             break;
         case LayoutTypeEnum.GridRight:
             {
                 StackLayout.Children.Clear();
                 LayoutGridRight control = new LayoutGridRight();
                 StackLayout.Children.Add(control);
             }
             break;
     }
 }