Esempio n. 1
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var surface = new CircleSurface(conformant);

            var list = new CircleGenList(conformant, surface)
            {
                Homogeneous                    = true,
                VerticalScrollBarColor         = Color.Red,
                VerticalScrollBackgroundColor  = Color.Pink,
                VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Visible,
            };

            ((IRotaryActionWidget)list).Activate();
            conformant.SetContent(list);

            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;;
        }
Esempio n. 2
0
        public override void Run(Window window)
        {
            var surface = new CircleSurface();

            var list = new CircleGenList(window, surface)
            {
                Homogeneous = true,
                VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
            };

            list.Show();
            ((IRotaryActionWidget)list).Activate();
            list.Move(0, 0);
            list.Resize(360, 360);

            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;;
        }
Esempio n. 3
0
        protected override void OnPreCreate()
        {
            base.OnPreCreate();
            Application.ClearCurrent();

            var type = typeof(Window);
            // Use reflection to avoid breaking compatibility. ElmSharp.Window.CreateWindow() is has been added since API6.
            var    methodInfo = type.GetMethod("CreateWindow", BindingFlags.NonPublic | BindingFlags.Static);
            Window window     = null;

            if (methodInfo != null)
            {
                window              = (Window)methodInfo.Invoke(null, new object[] { "FormsWindow" });
                BaseLayout          = (ELayout)window.GetType().GetProperty("BaseLayout")?.GetValue(window);
                BaseCircleSurface   = (CircleSurface)window.GetType().GetProperty("BaseCircleSurface")?.GetValue(window);
                Forms.CircleSurface = BaseCircleSurface;
            }
            else             // in case of Xamarin Preload
            {
                window = PreloadedWindow.GetInstance() ?? new Window("FormsWindow");
                if (window is PreloadedWindow precreated)
                {
                    BaseLayout = precreated.BaseLayout;
                }
            }
            MainWindow = window;
        }
Esempio n. 4
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var          surface      = new CircleSurface(conformant);
            CircleSlider circleSlider = new CircleSlider(conformant, surface)
            {
                AlignmentX            = -1,
                AlignmentY            = -1,
                WeightX               = 1,
                WeightY               = 1,
                Minimum               = 0,
                Maximum               = 15,
                BarColor              = Color.Purple,
                BackgroundColor       = Color.Red,
                BarRadius             = 160,
                BackgroundRadius      = 160,
                BarLineWidth          = 15,
                BackgroundLineWidth   = 15,
                BackgroundAngleOffset = 90,
                BackgroundAngle       = 270,
                BarAngleOffset        = 90.0,
                BarAngleMinimum       = 0.0,
                BarAngleMaximum       = 270.0,
                Value = 3,
                Step  = 0.5,
            };

            ((IRotaryActionWidget)circleSlider).Activate();
            circleSlider.Show();
            conformant.SetContent(circleSlider);
            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 - 30);
            label1.Show();

            Label label2 = new Label(window)
            {
                Text  = string.Format("min:{0},max{1}", circleSlider.Minimum, circleSlider.Maximum),
                Color = Color.White,
            };

            label2.Resize(window.ScreenSize.Width, window.ScreenSize.Height);
            label2.Move(110, window.ScreenSize.Height / 2 + 10);
            label2.Show();

            Log.Debug(TestName, "CircleSliderTest2 step:" + circleSlider.Step);

            circleSlider.ValueChanged += (s, e) =>
            {
                label1.Text = string.Format("{0:F1}", circleSlider.Value);
            };
        }
Esempio n. 5
0
        protected override void OnPreCreate()
        {
            base.OnPreCreate();
            Application.ClearCurrent();

            if (DotnetUtil.TizenAPIVersion < 5)
            {
                // We should set the env variable to support IsolatedStorageFile on tizen 4.0 or lower version.
                Environment.SetEnvironmentVariable("XDG_DATA_HOME", Current.DirectoryInfo.Data);
            }

            var type = typeof(EWindow);
            // Use reflection to avoid breaking compatibility. ElmSharp.Window.CreateWindow() is has been added since API6.
            var     methodInfo = type.GetMethod("CreateWindow", BindingFlags.NonPublic | BindingFlags.Static);
            EWindow window     = null;

            if (methodInfo != null)
            {
                window              = (EWindow)methodInfo.Invoke(null, new object[] { "FormsWindow" });
                BaseLayout          = (ELayout)window.GetType().GetProperty("BaseLayout")?.GetValue(window);
                BaseCircleSurface   = (CircleSurface)window.GetType().GetProperty("BaseCircleSurface")?.GetValue(window);
                Forms.CircleSurface = BaseCircleSurface;
            }
            else             // in case of Xamarin Preload
            {
                window = PreloadedWindow.GetInstance() ?? new EWindow("FormsWindow");
                if (window is PreloadedWindow precreated)
                {
                    BaseLayout = precreated.BaseLayout;
                }
            }
            MainWindow = window;
        }
Esempio n. 6
0
        public override void Run(Window window)
        {
            Layout layout = new Layout(window);

            layout.Show();
            layout.Move(0, 0);
            layout.Resize(360, 360);

            var            surface        = new CircleSurface(layout);
            CircleScroller circleScroller = new CircleScroller(layout, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            circleScroller.Move(0, 0);
            circleScroller.Resize(360, 360);
            circleScroller.Lower();

            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");
        }
Esempio n. 7
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleProgressBar run");
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var surface           = new CircleSurface(conformant);
            CircleProgressBar pb1 = new CircleProgressBar(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,

                // bar
                Value        = 0,
                Maximum      = 100,
                Minimum      = 0,
                BarRadius    = 100,
                BarLineWidth = 15,
                BarColor     = Color.Green,

                // background
                BackgroundRadius    = 100,
                BackgroundLineWidth = 15,
                BackgroundColor     = Color.Aqua,
            };

            pb1.Show();
            conformant.SetContent(pb1);
            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);
            });
        }
Esempio n. 8
0
        public WatchScroller(EvasObject parent, CircleSurface surface)
        {
            _surface = surface;
            Realize(parent);

            VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible;
            HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible;
        }
Esempio n. 9
0
 void InitializeComponent()
 {
     Control.LayoutUpdated += OnLayoutUpdated;
     _surfaceLayout         = new ElmSharp.Layout(XForms.NativeParent);
     _circleSurface         = new CircleSurface(_surfaceLayout);
     Control.Children.Add(_surfaceLayout);
     _surfaceLayout.Show();
     _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>();
 }
Esempio n. 10
0
        public WatchSpinner(EvasObject parent, CircleSurface surface) : base(parent, surface)
        {
            Style             = ThemeConstants.CircleSpinner.Styles.Circle;
            _wheelAppeared    = new SmartEvent(this, ThemeConstants.CircleSpinner.Signals.ShowList);
            _wheelDisappeared = new SmartEvent(this, ThemeConstants.CircleSpinner.Signals.HideList);

            _wheelAppeared.On    += (s, e) => WheelAppeared?.Invoke(this, EventArgs.Empty);
            _wheelDisappeared.On += (s, e) => WheelDisappeared?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 11
0
        public override void Run(Window window)
        {
            var surface = new CircleSurface();

            CircleScroller circleScroller = new CircleScroller(window, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Auto,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
                VerticalScrollBarColor           = Color.Yellow,
                VerticalScrollBackgroundColor    = Color.Red,
                VerticalScrollBarRadius          = 170,
                VerticalScrollBackgroundRadius   = 170,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            circleScroller.Move(0, 0);
            circleScroller.Resize(360, 360);

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

            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,
                    MinimumHeight = window.ScreenSize.Height,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled");
        }
Esempio n. 12
0
        void InitializeWindow()
        {
            Debug.Assert(MainWindow != null, "Window cannot be null");

            MainWindow.Active();
            MainWindow.Show();

            // in case of no use of preloaded window
            if (BaseLayout == null)
            {
                var conformant = new Conformant(MainWindow);
                conformant.Show();

                var layout = new ELayout(conformant);
                layout.SetTheme("layout", "application", "default");
                layout.Show();

                BaseLayout = layout;

                if (Device.Idiom == TargetIdiom.Watch)
                {
                    BaseCircleSurface   = new CircleSurface(conformant);
                    Forms.CircleSurface = BaseCircleSurface;
                }
                conformant.SetContent(BaseLayout);
            }

            MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270;

            MainWindow.Deleted += (s, e) =>
            {
                Exit();
            };

            Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation();

            MainWindow.RotationChanged += (sender, e) =>
            {
                Device.Info.CurrentOrientation = MainWindow.GetDeviceOrientation();
            };

            MainWindow.BackButtonPressed += (sender, e) =>
            {
                if (_platform != null)
                {
                    if (!_platform.SendBackButtonPressed())
                    {
                        Exit();
                    }
                }
            };

            _platform = Platform.CreatePlatform(BaseLayout);
            BaseLayout.SetContent(_platform.GetRootNativeView());
            _platform.RootNativeViewChanged += (s, e) => BaseLayout.SetContent(e.RootNativeView);
        }
Esempio n. 13
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);
            });
        }
Esempio n. 14
0
        void CreateTestPage(Window window)
        {
            var conformant = new Conformant(window);

            conformant.Show();

            var surface        = new CircleSurface(conformant);
            var circleScroller = new CircleScroller(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto,
                ScrollBlock = ScrollBlock.Vertical,
                HorizontalPageScrollLimit = 1,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.SetPageSize(1.0, 1.0);
            conformant.SetContent(circleScroller);
            circleScroller.Show();

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

            box.Show();
            box.PackEnd(CreateFirstPage(box));

            foreach (var tc in GetGalleryPage())
            {
                if (tc.ExceptProfile != ProfileType.Wearable)
                {
                    var view = tc.CreateContent(box);
                    if (view != null)
                    {
                        box.PackEnd(view);
                    }
                    else
                    {
                        box.PackEnd(CreateNewWindow(box, tc));
                    }
                }
            }
            circleScroller.SetContent(box);
        }
Esempio n. 15
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var            surface        = new CircleSurface(conformant);
            CircleScroller circleScroller = new CircleScroller(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Auto,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
            };

            ((IRotaryActionWidget)circleScroller).Activate();
            circleScroller.Show();
            conformant.SetContent(circleScroller);
            Box box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            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,
                    MinimumHeight = window.ScreenSize.Height,
                };
                colorBox.Show();
                box.PackEnd(colorBox);
            }
            circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Circle Scrolled Scrolled");
        }
Esempio n. 16
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleSpinnerTest run");

            Rect square = window.GetInnerSquare();

            Conformant conformant = new Conformant(window);

            conformant.Show();

            var surface = new CircleSurface(conformant);

            spn1 = new CircleSpinner(window, surface)
            {
                Text        = "Spinner Test",
                LabelFormat = "%d Ratio",
                Style       = "circle",
                Minimum     = 0,
                Maximum     = 100,
                Value       = 0.0,
                Step        = 10,
                Interval    = 0.5,
                AlignmentX  = -1,
                AlignmentY  = 0.5,
                WeightX     = 1,
                WeightY     = 1
            };
            spn1.Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 4);
            spn1.Show();

            spn2 = new CircleSpinner(window, surface)
            {
                Text        = "Spinner Test",
                LabelFormat = "%d Value",
                Style       = "circle",
                MarkerColor = Color.Red,
                Minimum     = 0,
                Maximum     = 100,
                Value       = 0,
                Interval    = 0.5,
                AlignmentX  = -1,
                AlignmentY  = 0.5,
                WeightX     = 1,
                WeightY     = 1
            };
            spn2.Geometry = new Rect(square.X, square.Y + square.Width * 2 / 4, square.Width, square.Height / 4);
            spn2.Show();

            spn1.Focused      += Spn1_Focused;
            spn2.Focused      += Spn2_Focused;
            spn1.ValueChanged += Spn1_ValueChanged;
        }
Esempio n. 17
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");
        }
Esempio n. 18
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleSpinnerTest run");
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Layout layout = new Layout(window);

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

            var           surface = new CircleSurface(conformant);
            CircleSpinner spn1    = new CircleSpinner(conformant, surface)
            {
                Text        = "Spinner Test",
                LabelFormat = "%d Value",
                Style       = "circle",
                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",
            };

            btn.Clicked += (s, e) =>
            {
                spn1.IsEnabled = false;
                spn1.Text      = "100 match";
                spn1.Value     = 0;
            };

            layout.SetPartContent("elm.swallow.btn", btn);
            layout.SetPartText("elm.text", "Set value");
        }
Esempio n. 19
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleProgressBar run");
            Conformant conformant = new Conformant(window);

            conformant.Show();

            var surface = new CircleSurface(conformant);

            CircleProgressBar pb1 = new CircleProgressBar(conformant, surface)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,

                // default
                Value        = 20,
                Maximum      = 100,
                Minimum      = 0,
                BarRadius    = 80,
                BarLineWidth = 6,

                // background
                BackgroundRadius    = 80,
                BackgroundLineWidth = 6,
            };

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

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

            EcoreMainloop.AddTimer(0.05, () =>
            {
                pb1.Value += 1;
                lb1.Text   = string.Format("{0} %", pb1.Value);

                return(true);
            });
        }
Esempio n. 20
0
        public override void Run(Window window)
        {
            Log.Debug(TestName, "CircleSpinnerTest run");
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Layout layout = new Layout(window);

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

            var           surface = new CircleSurface(conformant);
            CircleSpinner spn1    = new CircleSpinner(conformant, surface)
            {
                Text        = "Spinner Test",
                LabelFormat = "%d Value",
                Style       = "circle",
                AngleRatio  = 3.0,
                Minimum     = 0,
                Maximum     = 360,
                Value       = 0,
                Step        = 10,
                Interval    = 0.5,
                AlignmentX  = -1,
                AlignmentY  = 1,
                WeightX     = 1,
                WeightY     = 1,
                // change marker
                MarkerLineWidth = 40,
                MarkerColor     = Color.Pink,
                MarkerRadius    = 100,
            };

            ((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");
        }
        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());
            };
        }
Esempio n. 22
0
        public WatchDateTimePickerDialog(EvasObject parent) : base(parent)
        {
            AlignmentX = -1;
            AlignmentY = -1;
            WeightX    = 1.0;
            WeightY    = 1.0;
            Style      = "circle";

            _container = new Box(parent)
            {
                AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1
            };
            _container.BackgroundColor = ElmSharp.Color.Blue;
            _container.SetLayoutCallback(OnContainerLayout);

            _datetimeLayout = new ELayout(parent);
            _surfaceLayout  = new ELayout(parent);

            _container.PackEnd(_datetimeLayout);
            _container.PackEnd(_surfaceLayout);

            _datetimeLayout.SetTheme("layout", "circle", "datetime");
            _surface = new CircleSurface(_surfaceLayout);

            _picker = new WatchDateTimePicker(parent, _surface);
            _picker.Show();
            _datetimeLayout.SetContent(_picker);

            _doneButton = new Button(parent)
            {
                Text  = "Set",
                Style = "bottom",
            };
            _datetimeLayout.SetPartContent("elm.swallow.btn", _doneButton);
            _doneButton.Clicked += OnDoneClicked;

            ActivateRotaryInteraction();

            _datetimeLayout.Show();
            _surfaceLayout.Show();
            _container.Show();

            SetContent(_container);
            ShowAnimationFinished += OnShowAnimationFinished;
            BackButtonPressed     += OnBackButtonPressed;
        }
        public WatchSpinner(EvasObject parent, CircleSurface surface) : base(parent, surface)
        {
            Style = "circle";

            if (TizenDotnetUtil.TizenAPIVersion == 4)
            {
                _wheelAppeared    = new ElmSharp.SmartEvent(this, "genlist,show");
                _wheelDisappeared = new ElmSharp.SmartEvent(this, "genlist,hide");
            }
            else
            {
                _wheelAppeared    = new ElmSharp.SmartEvent(this, "list,show");
                _wheelDisappeared = new ElmSharp.SmartEvent(this, "list,hide");
            }

            _wheelAppeared.On    += (s, e) => WheelAppeared?.Invoke(this, EventArgs.Empty);
            _wheelDisappeared.On += (s, e) => WheelDisappeared?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 24
0
        internal static CircleSurface GetSurface(this IVisualElementRenderer renderer)
        {
            Element       element       = renderer.Element;
            CircleSurface circleSurface = null;

            if (element is ICircleSurfaceConsumer circleElement)
            {
                var provider = circleElement.CircleSurfaceProvider;
                if (provider != null)
                {
                    circleSurface = (CircleSurface)provider.CircleSurface;
                }
                else
                {
                    circleSurface = GetSurfaceRecursively(element);
                }
            }
            return(circleSurface ?? XForms.CircleSurface);
        }
Esempio n. 25
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);
            };
        }
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Layout layout = new Layout(window);

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

            conformant.SetContent(layout);

            var surface = new CircleSurface(conformant);

            var datetime = new CircleDateTimeSelector(conformant, surface)
            {
                MinimumDateTime = new DateTime(2015, 1, 1),
                MaximumDateTime = DateTime.Now,
                DateTime        = DateTime.Now
            };

            ((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 date");

            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());
            };
        }
Esempio n. 27
0
        public override void Run(Window window)
        {
            var layout = new Layout(window);

            layout.Show();

            layout.Move(0, 0);
            layout.Resize(360, 360);

            var surface = new CircleSurface(layout);

            var list = new CircleGenList(layout, surface)
            {
                Homogeneous = true,
                VerticalScrollBackgroundRadius    = 165,
                VerticalScrollBarRadius           = 165,
                VerticalScrollBackgroundLineWidth = 30,
                VerticalScrollBarLineWidth        = 30,
            };

            list.Show();
            ((IRotaryActionWidget)list).Activate();
            list.Move(0, 0);
            list.Resize(360, 360);
            list.Lower();


            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;;
        }
Esempio n. 28
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;;
        }
Esempio n. 29
0
        protected override void OnElementChanged(ElementChangedEventArgs <CircleSurfaceView> e)
        {
            if (Control == null)
            {
                var box = new Box(XForms.NativeParent);
                box.SetLayoutCallback(OnLayout);
                _surfaceLayout      = new ELayout(box);
                _circleSurface      = new CircleSurface(_surfaceLayout);
                _circleSurfaceItems = new Dictionary <ICircleSurfaceItem, ICircleWidget>();
                box.PackEnd(_surfaceLayout);
                _surfaceLayout.Show();
                SetNativeControl(box);
            }

            if (e.NewElement != null)
            {
                e.NewElement.CircleSurface = _circleSurface;
                var items = e.NewElement.CircleSurfaceItems as ObservableCollection <ICircleSurfaceItem>;
                items.CollectionChanged += OnCircleSurfaceItemsChanged;
                foreach (var item in items)
                {
                    AddCircleSurfaceItem(item);
                }
            }

            if (e.OldElement != null)
            {
                var items = e.OldElement.CircleSurfaceItems as ObservableCollection <ICircleSurfaceItem>;
                foreach (var item in items)
                {
                    RemoveCircleSurfaceItem(item);
                }
                items.CollectionChanged -= OnCircleSurfaceItemsChanged;
            }

            base.OnElementChanged(e);
        }
Esempio n. 30
0
 public WatchDateTimePicker(EvasObject parent, CircleSurface surface) : base()
 {
     _surface = surface;
     Realize(parent);
     UpdateMode();
 }