public override EvasObject CreateContent(EvasObject parent) { Box box = new ColoredBox(parent); box.Show(); var naviIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "menu.png"); var appbar = new MBottomAppBar(parent) { NavigationItem = new MActionItem("naviItem", naviIconPath, () => { Console.WriteLine($"Navigation action item clicked"); }) }; appbar.Show(); var airplaneIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "airplane.png"); var alarmIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "alarm.png"); var bluetoothIconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "bluetooth.png"); appbar.ActionItems.Add(new MActionItem("airplane", airplaneIconPath, () => { Console.WriteLine($"ariplane"); })); appbar.ActionItems.Add(new MActionItem("alarm", alarmIconPath, () => { Console.WriteLine($"alarm"); })); appbar.ActionItems.Add(new MActionItem("bluetooth", bluetoothIconPath, () => { Console.WriteLine($"bluetooth"); })); var nButton = new MButton(parent) { Text = "add/remove naviitem", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; var item = new MActionItem("new", naviIconPath, () => { Console.WriteLine($"new Navigation action item"); }); nButton.Clicked += (s, e) => { if (appbar.NavigationItem == null) { appbar.NavigationItem = item; } else { appbar.NavigationItem = null; } }; nButton.Show(); var addButton = new MButton(parent) { Text = "add item", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; int itemNum = 1; addButton.Clicked += (s, e) => { var iconPath = Path.Combine(Tizen.Applications.Application.Current.DirectoryInfo.Resource, "alarm.png"); appbar.ActionItems.Add(new MActionItem("new item" + itemNum++, iconPath, () => { Console.WriteLine($"new item{itemNum} clicked!!"); }));; }; addButton.Show(); var removeButton = new MButton(parent) { Text = "remove item", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; removeButton.Clicked += (s, e) => { if (appbar.ActionItems.Count > 0) { appbar.ActionItems.RemoveAt(appbar.ActionItems.Count - 1); } }; removeButton.Show(); var lbutton = new MButton(parent) { Text = "layout", MinimumWidth = 400, WeightY = 1, AlignmentY = 0.5, }; int layout = 0; lbutton.Clicked += (s, e) => { layout++; if (layout % 3 == 2) { appbar.LayoutOption = BottomAppBarLayoutOption.NoFAB; } else if (layout % 3 == 1) { appbar.LayoutOption = BottomAppBarLayoutOption.EndFAB; } else { appbar.LayoutOption = BottomAppBarLayoutOption.CenteredFAB; } lbutton.Text = "layout: " + appbar.LayoutOption.ToString(); lbutton.MinimumWidth = 400; }; lbutton.Show(); var entry = new MTextField(parent) { AlignmentX = -1, WeightY = 1, Label = "textfield", Text = "click here to show virtual keypad" }; entry.Show(); _conformant.KeyPadOn += (s, e) => { box.UnPack(appbar); }; _conformant.KeyPadOff += (s, e) => { box.PackEnd(appbar); }; MFloatingActionButton fab = new MFloatingActionButton(_conformant); Image img2 = new Image(parent); img2.Load(Path.Combine(MaterialGallery.ResourceDir, "airplane.png")); fab.Icon = img2; appbar.FloatingActionButton = fab; box.PackEnd(nButton); box.PackEnd(lbutton); box.PackEnd(addButton); box.PackEnd(removeButton); box.PackEnd(entry); box.PackEnd(appbar); return(box); }
public override EvasObject CreateContent(EvasObject parent) { if (_conformant == null) { return(null); } Box box = new ColoredBox(parent); box.Show(); var rect = new Rectangle(parent) { WeightX = 1, WeightY = 1, AlignmentX = -1, AlignmentY = -1, }; box.PackEnd(rect); #region FABs MFloatingActionButton fab = new MFloatingActionButton(_conformant); fab.Show(); fab.Resize(180, 176); fab.Move(540, 1070); Image img = new Image(parent); //The source of icon resources is https://materialdesignicons.com/ img.Load(Path.Combine(MaterialGallery.ResourceDir, "alarm.png")); img.Show(); fab.Icon = img; MFloatingActionButton fab2 = new MFloatingActionButton(_conformant); fab2.Show(); fab2.Resize(180, 176); fab2.Move(540, 940); Image img2 = new Image(parent); //The source of icon resources is https://materialdesignicons.com/ img2.Load(Path.Combine(MaterialGallery.ResourceDir, "airplane.png")); img2.Show(); fab2.Icon = img2; MFloatingActionButton fab3 = new MFloatingActionButton(_conformant); fab3.Show(); fab3.Resize(180, 176); fab3.Move(540, 810); Image img3 = new Image(parent); //The source of icon resources is https://materialdesignicons.com/ img3.Load(Path.Combine(MaterialGallery.ResourceDir, "bluetooth.png")); img3.Show(); fab3.Icon = img3; #endregion if (Elementary.GetProfile() == "wearable") { fab.Move(90, 20); fab2.Move(90, 200); fab3.Move(90, 400); fab.Clicked += (s, e) => { parent.Unrealize(); }; } else if (Elementary.GetProfile() == "tv") { fab.Move(1340, 870); fab2.Move(1340, 740); fab3.Move(1340, 610); } return(box); }
public override void Run(Window window) { MConformant conformant = new MConformant(window); conformant.Show(); Box box = new ColoredBox(window); conformant.SetContent(box); box.Show(); #region ThemeButton Box hbox = new Box(window) { IsHorizontal = true, WeightX = 1, WeightY = 0.2, AlignmentX = -1, AlignmentY = -1, }; hbox.Show(); box.PackEnd(hbox); var defaultColor = new MButton(window) { Text = "default", MinimumWidth = 200, WeightY = 1, AlignmentY = 0.5 }; var light = new MButton(window) { Text = "light", MinimumWidth = 200, WeightY = 1, AlignmentY = 0.5 }; var dark = new MButton(window) { Text = "Dark", MinimumWidth = 200, WeightY = 1, AlignmentY = 0.5 }; defaultColor.Show(); light.Show(); dark.Show(); hbox.PackEnd(defaultColor); hbox.PackEnd(light); hbox.PackEnd(dark); defaultColor.Clicked += (s, e) => MColors.Current = MColors.Default; light.Clicked += (s, e) => MColors.Current = MColors.Light; dark.Clicked += (s, e) => MColors.Current = MColors.Dark; #endregion #region FABs MFloatingActionButton fab = new MFloatingActionButton(conformant); fab.Show(); fab.Resize(180, 176); fab.Move(540, 1070); Image img = new Image(window); //The source of icon resources is https://materialdesignicons.com/ img.Load(Path.Combine(MaterialGallery.ResourceDir, "alarm.png")); img.Show(); fab.Icon = img; MFloatingActionButton fab2 = new MFloatingActionButton(conformant); fab2.Show(); fab2.Resize(180, 176); fab2.Move(540, 940); Image img2 = new Image(window); //The source of icon resources is https://materialdesignicons.com/ img2.Load(Path.Combine(MaterialGallery.ResourceDir, "airplane.png")); img2.Show(); fab2.Icon = img2; MFloatingActionButton fab3 = new MFloatingActionButton(conformant); fab3.Show(); fab3.Resize(180, 176); fab3.Move(540, 810); Image img3 = new Image(window); //The source of icon resources is https://materialdesignicons.com/ img3.Load(Path.Combine(MaterialGallery.ResourceDir, "bluetooth.png")); img3.Show(); fab3.Icon = img3; #endregion }