示例#1
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            square = window.GetInnerSquare();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            _navi = navi;

            navi.Popped += (s, e) =>
            {
                Console.WriteLine("----- Naviframe was popped {0:x} ", (int)(IntPtr)e.Content);
            };

            NaviItem item = navi.Push(CreatePage(window), "0 Page");

            item.SetPartContent("title_left_btn", new Button(window)
            {
                Text = "LEFT", Style = "naviframe/title_left"
            });
            item.SetPartContent("title_right_btn", new Button(window)
            {
                Text = "RIGHT", Style = "naviframe/title_right"
            });
            navi.Show();
            conformant.SetContent(navi);
        }
示例#2
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            square = window.GetInnerSquare();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            _navi = navi;

            navi.Popped += (s, e) =>
            {
                Console.WriteLine("----- Naviframe was popped {0:x} ", (int)(IntPtr)e.Content);
            };

            navi.Push(CreatePage(window), "0 Page");

            navi.Show();
            conformant.SetContent(navi);
        }
        protected override void Dispose(bool disposing)
        {
            if (_navi != null)
            {
                _navi.Unrealize();
                _navi = null;
            }

            if (_box != null)
            {
                _box.Unrealize();
                _box = null;
            }

            if (_tpage != null)
            {
                _tpage.Selected -= OnCurrentPageChanged;

                _tpage.Unrealize();
                _tpage = null;
            }

            if (_scroller != null)
            {
                _scroller.Unrealize();
                _scroller.PageScrolled -= OnPageScrolled;
            }

            base.Dispose(disposing);
        }
示例#4
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            navi.Popped += (s, e) =>
            {
                Console.WriteLine("naviframe was popped : " + e.Content.GetType());
            };

            Rectangle rect1 = new Rectangle(window)
            {
                Color    = Color.Red,
                Geometry = new Rect(0, 0, 200, 200)
            };

            navi.Push(rect1, "First Page");

            Rectangle rect2 = new Rectangle(window)
            {
                Color    = Color.Blue,
                Geometry = new Rect(0, 0, 200, 200)
            };

            navi.Push(rect2, "Second Page");
            navi.Show();
            conformant.SetContent(navi);
        }
示例#5
0
        void Initialize()
        {
            Forms.Init(this);

            Instance = this;
            window   = new Window("Phoneword");
            window.BackButtonPressed += (s, e) =>
            {
                if (naviFrame.NavigationStack.Count > 1)
                {
                    naviFrame.Pop();
                }
                else
                {
                    Exit();
                }
            };
            window.Show();

            var conformant = new Conformant(window);

            conformant.Show();

            naviFrame = new Naviframe(window);
            conformant.SetContent(naviFrame);
            naviFrame.Show();

            var mainPage = new PhonewordPage().CreateEvasObject(window);

            naviFrame.Push(mainPage);
        }
示例#6
0
 internal Platform(FormsApplication context)
 {
     Forms.Context.MainWindow.BackButtonPressed += (o, e) =>
     {
         bool handled = false;
         if (_navModel.CurrentPage != null)
         {
             if (CurrentModalNavigationTask != null && !CurrentModalNavigationTask.IsCompleted)
             {
                 handled = true;
             }
             else
             {
                 handled = _navModel.CurrentPage.SendBackButtonPressed();
             }
         }
         if (!handled)
         {
             context.Exit();
         }
     };
     _naviframe = new Naviframe(Forms.Context.MainWindow)
     {
         PreserveContentOnPop     = true,
         DefaultBackButtonEnabled = false,
     };
     _naviframe.SetAlignment(-1, -1);
     _naviframe.SetWeight(1.0, 1.0);
     _naviframe.Show();
     _naviframe.AnimationFinished += NaviAnimationFinished;
     Forms.Context.BaseLayout.SetContent(_naviframe);
 }
        /// <summary>
        /// Create a base UI.
        /// </summary>
        void Initialize()
        {
            // Create a Window
            window = new Window("ElmSharpApp")
            {
                AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90,
                AutoDeletion       = true,
            };
            window.Deleted += (s, e) => Exit();
            window.Show();

            // Create a Conformant
            var conf = new Conformant(window)
            {
                WeightX = 1.0,
                WeightY = 1.0,
            };

            window.AddResizeObject(conf);
            conf.Show();

            // Create a Naviframe
            navi = new Naviframe(window);
            conf.SetContent(navi);
            navi.BackButtonPressed += (s, e) => CloseApp();

            CreateMap();
        }
        protected override void OnElementChanged(ElementChangedEventArgs <NavigationPage> e)
        {
            if (_naviFrame == null)
            {
                _naviFrame = new Naviframe(Forms.NativeParent);
                _naviFrame.PreserveContentOnPop     = true;
                _naviFrame.DefaultBackButtonEnabled = false;
                _naviFrame.AnimationFinished       += OnAnimationFinished;

                SetNativeView(_naviFrame);
                _naviItemMap = new Dictionary <Page, NaviItem>();
            }

            if (_toolbarTracker == null)
            {
                _toolbarTracker = new ToolbarTracker();
                _toolbarTracker.CollectionChanged += OnToolbarCollectionChanged;
            }

            if (e.OldElement != null)
            {
                var navigation = e.OldElement as INavigationPageController;
                navigation.PopRequested              -= OnPopRequested;
                navigation.PopToRootRequested        -= OnPopToRootRequested;
                navigation.PushRequested             -= OnPushRequested;
                navigation.RemovePageRequested       -= OnRemovePageRequested;
                navigation.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;

                var pageController = e.OldElement as IPageController;
                pageController.InternalChildren.CollectionChanged -= OnPageCollectionChanged;
            }

            if (e.NewElement != null)
            {
                var navigation = e.NewElement as INavigationPageController;
                navigation.PopRequested              += OnPopRequested;
                navigation.PopToRootRequested        += OnPopToRootRequested;
                navigation.PushRequested             += OnPushRequested;
                navigation.RemovePageRequested       += OnRemovePageRequested;
                navigation.InsertPageBeforeRequested += OnInsertPageBeforeRequested;

                var pageController = e.NewElement as IPageController;
                pageController.InternalChildren.CollectionChanged += OnPageCollectionChanged;

                foreach (Page page in pageController.InternalChildren)
                {
                    _naviItemMap[page]    = _naviFrame.Push(Platform.GetOrCreateRenderer(page).NativeView, SpanTitle(page.Title));
                    page.PropertyChanged += NavigationBarPropertyChangedHandler;

                    UpdateHasNavigationBar(page);
                }

                _toolbarTracker.Target = e.NewElement;
                _previousPage          = e.NewElement.CurrentPage;
            }
            base.OnElementChanged(e);
        }
示例#9
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleProgressBar run");
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe naviframe = new Naviframe(window);

            naviframe.Show();
            conformant.SetContent(naviframe);

            var surface           = new CircleSurface(conformant);
            CircleProgressBar pb1 = new CircleProgressBar(naviframe, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Value      = 0,
                Maximum    = 100,
                Minimum    = 0,
            };

            pb1.Show();
            naviframe.Push(pb1, null, "empty");

            Label lb1 = new Label(window)
            {
                Text = string.Format("S {0} %", pb1.Value),
            };

            lb1.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            lb1.Move(160, window.ScreenSize.Height / 2 - 40);
            lb1.Show();

            EcoreMainloop.AddTimer(0.05, () =>
            {
                if (pb1.Value == pb1.Maximum / 2)
                {
                    // Test purpose : set disable
                    pb1.IsEnabled = false;
                }

                if (pb1.Value == pb1.Maximum)
                {
                    EcoreMainloop.RemoveTimer(pb1);
                }

                pb1.Value += 1;
                lb1.Text   = string.Format("S {0} %", pb1.Value);

                return(true);
            });
        }
示例#10
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            square = window.GetInnerSquare();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true,
                Geometry = square
            };

            box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Geometry   = new Rect(square.X, square.Y, square.Width, square.Height)
            };
            box.Show();

            box2          = new Box(box);
            box2.Geometry = new Rect(square.X, square.Y + square.Height / 6, square.Width, square.Height / 2);
            box2.Show();
            box.PackEnd(box2);

            list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1,
                Style       = "solid/default"
            };
            box.PackEnd(list);
            navi.Push(box, "Performance");

            InitializeListItem();

            list.Changed += List_Changed;
            list.ScrollAnimationStarted += List_ScrollAnimationStarted;
            list.ScrollAnimationStopped += List_ScrollAnimationStopped;
            list.Show();

            navi.Show();
            conformant.SetContent(navi);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <CustomTabbedPage> e)
        {
            if (_tpage == null)
            {
                _navi = new Naviframe(Forms.NativeParent);

                _tpage = new Toolbar(Forms.NativeParent)
                {
                    Style               = "tabbar",
                    Text                = Element.Title,
                    ShrinkMode          = ToolbarShrinkMode.Expand,
                    SelectionMode       = ToolbarSelectionMode.Always,
                    TransverseExpansion = true,
                };
                _tpage.Show();
                _tpage.Selected += OnCurrentPageChanged;

                _box = new Box(Forms.NativeParent)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                _box.IsHorizontal = true;
                _box.Show();

                _scroller = new Scroller(Forms.NativeParent)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                _scroller.Style = "tabbar";
                _scroller.HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Visible;
                _scroller.SetPageSize(App.ScreenWidth, 0);
                _scroller.HorizontalPageScrollLimit = 1;
                _scroller.PageScrolled += OnPageScrolled;
                _scroller.SetContent(_box);
                _scroller.Show();

                var item = _navi.Push(_scroller);
                item.Style = "tabbar/notitle";
                item.SetPartContent("tabbar", _tpage);

                SetNativeView(_navi);
            }

            base.OnElementChanged(e);
        }
示例#12
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleSpinnerTest run");
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe naviframe = new Naviframe(window);

            naviframe.Show();
            conformant.SetContent(naviframe);

            Layout layout = new Layout(naviframe);

            layout.SetTheme("layout", "circle", "spinner");

            var           surface = new CircleSurface(conformant);
            CircleSpinner spn1    = new CircleSpinner(naviframe, surface)
            {
                Text        = "Spinner Test",
                LabelFormat = "%d Value",
                Style       = "circle",
                AngleRatio  = 1.0,
                Minimum     = 0,
                Maximum     = 100,
                Value       = 0,
                Step        = 10,
                Interval    = 0.5,
                AlignmentX  = -1,
                AlignmentY  = 1,
                WeightX     = 1,
                WeightY     = 1
            };

            ((IRotaryActionWidget)spn1).Activate();
            spn1.AddSpecialValue(50, "50 match !!!!");
            layout.SetContent(spn1);

            Button btn = new Button(layout)
            {
                Text  = "OK",
                Style = "bottom",
            };

            layout.SetPartContent("elm.swallow.btn", btn);
            layout.SetPartText("elm.text", "Set value");

            naviframe.Push(layout, null, "empty");
        }
示例#13
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
            };
            box.Show();

            box2 = new Box(box);
            //elm_box_padding_set(box2, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10)); ºÎºÐ ºüÁü.
            box2.Show();
            box.PackEnd(box2);

            list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1,
                Style       = "solid/default"
            };
            box.PackEnd(list);
            navi.Push(box, "Performance");

            InitializeListItem();

            list.Changed += List_Changed;
            list.ScrollAnimationStarted += List_ScrollAnimationStarted;
            list.ScrollAnimationStopped += List_ScrollAnimationStopped;
            list.Show();

            navi.Show();
            conformant.SetContent(navi);
        }
示例#14
0
        protected override void OnElementChanged(ElementChangedEventArgs <NavigationPage> e)
        {
            if (_naviFrame == null)
            {
                _naviFrame = new Naviframe(System.Maui.Maui.NativeParent);
                _naviFrame.PreserveContentOnPop     = true;
                _naviFrame.DefaultBackButtonEnabled = false;
                _naviFrame.AnimationFinished       += OnAnimationFinished;

                SetNativeView(_naviFrame);
                _naviItemMap = new Dictionary <Page, NaviItem>();
            }

            if (_toolbarTracker == null)
            {
                _toolbarTracker = new ToolbarTracker();
                _toolbarTracker.CollectionChanged += OnToolbarCollectionChanged;
            }

            if (e.OldElement != null)
            {
                var navigation = e.OldElement as INavigationPageController;
                navigation.PopRequested              -= OnPopRequested;
                navigation.PopToRootRequested        -= OnPopToRootRequested;
                navigation.PushRequested             -= OnPushRequested;
                navigation.RemovePageRequested       -= OnRemovePageRequested;
                navigation.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;

                var pageController = e.OldElement as IPageController;
                pageController.InternalChildren.CollectionChanged -= OnPageCollectionChanged;
            }

            if (e.NewElement != null)
            {
                var navigation = e.NewElement as INavigationPageController;
                navigation.PopRequested              += OnPopRequested;
                navigation.PopToRootRequested        += OnPopToRootRequested;
                navigation.PushRequested             += OnPushRequested;
                navigation.RemovePageRequested       += OnRemovePageRequested;
                navigation.InsertPageBeforeRequested += OnInsertPageBeforeRequested;

                _toolbarTracker.Target = e.NewElement;
                _previousPage          = e.NewElement.CurrentPage;
            }
            base.OnElementChanged(e);
        }
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var naviframe = new Naviframe(window);

            conformant.SetContent(naviframe);
            Layout layout = new Layout(naviframe);

            layout.SetTheme("layout", "circle", "datetime");

            var surface = new CircleSurface(conformant);

            DateTimeSelector datetime = new CircleDateTimeSelector(naviframe, surface)
            {
                DateTime        = DateTime.Now,
                Style           = "timepicker/circle",
                MarkerLineWidth = 40,
                MarkerColor     = Color.Pink,
                MarkerRadius    = 100,
            };

            ((IRotaryActionWidget)datetime).Activate();
            layout.SetContent(datetime);

            Button btn = new Button(layout)
            {
                Text  = "OK",
                Style = "bottom",
            };

            layout.SetPartContent("elm.swallow.btn", btn);

            layout.SetPartText("elm.text", "Set time");

            naviframe.Push(layout, null, "empty");

            datetime.DateTimeChanged += (object sender, DateChangedEventArgs e) =>
            {
                Log.Debug(TestName, "Old DateTime={0}", e.OldDate.ToString());
                Log.Debug(TestName, "New DateTime={0}", e.NewDate.ToString());
                Log.Debug(TestName, "Current DateTime={0}", datetime.DateTime.ToString());
            };
        }
示例#16
0
        public override void Run(Window window)
        {
            accessRoleValues = Enum.GetValues(typeof(AccessRole));

            Conformant conformant = new Conformant(window);

            conformant.Show();

            navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            navi.Push(CreatePage(window, "Main page"), "first page");
            navi.Show();
            conformant.SetContent(navi);
        }
示例#17
0
#pragma warning restore 0067

        internal DefaultPlatform(EvasObject parent)
        {
            Forms.NativeParent = parent;
            _pageBusyCount     = 0;
            MessagingCenter.Subscribe <Page, bool>(this, Page.BusySetSignalName, BusySetSignalNameHandler);
            MessagingCenter.Subscribe <Page, AlertArguments>(this, Page.AlertSignalName, AlertSignalNameHandler);
            MessagingCenter.Subscribe <Page, ActionSheetArguments>(this, Page.ActionSheetSignalName, ActionSheetSignalNameHandler);

            _internalNaviframe = new Naviframe(Forms.NativeParent)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = false,
            };
            _internalNaviframe.SetAlignment(-1, -1);
            _internalNaviframe.SetWeight(1.0, 1.0);
            _internalNaviframe.Show();
            _internalNaviframe.AnimationFinished += NaviAnimationFinished;
        }
示例#18
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe naviframe = new Naviframe(window);

            naviframe.Show();
            conformant.SetContent(naviframe);

            var          surface      = new CircleSurface(conformant);
            CircleSlider circleSlider = new CircleSlider(naviframe, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Minimum    = 0,
                Maximum    = 20,
                Value      = 5,
                Step       = 0.5,
            };

            ((IRotaryActionWidget)circleSlider).Activate();
            circleSlider.Show();
            naviframe.Push(circleSlider, null, "empty");

            Label label1 = new Label(window)
            {
                Text  = string.Format("{0:F1}", circleSlider.Value),
                Color = Color.White,
            };

            label1.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            label1.Move(170, window.ScreenSize.Height / 2 - 20);
            label1.Show();

            circleSlider.ValueChanged += (s, e) =>
            {
                label1.Text = string.Format("{0:F1}", circleSlider.Value);
            };
        }
示例#19
0
#pragma warning restore 0067

        internal DefaultPlatform(EvasObject parent)
        {
            System.Maui.Maui.NativeParent = parent;

            _internalNaviframe = new Naviframe(System.Maui.Maui.NativeParent)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = false,
            };
            _internalNaviframe.SetAlignment(-1, -1);
            _internalNaviframe.SetWeight(1.0, 1.0);
            _internalNaviframe.Show();
            _internalNaviframe.AnimationFinished += NaviAnimationFinished;

            if (System.Maui.Maui.UseMessagingCenter)
            {
                _popupManager = new PopupManager(this);
            }
        }
示例#20
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var naviframe = new Naviframe(conformant);

            conformant.SetContent(naviframe);

            var surface = new CircleSurface(conformant);

            var list = new CircleGenList(naviframe, surface)
            {
                Homogeneous = true,
                VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
                IsEnabled = false,
            };

            ((IRotaryActionWidget)list).Activate();
            var item = naviframe.Push(list);

            item.Style = "empty";

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (obj, part) =>
                {
                    return(string.Format("{0} - {1}", (string)obj, part));
                }
            };

            for (int i = 0; i < 100; i++)
            {
                list.Append(defaultClass, string.Format("{0} Item", i));
            }
            list.ItemSelected += List_ItemSelected;;
        }
示例#21
0
文件: App.cs 项目: MIliev11/Samples
        void Initialize()
        {
            var conformant = new Conformant(_mainWindow);

            conformant.Show();

            _navi = new Naviframe(_mainWindow)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };
            _navi.Show();
            conformant.SetContent(_navi);

            var rootPage = CreateMainPage(_mainWindow);

            _navi.Push(rootPage);

            _mainWindow.BackButtonPressed += (sender, e) =>
            {
                bool handled = _currentPage?.SendBackButtonPressed() ?? false;

                if (!handled)
                {
                    if (_navi.NavigationStack.Count == 1)
                    {
                        Exit();
                    }
                    _currentPage = null;
                    _navi.Pop();
                }
            };

            _navi.Popped += (sender, e) =>
            {
                _currentPage = null;
            };
        }
示例#22
0
        protected override void OnElementChanged(ElementChangedEventArgs <ColoredTabbedPage> e)
        {
            if (_tpage == null)
            {
                _navi = new Naviframe(Forms.Context.MainWindow);

                _tpage = new Toolbar(Forms.Context.MainWindow)
                {
                    Style               = "tabbar",
                    Text                = Element.Title,
                    ShrinkMode          = ToolbarShrinkMode.Expand,
                    SelectionMode       = ToolbarSelectionMode.Always,
                    TransverseExpansion = true,
                };
                _tpage.Show();
                _tpage.SelectionMode = ToolbarSelectionMode.Default;
                _tpage.Selected     += OnCurrentPageChanged;

                _box = new Box(Forms.Context.MainWindow)
                {
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                _box.Show();

                var item = _navi.Push(_box);
                item.Style = "tabbar/notitle";
                item.SetPartContent("tabbar", _tpage);

                SetNativeControl(_navi);
            }

            base.OnElementChanged(e);
        }
示例#23
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            Scroller scroller = new Scroller(window)
            {
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1,
                ScrollBlock = ScrollBlock.None,
            };

            scroller.Show();
            Box container = new Box(window);

            scroller.SetContent(container);

            var rect1 = new Rectangle(window)
            {
                AlignmentX    = -1,
                WeightX       = 1,
                Color         = Color.Blue,
                MinimumHeight = 500
            };

            rect1.Show();

            var clipper = new Rectangle(window);

            clipper.Color    = new ElmSharp.Color(200, 200, 200, 200);
            clipper.Geometry = rect1.Geometry;
            rect1.Moved     += (s, e) =>
            {
                clipper.Geometry = ((Rectangle)s).Geometry;
            };
            rect1.SetClip(clipper);
            clipper.Show();
            container.PackEnd(rect1);

            Color[] colors = { Color.Red, Color.Olive, Color.Green, Color.Gray, Color.Lime, Color.Maroon };
            for (int i = 0; i < 6; i++)
            {
                var rect = new Rectangle(window)
                {
                    AlignmentX    = -1,
                    WeightX       = 1,
                    Color         = colors[i],
                    MinimumHeight = 500
                };
                rect.Show();
                container.PackEnd(rect);
            }

            navi.Push(scroller, "Scroll Page");
            navi.Show();
            conformant.SetContent(navi);
        }
示例#24
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe naviframe = new Naviframe(window);

            naviframe.Show();
            conformant.SetContent(naviframe);

            var            surface        = new CircleSurface(conformant);
            CircleScroller circleScroller = new CircleScroller(naviframe, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy      = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy    = ScrollBarVisiblePolicy.Auto,
                HorizontalScrollBarColor            = new Color(255, 0, 0, 50),
                HorizontalScrollBackgroundColor     = Color.Orange,
                HorizontalScrollBarLineWidth        = 15,
                HorizontalScrollBackgroundLineWidth = 15,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            naviframe.Push(circleScroller, null, "empty");


            Box box = new Box(window)
            {
                AlignmentX   = -1,
                AlignmentY   = -1,
                WeightX      = 1,
                WeightY      = 1,
                IsHorizontal = true,
            };

            box.Show();
            circleScroller.SetContent(box);

            var rnd = new Random();

            for (int i = 0; i < 10; i++)
            {
                int       r        = rnd.Next(255);
                int       g        = rnd.Next(255);
                int       b        = rnd.Next(255);
                Color     color    = Color.FromRgb(r, g, b);
                Rectangle colorBox = new Rectangle(window)
                {
                    AlignmentX   = -1,
                    AlignmentY   = -1,
                    WeightX      = 1,
                    WeightY      = 1,
                    Color        = color,
                    MinimumWidth = window.ScreenSize.Width,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled");
        }
示例#25
0
        private void CreateTesterView()
        {
            Window window = new Window("GraphicsTester")
            {
                AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90
            };

            window.Show();
            window.BackButtonPressed += (s, e) =>
            {
                EcoreMainloop.Quit();
            };

            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(window)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            navi.Show();

            GenList list = new GenList(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };
            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (data, part) =>
                {
                    var scenario = data as AbstractScenario;
                    return(scenario == null ? "" : scenario.GetType().Name);
                }
            };

            foreach (var scenario in ScenarioList.Scenarios)
            {
                list.Append(defaultClass, scenario);
            }

            SkiaGraphicsView graphicsView = new SkiaGraphicsView(window)
            {
                AlignmentX      = -1,
                AlignmentY      = -1,
                WeightX         = 1,
                WeightY         = 1,
                BackgroundColor = Color.White
            };

            graphicsView.Show();

            list.ItemSelected += (s, e) =>
            {
                var scenario = ScenarioList.Scenarios[e.Item.Index - 1];
                graphicsView.Drawable = scenario;
                navi.Push(graphicsView, scenario.GetType().Name);
            };
            list.Show();
            navi.Push(list, "GraphicsTester.Skia.Tizen");
            conformant.SetContent(navi);
        }
示例#26
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Naviframe navi = new Naviframe(conformant)
            {
                PreserveContentOnPop     = true,
                DefaultBackButtonEnabled = true
            };

            navi.Show();
            conformant.SetContent(navi);

            Layout layout = new Layout(conformant)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentX = -1,
                AlignmentY = -1,
            };

            layout.SetTheme("layout", "application", "default");
            layout.Show();

            Background bg = new Background(layout)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentX = -1,
                AlignmentY = -1,
                Color      = Color.Gray,
            };

            bg.Show();
            layout.SetPartContent("elm.swallow.bg", bg);

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

            box.Show();
            box.SetPadding(5, 5);
            layout.SetPartContent("elm.swallow.content", box);

            Label label = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 0.5,
                AlignmentY = 0,
            };

            label.Show();
            box.PackEnd(label);

            AnimationView aniview = new AnimationView(box)
            {
                WeightX    = 1,
                WeightY    = 1,
                AlignmentX = -1,
                AlignmentY = -1,
            };

            aniview.SetAnimation(Path.Combine(TestRunner.ResourceDir, "a_mountain.json"));
            aniview.Show();

            Box box1 = new Box(box)
            {
                WeightX      = 1,
                WeightY      = 0,
                AlignmentX   = -1,
                AlignmentY   = 1,
                IsHorizontal = true,
            };

            box1.Show();
            box.PackEnd(box1);

            Label label1 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 0.0,
                AlignmentY = 0.5,
                Text       = "Default Size = (" + aniview.DefaultSize.Width + "," + aniview.DefaultSize.Height + ")",
            };

            label1.Show();
            box1.PackEnd(label1);

            Label label2 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 1.0,
                AlignmentY = 0.5,
                Text       = "FrameCount : " + (aniview.FrameCount).ToString(),
            };

            label2.Show();
            box1.PackEnd(label2);

            Label label3 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 1.0,
                AlignmentY = 0.5,
                Text       = "Duration : " + (Math.Round(Convert.ToDouble(aniview.DurationTime), 2)).ToString(),
            };

            label3.Show();
            box.PackEnd(label3);

            box.PackEnd(aniview);

            Box box2 = new Box(box)
            {
                WeightX      = 1,
                WeightY      = 0,
                AlignmentX   = -1,
                AlignmentY   = 1,
                IsHorizontal = true,
            };

            box2.Show();
            box.PackEnd(box2);

            Check check = new Check(box2)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Loop",
            };

            check.Show();
            box2.PackEnd(check);

            check.StateChanged += (s, e) =>
            {
                aniview.AutoRepeat = !aniview.AutoRepeat;
            };

            Check check2 = new Check(box2)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Speed: 0.25x",
            };

            check2.Show();
            box2.PackEnd(check2);

            check2.StateChanged += (s, e) =>
            {
                if (check2.IsChecked)
                {
                    aniview.Speed = 0.25;
                }
                else
                {
                    aniview.Speed = 1.0;
                }
            };

            Slider slider = new Slider(box)
            {
                WeightX            = 1,
                WeightY            = 0,
                AlignmentX         = -1,
                AlignmentY         = -1,
                IsIndicatorVisible = true,
                IndicatorFormat    = "%1.1f",
                Minimum            = 0,
                Maximum            = 1,
            };

            slider.Show();
            box.PackEnd(slider);

            slider.ValueChanged += (s, e) =>
            {
                aniview.Progress = slider.Value;
            };

            Box box3 = new Box(box)
            {
                WeightX      = 1,
                WeightY      = 0,
                AlignmentX   = -1,
                AlignmentY   = 1,
                IsHorizontal = true,
            };

            box3.Show();
            box.PackEnd(box3);

            Label label4 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 0.0,
                AlignmentY = 0.5,
                Text       = (aniview.MinFrame).ToString() + " / " + (aniview.MaxFrame).ToString(),
            };

            label4.Show();
            box3.PackEnd(label4);

            Label label5 = new Label(box)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = 1.0,
                AlignmentY = 0.5,
                Text       = (aniview.MinProgress).ToString() + " / " + (aniview.MaxProgress).ToString(),
            };

            label5.Show();
            box3.PackEnd(label5);

            Box box4 = new Box(box)
            {
                WeightX      = 1,
                WeightY      = 0,
                AlignmentX   = -1,
                AlignmentY   = 1,
                IsHorizontal = true,
            };

            box4.Show();
            box.PackEnd(box4);

            Button btn1 = new Button(box4)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Play",
            };

            btn1.Show();
            box4.PackEnd(btn1);

            btn1.Clicked += (s, e) =>
            {
                aniview.Play();
                UpdateAnimationViewStateLabel(aniview, label);
            };

            Button btn2 = new Button(box4)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Reverse",
            };

            btn2.Show();
            box4.PackEnd(btn2);

            btn2.Clicked += (s, e) =>
            {
                aniview.Play(true);
                UpdateAnimationViewStateLabel(aniview, label);
            };

            Button btn3 = new Button(box4)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Stop",
            };

            btn3.Show();
            box4.PackEnd(btn3);

            btn3.Clicked += (s, e) =>
            {
                aniview.Stop();
            };

            Box box5 = new Box(box)
            {
                WeightX      = 1,
                WeightY      = 0,
                AlignmentX   = -1,
                AlignmentY   = 1,
                IsHorizontal = true,
            };

            box5.Show();
            box.PackEnd(box5);

            Button btn4 = new Button(box5)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Pause",
            };

            btn4.Show();
            box5.PackEnd(btn4);

            btn4.Clicked += (s, e) =>
            {
                aniview.Pause();
            };

            Button btn5 = new Button(box5)
            {
                WeightX    = 1,
                WeightY    = 0,
                AlignmentX = -1,
                AlignmentY = -1,
                Text       = "Resume",
            };

            btn5.Show();
            box5.PackEnd(btn5);

            btn5.Clicked += (s, e) =>
            {
                aniview.Resume();
            };

            aniview.Started += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
            };

            aniview.Stopped += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
                label4.Text  = "0 / " + (aniview.MaxFrame).ToString();
                label5.Text  = "0 / " + (aniview.MaxProgress).ToString();
                slider.Value = 0;
            };

            aniview.Paused += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
            };

            aniview.Resumed += (s, e) =>
            {
                UpdateAnimationViewStateLabel(aniview, label);
            };

            aniview.Updated += (s, e) =>
            {
                slider.Value = aniview.Progress;
                label4.Text  = (aniview.Frame).ToString() + " / " + (aniview.MaxFrame).ToString();
                label5.Text  = (Math.Round(Convert.ToDouble(aniview.Progress), 2)).ToString() + " / " + (aniview.MaxProgress).ToString();
            };

            UpdateAnimationViewStateLabel(aniview, label);

            navi.Push(layout, "AnimationView Test");
        }
示例#27
0
 /// <summary>
 /// Creates and initializes a new instance of the CircleSurface class with surface on the Naviframe widget.
 /// </summary>
 /// <param name="naviframe">Naviframe widget to create a surface.</param>
 /// <since_tizen> preview </since_tizen>
 public CircleSurface(Naviframe naviframe)
 {
     _handle = Interop.Eext.eext_circle_surface_naviframe_add(naviframe.RealHandle);
 }