public override View Run() { var view = new View { Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, } }; var ai = new ActivityIndicator(); ai.SizeHeight = (float)ai.Measure(300, 300).Height; ai.SizeWidth = (float)ai.Measure(300, 300).Width; view.Add(ai); var ai2 = new ActivityIndicator { Color = Color.Red, }; ai2.SizeHeight = (float)ai2.Measure(300, 300).Height; ai2.SizeWidth = (float)ai2.Measure(300, 300).Width; view.Add(ai2); var start = new Tizen.UIExtensions.NUI.Button() { Text = "start" }; view.Add(start); start.Clicked += (s, e) => { ai.IsRunning = true; ai2.IsRunning = true; }; var stop = new Tizen.UIExtensions.NUI.Button() { Text = "stop" }; view.Add(stop); stop.Clicked += (s, e) => { ai.IsRunning = false; ai2.IsRunning = false; }; return(view); }
public override View Run() { var main = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; main.Add(new Label { Text = "Refresh Layout Test", TextColor = Color.White, FontSize = 9, FontAttributes = Tizen.UIExtensions.Common.FontAttributes.Bold, VerticalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Center, WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 100, Padding = new Extents(20, 10, 10, 10), BackgroundColor = Color.FromHex("#2196f3").ToNative(), BoxShadow = new Shadow(5, Color.FromHex("#bbbbbb").ToNative(), new Vector2(0, 5)) }); var scrollview = new Tizen.UIExtensions.NUI.ScrollView() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; scrollview.ContentContainer.Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical, }; for (int i = 0; i < 3; i++) { var rnd = new Random(); var child = new View { WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 50, }; child.BackgroundColor = new Tizen.NUI.Color(rnd.NextSingle(), rnd.NextSingle(), rnd.NextSingle(), 1); scrollview.Add(child); } var startRefresh = new Tizen.UIExtensions.NUI.Button() { Text = "StartRefresh" }; scrollview.Add(startRefresh); var changeBg = new Tizen.UIExtensions.NUI.Button() { Text = "Change background" }; scrollview.Add(changeBg); var changeColor = new Tizen.UIExtensions.NUI.Button() { Text = "Change Color" }; scrollview.Add(changeColor); for (int i = 0; i < 100; i++) { var rnd = new Random(); var child = new View { WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 50, }; child.BackgroundColor = new Tizen.NUI.Color(rnd.NextSingle(), rnd.NextSingle(), rnd.NextSingle(), 1); scrollview.Add(child); } var wrapperView = new View { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, }; wrapperView.Add(scrollview); var refreshView = new RefreshLayout() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, Content = wrapperView, }; refreshView.Refreshing += async(s, e) => { await System.Threading.Tasks.Task.Delay(2000); refreshView.IsRefreshing = false; }; main.Add(refreshView); startRefresh.Clicked += (s, e) => refreshView.IsRefreshing = true; changeBg.Clicked += (s, e) => { if (refreshView.IconBackgroundColor == Color.Default) { refreshView.IconBackgroundColor = Color.Green; } else { refreshView.IconBackgroundColor = Color.Default; } }; changeColor.Clicked += (s, e) => { if (refreshView.IconColor == Color.Default) { refreshView.IconColor = Color.Red; } else { refreshView.IconColor = Color.Default; } }; return(main); }
public override View Run() { var scrollview = new Tizen.UIExtensions.NUI.ScrollView(); scrollview.ContentContainer.Layout = new LinearLayout { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Vertical, }; var view = scrollview.ContentContainer; view.Add(new Label { Text = "Switch Test", TextColor = Color.White, FontSize = 9, FontAttributes = Tizen.UIExtensions.Common.FontAttributes.Bold, VerticalTextAlignment = Tizen.UIExtensions.Common.TextAlignment.Center, WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 100, Padding = new Extents(20, 10, 10, 10), BackgroundColor = Color.FromHex("#2196f3").ToNative(), BoxShadow = new Shadow(5, Color.FromHex("#bbbbbb").ToNative(), new Vector2(0, 5)) }); view.Add(new View { SizeHeight = 20, }); var hlayout = new View { Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Horizontal, }, Padding = 10, }; Switch switchtest = null; { var switch1 = new Switch { Margin = 5, }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } { var switch1 = new Switch { IsEnabled = false, Margin = 5, ThumbColor = Color.Red, OnColor = Color.Yellow }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); } { var switch1 = new Switch { Margin = 5, ThumbColor = Color.BlueViolet, OnColor = Color.Red, IsToggled = true, }; switch1.SizeHeight = (float)switch1.Measure(300, 300).Height; switch1.SizeWidth = (float)switch1.Measure(300, 300).Width; hlayout.Add(switch1); switchtest = switch1; } view.Add(hlayout); var btn = new Tizen.UIExtensions.NUI.Button { Text = "Toggle" }; btn.Clicked += (s, e) => switchtest.IsToggled = !switchtest.IsToggled; scrollview.ContentContainer.Add(btn); return(scrollview); }