Exemplo n.º 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);
            };

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

            navi.Show();
            conformant.SetContent(navi);
        }
Exemplo n.º 2
0
        public override void Run(Window window)
        {
            Background bg = new Background(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Color      = Color.Yellow
            };

            bg.Show();
            window.AddResizeObject(bg);

            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

            Check check = new Check(window)
            {
                AlignmentX = -1,
                AlignmentY = 0.9,
                WeightX    = 1,
                WeightY    = 0.1,
                Text       = "Select All",
            };

            check.Show();

            Entry entry = new Entry(window)
            {
                AlignmentX   = -1,
                AlignmentY   = 0.1,
                WeightX      = 1,
                WeightY      = 1,
                IsSingleLine = true,
                Text         = "Hello, Tizen !!!"
            };

            entry.Show();

            check.StateChanged += (object sender, CheckStateChangedEventArgs e) =>
            {
                if (e.NewState == true)
                {
                    entry.SelectAll();
                }
                else
                {
                    entry.SelectNone();
                }
            };

            box.PackEnd(check);
            box.PackEnd(entry);
        }
Exemplo n.º 3
0
        private void EnsureMainWindow()
        {
            if (Window != null)
            {
                return;
            }

            Window = new TizenWindow("ElmSharpApp")
            {
                AvailableRotations =
                    DisplayRotation.Degree_0 |
                    DisplayRotation.Degree_180 |
                    DisplayRotation.Degree_270 |
                    DisplayRotation.Degree_90
            };
            Window.IndicatorMode      = IndicatorMode.Hide;
            Window.BackButtonPressed += (s, e) =>
            {
                if (!SystemNavigationManager.GetForCurrentView().RequestBack())
                {
                    Exit();
                }
            };
            Window.Show();

            Canvas = new UnoCanvas(Window);
            Canvas.Show();

            var conformant = new Conformant(Window);

            conformant.Show();
            conformant.SetContent(Canvas);
        }
Exemplo n.º 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);
        }
Exemplo n.º 5
0
        private Box CreateBaseUI(Window window)
        {
            // Create Background
            Background background = new Background(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Color      = Color.White
            };

            background.Show();
            window.AddResizeObject(background);

            // Create Conformant
            Conformant conformant = new Conformant(window);

            conformant.Show();

            // Create Box for all contents
            Box box = new Box(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            box.Show();
            conformant.SetContent(box);

            return(box);
        }
Exemplo n.º 6
0
        public override void Run(Window win)
        {
            Conformant conformant = new Conformant(win);

            conformant.Show();

            Box box = new Box(win);

            box.Show();

            // AcceleratorLabel
            Label acceleratorLabel = new Label(win)
            {
                Text = "AcceleratorLabel"
            };

            Label alertLabel = new Label(win)
            {
                Text = "Alert"
            };

            Label Animation = new Label(win)
            {
            };

            conformant.SetContent(conformant);
        }
Exemplo n.º 7
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;;
        }
Exemplo n.º 8
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Background bg = new Background(window);

            bg.Color = Color.Black;
            bg.Show();
            conformant.SetContent(bg);

            DateTimeSelector dateTime = new DateTimeSelector(window)
            {
                DateTime = DateTime.Today,
                Style    = "time_layout",
                Format   = "%I:%M %p"
            };

            dateTime.Geometry = new Rect(0, 0, window.ScreenSize.Width, window.ScreenSize.Height);
            dateTime.Show();

            dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) =>
            {
                Log.Debug($"Old DateTime={e.OldDate}");
                Log.Debug($"New DateTime={e.NewDate}");
                Log.Debug($"Current DateTime={dateTime.DateTime}");
            };
        }
Exemplo n.º 9
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);
        }
Exemplo n.º 10
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box box = new Box(window);

            conformant.SetContent(box);
            box.Show();

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

            Button button = new Button(window)
            {
                Text       = "Remove",
                AlignmentX = -1,
                AlignmentY = -1,
            };

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

            GenListItem[] itemArr = new GenListItem[9];
            for (int i = 0; i < 9; i++)
            {
                itemArr[i] = list.Append(defaultClass, string.Format("{0} Item", i));
            }

            int idx = 0;

            button.Clicked += (s, e) =>
            {
                if (idx < 9)
                {
                    Console.WriteLine("GenListItem deleted");
                    itemArr[idx++].Delete();
                }
            };
            button.Show();

            list.Show();
            list.ItemSelected   += List_ItemSelected;
            list.ItemRealized   += List_ItemRealized;
            list.ItemUnrealized += List_ItemUnrealized;

            box.PackEnd(list);
            box.PackEnd(button);
        }
Exemplo n.º 11
0
        void makeUI()
        {
            try
            {
                Conformant conformant = new Conformant(Window);
                conformant.Show();

                Box box = new Box(Window)
                {
                    AlignmentX      = -1,
                    AlignmentY      = -1,
                    WeightX         = 1,
                    WeightY         = 1,
                    BackgroundColor = Color.Orange,
                };
                conformant.SetContent(box);
                box.Show();

                Button btn = new Button(Window)
                {
                    Text       = "ElmSharpWidget",
                    AlignmentX = -1,
                    AlignmentY = -1,
                    WeightX    = 1,
                    WeightY    = 1,
                };
                btn.Clicked += Btn_Clicked;
                box.PackEnd(btn);
                btn.Show();
            }
            catch (Exception e)
            {
                Console.WriteLine("Exception : " + e.Message);
            }
        }
Exemplo n.º 12
0
        private void CreateFirstPage(IEnumerable <TestCaseBase> testCases)
        {
            _firstPageWindow = CreateWindow();
            Console.WriteLine("Screen DPI : {0}", _firstPageWindow.ScreenDpi.X);
            Conformant conformant = new Conformant(_firstPageWindow);

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

            box.Show();
            var bg = new Background(_firstPageWindow);

            bg.Color = Color.White;
            bg.SetContent(box);
            conformant.SetContent(bg);

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

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (data, part) =>
                {
                    TestCaseBase tc = data as TestCaseBase;
                    return(tc == null ? "" : tc.TestName);
                }
            };

            foreach (var tc in testCases.Where <TestCaseBase>((tc) => tc.TargetProfile.HasFlag(GetTargetProfile())))
            {
                list.Append(defaultClass, tc);
            }

            if (Profile == "wearable")
            {
                list.Prepend(defaultClass, null);
                list.Append(defaultClass, null);
            }

            list.ItemSelected += (s, e) =>
            {
                TestCaseBase tc = e.Item.Data as TestCaseBase;
                StartTCFromList(tc);
            };
            list.Show();

            box.PackEnd(list);
        }
Exemplo n.º 13
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);
            };
        }
Exemplo n.º 14
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);
        }
Exemplo n.º 15
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            GenGrid grid = new GenGrid(window)
            {
                AlignmentX     = -1,
                AlignmentY     = -1,
                WeightX        = 1,
                WeightY        = 1,
                ItemAlignmentX = -1,
                ItemAlignmentY = -1,
                ItemWidth      = window.ScreenSize.Width / 3,
                ItemHeight     = window.ScreenSize.Width / 3,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible
            };

            GenItemClass defaultClass = new GenItemClass("default")
            {
                GetTextHandler = (obj, part) =>
                {
                    Color item = (Color)obj;
                    return(String.Format("#{0:X}{1:X}{2:X}", item.R, item.G, item.B));
                },
                GetContentHandler = (obj, part) =>
                {
                    Color item = (Color)obj;
                    Console.WriteLine("{0} part create requested", part);
                    if (part == "elm.swallow.icon")
                    {
                        var colorbox = new Rectangle(window)
                        {
                            Color = item
                        };
                        return(colorbox);
                    }
                    return(null);
                }
            };

            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);
                var   griditem = grid.Append(defaultClass, color);
                griditem.SetTooltipText("AAAAAA");
                //griditem.TooltipStyle = "transparent";

                griditem.TooltipContentDelegate = () => { return(new Button(window)); };
            }

            grid.Show();
            conformant.SetContent(grid);
        }
Exemplo n.º 16
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            GenList list = new GenList(window)
            {
                Homogeneous = true,
                AlignmentX  = -1,
                AlignmentY  = -1,
                WeightX     = 1,
                WeightY     = 1
            };

            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.Show();
            list.ItemSelected += List_ItemSelected;;
            conformant.SetContent(list);
        }
Exemplo n.º 17
0
        public virtual void Run(Window window)
        {
            Conformant comformant = CreateComformant(window);
            var        content    = CreateContent(window);

            comformant.SetContent(content);
        }
        /// <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();
        }
Exemplo n.º 19
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

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

            scroller.Show();
            conformant.SetContent(scroller);

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

            box.Show();
            scroller.SetContent(box);

            ProgressBar pb1 = new ProgressBar(window)
            {
                Text       = "ProgressBar Test",
                Style      = "process",
                Value      = 0.1,
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            pb1.PlayPulse();
            pb1.Show();

            ProgressBar pb2 = new ProgressBar(window)
            {
                Text       = "ProgressBar Test",
                Style      = "process/small",
                Value      = 0.1,
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            pb2.PlayPulse();
            pb2.Show();

            box.PackEnd(pb1);
            box.PackEnd(pb2);
        }
Exemplo n.º 20
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);
            });
        }
/*
 *      /// <summary>
 *      /// INavigation Object to handle page stack
 *      /// </summary>
 *      public Naviframe Navigator
 *      {
 *          get { return _naviframe; }
 *      }
 */

        /// <summary>
        /// Sets the main page of Window.
        /// </summary>
        /// <param name="content">ElmSharp.EvasObject type page to be set.</param>
        public void SetMainPage(EvasObject content)
        {
            Log.Info(ReactConstants.Tag, "### Main Page:" + content);

            // Navigator.Push(content, "Instagram");

            _conformant.SetContent(content);
        }
        void CreateTestPage(Window window)
        {
            var conformant = new Conformant(window);

            conformant.Show();

            var circleScroller = new Scroller(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                VerticalScrollBarVisiblePolicy   = ScrollBarVisiblePolicy.Invisible,
                HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Visible,
                ScrollBlock = ScrollBlock.Vertical,
                HorizontalPageScrollLimit = 1,
            };

            circleScroller.SetPageSize(1.0, 1.0);
            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));

            var pages = GetGalleryPage();

            foreach (var tc in pages)
            {
                if (tc.RunningOnNewWindow)
                {
                    var view = CreateNewWindow(box, tc);
                    view.Show();
                    box.PackEnd(view);
                }
                else
                {
                    var view = tc.CreateContent(box);
                    if (view != null)
                    {
                        view.Show();
                        box.PackEnd(view);
                    }
                }
            }

            circleScroller.SetContent(box);
            conformant.SetContent(circleScroller);
        }
Exemplo n.º 23
0
        void InitializeWindow()
        {
            Debug.Assert(MainWindow != null, "Window cannot be null");

            MainWindow.Active();
            MainWindow.Show();
            var conformant = new Conformant(MainWindow);

            conformant.Show();

            // Create the base (default) layout for the application
            var layout = new ELayout(conformant);

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

            BaseLayout = layout;
            conformant.SetContent(BaseLayout);
            MainWindow.AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_90 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270;

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

            MainWindow.RotationChanged += (sender, e) =>
            {
                switch (MainWindow.Rotation)
                {
                case 0:
                    Device.Info.CurrentOrientation = Internals.DeviceOrientation.PortraitUp;
                    break;

                case 90:
                    Device.Info.CurrentOrientation = Internals.DeviceOrientation.LandscapeLeft;
                    break;

                case 180:
                    Device.Info.CurrentOrientation = Internals.DeviceOrientation.PortraitDown;
                    break;

                case 270:
                    Device.Info.CurrentOrientation = Internals.DeviceOrientation.LandscapeRight;
                    break;
                }
            };

            MainWindow.BackButtonPressed += (sender, e) =>
            {
                if (_platform != null)
                {
                    if (!_platform.SendBackButtonPressed())
                    {
                        Exit();
                    }
                }
            };
        }
Exemplo n.º 24
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();

            Background bg = new Background(window);

            bg.Color = Color.Black;
            bg.Show();
            conformant.SetContent(bg);

            DateTimeSelector dateTime = new DateTimeSelector(window)
            {
                MinimumDateTime = new DateTime(2015, 1, 1),
                MaximumDateTime = DateTime.Now,
                DateTime        = DateTime.Now
            };

            dateTime.Geometry = new Rect(0, 0, window.ScreenSize.Width, window.ScreenSize.Height);
            dateTime.Show();

            dateTime.DateTimeChanged += (object sender, DateChangedEventArgs e) =>
            {
                Log.Debug($"Old DateTime={e.OldDate}");
                Log.Debug($"New DateTime={e.NewDate}");
                Log.Debug($"Current DateTime={dateTime.DateTime}");
            };

            Button btn_left = new Button(window)
            {
                Style    = "popup/circle/left",
                Text     = "Left",
                Geometry = new Rect(0, 0, 64, 360)
            };

            btn_left.Show();

            Button btn_right = new Button(window)
            {
                Style    = "popup/circle/right",
                Text     = "Right",
                Geometry = new Rect(window.ScreenSize.Width - 64, 0, 64, 360)
            };

            btn_right.Show();

            btn_left.Clicked += (s, e) =>
            {
                dateTime.DateTime -= new TimeSpan(1, 0, 0, 0, 0);
            };

            btn_right.Clicked += (s, e) =>
            {
                dateTime.DateTime += new TimeSpan(1, 0, 0, 0, 0);
            };
        }
Exemplo n.º 25
0
        void Initialize()
        {
            Window window = new Window("ElmSharpApp")
            {
                AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90
            };

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

            var conformant = new Conformant(window);

            conformant.Show();

            var view = new SKCanvasView(conformant);

            conformant.SetContent(view);
            view.Show();

            view.PaintSurface += OnRender;

            loop            = new AnimatorLoop();
            loop.Processed += (s, e) =>
            {
                view.Invalidate();
            };

            root = new World((int)(1 / loop.FrameTime * 3));

            loop.Start();

            gestureLayer = new GestureLayer(conformant);
            gestureLayer.Attach(view);
            gestureLayer.SetTapCallback(GestureType.Tap, GestureState.Start, data => {
                var args = new TouchEventArgs {
                    X = data.X, Y = data.Y, State = TouchState.Start
                };
                root.DispatchEvent(args);
            });
            gestureLayer.SetTapCallback(GestureType.Tap, GestureState.End, data => {
                var args = new TouchEventArgs {
                    X = data.X, Y = data.Y, State = TouchState.End
                };
                root.DispatchEvent(args);
            });
            gestureLayer.SetTapCallback(GestureType.Tap, GestureState.Abort, data => {
                var args = new TouchEventArgs {
                    X = data.X, Y = data.Y, State = TouchState.Abort
                };
                root.DispatchEvent(args);
            });

            //Drawable.DebugSquare = true;
        }
Exemplo n.º 26
0
        public override void Run(Window window)
        {
            Conformant conformant = new Conformant(window);

            conformant.Show();
            Box outterBox = new Box(window)
            {
                AlignmentX      = -1,
                AlignmentY      = -1,
                WeightX         = 1,
                WeightY         = 1,
                IsHorizontal    = false,
                BackgroundColor = Color.Aqua,
            };

            outterBox.Show();

            Toolbar toolbar = new Toolbar(window)
            {
                AlignmentX = -1,
                WeightX    = 1,
            };

            var rnd = new Random();

            toolbar.BackgroundColor = Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
            toolbar.Show();
            outterBox.PackEnd(toolbar);

            toolbar.Selected += (s, e) =>
            {
                e.Item.DeletePartColor("bg");
            };

            Label lb = new Label(window)
            {
                Text = "Please, click an item for delete part color",
            };

            lb.Show();
            outterBox.PackEnd(lb);

            for (int i = 0; i < 5; i++)
            {
                ToolbarItem item    = toolbar.Append(string.Format("{0} home", i), "home");
                Color       bgColor = Color.FromRgb(rnd.Next(255), rnd.Next(255), rnd.Next(255));
                item.SetPartColor("bg", bgColor);

                item.Clicked += (s, e) =>
                {
                    lb.Text = (s as ToolbarItem).Text + " clicked";
                };
            }


            conformant.SetContent(outterBox);
        }
Exemplo n.º 27
0
        public override void Run(Window window)
        {
            Conformant conf = new Conformant(window);

            conf.Show();

            MoreOption option = new MoreOption(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Direction  = MoreOptionDirection.Right
            };

            option.Show();
            //option.Move(window.ScreenSize.Width/2, window.ScreenSize.Height/2);
            conf.SetContent(option);

            option.Items.Add(new ColorMoreOptionItem(window, "icon_aquamarine_260_me", Color.FromHex("#800000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_auamarine_260_me", Color.FromHex("#800012")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_azure_215_me", Color.FromHex("#800034")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_beige_330_me", Color.FromHex("#800056")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_blue_45_me", Color.FromHex("#800067")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_brown_90_me", Color.FromHex("#800087")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_cyan_230_me", Color.FromHex("#800023")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_firebrick_95_me", Color.FromHex("#804300")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_gold_75_me", Color.FromHex("#854000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_green_60_me", Color.FromHex("#800340")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_honeydew_285_me", Color.FromHex("#823000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_ivory_315_me", Color.FromHex("#806700")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_khaki_360_me", Color.FromHex("#80ab00")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_lime_300_me", Color.FromHex("#800c30")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_maroon_120_me", Color.FromHex("#8fd000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_me", Color.FromHex("#800000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_orchid_160_me", Color.FromHex("#8d3000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_pink_145_me", Color.FromHex("#8002d0")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_purple_200_me", Color.FromHex("#8ff000")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_red_30_me", Color.FromHex("#800fa0")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_snow_75_me", Color.FromHex("#80f200")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_snow_80_me", Color.FromHex("#80d200")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_teal_245_me", Color.FromHex("#80f300")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_violet_180_me", Color.FromHex("#80fb00")));
            option.Items.Add(new ColorMoreOptionItem(window, "icon_yellow_345_me", Color.FromHex("#800b30")));

            option.Opened   += (s, e) => Log.Debug(TestName, "Opened!");
            option.Closed   += (s, e) => Log.Debug(TestName, "Closed!");
            option.Selected += (s, e) => Log.Debug(TestName, "Selected! : " + e?.Item?.MainText);
            option.Clicked  += (s, e) => Log.Debug(TestName, "Clicked! : " + e?.Item?.MainText);

            option.Opened += (s, e) => option.BackgroundColor = Color.Aqua;
            option.Closed += (s, e) => option.BackgroundColor = Color.Black;

            option.Selected += (s, e) => option.BackgroundColor = (e?.Item as ColorMoreOptionItem).Color;
            option.Clicked  += (s, e) => option.BackgroundColor = Deep((e?.Item as ColorMoreOptionItem).Color);
        }
Exemplo n.º 28
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);
        }
Exemplo n.º 29
0
        public override void Run(Window window)
        {
            Background bg = new Background(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Color      = Color.White
            };

            bg.Show();
            window.AddResizeObject(bg);

            Conformant conformant = new Conformant(window);

            conformant.Show();
            Scroller scroller = new Scroller(window);

            scroller.Show();
            conformant.SetContent(scroller);
            Box box = new Box(window);

            box.Show();
            scroller.SetContent(box);

            List <string> iconList = new List <string> {
                "home", "close", "apps", "arrow_up", "arrow_down", "arrow_left", "arrow_right", "chat", "clock", "delete", "edit", "refresh", "folder", "file",
                "menu/home", "menu/close", "menu/apps", "menu/arrow_up", "menu/arrow_down", "menu/arrow_left", "menu/arrow_right", "menu/chat", "menu/clock", "menu/delete", "menu/edit", "menu/refresh", "menu/folder",
                "menu/file", "media_player/forward", "media_player/info", "media_player/next", "media_player/pause", "media_player/play", "media_player/prev", "media_player/rewind", "media_player/stop"
            };

            foreach (var iconName in iconList)
            {
                Label label = new Label(window)
                {
                    Text = iconName,
                };
                Icon icon = new Icon(window)
                {
                    IconLookupOrder  = IconLookupOrder.ThemeFirst,
                    StandardIconName = iconName,
                    AlignmentX       = -1,
                    AlignmentY       = -1,
                    WeightX          = 1,
                    WeightY          = 1,
                    MinimumHeight    = 100,
                    MinimumWidth     = 100,
                };
                icon.Show();
                label.Show();
                box.PackEnd(icon);
                box.PackEnd(label);
            }
        }
Exemplo n.º 30
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);
            });
        }