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); }
protected override void OnElementChanged(ElementChangedEventArgs <NavigationPage> e) { if (_naviFrame == null) { _naviFrame = new Naviframe(Forms.NativeParent); _naviFrame.PreserveContentOnPop = true; _naviFrame.DefaultBackButtonEnabled = false; _naviFrame.AnimationFinished += OnAnimationFinished; SetNativeView(_naviFrame); _naviItemMap = new Dictionary <Page, NaviItem>(); } if (_toolbarTracker == null) { _toolbarTracker = new ToolbarTracker(); _toolbarTracker.CollectionChanged += OnToolbarCollectionChanged; } if (e.OldElement != null) { var navigation = e.OldElement as INavigationPageController; navigation.PopRequested -= OnPopRequested; navigation.PopToRootRequested -= OnPopToRootRequested; navigation.PushRequested -= OnPushRequested; navigation.RemovePageRequested -= OnRemovePageRequested; navigation.InsertPageBeforeRequested -= OnInsertPageBeforeRequested; var pageController = e.OldElement as IPageController; pageController.InternalChildren.CollectionChanged -= OnPageCollectionChanged; } if (e.NewElement != null) { var navigation = e.NewElement as INavigationPageController; navigation.PopRequested += OnPopRequested; navigation.PopToRootRequested += OnPopToRootRequested; navigation.PushRequested += OnPushRequested; navigation.RemovePageRequested += OnRemovePageRequested; navigation.InsertPageBeforeRequested += OnInsertPageBeforeRequested; var pageController = e.NewElement as IPageController; pageController.InternalChildren.CollectionChanged += OnPageCollectionChanged; foreach (Page page in pageController.InternalChildren) { _naviItemMap[page] = _naviFrame.Push(Platform.GetOrCreateRenderer(page).NativeView, SpanTitle(page.Title)); page.PropertyChanged += NavigationBarPropertyChangedHandler; UpdateHasNavigationBar(page); } _toolbarTracker.Target = e.NewElement; _previousPage = e.NewElement.CurrentPage; } base.OnElementChanged(e); }
public void SetPage(Page newRoot) { if (Page != null) { var copyOfStack = new List <NaviItem>(_internalNaviframe.NavigationStack); for (var i = 0; i < copyOfStack.Count; i++) { copyOfStack[i].Delete(); } foreach (Page page in _navModel.Roots) { var renderer = Platform.GetRenderer(page); renderer?.Dispose(); } _navModel = new NavigationModel(); } if (newRoot == null) { return; } _navModel.Push(newRoot, null); Page = newRoot; #pragma warning disable CS0618 // Type or member is obsolete // The Platform property is no longer necessary, but we have to set it because some third-party // library might still be retrieving it and using it Page.Platform = this; #pragma warning restore CS0618 // Type or member is obsolete IVisualElementRenderer pageRenderer = Platform.CreateRenderer(Page); var naviItem = _internalNaviframe.Push(pageRenderer.NativeView); naviItem.TitleBarVisible = false; // Make naviitem transparent if parent window is transparent. // Make sure that this is only for _navModel._naviTree. (not for _navModel._modalStack) // In addtion, the style of naviItem is only decided before the naviItem pushed into Naviframe. (not on-demand). if (HasAlpha) { naviItem.Style = "default/transparent"; } ((Application)Page.RealParent).NavigationProxy.Inner = this; Device.StartTimer(TimeSpan.Zero, () => { CurrentPageController?.SendAppearing(); return(false); }); }
public void SetPage(Page newRoot) { if (Page != null) { var copyOfStack = new List <NaviItem>(_naviframe.NavigationStack); for (var i = 0; i < copyOfStack.Count; i++) { copyOfStack[i].Delete(); } foreach (Page page in _navModel.Roots) { var renderer = GetRenderer(page); (page as IPageController)?.SendDisappearing(); renderer?.Dispose(); } _navModel = new NavigationModel(); } if (newRoot == null) { return; } _navModel.Push(newRoot, null); Page = newRoot; Page.Platform = this; IVisualElementRenderer pageRenderer = AttachRenderer(Page); var naviItem = _naviframe.Push(pageRenderer.NativeView); naviItem.TitleBarVisible = false; // Make naviitem transparent if Forms.Context.MainWindow is transparent. // Make sure that this is only for _navModel._naviTree. (not for _navModel._modalStack) // In addtion, the style of naviItem is only decided before the naviItem pushed into Naviframe. (not on-demand). if (Forms.Context.MainWindow.Alpha) { naviItem.Style = "default/transparent"; } ((Application)Page.RealParent).NavigationProxy.Inner = this; Device.StartTimer(TimeSpan.Zero, () => { CurrentPageController?.SendAppearing(); return(false); }); }
protected override void OnElementReady() { base.OnElementReady(); var pageController = Element as IPageController; pageController.InternalChildren.CollectionChanged += OnPageCollectionChanged; foreach (Page page in pageController.InternalChildren) { _naviItemMap[page] = _naviFrame.Push(CreateNavItem(page), SpanTitle(page.Title)); page.PropertyChanged += NavigationBarPropertyChangedHandler; UpdateHasNavigationBar(page); } }
EvasObject CreatePage(Window parent) { Box box = new Box(parent); box.Show(); Label label = new Label(parent) { Text = string.Format("{0} Page", _sequence++), WeightX = 1, AlignmentX = -1, }; Button push = new Button(parent) { Text = "Push", WeightX = 1, AlignmentX = -1, }; Button pop = new Button(parent) { Text = "pop", WeightX = 1, AlignmentX = -1, }; label.Show(); push.Show(); pop.Show(); push.Clicked += (s, e) => { _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; pop.Clicked += (s, e) => { var item = _navi.NavigationStack.LastOrDefault(); int nativePointer = (int)(IntPtr)(item.Content); Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer); _navi.Pop(); Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer); }; push.Resize(500, 100); pop.Resize(500, 100); label.Resize(500, 100); box.SetLayoutCallback(() => { Console.WriteLine("Layout callback with : {0}", box.Geometry); var rect = box.Geometry; label.Move(rect.X, rect.Y); push.Move(rect.X, rect.Y + 100); pop.Move(rect.X, rect.Y + 200); }); box.PackEnd(label); box.PackEnd(push); box.PackEnd(pop); return(box); }
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); }
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); }
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); }
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); }); }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); square = window.GetInnerSquare(); Naviframe navi = new Naviframe(window) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true, Geometry = square }; box = new Box(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Geometry = new Rect(square.X, square.Y, square.Width, square.Height) }; box.Show(); box2 = new Box(box); box2.Geometry = new Rect(square.X, square.Y + square.Height / 6, square.Width, square.Height / 2); box2.Show(); box.PackEnd(box2); list = new GenList(window) { Homogeneous = true, AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Style = "solid/default" }; box.PackEnd(list); navi.Push(box, "Performance"); InitializeListItem(); list.Changed += List_Changed; list.ScrollAnimationStarted += List_ScrollAnimationStarted; list.ScrollAnimationStopped += List_ScrollAnimationStopped; list.Show(); navi.Show(); conformant.SetContent(navi); }
protected override void OnElementChanged(ElementChangedEventArgs <CustomTabbedPage> e) { if (_tpage == null) { _navi = new Naviframe(Forms.NativeParent); _tpage = new Toolbar(Forms.NativeParent) { Style = "tabbar", Text = Element.Title, ShrinkMode = ToolbarShrinkMode.Expand, SelectionMode = ToolbarSelectionMode.Always, TransverseExpansion = true, }; _tpage.Show(); _tpage.Selected += OnCurrentPageChanged; _box = new Box(Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _box.IsHorizontal = true; _box.Show(); _scroller = new Scroller(Forms.NativeParent) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _scroller.Style = "tabbar"; _scroller.HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Visible; _scroller.SetPageSize(App.ScreenWidth, 0); _scroller.HorizontalPageScrollLimit = 1; _scroller.PageScrolled += OnPageScrolled; _scroller.SetContent(_box); _scroller.Show(); var item = _navi.Push(_scroller); item.Style = "tabbar/notitle"; item.SetPartContent("tabbar", _tpage); SetNativeView(_navi); } base.OnElementChanged(e); }
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"); }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); Naviframe navi = new Naviframe(window) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true }; box = new Box(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; box.Show(); box2 = new Box(box); //elm_box_padding_set(box2, ELM_SCALE_SIZE(10), ELM_SCALE_SIZE(10)); ºÎºÐ ºüÁü. box2.Show(); box.PackEnd(box2); list = new GenList(window) { Homogeneous = true, AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Style = "solid/default" }; box.PackEnd(list); navi.Push(box, "Performance"); InitializeListItem(); list.Changed += List_Changed; list.ScrollAnimationStarted += List_ScrollAnimationStarted; list.ScrollAnimationStopped += List_ScrollAnimationStopped; list.Show(); navi.Show(); conformant.SetContent(navi); }
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()); }; }
public override void Run(Window window) { accessRoleValues = Enum.GetValues(typeof(AccessRole)); Conformant conformant = new Conformant(window); conformant.Show(); navi = new Naviframe(window) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true }; navi.Push(CreatePage(window, "Main page"), "first page"); navi.Show(); conformant.SetContent(navi); }
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); }; }
void Initialize() { var conformant = new Conformant(_mainWindow); conformant.Show(); _navi = new Naviframe(_mainWindow) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true }; _navi.Show(); conformant.SetContent(_navi); var rootPage = CreateMainPage(_mainWindow); _navi.Push(rootPage); _mainWindow.BackButtonPressed += (sender, e) => { bool handled = _currentPage?.SendBackButtonPressed() ?? false; if (!handled) { if (_navi.NavigationStack.Count == 1) { Exit(); } _currentPage = null; _navi.Pop(); } }; _navi.Popped += (sender, e) => { _currentPage = null; }; }
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;; }
protected override void OnElementChanged(ElementChangedEventArgs <ColoredTabbedPage> e) { if (_tpage == null) { _navi = new Naviframe(Forms.Context.MainWindow); _tpage = new Toolbar(Forms.Context.MainWindow) { Style = "tabbar", Text = Element.Title, ShrinkMode = ToolbarShrinkMode.Expand, SelectionMode = ToolbarSelectionMode.Always, TransverseExpansion = true, }; _tpage.Show(); _tpage.SelectionMode = ToolbarSelectionMode.Default; _tpage.Selected += OnCurrentPageChanged; _box = new Box(Forms.Context.MainWindow) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, }; _box.Show(); var item = _navi.Push(_box); item.Style = "tabbar/notitle"; item.SetPartContent("tabbar", _tpage); SetNativeControl(_navi); } base.OnElementChanged(e); }
EvasObject CreatePage(Window parent) { Table table = new Table(parent); table.Geometry = square; table.Show(); Label label = new Label(parent) { Text = string.Format("<span color=#000000 font_size=15>{0} Page</span>", _sequence++), WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X, square.Y, square.Width, square.Height / 9) }; Button push = new Button(parent) { Text = "<span color=#000000 font_size=15>Push</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X, square.Y + square.Height / 9, square.Width / 2, square.Height / 9) }; Button pop = new Button(parent) { Text = "<span color=#000000 font_size=15>pop</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height / 9, square.Width / 2, square.Height / 9) }; Button insertBeforeTop = new Button(parent) { Text = "<span color=#000000 font_size=15>insertBeforeTop</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X, square.Y + square.Height / 9 * 2, square.Width / 2, square.Height / 9) }; Button insertAfterTop = new Button(parent) { Text = "<span color=#000000 font_size=15>insertAfterTop</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height / 9 * 2, square.Width / 2, square.Height / 9) }; Button removeTop = new Button(parent) { Text = "<span color=#000000 font_size=15>removeTop</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X, square.Y + square.Height / 9 * 3, square.Width, square.Height / 9) }; Button barChange = new Button(parent) { Text = "<span color=#000000 font_size=15>TitleBarColor Change</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X, square.Y + square.Height / 9 * 4, square.Width / 2, square.Height / 9) }; Button barColorDefault = new Button(parent) { Text = "<span color=#000000 font_size=15>TitleBarColor - Default</span>", WeightX = 1, AlignmentX = -1, BackgroundColor = Color.Black, Geometry = new Rect(square.X + square.Width / 2, square.Y + square.Height / 9 * 4, square.Width / 2, square.Height / 9) }; label.Show(); push.Show(); pop.Show(); insertBeforeTop.Show(); insertAfterTop.Show(); removeTop.Show(); barChange.Show(); barColorDefault.Show(); push.Clicked += (s, e) => { _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; pop.Clicked += (s, e) => { var item = _navi.NavigationStack.LastOrDefault(); int nativePointer = (int)(IntPtr)(item.Content); Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer); _navi.Pop(); Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer); }; insertBeforeTop.Clicked += (s, e) => { _navi.InsertBefore(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; insertAfterTop.Clicked += (s, e) => { _navi.InsertAfter(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; removeTop.Clicked += (s, e) => { var item = _navi.NavigationStack.LastOrDefault(); int nativePointer = (int)(IntPtr)(item.Content); Console.WriteLine("----- Before Call NaviItem.Delete() {0:x} ", nativePointer); item.Delete(); Console.WriteLine("----- After Call NaviItem.Delete() {0:x} ", nativePointer); }; Random rand = new Random(DateTime.Now.Millisecond); barChange.Clicked += (s, e) => { int currentIndex = _navi.NavigationStack.Count - 1; if (currentIndex >= 0) { _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.FromHex(string.Format("#{0:X8}", rand.Next())); } }; barColorDefault.Clicked += (s, e) => { int currentIndex = _navi.NavigationStack.Count - 1; if (currentIndex >= 0) { _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.Default; } }; table.Pack(label, 0, 0, 1, 1); table.Pack(push, 0, 1, 1, 1); table.Pack(pop, 1, 1, 1, 1); table.Pack(insertBeforeTop, 0, 2, 1, 1); table.Pack(insertAfterTop, 1, 2, 1, 1); table.Pack(removeTop, 0, 3, 1, 1); table.Pack(barChange, 0, 4, 1, 1); table.Pack(barColorDefault, 1, 4, 1, 1); return(table); }
public void NavigateToCallHistoryPage() { var callHistoryPage = new CallHistoryPage().CreateEvasObject(window); naviFrame.Push(callHistoryPage); }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); Naviframe navi = new Naviframe(window) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true }; Scroller scroller = new Scroller(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, ScrollBlock = ScrollBlock.None, }; scroller.Show(); Box container = new Box(window); scroller.SetContent(container); var rect1 = new Rectangle(window) { AlignmentX = -1, WeightX = 1, Color = Color.Blue, MinimumHeight = 500 }; rect1.Show(); var clipper = new Rectangle(window); clipper.Color = new ElmSharp.Color(200, 200, 200, 200); clipper.Geometry = rect1.Geometry; rect1.Moved += (s, e) => { clipper.Geometry = ((Rectangle)s).Geometry; }; rect1.SetClip(clipper); clipper.Show(); container.PackEnd(rect1); Color[] colors = { Color.Red, Color.Olive, Color.Green, Color.Gray, Color.Lime, Color.Maroon }; for (int i = 0; i < 6; i++) { var rect = new Rectangle(window) { AlignmentX = -1, WeightX = 1, Color = colors[i], MinimumHeight = 500 }; rect.Show(); container.PackEnd(rect); } navi.Push(scroller, "Scroll Page"); navi.Show(); conformant.SetContent(navi); }
/// <summary> /// Create a MapView object. /// </summary> public void CreateMap() { // Create the MapView var layout = new Layout(navi); s_mapview = new MapView(layout, s_maps); // Move the MapView s_mapview.Move(0, 0); // Resize the MapView s_mapview.Resize(360, 360); // Show the MapView s_mapview.Show(); // Set the latitude and longitude for the center position of the MapView //s_mapview.Center = new Geocoordinates(SEOUL_LAT, SEOUL_LON); s_mapview.Center = new Geocoordinates(DEFAULT_LAT, DEFAULT_LON); // Set the zoom level s_mapview.ZoomLevel = 9; // Add the handler for the longpress event on MapView s_mapview.LongPressed += MapViewLongPressed; // Create the MoreOption var viewOption = new MoreOption(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Direction = MoreOptionDirection.Right }; // Move the viewOption viewOption.Move(180, 180); // Show the viewOption viewOption.Show(); viewOption.Clicked += ViewOptionSelected; // Create and add items of the MoreOption viewOption.Items.Add(new MoreOptionItem() { MainText = "Map" }); viewOption.Items.Add(new MoreOptionItem() { MainText = "POI" }); viewOption.Items.Add(new MoreOptionItem() { MainText = "Route" }); RotaryEventManager.Rotated += (e) => { if (viewOption.IsOpened == false) { if (e.IsClockwise) { s_mapview.ZoomLevel += 1; } else { s_mapview.ZoomLevel -= 1; } } }; var mapPage = navi.Push(layout, null, "empty"); navi.Popped += (s, e) => { viewOption.Unrealize(); }; }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); Naviframe naviframe = new Naviframe(window); naviframe.Show(); conformant.SetContent(naviframe); var surface = new CircleSurface(conformant); CircleScroller circleScroller = new CircleScroller(naviframe, surface) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, VerticalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Invisible, HorizontalScrollBarVisiblePolicy = ScrollBarVisiblePolicy.Auto, HorizontalScrollBarColor = new Color(255, 0, 0, 50), HorizontalScrollBackgroundColor = Color.Orange, HorizontalScrollBarLineWidth = 15, HorizontalScrollBackgroundLineWidth = 15, }; ((IRotaryActionWidget)circleScroller).Activate(); circleScroller.Show(); naviframe.Push(circleScroller, null, "empty"); Box box = new Box(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, IsHorizontal = true, }; box.Show(); circleScroller.SetContent(box); var rnd = new Random(); for (int i = 0; i < 10; i++) { int r = rnd.Next(255); int g = rnd.Next(255); int b = rnd.Next(255); Color color = Color.FromRgb(r, g, b); Rectangle colorBox = new Rectangle(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, Color = color, MinimumWidth = window.ScreenSize.Width, }; colorBox.Show(); box.PackEnd(colorBox); } circleScroller.Scrolled += (s, e) => Log.Debug(TestName, "Horizental Circle Scroll Scrolled"); }
Widget CreatePage(Window win, string pageName) { Box box = new Box(win); ((IAccessibleObject)box).Name = pageName; box.Show(); Button abutton = new Button(win) { Text = "Accessibility-normal", WeightX = 1, AlignmentX = -1 }; ((IAccessibleObject)abutton).TranslationDomain = "kr"; ((IAccessibleObject)abutton).Name = "Accessibility"; ((IAccessibleObject)abutton).Description = "Description for Accessibility"; Label abutton_label = new Label(win) { WeightX = 1, AlignmentX = -1 }; abutton_label.Text = "domain : " + ((IAccessibleObject)abutton).TranslationDomain + ", name : " + ((IAccessibleObject)abutton).Name + ", desc : " + ((IAccessibleObject)abutton).Description; Button bbutton = new Button(win) { Text = "Accessibility-provider", WeightX = 1, AlignmentX = -1 }; ((IAccessibleObject)bbutton).NameProvider = (obj) => "Name-provider"; ((IAccessibleObject)bbutton).DescriptionProvider = (obj) => "Description-provider"; Label bbutton_label = new Label(win) { WeightX = 1, AlignmentX = -1 }; bbutton_label.Text = "name : " + ((IAccessibleObject)bbutton).Name + ", desc : " + ((IAccessibleObject)bbutton).Description; Button cbutton = new Button(win) { Text = "Readingtype,CanHighlight", WeightX = 1, AlignmentX = -1 }; ((IAccessibleObject)cbutton).ReadingInfoType = ReadingInfoType.Name | ReadingInfoType.Role | ReadingInfoType.Description; ((IAccessibleObject)cbutton).Name = "FooFoo"; ((IAccessibleObject)cbutton).Role = AccessRole.Text; ((IAccessibleObject)cbutton).Description = "FooFooButton"; Label name_onoff_label = new Label(win) { Text = "ReadingInfoType.Name : " + ((((IAccessibleObject)cbutton).ReadingInfoType & ReadingInfoType.Name) != 0 ? "on" : "off"), WeightX = 1, AlignmentX = -1 }; Label role_onoff_label = new Label(win) { Text = "ReadingInfoType.Role : " + ((((IAccessibleObject)cbutton).ReadingInfoType & ReadingInfoType.Role) != 0 ? "on" : "off"), WeightX = 1, AlignmentX = -1 }; Label description_onoff_label = new Label(win) { Text = "ReadingInfoType.Description : " + ((((IAccessibleObject)cbutton).ReadingInfoType & ReadingInfoType.Description) != 0 ? "on" : "off"), WeightX = 1, AlignmentX = -1 }; Label state_onoff_label = new Label(win) { Text = "ReadingInfoType.State : " + ((((IAccessibleObject)cbutton).ReadingInfoType & ReadingInfoType.State) != 0 ? "on" : "off"), WeightX = 1, AlignmentX = -1 }; Button saybutton = new Button(win) { Text = "HHGG with false", WeightX = 1, AlignmentX = -1 }; Button saybutton2 = new Button(win) { Text = "HHGG with true", WeightX = 1, AlignmentX = -1 }; int labelIndex = 0; Button roleButton = new Button(win) { WeightX = 1, AlignmentX = -1 }; roleButton.Clicked += (s, e) => { if (labelIndex >= accessRoleValues.Length) { labelIndex = 0; } IAccessibleObject obj = roleButton as IAccessibleObject; AccessRole role = (AccessRole)accessRoleValues.GetValue(labelIndex); obj.Role = role; roleButton.Text = Enum.GetName(typeof(AccessRole), obj.Role); labelIndex++; }; Label label = new Label(win) { Text = string.Format("{0} Apple", sequence++), WeightX = 1, AlignmentX = -1 }; ((IAccessibleObject)label).Name = "Apple"; Button push = new Button(win) { Text = "Push", WeightX = 1, AlignmentX = -1 }; ((IAccessibleObject)push).Name = "PushButton"; Button pop = new Button(win) { Text = "pop", WeightX = 1, AlignmentX = -1, }; ((IAccessibleObject)pop).Name = "PopButton"; abutton.Show(); abutton_label.Show(); bbutton.Show(); bbutton_label.Show(); cbutton.Show(); name_onoff_label.Show(); role_onoff_label.Show(); description_onoff_label.Show(); state_onoff_label.Show(); saybutton.Show(); saybutton2.Show(); roleButton.Show(); label.Show(); push.Show(); pop.Show(); push.Clicked += (s, e) => { NaviItem item = navi.Push(CreatePage(win, string.Format("Apple {0}", sequence - 1)), string.Format("Page {0}", sequence - 1)); }; Label statusLog = new Label(win) { WeightX = 1, AlignmentX = -1 }; statusLog.Show(); saybutton.Clicked += (s, e) => { AccessibleUtil.Say("The Hitchhiker's Guide to the Galaxy", false) .ContinueWith(status => { statusLog.Text = StatusStr(status.Result); }); }; saybutton2.Clicked += (s, e) => { AccessibleUtil.Say("The Hitchhiker's Guide to the Galaxy", true) .ContinueWith(status => { statusLog.Text = StatusStr(status.Result); }); }; pop.Clicked += (s, e) => { var item = navi.NavigationStack.LastOrDefault(); navi.Pop(); }; box.PackEnd(abutton); box.PackEnd(abutton_label); box.PackEnd(bbutton); box.PackEnd(bbutton_label); box.PackEnd(cbutton); box.PackEnd(name_onoff_label); box.PackEnd(role_onoff_label); box.PackEnd(description_onoff_label); box.PackEnd(state_onoff_label); box.PackEnd(saybutton); box.PackEnd(saybutton2); box.PackEnd(roleButton); box.PackEnd(label); box.PackEnd(push); box.PackEnd(pop); box.PackEnd(statusLog); return(box); }
public void ShowHello() { _currentPage = new Hello(); _navi.Push(_currentPage.CreateEvasObject(_mainWindow)); }
private void CreateTesterView() { Window window = new Window("GraphicsTester") { AvailableRotations = DisplayRotation.Degree_0 | DisplayRotation.Degree_180 | DisplayRotation.Degree_270 | DisplayRotation.Degree_90 }; window.Show(); window.BackButtonPressed += (s, e) => { EcoreMainloop.Quit(); }; Conformant conformant = new Conformant(window); conformant.Show(); Naviframe navi = new Naviframe(window) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true }; navi.Show(); GenList list = new GenList(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1 }; GenItemClass defaultClass = new GenItemClass("default") { GetTextHandler = (data, part) => { var scenario = data as AbstractScenario; return(scenario == null ? "" : scenario.GetType().Name); } }; foreach (var scenario in ScenarioList.Scenarios) { list.Append(defaultClass, scenario); } SkiaGraphicsView graphicsView = new SkiaGraphicsView(window) { AlignmentX = -1, AlignmentY = -1, WeightX = 1, WeightY = 1, BackgroundColor = Color.White }; graphicsView.Show(); list.ItemSelected += (s, e) => { var scenario = ScenarioList.Scenarios[e.Item.Index - 1]; graphicsView.Drawable = scenario; navi.Push(graphicsView, scenario.GetType().Name); }; list.Show(); navi.Push(list, "GraphicsTester.Skia.Tizen"); conformant.SetContent(navi); }
EvasObject CreatePage(Window parent) { Box box = new Box(parent); box.Show(); Label label = new Label(parent) { Text = string.Format("{0} Page", _sequence++), WeightX = 1, AlignmentX = -1, }; Button push = new Button(parent) { Text = "Push", WeightX = 1, AlignmentX = -1, }; Button pop = new Button(parent) { Text = "pop", WeightX = 1, AlignmentX = -1, }; Button insertBeforeTop = new Button(parent) { Text = "insertBeforeTop", WeightX = 1, AlignmentX = -1, }; Button insertAfterTop = new Button(parent) { Text = "insertAfterTop", WeightX = 1, AlignmentX = -1, }; Button removeTop = new Button(parent) { Text = "removeTop", WeightX = 1, AlignmentX = -1, }; Button barChange = new Button(parent) { Text = "TitleBarColor Change", WeightX = 1, AlignmentX = -1, }; Button barColorDefault = new Button(parent) { Text = "TitleBarColor - Default", WeightX = 1, AlignmentX = -1, }; label.Show(); push.Show(); pop.Show(); insertBeforeTop.Show(); insertAfterTop.Show(); removeTop.Show(); barChange.Show(); barColorDefault.Show(); push.Clicked += (s, e) => { _navi.Push(CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; pop.Clicked += (s, e) => { var item = _navi.NavigationStack.LastOrDefault(); int nativePointer = (int)(IntPtr)(item.Content); Console.WriteLine("----- Before Call _navi.Pop() {0:x} ", nativePointer); _navi.Pop(); Console.WriteLine("----- After Call _navi.Pop() {0:x} ", nativePointer); }; insertBeforeTop.Clicked += (s, e) => { _navi.InsertBefore(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; insertAfterTop.Clicked += (s, e) => { _navi.InsertAfter(_navi.NavigationStack.LastOrDefault(), CreatePage(parent), string.Format("{0} Page", _sequence - 1)); }; removeTop.Clicked += (s, e) => { var item = _navi.NavigationStack.LastOrDefault(); int nativePointer = (int)(IntPtr)(item.Content); Console.WriteLine("----- Before Call NaviItem.Delete() {0:x} ", nativePointer); item.Delete(); Console.WriteLine("----- After Call NaviItem.Delete() {0:x} ", nativePointer); }; Random rand = new Random(DateTime.Now.Millisecond); barChange.Clicked += (s, e) => { int currentIndex = _navi.NavigationStack.Count - 1; if (currentIndex >= 0) { _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.FromHex(string.Format("#{0:X8}", rand.Next())); } }; barColorDefault.Clicked += (s, e) => { int currentIndex = _navi.NavigationStack.Count - 1; if (currentIndex >= 0) { _navi.NavigationStack[currentIndex].TitleBarBackgroundColor = Color.Default; } }; box.PackEnd(label); box.PackEnd(push); box.PackEnd(pop); box.PackEnd(insertBeforeTop); box.PackEnd(insertAfterTop); box.PackEnd(removeTop); box.PackEnd(barChange); box.PackEnd(barColorDefault); return(box); }
public override void Run(Window window) { Conformant conformant = new Conformant(window); conformant.Show(); Naviframe navi = new Naviframe(conformant) { PreserveContentOnPop = true, DefaultBackButtonEnabled = true }; navi.Show(); conformant.SetContent(navi); Layout layout = new Layout(conformant) { WeightX = 1, WeightY = 1, AlignmentX = -1, AlignmentY = -1, }; layout.SetTheme("layout", "application", "default"); layout.Show(); Background bg = new Background(layout) { WeightX = 1, WeightY = 1, AlignmentX = -1, AlignmentY = -1, Color = Color.Gray, }; bg.Show(); layout.SetPartContent("elm.swallow.bg", bg); Box box = new Box(conformant) { WeightX = 1, WeightY = 1, AlignmentX = -1, AlignmentY = -1, }; box.Show(); box.SetPadding(5, 5); layout.SetPartContent("elm.swallow.content", box); Label label = new Label(box) { WeightX = 1, WeightY = 0, AlignmentX = 0.5, AlignmentY = 0, }; label.Show(); box.PackEnd(label); AnimationView aniview = new AnimationView(box) { WeightX = 1, WeightY = 1, AlignmentX = -1, AlignmentY = -1, }; aniview.SetAnimation(Path.Combine(TestRunner.ResourceDir, "a_mountain.json")); aniview.Show(); Box box1 = new Box(box) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = 1, IsHorizontal = true, }; box1.Show(); box.PackEnd(box1); Label label1 = new Label(box) { WeightX = 1, WeightY = 0, AlignmentX = 0.0, AlignmentY = 0.5, Text = "Default Size = (" + aniview.DefaultSize.Width + "," + aniview.DefaultSize.Height + ")", }; label1.Show(); box1.PackEnd(label1); Label label2 = new Label(box) { WeightX = 1, WeightY = 0, AlignmentX = 1.0, AlignmentY = 0.5, Text = "FrameCount : " + (aniview.FrameCount).ToString(), }; label2.Show(); box1.PackEnd(label2); Label label3 = new Label(box) { WeightX = 1, WeightY = 0, AlignmentX = 1.0, AlignmentY = 0.5, Text = "Duration : " + (Math.Round(Convert.ToDouble(aniview.DurationTime), 2)).ToString(), }; label3.Show(); box.PackEnd(label3); box.PackEnd(aniview); Box box2 = new Box(box) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = 1, IsHorizontal = true, }; box2.Show(); box.PackEnd(box2); Check check = new Check(box2) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Loop", }; check.Show(); box2.PackEnd(check); check.StateChanged += (s, e) => { aniview.AutoRepeat = !aniview.AutoRepeat; }; Check check2 = new Check(box2) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Speed: 0.25x", }; check2.Show(); box2.PackEnd(check2); check2.StateChanged += (s, e) => { if (check2.IsChecked) { aniview.Speed = 0.25; } else { aniview.Speed = 1.0; } }; Slider slider = new Slider(box) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, IsIndicatorVisible = true, IndicatorFormat = "%1.1f", Minimum = 0, Maximum = 1, }; slider.Show(); box.PackEnd(slider); slider.ValueChanged += (s, e) => { aniview.Progress = slider.Value; }; Box box3 = new Box(box) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = 1, IsHorizontal = true, }; box3.Show(); box.PackEnd(box3); Label label4 = new Label(box) { WeightX = 1, WeightY = 0, AlignmentX = 0.0, AlignmentY = 0.5, Text = (aniview.MinFrame).ToString() + " / " + (aniview.MaxFrame).ToString(), }; label4.Show(); box3.PackEnd(label4); Label label5 = new Label(box) { WeightX = 1, WeightY = 0, AlignmentX = 1.0, AlignmentY = 0.5, Text = (aniview.MinProgress).ToString() + " / " + (aniview.MaxProgress).ToString(), }; label5.Show(); box3.PackEnd(label5); Box box4 = new Box(box) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = 1, IsHorizontal = true, }; box4.Show(); box.PackEnd(box4); Button btn1 = new Button(box4) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Play", }; btn1.Show(); box4.PackEnd(btn1); btn1.Clicked += (s, e) => { aniview.Play(); UpdateAnimationViewStateLabel(aniview, label); }; Button btn2 = new Button(box4) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Reverse", }; btn2.Show(); box4.PackEnd(btn2); btn2.Clicked += (s, e) => { aniview.Play(true); UpdateAnimationViewStateLabel(aniview, label); }; Button btn3 = new Button(box4) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Stop", }; btn3.Show(); box4.PackEnd(btn3); btn3.Clicked += (s, e) => { aniview.Stop(); }; Box box5 = new Box(box) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = 1, IsHorizontal = true, }; box5.Show(); box.PackEnd(box5); Button btn4 = new Button(box5) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Pause", }; btn4.Show(); box5.PackEnd(btn4); btn4.Clicked += (s, e) => { aniview.Pause(); }; Button btn5 = new Button(box5) { WeightX = 1, WeightY = 0, AlignmentX = -1, AlignmentY = -1, Text = "Resume", }; btn5.Show(); box5.PackEnd(btn5); btn5.Clicked += (s, e) => { aniview.Resume(); }; aniview.Started += (s, e) => { UpdateAnimationViewStateLabel(aniview, label); }; aniview.Stopped += (s, e) => { UpdateAnimationViewStateLabel(aniview, label); label4.Text = "0 / " + (aniview.MaxFrame).ToString(); label5.Text = "0 / " + (aniview.MaxProgress).ToString(); slider.Value = 0; }; aniview.Paused += (s, e) => { UpdateAnimationViewStateLabel(aniview, label); }; aniview.Resumed += (s, e) => { UpdateAnimationViewStateLabel(aniview, label); }; aniview.Updated += (s, e) => { slider.Value = aniview.Progress; label4.Text = (aniview.Frame).ToString() + " / " + (aniview.MaxFrame).ToString(); label5.Text = (Math.Round(Convert.ToDouble(aniview.Progress), 2)).ToString() + " / " + (aniview.MaxProgress).ToString(); }; UpdateAnimationViewStateLabel(aniview, label); navi.Push(layout, "AnimationView Test"); }