Exemplo n.º 1
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.º 2
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;;
            list.Geometry      = window.GetInnerSquare();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Represents the immutable class for the attach panel.
        /// </summary>
        /// <since_tizen> 4 </since_tizen>
        /// <param name="conformant">The caller's conformant.</param>
        /// <exception cref="OutOfMemoryException">Thrown when an attempt to allocate the memory fails.</exception>
        /// <exception cref="InvalidOperationException">Thrown when the AttachPanel already exists or the <paramref name="conformant"/> is not a conformant object.</exception>
        public AttachPanel(Conformant conformant)
        {
            if (conformant == IntPtr.Zero)
            {
                throw new ArgumentNullException("Use the value property, not null value");
            }

            IntPtr candidateAttachPanel = new IntPtr();

            Interop.AttachPanel.ErrorCode err = Interop.AttachPanel.CreateAttachPanel(conformant, ref candidateAttachPanel);
            CheckException(err);

            Tizen.Log.Debug("AttachPanelSharp", "Success to create an AttachPanel Instance");
            isCreationSucceed = true;
            _attachPanel      = candidateAttachPanel;

            if (_eventEventHandler == null)
            {
                StateEventListenStart();
            }

            if (_resultEventHandler == null)
            {
                ResultEventListenStart();
            }
        }
Exemplo n.º 4
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.º 5
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.º 6
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.º 7
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.º 8
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.º 9
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.º 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
            };

            _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.º 11
0
        public override void Run(Window window)
        {
            Background bg = new Background(window)
            {
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1,
                Color      = Color.Black
            };

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

            Conformant conformant = new Conformant(window);

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

            box.Geometry = window.GetInnerSquare();
            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.º 12
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.º 13
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.º 14
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();
            grid.Geometry = window.GetInnerSquare();
        }
        public virtual Conformant CreateComformant(Window window)
        {
            Conformant conformant = new Conformant(window);

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

            conformant.Show();
            GenList list = new GenList(window)
            {
                Homogeneous = true
            };

            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;;
            list.ItemActivated     += List_ItemActivated;
            list.ItemUnselected    += List_ItemUnselected;
            list.ItemPressed       += List_ItemPressed;
            list.ItemRealized      += List_ItemRealized;
            list.ItemReleased      += List_ItemReleased;
            list.ItemUnrealized    += List_ItemUnrealized;
            list.ItemLongPressed   += List_ItemLongPressed;
            list.ItemDoubleClicked += List_ItemDoubleClicked;

            list.Geometry = window.GetInnerSquare();
        }
Exemplo n.º 17
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.º 18
0
        public virtual void Run(Window window)
        {
            Conformant comformant = CreateComformant(window);
            var        content    = CreateContent(window);

            comformant.SetContent(content);
        }
Exemplo n.º 19
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);
            };
        }
        //private Naviframe _naviframe;

        /// <summary>
        /// Initializes a new instance of the Window class.
        /// </summary>
        public ReactWindow(string name) : base(name)
        {
            Log.Info(ReactConstants.Tag, "## Contruct ReactWindow [BGN] ## ");

            // size
            //var size = ScreenSize;
            //Resize(size.Width, size.Height);
            //BackgroundColor = Color.Gray;

            // events

            /*
             * Deleted += (sender, e) =>
             * {
             *  Closed?.Invoke(this, EventArgs.Empty);
             * };
             * CloseRequested += (sender, e) =>
             * {
             *  Unrealize();
             * };
             *
             * KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, false);
             * KeyUp += (s, e) =>
             * {
             *  if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
             *  {
             *      BackButtonPressed?.Invoke(this, EventArgs.Empty);
             *  }
             * };
             */
            // active window
            //Active();

            //AutoDeletion = false;   // f**k off here
            //Show();
            this.KeyGrab(EvasKeyEventArgs.PlatformBackButtonName, false);
            this.KeyGrab("XF86Red", false);
            this.KeyUp += (s, e) =>
            {
                if (e.KeyName == EvasKeyEventArgs.PlatformBackButtonName)
                {
                    Log.Info(ReactConstants.Tag, "============================Back key is pressed");
                    BackButtonPressed?.Invoke(this, EventArgs.Empty);
                }
                else if (e.KeyName == "XF86Red")
                {
                    Log.Info(ReactConstants.Tag, "============================Red key is pressed");
                    RedButtonPressed?.Invoke(this, EventArgs.Empty);
                }
            };
            // conformant container
            _conformant = new Conformant(this);
            _conformant.SetAlignment(-1.0, -1.0);   // fill
            _conformant.SetWeight(1.0, 1.0);        // expand
            _conformant.Show();

            Log.Info(ReactConstants.Tag, "## Contruct ReactWindow [END] ## ");
            //
            // Initialize();
        }
        /// <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.º 22
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.º 23
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.º 24
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);
            });
        }
Exemplo n.º 25
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
            };

            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;

            var square = window.GetInnerSquare();

            list.Geometry   = new Rect(square.X, square.Y, square.Width, square.Height * 3 / 4);
            button.Geometry = new Rect(square.X, square.Y + square.Height * 3 / 4, square.Width, square.Height / 4);
        }
        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.º 27
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.º 28
0
        public override void Run(Window window)
        {
            Background bg = new Background(window)
            {
                Color      = Color.Gray,
                AlignmentX = -1,
                AlignmentY = -1,
                WeightX    = 1,
                WeightY    = 1
            };

            bg.Show();
            bg.Lower();

            window.AddResizeObject(bg);
            Conformant conformant = new Conformant(window);

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

            GenItemClass fullyCustomizeClass = new GenItemClass("full")
            {
                GetContentHandler = (obj, part) =>
                {
                    Log.Debug(string.Format("{0} part create requested", part));
                    var btn = new Button(window)
                    {
                        AlignmentX = -1,
                        WeightX    = 1,
                        Text       = (string)(obj as ItemContext).Data
                    };
                    btn.MinimumHeight             = 100;
                    (obj as ItemContext).Realized = btn;
                    (obj as ItemContext).Item?.UpdateField("elm.swallow.content", GenListItemFieldType.None);
                    return(btn);
                },
            };

            for (int i = 0; i < 100; i++)
            {
                var context = new ItemContext();
                context.Data = string.Format("{0} Item", i);
                context.Item = list.Append(fullyCustomizeClass, context, GenListItemType.Normal);
            }

            list.Show();
            list.ItemSelected += List_ItemSelected;

            list.Geometry = window.GetInnerSquare();
        }
Exemplo n.º 29
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.º 30
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;
        }