コード例 #1
0
        EvasObject CreateNewWindow(EvasObject parent, BaseGalleryPage page)
        {
            var box = new ColoredBox(parent)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();

            var titleLabel = new Label(parent)
            {
                AlignmentX    = -1,
                AlignmentY    = 1,
                WeightX       = 1,
                WeightY       = 1,
                LineWrapType  = WrapType.Word,
                LineWrapWidth = 300,
                Text          = $"<span align=center color=#000000>{page.Name}</span > "
            };

            titleLabel.Show();

            var button = new MButton(parent)
            {
                AlignmentX = -1,
                AlignmentY = 0,
                WeightX    = 1,
                WeightY    = 1,
                Text       = "run"
            };

            button.Show();

            button.Clicked += (s, e) =>
            {
                Window window = new Window(page.Name);
                window.Show();
                window.BackButtonPressed += (sender, args) =>
                {
                    page.TearDown();
                    window.Hide();
                    window.Unrealize();
                };
                page.Run(window);
            };

            box.PackEnd(titleLabel);
            box.PackEnd(button);

            return(box);
        }
コード例 #2
0
        Window CreatePageWindow(BaseGalleryPage page)
        {
            Window window = new Window("MaterialGalleryPageWindow");

            window.Show();
            window.BackButtonPressed += (s, e) =>
            {
                page.TearDown();
                window.Hide();
                window.Unrealize();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            };
            return(window);
        }
コード例 #3
0
        EvasObject CreateNewWindow(EvasObject parent, BaseGalleryPage page)
        {
            var box = new ColoredBox(parent)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();

            var button = new MButton(parent)
            {
                AlignmentX = -1,
                AlignmentY = 0.5,
                WeightX    = 1,
                WeightY    = 1,
                Text       = "click"
            };

            button.Show();

            button.Clicked += (s, e) =>
            {
                Window window = new Window(page.Name);
                window.Show();
                window.BackButtonPressed += (sender, args) =>
                {
                    page.TearDown();
                    window.Hide();
                    window.Unrealize();
                };
                page.Run(window);
            };

            box.PackEnd(button);

            return(box);
        }
コード例 #4
0
        void Initialize()
        {
            ResourceDir = DirectoryInfo.Resource;
            MaterialComponents.Init(ResourceDir, new InitializationOptions
            {
                ThrowOnValidateComponentErrors = false
            });

            _mainWindow = new Window("MaterialGallery");
            _mainWindow.Show();
            _mainWindow.BackButtonPressed += (s, e) =>
            {
                UIExit();
            };

            var conformant = new Conformant(_mainWindow);

            conformant.Show();

            var box = new Box(_mainWindow)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();

            var bg = new Background(_mainWindow)
            {
                Color = Color.White
            };

            bg.SetContent(box);
            conformant.SetContent(bg);

            GenList list = new GenList(_mainWindow)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (data, part) =>
                {
                    BaseGalleryPage page = data as BaseGalleryPage;
                    return(page == null ? "" : page.Name);
                }
            };

            foreach (var page in GetGalleryPage())
            {
                list.Append(defaultClass, page);
            }

            if (MaterialComponents.Profile == TargetProfile.Wearable)
            {
                list.Prepend(defaultClass, null);
                list.Append(defaultClass, null);
            }

            list.ItemSelected += (s, e) =>
            {
                BaseGalleryPage page = e.Item.Data as BaseGalleryPage;
                RunGalleryPage(page);
            };
            list.Show();
            box.PackEnd(list);
        }
コード例 #5
0
        void RunGalleryPage(BaseGalleryPage page)
        {
            Window window = CreatePageWindow(page);

            page.Run(window);
        }
コード例 #6
0
        void Initialize()
        {
            ResourceDir = DirectoryInfo.Resource;
            ThemeLoader.Initialize(ResourceDir);

            _mainWindow = new Window("MaterialGallery");
            _mainWindow.Show();
            _mainWindow.BackButtonPressed += (s, e) =>
            {
                UIExit();
            };

            var conformant = new Conformant(_mainWindow);

            conformant.Show();

            var box = new Box(_mainWindow)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };

            box.Show();

            var bg = new Background(_mainWindow)
            {
                Color = Color.White
            };

            bg.SetContent(box);
            conformant.SetContent(bg);

            GenList list = new GenList(_mainWindow)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (data, part) =>
                {
                    BaseGalleryPage page = data as BaseGalleryPage;
                    return(page == null ? "" : page.Name);
                }
            };

            foreach (var page in GetGalleryPage())
            {
                if (Elementary.GetProfile() == "tv" && page.ExceptProfile == ProfileType.TV)
                {
                    continue;
                }
                list.Append(defaultClass, page);
            }

            if (ThemeLoader.Profile == TargetProfile.Wearable)
            {
                list.Prepend(defaultClass, null);
                list.Append(defaultClass, null);
            }

            list.ItemSelected += (s, e) =>
            {
                BaseGalleryPage page = e.Item.Data as BaseGalleryPage;
                RunGalleryPage(page);
            };
            list.Show();
            box.PackEnd(list);
        }