void UpdateSecondButton()
        {
            _secondButton?.Hide();

            if (SecondButton != null)
            {
                _secondButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/right"
                };

                if (!string.IsNullOrEmpty(SecondButton.Text))
                {
                    _secondButton.Text = SecondButton.Text;
                }

                if (SecondButton.Icon != null)
                {
                    var iconPath = SecondButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_secondButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _secondButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _secondButton.Clicked += (s, e) =>
                {
                    SecondButton.Activate();
                };

                if (_secondButtonBgColor != Color.Default)
                {
                    Console.WriteLine($"TwoButtonPopup set second button background color:{_secondButtonBgColor.ToNative()}");
                    _secondButton.BackgroundColor = _secondButtonBgColor.ToNative();
                }

                _popUp.SetPartContent("button2", _secondButton);
            }
            else
            {
                /* This is workaround fix for Left button occupied whole window when right button is null*/
                _secondButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/right"
                };
                _popUp.SetPartContent("button2", _secondButton);
                _secondButton.Unrealize();
                _secondButton = null;
            }
        }
Esempio n. 2
0
 public Task <bool> SetSource(Player player, MediaSource source)
 {
     if (source is FileMediaSource fileSource)
     {
         Log.Info(Circular.Tag, $"Set FileMediaSource");
         player.SetSource(new MediaUriSource(ResourcePath.GetPath(fileSource.File)));
     }
     return(Task.FromResult <bool>(true));
 }
Esempio n. 3
0
 void UpdateAnimationFile()
 {
     Control.SetAnimation(ResourcePath.GetPath(Element.AnimationFile));
     ElementController.SendAnimationInitialized(new AnimationInitializedEventArgs(Control.TotalFrame, Control.DurationTime, Control.IsPlaying));
     if (Element.AutoPlay)
     {
         Control.Play();
     }
 }
Esempio n. 4
0
 void UpdateImage()
 {
     if (Element.Image == null)
     {
         Control.File = "";
     }
     else
     {
         Control.File = ResourcePath.GetPath(Element.Image.File);
     }
 }
 void UpdateIcon()
 {
     if (Icon != null)
     {
         var path  = ResourcePath.GetPath(_icon);
         var image = new ElmSharp.Image(_control);
         image.LoadAsync(path);
         image.Show();
         _control.SetPartContent(IconPart, image);
     }
 }
Esempio n. 6
0
 private void UpdateAnimation()
 {
     if (!string.IsNullOrEmpty(Element.Animation))
     {
         Control.SetAnimation(ResourcePath.GetPath(Element.Animation));
         Element.Duration = TimeSpan.FromMilliseconds(Control.DurationTime);
         if (Element.IsPlaying)
         {
             Control.Play();
         }
     }
 }
Esempio n. 7
0
 void UpdateImage()
 {
     if (Element.Image == null)
     {
         Control.File = "";
     }
     else
     {
         Control.File = ResourcePath.GetPath(Element.Image.File);
     }
     Console.WriteLine("Control.File :" + Control.File);
 }
Esempio n. 8
0
 protected override void OnElementPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     base.OnElementPropertyChanged(sender, e);
     _circleImage          = new ElmSharp.EvasImage(Forms.NativeParent);
     _circleImage.IsFilled = true;
     _circleImage.File     = ResourcePath.GetPath("circle.png");
     _circleImage.Show();
     _circleImage.Geometry = Control.Geometry;
     Control.SetClip(_circleImage);
     Control.LayoutUpdated += OnLayoutUpdated;
     Control.Moved         += Control_Moved;
     Control.Deleted       += Control_Deleted;
 }
        void UpdateActionButton(bool initialize)
        {
            if (Element.ActionButton != null)
            {
                if (_actionButton == null)
                {
                    _actionButton = new ElmSharp.Button(_box)
                    {
                        Style = "bottom"
                    };
                    _actionButton.Clicked += OnActionButtonClicked;
                    _box.PackEnd(_actionButton);
                }

                SetVisibleActionButton(Element.ActionButton.IsVisible);

                Element.ActionButton.PropertyChanged += OnActionButtonItemChanged;
                _actionButton.Text = Element.ActionButton.Text?.Replace("&", "&amp;")
                                     .Replace("<", "&lt;")
                                     .Replace(">", "&gt;")
                                     .Replace(Environment.NewLine, "<br>");

                _actionButton.IsEnabled = Element.ActionButton.IsEnable;
                if (!Element.ActionButton.IconImageSource.IsNullOrEmpty())
                {
                    var imageSource = Element.ActionButton.IconImageSource as FileImageSource;
                    var path        = ResourcePath.GetPath(imageSource);
                    var buttonImage = new ElmSharp.Image(_actionButton);
                    buttonImage.LoadAsync(path);
                    buttonImage.Show();
                    _actionButton.SetPartContent("elm.swallow.content", buttonImage);
                }
                else
                {
                    _actionButton.SetPartContent("elm.swallow.content", null);
                }

                _actionButton.BackgroundColor = Element.ActionButton.BackgroundColor.ToNative();
            }
            else
            {
                if (_actionButton != null)
                {
                    _actionButton.Clicked -= OnActionButtonClicked;
                    _box.UnPack(_actionButton);
                    _actionButton.Unrealize();
                    _actionButton = null;
                }
            }
        }
        void UpdateButton()
        {
            _bottomButton?.Hide();

            if (BottomButton != null)
            {
                _bottomButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "bottom"
                };

                if (!string.IsNullOrEmpty(BottomButton.Text))
                {
                    _bottomButton.Text = BottomButton.Text;
                }

                if (BottomButton.Icon != null)
                {
                    var iconPath = BottomButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_bottomButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _bottomButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _bottomButton.Clicked += (s, e) =>
                {
                    ((IMenuItemController)BottomButton).Activate();
                };

                if (_buttonBgColor != Color.Default)
                {
                    Log.Debug(FormsCircularUI.Tag, $"InformationPopup set button background color:{_buttonBgColor.ToNative()}");
                    _bottomButton.BackgroundColor = _buttonBgColor.ToNative();
                }
            }
            else
            {
                _bottomButton.Unrealize();
                _bottomButton = null;
            }

            _popUp.SetPartContent("button1", _bottomButton);
        }
Esempio n. 11
0
 void UpdateActionButtonIcon(ImageSource source)
 {
     if (source is FileImageSource filesource)
     {
         var path        = ResourcePath.GetPath(filesource);
         var buttonImage = new ElmSharp.Image(_actionButton);
         buttonImage.Load(path);
         buttonImage.Show();
         _actionButton.SetPartContent("elm.swallow.content", buttonImage);
     }
     else
     {
         _actionButton.SetPartContent("elm.swallow.content", null);
     }
 }
Esempio n. 12
0
        void UpdateFirstButton()
        {
            _firstButton?.Hide();

            if (FirstButton != null)
            {
                _firstButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/left"
                };

                if (!string.IsNullOrEmpty(FirstButton.Text))
                {
                    _firstButton.Text = FirstButton.Text;
                }

                if (!FirstButton.IconImageSource.IsNullOrEmpty())
                {
                    var iconSource = FirstButton.IconImageSource as FileImageSource;
                    if (!iconSource.IsNullOrEmpty())
                    {
                        var buttonImage = new ElmSharp.Image(_firstButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconSource));
                        buttonImage.Show();
                        _firstButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _firstButton.Clicked += (s, e) =>
                {
                    ((IMenuItemController)FirstButton).Activate();
                };

                if (_firstButtonBgColor != Color.Default)
                {
                    Log.Debug(FormsCircularUI.Tag, $"TwoButtonPopup set first button background color:{_firstButtonBgColor.ToNative()}");
                    _firstButton.BackgroundColor = _firstButtonBgColor.ToNative();
                }
            }
            else
            {
                _firstButton = null;
            }

            _popUp.SetPartContent("button1", _firstButton);
        }
        void UpdateFirstButton()
        {
            _firstButton?.Hide();

            if (FirstButton != null)
            {
                _firstButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/left"
                };

                if (!string.IsNullOrEmpty(FirstButton.Text))
                {
                    _firstButton.Text = FirstButton.Text;
                }

                if (FirstButton.Icon != null)
                {
                    var iconPath = FirstButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_firstButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _firstButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _firstButton.Clicked += (s, e) =>
                {
                    FirstButton.Activate();
                };

                if (_firstButtonBgColor != Color.Default)
                {
                    Console.WriteLine($"TwoButtonPopup set first button background color:{_firstButtonBgColor.ToNative()}");
                    _firstButton.BackgroundColor = _firstButtonBgColor.ToNative();
                }
            }
            else
            {
                _firstButton = null;
            }

            _popUp.SetPartContent("button1", _firstButton);
        }
Esempio n. 14
0
        void UpdateBackgroundImage(bool initialize)
        {
            if (initialize && string.IsNullOrEmpty(Element.BackgroundImage))
            {
                return;
            }

            if (string.IsNullOrEmpty(Element.BackgroundImage))
            {
                _widget.File = null;
            }
            else
            {
                _widget.File = ResourcePath.GetPath(Element.BackgroundImage);
            }
        }
Esempio n. 15
0
        private static Task <SKImage?> PlatformToSKImageAsync(FileImageSource imageSource, CancellationToken cancellationToken = default)
        {
            var file = imageSource.File;

            if (string.IsNullOrEmpty(file))
            {
                return(Task.FromResult <SKImage?>(null));
            }

            // TODO: test this to see if it is a real file path
            file = ResourcePath.GetPath(file);

            var image = SKImage.FromEncodedData(file);

            return(Task.FromResult <SKImage?>(image));
        }
Esempio n. 16
0
 protected override void OnElementChanged(ElementChangedEventArgs <Layout> e)
 {
     base.OnElementChanged(e);
     if (_circleImage == null)
     {
         _circleImage          = new ElmSharp.EvasImage(Forms.NativeParent);
         _circleImage.IsFilled = true;
         _circleImage.File     = ResourcePath.GetPath("circle.png");
         _circleImage.Show();
         _circleImage.Geometry   = Control.Geometry;
         _circleImage.PassEvents = true;
         Control.SetClip(_circleImage);
         Control.LayoutUpdated += OnLayoutUpdated;
         Control.Moved         += Control_Moved;
         Control.Deleted       += Control_Deleted;
     }
 }
Esempio n. 17
0
        void UpdateActionButton(bool initialize)
        {
            if (Element.ActionButton != null)
            {
                if (_actionButton == null)
                {
                    _actionButton = new ElmSharp.Button(_box)
                    {
                        Style = "bottom"
                    };
                    _actionButton.Clicked += OnActionButtonClicked;
                    _box.PackEnd(_actionButton);
                }

                SetVisibleActionButton(Element.ActionButton.IsVisible);

                Element.ActionButton.PropertyChanged += OnActionButtonItemChanged;
                _actionButton.Text      = Element.ActionButton.Text;
                _actionButton.IsEnabled = Element.ActionButton.IsEnable;
                if (!Element.ActionButton.IconImageSource.IsNullOrEmpty())
                {
                    var imageSource = Element.ActionButton.IconImageSource as FileImageSource;
                    var path        = ResourcePath.GetPath(imageSource);
                    var buttonImage = new ElmSharp.Image(_actionButton);
                    buttonImage.LoadAsync(path);
                    buttonImage.Show();
                    _actionButton.SetPartContent("elm.swallow.content", buttonImage);
                }

                if (Element.ActionButton.BackgroundColor != Xamarin.Forms.Color.Default)
                {
                    _actionButton.BackgroundColor = Element.ActionButton.BackgroundColor.ToNative();
                }
            }
            else
            {
                if (_actionButton != null)
                {
                    _actionButton.Clicked -= OnActionButtonClicked;
                    _box.UnPack(_actionButton);
                    _actionButton.Unrealize();
                    _actionButton = null;
                }
            }
        }
Esempio n. 18
0
        void UpdateBackgroundImage(bool initialize)
        {
            if (initialize && Element.BackgroundImageSource.IsNullOrEmpty())
            {
                return;
            }

            var bgImage = Element.BackgroundImageSource as FileImageSource;

            if (bgImage.IsNullOrEmpty())
            {
                _widget.File = null;
            }
            else
            {
                _widget.File = ResourcePath.GetPath(bgImage);
            }
        }
 protected void UpdateBackgroundImage(bool initialize)
 {
     if (initialize && string.IsNullOrWhiteSpace(Element.BackgroundImage))
     {
         return;
     }
     if (string.IsNullOrWhiteSpace(Element.BackgroundImage))
     {
         _bgImageObject.File = null;
         _bgImage            = null;
     }
     else
     {
         _bgImageObject.File = ResourcePath.GetPath(Element.BackgroundImage);
         _bgImage            = Element.BackgroundImage;
     }
     UpdateBackground();
 }
Esempio n. 20
0
        public static void Init()
        {
            var fontName = "content-font.ttf";

#if WINDOWS_UWP
            var pkg  = Package.Current.InstalledLocation.Path;
            var path = Path.Combine(pkg, "Assets", "Media", fontName);
#elif __IOS__ || __TVOS__ || __MACOS__
            var path = NSBundle.MainBundle.PathForResource(Path.GetFileNameWithoutExtension(fontName), Path.GetExtension(fontName));
#elif __ANDROID__
            var path = Path.Combine(Application.Context.CacheDir.AbsolutePath, fontName);
            using (var asset = Application.Context.Assets.Open(Path.Combine("Media", fontName)))
                using (var dest = File.Open(path, FileMode.Create))
                {
                    asset.CopyTo(dest);
                }
#elif __DESKTOP__
            var root = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            var path = Path.Combine(root, "Media", fontName);
#elif __TIZEN__
            var path = ResourcePath.GetPath(fontName);
#endif

#if WINDOWS_UWP
            var localStorage = ApplicationData.Current.LocalFolder.Path;
#elif __IOS__ || __TVOS__
            var documents    = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            var localStorage = Path.Combine(documents, "..", "Library");
#elif __MACOS__ || __ANDROID__
            var localStorage = System.Environment.GetFolderPath(System.Environment.SpecialFolder.MyDocuments);
#elif __DESKTOP__
            var localStorage = System.Windows.Forms.Application.LocalUserAppDataPath;
#elif __TIZEN__
            var localStorage = Application.Current.DirectoryInfo.Data;
#endif

            SamplesManager.ContentFontPath = path;
            SamplesManager.OpenFile       += OnOpenSampleFile;
            SamplesManager.TempDataPath    = Path.Combine(localStorage, "SkiaSharpSample", "TemporaryData");
            if (!Directory.Exists(SamplesManager.TempDataPath))
            {
                Directory.CreateDirectory(SamplesManager.TempDataPath);
            }
        }
Esempio n. 21
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainViewModel"/> class
        /// </summary>
        /// <param name="navigation">
        /// Navigation instance
        /// </param>
        public MainViewModel(INavigation navigation)
        {
            Navigation = navigation;

            PlayCommand = new Command(async() =>
            {
                _isPlaying         = true;
                _cts               = new CancellationTokenSource();
                _audioStreamPolicy = new AudioStreamPolicy(AudioStreamType.Media);

                PlayCommand.ChangeCanExecute();
                CancelCommand.ChangeCanExecute();

                try
                {
                    await WavPlayer.StartAsync(ResourcePath.GetPath("test.wav"), _audioStreamPolicy, _cts.Token);
                }
                catch (TaskCanceledException)
                {
                    Tizen.Log.Info("WavPlayer", "A task for playing media was canceled.");
                }
                finally
                {
                    _isPlaying = false;
                    _cts?.Dispose();
                    _audioStreamPolicy?.Dispose();
                }

                PlayCommand.ChangeCanExecute();
                CancelCommand.ChangeCanExecute();
            }, CanPlay);

            CancelCommand = new Command(() =>
            {
                if (_isPlaying)
                {
                    _cts?.Cancel();
                    _isPlaying = false;
                }

                PlayCommand.ChangeCanExecute();
                CancelCommand.ChangeCanExecute();
            }, CanCancel);
        }
        public GraphicPopUpRenderer()
        {
            Console.WriteLine("GraphicPopUpRenderer()  GetHashCode:" + this.GetHashCode());
            _popUp = new Popup(TForms.NativeParent)
            {
                Style       = "toast/circle",
                Orientation = PopupOrientation.Center,
                AllowEvents = true,
            };
            var path  = ResourcePath.GetPath("tw_ic_popup_btn_check.png");
            var image = new Image(_popUp);

            image.LoadAsync(path);
            image.Show();
            _popUp.SetPartContent("toast,icon", image);
            _popUp.BackButtonPressed += BackButtonPressedHandler;
            _popUp.TimedOut          += TimedOutHandler;
            _popUp.Dismissed         += _popUp_Dismissed;
        }
Esempio n. 23
0
        void UpdateFirstButton()
        {
            _firstButton?.Hide();

            if (FirstButton != null)
            {
                _firstButton = new ElmSharp.Button(_popUp)
                {
                    WeightX = 1.0,
                    WeightY = 1.0,
                    Style   = "popup/circle/left"
                };

                if (!string.IsNullOrEmpty(FirstButton.Text))
                {
                    _firstButton.Text = FirstButton.Text;
                }

                if (FirstButton.Icon != null)
                {
                    var iconPath = FirstButton.Icon.File;
                    if (!string.IsNullOrEmpty(iconPath))
                    {
                        var buttonImage = new ElmSharp.Image(_firstButton);
                        buttonImage.LoadAsync(ResourcePath.GetPath(iconPath));
                        buttonImage.Show();
                        _firstButton.SetPartContent("elm.swallow.content", buttonImage);
                    }
                }

                _firstButton.Clicked += (s, e) =>
                {
                    FirstButton.Activate();
                };
            }
            else
            {
                _firstButton = null;
            }

            _popUp.SetPartContent("button1", _firstButton);
        }
Esempio n. 24
0
        protected void UpdateBackgroundImage(bool initialize)
        {
            if (initialize && Element.BackgroundImageSource.IsNullOrEmpty())
            {
                return;
            }

            var bgImageSource = Element.BackgroundImageSource as FileImageSource;

            if (bgImageSource.IsNullOrEmpty())
            {
                _bgImageObject.File = null;
                _bgImage            = null;
            }
            else
            {
                _bgImageObject.File = ResourcePath.GetPath(bgImageSource);
                _bgImage            = Element.BackgroundImageSource;
            }
            UpdateBackground();
        }
Esempio n. 25
0
        void UpdateActionButton(bool initialize)
        {
            if (Element.ActionButton != null)
            {
                if (_actionButton == null)
                {
                    _actionButton = new ElmSharp.Button(_box)
                    {
                        Style = "bottom"
                    };
                    _actionButton.Clicked += OnActionButtonClicked;
                    _box.PackEnd(_actionButton);
                }

                SetVisibleActionButton(Element.ActionButton.IsVisible);

                Element.ActionButton.PropertyChanged += OnActionButtonItemChanged;
                _actionButton.Text      = Element.ActionButton.Text;
                _actionButton.IsEnabled = Element.ActionButton.IsEnable;
                if (Element.ActionButton.Icon != null)
                {
                    var path        = ResourcePath.GetPath(Element.ActionButton.Icon);
                    var buttonImage = new ElmSharp.Image(_actionButton);
                    buttonImage.LoadAsync(path);
                    buttonImage.Show();
                    _actionButton.SetPartContent("elm.swallow.content", buttonImage);
                }
            }
            else
            {
                if (_actionButton != null)
                {
                    _actionButton.Clicked -= OnActionButtonClicked;
                    _box.UnPack(_actionButton);
                    _actionButton.Unrealize();
                    _actionButton = null;
                }
            }
        }
        void UpdateActionButton(bool initialize)
        {
            if (initialize && Element.ActionButton == null)
            {
                return;
            }

            if (Element.ActionButton != null)
            {
                SetVisibleActionButton(Element.ActionButton.IsVisible);

                Element.ActionButton.PropertyChanged += OnActionButtonItemChanged;
                _actionButton.Text      = Element.ActionButton.Text;
                _actionButton.IsEnabled = Element.ActionButton.IsEnable;
                if (Element.ActionButton.Icon != null)
                {
                    var path        = ResourcePath.GetPath(Element.ActionButton.Icon);
                    var buttonImage = new ElmSharp.Image(_actionButton);
                    buttonImage.LoadAsync(path);
                    buttonImage.Show();
                    _actionButton.SetPartContent("elm.swallow.content", buttonImage);
                }
            }
        }
Esempio n. 27
0
 public static string ToAbsPath(this FileImageSource source)
 {
     return(ResourcePath.GetPath(source.File));
 }
Esempio n. 28
0
        void FillToolbarItems()
        {
            var logicalChildren = (Element as IElementController).LogicalChildren;

            foreach (Page child in logicalChildren)
            {
                var childRenderer = Platform.GetRenderer(child);
                if (childRenderer != null)
                {
                    childRenderer.NativeView.Hide();
                }

                EToolbarItem toolbarItem = _tpage.Append(child.Title, string.IsNullOrEmpty(child.Icon) ? null : ResourcePath.GetPath(child.Icon));
                toolbarItem.SetPartColor("bg", Element.BarBackgroundColor.ToNative());

                _itemToItemPage.Add(toolbarItem, child);
                if (Element.CurrentPage == child)
                {
                    toolbarItem.IsSelected = true;
                    OnCurrentPageChanged(null, null);
                }

                child.PropertyChanged += OnPageTitleChanged;
            }
        }
        /// <summary>
        /// To initialize page info.
        /// </summary>
        void InitializePageInfo()
        {
            var logicalChildren = (Element as IElementController).LogicalChildren;
            int pageIndex       = 0;

            foreach (Page child in logicalChildren)
            {
                var toolbarItem = _tpage.Append(null, string.IsNullOrEmpty(child.Icon) ? null : ResourcePath.GetPath(child.Icon));

                /// To Set a backgroundcolor for every toolbar item
                toolbarItem.SetPartColor("bg", Element.BarBackgroundColor.ToNative());

                _pageInfo.Add(toolbarItem, new PageInfo {
                    Index = pageIndex++, Page = child
                });

                var content = Platform.GetOrCreateRenderer(child).NativeView;
                content.SetAlignment(-1, -1);
                content.SetWeight(1, 1);
                content.MinimumWidth = App.ScreenWidth;
                content.Show();
                _box.PackEnd(content);

                if (Element.CurrentPage == child)
                {
                    toolbarItem.IsSelected = true;
                    ShowCurrentPage(_pageInfo[toolbarItem]);
                }
            }
        }
        /// <summary>
        /// Initialize ThumbnailIndex View
        /// </summary>
        private void Initialize()
        {
            Console.WriteLine("Initialize");
            _isFirstItem = true;

            _pbox = new PaddingBox(Forms.NativeParent)
            {
                Padding = new Thickness {
                    Left = 0, Right = 0, Top = 22, Bottom = 0
                },
                HeaderSize = new ElmSharp.Size(200, 19),
                HeaderGap  = 38
            };
            _pbox.Show();

            _index = new ElmSharp.Index(_pbox)
            {
                Style        = "thumbnail",
                AutoHide     = false,
                IsHorizontal = true,
                AlignmentX   = 0.5,
                AlignmentY   = 0.5,
            };
            _index.Show();
            _pbox.Header = _index;
            //index.Geometry = new Rect(0, 22, 200, 19);

            _scroller = new ElmSharp.Scroller(_pbox)
            {
                HorizontalLoop = false,
                VerticalLoop   = false,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalPageScrollLimit        = 1,
                VerticalPageScrollLimit          = 0,
            };

            _scroller.PageScrolled += (s, e) =>
            {
                Console.WriteLine($" _scroller PageScrolled");
                var pageIndex = _scroller.HorizontalPageIndex;
                _items[pageIndex].Select(true);
            };
            _scroller.Show();
            _pbox.Content = _scroller;
            //_scroller.Geometry = new Rect(0, 79, 360, 281);

            var box = new ElmSharp.Box(_scroller)
            {
                IsHorizontal = true,
                AlignmentX   = 0.5,
                AlignmentY   = 0.5,
            };

            _scroller.SetContent(box);
            box.Show();

            // Create Rectangle for layout center align in Box
            var padder = new ElmSharp.Rectangle(box);

            box.PackEnd(padder);
            _items.Clear();

            // Initialize ThumbnailItems
            foreach (var item in Element.ThumbnailItems)
            {
                // create layout
                var page = new ElmSharp.Layout(box)
                {
                    WeightX    = 1.0,
                    WeightY    = 1.0,
                    AlignmentX = -1.0,
                    AlignmentY = 0.5
                };
                page.SetTheme("layout", "body_thumbnail", "default");
                page.Show();

                // set icon
                var img  = new ElmSharp.Image(page);
                var icon = item.Image;
                Console.WriteLine($"item.Image File:{icon.File}");
                img.LoadAsync(ResourcePath.GetPath(icon.File));
                page.SetPartContent("elm.icon", img);

                var indexItem = _index.Append(null);
                _items.Add(indexItem);

                // first item case
                if (_isFirstItem)
                {
                    Console.WriteLine($"_isFirstItem is true");
                    page.Resized += (s, e) =>
                    {
                        var g  = _scroller.Geometry;
                        var pg = page.Geometry;
                        padder.MinimumWidth  = (g.Width - pg.Width) / 2;
                        padder.MinimumHeight = g.Height / 2;
                        _scroller.SetPageSize(pg.Width, pg.Height);
                    };
                    indexItem.Select(true);
                }

                _isFirstItem = false;
                box.PackEnd(page);
            }

            box.PackEnd(padder);
            _index.Update(0);
        }