public void Activate() { window = NUIApplication.GetDefaultWindow(); defaultLayer = window.GetDefaultLayer(); window.TouchEvent += OnRiveWindowTouchEvent; // Load RiveAnimation File rav = new RiveAnimationView(Tizen.Applications.Application.Current.DirectoryInfo.Resource + "rive/space_reload.riv") { Size = new Size(720, 500), Position = new Position(0, 72) }; scroll = new Components.ScrollableBase() { Position = new Position(0, 120), Size = new Size(720, 1160), ScrollingDirection = Components.ScrollableBase.Direction.Vertical, EnableOverShootingEffect = true, HideScrollbar = true, ScrollEnabled = false }; scroll.Scrolling += Scrolling; header = new TextLabel { Text = "Universe", Position = new Position(0, 0), Size = new Size(720, 120), BackgroundColor = new Color(52.0f / 255.0f, 43.0f / 255.0f, 117.0f / 255.0f, 1.0f), VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, TextColor = new Color(1.0f, 1.0f, 1.0f, 1.0f), PointSize = 20.0f, }; viewItems = new View[5]; for (int i = 0; i < 5; i++) { viewItems[i] = new View { Position = VIEW_POSITION[i], Size = VIEW_SIZE[i], BackgroundImage = VIEW_BG_PATH[i], Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, LinearAlignment = LinearLayout.Alignment.Center, CellPadding = new Size(40, 0) } }; TextLabel title = new TextLabel { Size = new Size(550, 70), PointSize = 12.0f, Text = VIEW_TITLE[i], TextColor = VIEW_TITLE_COLOR[i] }; TextLabel text = new TextLabel { Size = new Size(550, 100), PointSize = 9.0f, MultiLine = true, Text = VIEW_TEXT[i], TextColor = new Color(1.0f, 1.0f, 1.0f, 1.0f) }; if (i == 0) { viewItems[i].TouchEvent += OnChangeEarthColor; } else if (i == 1) { viewItems[i].TouchEvent += OnChangeMoonColor; } else if (i == 2) { viewItems[i].TouchEvent += OnChangeSunColor; } else if (i == 3) { viewItems[i].TouchEvent += OnChangeJupiterColor; } viewItems[i].Add(title); viewItems[i].Add(text); scroll.Add(viewItems[i]); } defaultLayer.Add(rav); defaultLayer.Add(scroll); defaultLayer.Add(header); // Enable RiveAnimation and Play rav.EnableAnimation("Idle", true); rav.Play(); }
private void SendViewAddedEventToWindow(IntPtr data) { NUIApplication.GetDefaultWindow()?.SendViewAdded(this); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View() { Size2D = new Size2D(1920, 1080), }; CreateBoardAndButtons(); //button1.ClickEvent += bar1Add; //button2.ClickEvent += bar1Minus; //button3.ClickEvent += circle1Add; //button4.ClickEvent += circle1Minus; //button5.ClickEvent += circleStatusChanged; progressBar1_1 = new Progress(); progressBar1_1.Position2D = new Position2D(80, 350); progressBar1_1.Size2D = new Size2D(140, 4); progressBar1_1.MaxValue = 100; progressBar1_1.MinValue = 0; progressBar1_1.CurrentValue = 45; progressBar1_1.Style.Track.BackgroundColor = Color.Green; progressBar1_1.Style.Progress.BackgroundColor = Color.Black; root.Add(progressBar1_1); progressBar1_2 = new Progress(); progressBar1_2.Position2D = new Position2D(80, 420); progressBar1_2.Size2D = new Size2D(140, 4); progressBar1_2.MaxValue = 100; progressBar1_2.MinValue = 0; progressBar1_2.CurrentValue = 15; progressBar1_2.Style.Track.BackgroundColor = Color.Green; progressBar1_2.Style.Progress.BackgroundColor = Color.Black; root.Add(progressBar1_2); ProgressStyle attr = new ProgressStyle { Track = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = Color.Cyan, } }, Progress = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = Color.Black, } }, }; progressBar2_1 = new Progress(attr); progressBar2_1.Position2D = new Position2D(380, 350); progressBar2_1.Size2D = new Size2D(140, 4); progressBar2_1.MaxValue = 100; progressBar2_1.MinValue = 0; progressBar2_1.CurrentValue = 30; root.Add(progressBar2_1); //progressBar2_2 = new Progress(att); //progressBar2_2.Position2D = new Position2D(80, 560); //progressBar2_2.Size2D = new Size2D(140, 4); //progressBar2_2.MaxValue = 100; //progressBar2_2.MinValue = 0; //progressBar2_2.CurrentValue = 75; //progressBar2_2.UpdateValue(); //progressBar2_2.Direction = Progress.DirectionType.Horizontal; //root.Add(progressBar2_2); board.UpFocusableView = button1; window.Add(root); FocusManager.Instance.SetCurrentFocusView(button1); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View() { Size2D = new Size2D(1920, 1080), }; CreateBoardAndButtons(); scrollBar1_1 = new ScrollBar(); scrollBar1_1.Position2D = new Position2D(50, 300); scrollBar1_1.Size2D = new Size2D(300, 4); scrollBar1_1.Style.Track.BackgroundColor = Color.Green; scrollBar1_1.MaxValue = (int)scrollBar1_1.SizeWidth / 10; scrollBar1_1.MinValue = 0; scrollBar1_1.Style.Thumb.Size = new Size(30, 4); scrollBar1_1.CurrentValue = 0; //set after thumbsize scrollBar1_1.Style.Thumb.BackgroundColor = Color.Black; root.Add(scrollBar1_1); scrollBar1_2 = new ScrollBar(); scrollBar1_2.Position2D = new Position2D(50, 400); scrollBar1_2.Size2D = new Size2D(300, 4); scrollBar1_2.Style.Track.BackgroundColor = Color.Green; scrollBar1_2.MaxValue = (int)scrollBar1_2.SizeWidth / 10; scrollBar1_2.MinValue = 0; scrollBar1_2.Style.Thumb.Size = new Size(30, 4); scrollBar1_2.CurrentValue = 0;//set after thumbsize scrollBar1_2.Style.Thumb.BackgroundColor = Color.Yellow; scrollBar1_2.Style.Track.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_progressbar/c_progressbar_white_buffering.png"; root.Add(scrollBar1_2); ScrollBarStyle attr = new ScrollBarStyle { Track = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = new Color(0.43f, 0.43f, 0.43f, 0.1f), } }, Thumb = new ImageViewStyle { BackgroundColor = new Selector <Color> { All = new Color(1.0f, 0.0f, 0.0f, 0.2f), } }, }; scrollBar2_1 = new ScrollBar(attr); scrollBar2_1.Position2D = new Position2D(500, 300); scrollBar2_1.Size2D = new Size2D(300, 4); scrollBar2_1.MaxValue = (int)scrollBar2_1.SizeWidth / 10; scrollBar2_1.MinValue = 0; scrollBar2_1.Style.Thumb.Size = new Size(30, 4); scrollBar2_1.CurrentValue = 0; //set after thumbsize root.Add(scrollBar2_1); board.UpFocusableView = button1; window.Add(root); FocusManager.Instance.SetCurrentFocusView(button1); }
public void Activate() { Console.WriteLine($"@@@ this.GetType().Name={this.GetType().Name}, Activate()"); window = NUIApplication.GetDefaultWindow(); window.GetDefaultNavigator().Push(new IndicatorViewTest2Page()); }
public void AddContact(string contactName, string contactAddress, string imagePath) { if (!mInitialized) { // Set up the common layouting info shared between all contact cards when first called mContactCardLayoutInfo.unfoldedPosition = mContactCardLayoutInfo.padding = new Vector2(DEFAULT_PADDING, DEFAULT_PADDING); Vector2 windowSize = new Vector2(NUIApplication.GetDefaultWindow().Size.Width, NUIApplication.GetDefaultWindow().Size.Height); mContactCardLayoutInfo.unfoldedSize = windowSize - mContactCardLayoutInfo.padding * (MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f); // Calculate the size of the folded card (use the minimum of width/height as size) mContactCardLayoutInfo.foldedSize = (mContactCardLayoutInfo.unfoldedSize - (mContactCardLayoutInfo.padding * (MINIMUM_ITEMS_PER_ROW_OR_COLUMN - 1.0f))) / MINIMUM_ITEMS_PER_ROW_OR_COLUMN; mContactCardLayoutInfo.foldedSize.Width = mContactCardLayoutInfo.foldedSize.Height = Math.Min(mContactCardLayoutInfo.foldedSize.Width, mContactCardLayoutInfo.foldedSize.Height); // Set the size and positions of the header mContactCardLayoutInfo.headerSize.Width = mContactCardLayoutInfo.unfoldedSize.Width; mContactCardLayoutInfo.headerSize.Height = mContactCardLayoutInfo.unfoldedSize.Height * HEADER_HEIGHT_TO_UNFOLDED_SIZE_RATIO; mContactCardLayoutInfo.headerFoldedPosition = mContactCardLayoutInfo.headerSize * HEADER_FOLDED_POSITION_AS_RATIO_OF_SIZE; mContactCardLayoutInfo.headerUnfoldedPosition = HEADER_UNFOLDED_POSITION; // Set the image size and positions mContactCardLayoutInfo.imageSize = mContactCardLayoutInfo.foldedSize * IMAGE_SIZE_AS_RATIO_TO_FOLDED_SIZE; mContactCardLayoutInfo.imageFoldedPosition = mContactCardLayoutInfo.imageSize * IMAGE_FOLDED_POSITION_AS_RATIO_OF_SIZE; mContactCardLayoutInfo.imageUnfoldedPosition.X = mContactCardLayoutInfo.padding.Width; mContactCardLayoutInfo.imageUnfoldedPosition.Y = mContactCardLayoutInfo.headerSize.Height + mContactCardLayoutInfo.padding.Height; // Set the positions of the contact name mContactCardLayoutInfo.textFoldedPosition.X = 0.0f; mContactCardLayoutInfo.textFoldedPosition.Y = mContactCardLayoutInfo.imageFoldedPosition.X + mContactCardLayoutInfo.imageSize.Height * FOLDED_TEXT_POSITION_AS_RATIO_OF_IMAGE_SIZE; mContactCardLayoutInfo.textUnfoldedPosition.X = mContactCardLayoutInfo.padding.Width; mContactCardLayoutInfo.textUnfoldedPosition.Y = mContactCardLayoutInfo.imageUnfoldedPosition.Y + mContactCardLayoutInfo.imageSize.Height + mContactCardLayoutInfo.padding.Height; // Figure out the positions of the contact cards mItemsPerRow = (int)((mContactCardLayoutInfo.unfoldedSize.Width + mContactCardLayoutInfo.padding.Width) / (mContactCardLayoutInfo.foldedSize.Width + mContactCardLayoutInfo.padding.Width)); mLastPosition = new Vector2(mContactCardLayoutInfo.unfoldedPosition.X, mContactCardLayoutInfo.unfoldedPosition.Y); mPositionIncrementer.X = mContactCardLayoutInfo.foldedSize.Width + mContactCardLayoutInfo.padding.Width; mPositionIncrementer.Y = mContactCardLayoutInfo.foldedSize.Height + mContactCardLayoutInfo.padding.Height; mInitialized = true; } mContactCards.Add(new ContactCard(mContactCardLayoutInfo, contactName, contactAddress, imagePath, NextCardPosition(), rootView)); }
private void DisConnectFromSignals() { // Save current CPtr. global::System.Runtime.InteropServices.HandleRef currentCPtr = swigCPtr; // Use BaseHandle CPtr as current might have been deleted already in derived classes. swigCPtr = GetBaseHandleCPtrHandleRef; if (_onRelayoutEventCallback != null) { this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback); } if (_offWindowEventCallback != null) { this.OffWindowSignal().Disconnect(_offWindowEventCallback); } if (_onWindowEventCallback != null) { this.OnWindowSignal().Disconnect(_onWindowEventCallback); } if (_wheelEventCallback != null) { this.WheelEventSignal().Disconnect(_wheelEventCallback); } if (WindowWheelEventHandler != null) { NUIApplication.GetDefaultWindow().WheelEvent -= OnWindowWheelEvent; } if (_hoverEventCallback != null) { this.HoveredSignal().Disconnect(_hoverEventCallback); } if (_touchDataCallback != null) { this.TouchSignal().Disconnect(_touchDataCallback); } if (_ResourcesLoadedCallback != null) { this.ResourcesLoadedSignal().Disconnect(_ResourcesLoadedCallback); } if (_offWindowEventCallback != null) { this.OffWindowSignal().Disconnect(_offWindowEventCallback); } if (_onWindowEventCallback != null) { this.OnWindowSignal().Disconnect(_onWindowEventCallback); } if (_wheelEventCallback != null) { this.WheelEventSignal().Disconnect(_wheelEventCallback); } if (_hoverEventCallback != null) { this.HoveredSignal().Disconnect(_hoverEventCallback); } if (_touchDataCallback != null) { this.TouchSignal().Disconnect(_touchDataCallback); } if (_onRelayoutEventCallback != null) { this.OnRelayoutSignal().Disconnect(_onRelayoutEventCallback); } if (_keyCallback != null) { this.KeyEventSignal().Disconnect(_keyCallback); } if (_keyInputFocusLostCallback != null) { this.KeyInputFocusLostSignal().Disconnect(_keyInputFocusLostCallback); } if (_keyInputFocusGainedCallback != null) { this.KeyInputFocusGainedSignal().Disconnect(_keyInputFocusGainedCallback); } if (_backgroundResourceLoadedCallback != null) { this.ResourcesLoadedSignal().Disconnect(_backgroundResourceLoadedCallback); } if (_onWindowSendEventCallback != null) { this.OnWindowSignal().Disconnect(_onWindowSendEventCallback); } // BaseHandle CPtr is used in Registry and there is danger of deletion if we keep using it here. // Restore current CPtr. swigCPtr = currentCPtr; }
static string GetXamlForType(Type type) { //the Previewer might want to provide it's own xaml for this... let them do that //the check at the end is preferred (using ResourceLoader). keep this until all the previewers are updated string xaml; string resourceName = type.Name + ".xaml"; string resource = Tizen.Applications.Application.Current.DirectoryInfo.Resource; Tizen.Log.Fatal("NUI", "the resource path: " + resource); int windowWidth = NUIApplication.GetDefaultWindow().Size.Width; int windowHeight = NUIApplication.GetDefaultWindow().Size.Height; string likelyResourcePath = resource + "layout/" + windowWidth.ToString() + "x" + windowHeight.ToString() + "/" + resourceName; Tizen.Log.Fatal("NUI", "the resource path: " + likelyResourcePath); if (!File.Exists(likelyResourcePath)) { likelyResourcePath = resource + "layout/" + resourceName; } //Find the xaml file in the layout folder if (File.Exists(likelyResourcePath)) { StreamReader reader = new StreamReader(likelyResourcePath); xaml = reader.ReadToEnd(); reader.Close(); reader.Dispose(); Tizen.Log.Fatal("NUI", "File is exist!, try with xaml: " + xaml); var pattern = String.Format("x:Class *= *\"{0}\"", type.FullName); var regex = new Regex(pattern, RegexOptions.ECMAScript); if (regex.IsMatch(xaml) || xaml.Contains(String.Format("x:Class=\"{0}\"", type.FullName))) { return(xaml); } else { throw new XamlParseException(string.Format("Can't find type {0}", type.FullName), new XmlLineInfo()); } } else { Assembly assembly = type.Assembly; var resourceId = XamlResourceIdAttribute.GetResourceIdForType(type); if (null == resourceId) { throw new XamlParseException(string.Format("Can't find type {0} in embedded resource", type.FullName), new XmlLineInfo()); } else { Stream stream = assembly.GetManifestResourceStream(resourceId); if (null != stream) { Byte[] buffer = new byte[stream.Length]; stream.Read(buffer, 0, (int)stream.Length); string ret = System.Text.Encoding.Default.GetString(buffer); return(ret); } else { throw new XamlParseException(string.Format("Can't get xaml stream {0} in embedded resource", type.FullName), new XmlLineInfo()); } } } }
public void Activate() { resPath = Tizen.Applications.Application.Current.DirectoryInfo.Resource; root = new View(); root.BackgroundColor = Color.Green; root.Size2D = new Size2D(NUIApplication.GetDefaultWindow().Size.Width, NUIApplication.GetDefaultWindow().Size.Height); var layer = new LinearLayout(); layer.LinearAlignment = LinearLayout.Alignment.CenterHorizontal; layer.LinearOrientation = LinearLayout.Orientation.Vertical; root.Layout = layer; NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(root); box = new Box(new Size2D(root.Size2D.Width, GetRatio(40, root.Size2D.Height)), "AGIF Test", resPath + "images/AGIF/dali-logo-anim.gif"); root.Add(box); box.image.SetValues(); box.but1.Clicked += But1_Clicked; box.but1.Style.Text.Text = new Selector <string> { Normal = "Pause !", Selected = "Play !" }; box.but2.Clicked += But2_Clicked; box.but2.Style.Text.Text = new Selector <string> { Normal = "Stop !", Selected = "Play !" }; box.status.Text = "playing now"; box.but3.IsEnabled = false; box2 = new Box(new Size2D(root.Size2D.Width, GetRatio(40, root.Size2D.Height)), "Image array Test", ""); root.Add(box2); for (int i = 1; i <= 8; i++) { box2.image.URLs.Add(resPath + "images/AGIF/dog-anim-00" + i + ".png"); } box2.image.Play(); box2.but1.Clicked += But1_Clicked1; box2.but1.Style.Text.Text = new Selector <string> { Normal = "Pause !", Selected = "Play by reseting frame dalay and loop count!", }; box2.but1.Style.Text.PointSize = new Selector <float?> { Normal = 20, Selected = 15, }; box2.but1.Style.Text.MultiLine = true; box2.but2.Clicked += But2_Clicked1; box2.but2.IsSelectable = false; box2.but2.Style.Text.Text = new Selector <string> { Normal = "Increase frame delay", Pressed = "Up 100ms", }; box2.but3.Clicked += But3_Clicked; box2.but3.IsSelectable = false; box2.but3.Style.Text.Text = new Selector <string> { Normal = "Increase loop count", Pressed = "Up 1 count", }; box2.status.Text = $"playing now, frame delay: {box2.image.FrameDelay}ms, loop count: {box2.image.LoopCount}"; }
/// <summary> /// Text Sample Application initialization. /// </summary> public void Initialize() { // Set the background Color of Window. window = NUIApplication.GetDefaultWindow(); root = new View() { Size = new Size(window.Size.Width, window.Size.Height), BackgroundColor = Color.Black }; // Create Title TextLabel TextLabel Title = new TextLabel("Text Editor"); Title.HorizontalAlignment = HorizontalAlignment.Center; Title.VerticalAlignment = VerticalAlignment.Center; // Set Text color to White Title.TextColor = Color.White; Title.PositionUsesPivotPoint = true; Title.ParentOrigin = ParentOrigin.TopCenter; Title.PivotPoint = PivotPoint.TopCenter; Title.Position = new Position(0, window.Size.Height / 10); // Use Samsung One 600 font Title.FontFamily = "Samsung One 600"; // Set MultiLine to false. Title.MultiLine = false; Title.PointSize = mLargePointSize; root.Add(Title); // Create TextEditor. CreateTextEditor(); // Create buttons to show some functions or properties. CreateButtons(); mCurruntButtonIndex = 0; // Create subTitle TextLabel TextLabel subTitle = new TextLabel("Swipe and Click the button"); subTitle.HorizontalAlignment = HorizontalAlignment.Center; subTitle.VerticalAlignment = VerticalAlignment.Center; // Set Text color to White subTitle.TextColor = Color.White; subTitle.PositionUsesPivotPoint = true; subTitle.ParentOrigin = ParentOrigin.BottomCenter; subTitle.PivotPoint = PivotPoint.BottomCenter; subTitle.Position = new Position(0, -30); // Use Samsung One 600 font subTitle.FontFamily = "Samsung One 600"; // Set MultiLine to false. subTitle.MultiLine = false; subTitle.PointSize = mSmallPointSize; root.Add(subTitle); // Animation setting for the button animation mTableViewAnimation = new Animation[2]; mTableViewAnimation[0] = new Animation(); mTableViewAnimation[0].Duration = 100; mTableViewAnimation[0].AnimateBy(mTableView, "Position", new Vector3(-360, 0, 0)); mTableViewAnimation[1] = new Animation(); mTableViewAnimation[1].Duration = 100; mTableViewAnimation[1].AnimateBy(mTableView, "Position", new Vector3(360, 0, 0)); window.Add(root); // Add Signal Callback functions window.TouchEvent += OnWindowTouched; window.KeyEvent += OnKey; }
public void Deactivate() { if (root != null) { layout[0].Remove(button[0]); button[0].Dispose(); button[0] = null; layout[0].Remove(button[1]); button[1].Dispose(); button[1] = null; gridLayout.Remove(layout[0]); layout[0].Dispose(); layout[0] = null; gridLayout.Remove(textLabel[0]); textLabel[0].Dispose(); textLabel[0] = null; layout[1].Remove(loading[0]); loading[0].Dispose(); loading[0] = null; gridLayout.Remove(layout[1]); layout[1].Dispose(); layout[1] = null; gridLayout.Remove(textLabel[1]); textLabel[1].Dispose(); textLabel[1] = null; gridLayout.Remove(textLabel[2]); textLabel[2].Dispose(); textLabel[2] = null; layout[2].Remove(loading[1]); loading[1].Dispose(); loading[1] = null; gridLayout.Remove(layout[2]); layout[2].Dispose(); layout[2] = null; layout[3].Remove(button[2]); button[2].Dispose(); button[2] = null; gridLayout.Remove(layout[3]); layout[3].Dispose(); layout[3] = null; root.Remove(gridLayout); gridLayout.Dispose(); gridLayout = null; NUIApplication.GetDefaultWindow().Remove(root); root.Dispose(); root = null; } }
public void Deactivate() { if (mLayoutButton != null) { mLayoutButton.GetParent().Remove(mLayoutButton); mLayoutButton.Dispose(); } if (mEditButton != null) { mEditButton.GetParent().Remove(mEditButton); mEditButton.Dispose(); } if (mReplaceButton != null) { mReplaceButton.GetParent().Remove(mReplaceButton); mReplaceButton.Dispose(); } if (mInsertButton != null) { mInsertButton.GetParent().Remove(mInsertButton); mInsertButton.Dispose(); } if (mDeleteButton != null) { mDeleteButton.GetParent().Remove(mDeleteButton); mDeleteButton.Dispose(); } if (mTitle != null) { mTitle.GetParent().Remove(mTitle); mTitle.Dispose(); } if (mToolBarBackground != null) { mToolBarBackground.GetParent().Remove(mToolBarBackground); mToolBarBackground.Dispose(); } if (mItemView != null) { mItemView.GetParent().Remove(mItemView); mItemView.Dispose(); } if (mContentView != null) { NUIApplication.GetDefaultWindow().Remove(mContentView); mContentView.Dispose(); } if (mToolBarLayer != null) { NUIApplication.GetDefaultWindow().RemoveLayer(mToolBarLayer); mToolBarLayer.Dispose(); } NUIApplication.GetDefaultWindow().GetDefaultLayer().Behavior = Layer.LayerBehavior.Layer2D; }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); FocusManager.Instance.EnableDefaultAlgorithm(true); root = new View(); root.Layout = new AbsoluteLayout(); root.Size = new Size(300, 800); var scrollview = new ScrollableBase { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, ScrollingDirection = ScrollableBase.Direction.Vertical, Focusable = true, FocusableInTouch = true, }; root.Add(scrollview); scrollview.ContentContainer.Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical }; scrollview.ContentContainer.Add(new View { BackgroundColor = new Vector4(1.0f, 0.6f, 0.2f, 1.0f), SizeHeight = 100, WidthResizePolicy = ResizePolicyType.FillToParent, }); var scroll2 = new ScrollableBase { BackgroundColor = Color.Gray, ScrollingDirection = ScrollableBase.Direction.Vertical, Focusable = true, FocusableInTouch = true, }; scroll2.WidthSpecification = LayoutParamPolicies.MatchParent; scroll2.HeightSpecification = LayoutParamPolicies.MatchParent; scroll2.WidthResizePolicy = ResizePolicyType.FillToParent; scroll2.SizeHeight = 400; var abscontainer = new View { Layout = new AbsoluteLayout(), WidthSpecification = LayoutParamPolicies.MatchParent, SizeHeight = 400, }; abscontainer.Add(scroll2); scrollview.ContentContainer.Add(abscontainer); scroll2.ContentContainer.Layout = new LinearLayout { LinearOrientation = LinearLayout.Orientation.Vertical }; for (int i = 0; i < 50; i++) { scroll2.ContentContainer.Add(new TextLabel { Text = $"Text {i}", WidthResizePolicy = ResizePolicyType.FillToParent, Focusable = true, FocusableInTouch = true, // Position = new Position(0, i*50+200), }); } scrollview.ContentContainer.Add(new View { BackgroundColor = Color.Yellow, SizeHeight = 400, WidthResizePolicy = ResizePolicyType.FillToParent, }); TextLabel titleView = new TextLabel { Text = "Title", Focusable = true, FocusableInTouch = true, Size = new Size(300, 100), }; TextLabel footView = new TextLabel { Text = "Foot", Focusable = true, FocusableInTouch = true, Size = new Size(300, 100), Position = new Position(0, 500), }; window.Add(root); window.Add(titleView); window.Add(footView); }
public void Activate() { window = NUIApplication.GetDefaultWindow(); rootView = new ScrollableBase() { ScrollingDirection = ScrollableBase.Direction.Vertical, HideScrollbar = false, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; window.Add(rootView); var mainView = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 20), }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Black, }; rootView.Add(mainView); var flexRowViewTitle = new TextLabel() { Text = "Row with MatchParent", WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; mainView.Add(flexRowViewTitle); var flexRowView = new View() { Layout = new FlexLayout() { Direction = FlexLayout.FlexDirection.Row, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 400, Margin = new Extents(20, 20, 20, 20), Padding = new Extents(20, 20, 20, 20), BackgroundColor = Color.White, }; mainView.Add(flexRowView); var rowChild = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Black, }; flexRowView.Add(rowChild); var rowGrandChild = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; rowChild.Add(rowGrandChild); var rowGrandChild2 = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Green, }; rowChild.Add(rowGrandChild2); var rowChild2 = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Black, }; flexRowView.Add(rowChild2); var rowGrandChild3 = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Blue, }; rowChild2.Add(rowGrandChild3); var rowGrandChild4 = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Yellow, }; rowChild2.Add(rowGrandChild4); var flexColViewTitle = new TextLabel() { Text = "Column with MatchParent", WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; mainView.Add(flexColViewTitle); var flexColView = new View() { Layout = new FlexLayout() { Direction = FlexLayout.FlexDirection.Column, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 400, Margin = new Extents(20, 20, 20, 20), Padding = new Extents(20, 20, 20, 20), BackgroundColor = Color.White, }; mainView.Add(flexColView); var colChild = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Black, }; flexColView.Add(colChild); var colGrandChild = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; colChild.Add(colGrandChild); var colGrandChild2 = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Green, }; colChild.Add(colGrandChild2); var colChild2 = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Black, }; flexColView.Add(colChild2); var colGrandChild3 = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Blue, }; colChild2.Add(colGrandChild3); var colGrandChild4 = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Yellow, }; colChild2.Add(colGrandChild4); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View() { Size = new Size(1920, 1080), BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f), }; window.Add(root); parent1 = new View() { Size = new Size(1920, 1080), }; parent1.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.Center, CellPadding = new Size(50, 50) }; parent2 = new View() { Size = new Size(1032, 980), }; parent2.Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, LinearAlignment = LinearLayout.Alignment.CenterHorizontal, CellPadding = new Size(400, 400) }; ///////////////////////////////////////////////Create by Property////////////////////////////////////////////////////////// createText[0] = new TextLabel(); createText[0].Text = "Create Popup just by properties"; createText[0].WidthSpecification = 500; createText[0].HeightSpecification = 100; parent2.Add(createText[0]); popup = new Popup(); popup.MinimumSize = new Size(1032, 184); popup.Size = new Size(1032, 400); popup.Position = new Position(150, 100); // Title popup.Title.PointSize = 25; popup.Title.Size = new Size(0, 68); popup.Title.PositionUsesPivotPoint = true; popup.Title.ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft; popup.Title.PivotPoint = Tizen.NUI.PivotPoint.TopLeft; popup.Title.HorizontalAlignment = HorizontalAlignment.Begin; popup.Title.VerticalAlignment = VerticalAlignment.Bottom; popup.Title.Position = new Position(64, 52); popup.Title.Text = "Popup Title"; popup.Title.Padding = 0; // Shadow popup.ImageShadow = new ImageShadow { Url = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png", Border = new Rectangle(24, 24, 24, 24), Extents = new Vector2(48, 48) }; // Background popup.BackgroundImage = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png"; popup.BackgroundImageBorder = new Rectangle(0, 0, 81, 81); // Buttons popup.AddButton("Yes"); popup.AddButton("Exit"); popup.ButtonBackground = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png"; popup.ButtonBackgroundBorder = new Rectangle(5, 5, 5, 5); popup.ButtonOverLayBackgroundColorSelector = new Selector <Color> { Normal = new Color(1.0f, 1.0f, 1.0f, 0.5f), Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f) }; popup.ButtonImageShadow = new ImageShadow { Url = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", Border = new Rectangle(5, 5, 5, 5) }; popup.ButtonTextColor = color[0]; popup.ButtonHeight = 132; popup.PopupButtonClickEvent += PopupButtonClickedEvent; popup.LayoutDirectionChanged += PopupLayoutDirectionChanged; popup.Post(window); contentText = new TextLabel(); contentText.Size = new Size(1032, 100); contentText.PointSize = 20; contentText.HorizontalAlignment = HorizontalAlignment.Begin; contentText.VerticalAlignment = VerticalAlignment.Center; contentText.Text = "Popup ButtonStyle is " + buttonStyles[index]; contentText.TextColor = new Color(0, 0, 222, 1); popup.AddContentText(contentText); ///////////////////////////////////////////////Create by Attributes////////////////////////////////////////////////////////// createText[1] = new TextLabel(); createText[1].Text = "Create Popup just by Attributes"; createText[1].WidthSpecification = 500; createText[1].HeightSpecification = 100; parent2.Add(createText[1]); PopupStyle attrs = new PopupStyle { MinimumSize = new Size(1032, 184), BackgroundImage = new Selector <string> { All = CommonResource.GetFHResourcePath() + "11. Popup/popup_background.png" }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(0, 0, 81, 81) }, ImageShadow = new ImageShadow { Url = CommonResource.GetFHResourcePath() + "11. Popup/popup_background_shadow.png", Border = new Rectangle(24, 24, 24, 24), Extents = new Vector2(48, 48), }, Title = new TextLabelStyle { PointSize = new Selector <float?> { All = 25 }, TextColor = new Selector <Color> { All = Color.Black }, Size = new Size(0, 68), PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.TopLeft, PivotPoint = Tizen.NUI.PivotPoint.TopLeft, HorizontalAlignment = HorizontalAlignment.Begin, VerticalAlignment = VerticalAlignment.Bottom, Position = new Position(64, 52), Text = new Selector <string> { All = "Popup Title" }, }, Buttons = new ButtonStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.BottomLeft, PivotPoint = Tizen.NUI.PivotPoint.BottomLeft, BackgroundImage = new Selector <string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png" }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, ImageShadow = new ImageShadow { Url = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", Border = new Rectangle(5, 5, 5, 5), }, Overlay = new ImageViewStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.Center, PivotPoint = Tizen.NUI.PivotPoint.Center, WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, BackgroundColor = new Selector <Color> { Normal = new Color(1.0f, 1.0f, 1.0f, 0.5f), Pressed = new Color(0.0f, 0.0f, 0.0f, 0.5f), } }, Text = new TextLabelStyle { PositionUsesPivotPoint = true, ParentOrigin = Tizen.NUI.ParentOrigin.Center, PivotPoint = Tizen.NUI.PivotPoint.Center, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, TextColor = new Selector <Color> { All = color[index2] } }, }, }; popup2 = new Popup(attrs); popup2.Size = new Size(1032, 400); popup2.Position = new Position(150, 600); popup2.AddButton("Yes"); popup2.AddButton("Exit"); popup2.ButtonHeight = 132; popup2.PopupButtonClickEvent += PopupButtonClickedEvent; popup2.LayoutDirectionChanged += Popup2LayoutDirectionChanged; popup2.Post(window); contentText2 = new TextLabel(); contentText2.Size = new Size(1032, 100); contentText2.PointSize = 20; contentText2.HorizontalAlignment = HorizontalAlignment.Begin; contentText2.VerticalAlignment = VerticalAlignment.Center; contentText2.Text = "Popup2 ButtonStyle is " + buttonStyles[index]; popup2.ContentView.Add(contentText2); button = new Button(); button.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png"; button.BackgroundImageBorder = new Rectangle(4, 4, 5, 5); button.WidthSpecification = 580; button.HeightSpecification = 80; button.TextLabel.Text = "LayoutDirection is left to right"; button.Clicked += ButtonClicked; parent1.Add(parent2); parent1.Add(button); root.Add(parent1); }
public void Deactivate() { if (root != null) { NUIApplication.GetDefaultWindow().Remove(root); for (int i = 0; i < 2; i++) { if (createText[i] != null) { createText[i].Dispose(); createText[i] = null; } if (inforText[i] != null) { inforText[i].Dispose(); inforText[i] = null; } } for (int j = 0; j < 4; j++) { if (slider_null_style[j] != null) { slider_null_style[j].Dispose(); slider_null_style[j] = null; } if (slider_style[j] != null) { slider_style[j].Dispose(); slider_style[j] = null; } } if (top_parent != null) { top_parent.Dispose(); top_parent = null; } if (bottom_parent != null) { bottom_parent.Dispose(); bottom_parent = null; } if (ver_slider_parent != null) { ver_slider_parent.Dispose(); ver_slider_parent = null; } if (hori_slider_parent != null) { hori_slider_parent.Dispose(); hori_slider_parent = null; } root.Dispose(); root = null; } }
private void Initialize() { mContactCardLayoutInfo = new ContactCardLayoutInfo(); mContactCards = new List <ContactCard>(); mLastPosition = new Vector2(); mPositionIncrementer = new Vector2(); mItemsPerRow = 0; mInitialized = false; rootView = new View() { Size2D = new Size2D(NUIApplication.GetDefaultWindow().WindowSize.Width, NUIApplication.GetDefaultWindow().WindowSize.Height), BackgroundColor = ROOTVIEW_COLOR, PositionUsesPivotPoint = false, }; NUIApplication.GetDefaultWindow().Add(rootView); }
protected override void OnCreate() { base.OnCreate(); Window window = NUIApplication.GetDefaultWindow(); window.BackgroundColor = Color.Black; // Create CircularPagination pagination = new CircularPagination() { Size = new Size(360, 360), // Set CircularPagination properties, such as Indicator size, count, and images. IndicatorSize = new Size(10, 10), IndicatorImageURL = new Selector <string>() { Normal = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "normal_dot.png", Selected = Tizen.Applications.Application.Current.DirectoryInfo.Resource + "focus_dot.png", }, IndicatorCount = PAGE_COUNT, SelectedIndex = 0, // Positioning it to the center ParentOrigin = ParentOrigin.Center, PivotPoint = PivotPoint.Center, PositionUsesPivotPoint = true }; // To move on to the next page using Swipe gesture, add ScrollableBase and its View container. scrollable = new ScrollableBase() { Size = new Size(360, 360), ScrollingDirection = ScrollableBase.Direction.Horizontal, SnapToPage = true, ParentOrigin = ParentOrigin.Center, PivotPoint = PivotPoint.Center, PositionUsesPivotPoint = true }; View container = new View() { WidthSpecification = LayoutParamPolicies.WrapContent, HeightSpecification = 360, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, }, BackgroundColor = Color.Black, }; scrollable.Add(container); for (int i = 0; i < PAGE_COUNT; i++) { View page = new View() { Size = new Size(360, 360), CornerRadius = 150.0f, BackgroundColor = Color.Black, }; container.Add(page); } window.Add(scrollable); window.Add(pagination); // Bezel event window.WheelEvent += Pagination_WheelEvent; // Screen Touch Event scrollable.ScrollAnimationEndEvent += Scroll_AnimationEnd; }
public void MenuGetRootView() { tlog.Debug(tag, $"MenuGetRootView START"); var testingTarget = new MyMenu() { Size = new Size(100, 200), BackgroundColor = Color.Green, }; Assert.IsNotNull(testingTarget, "null handle"); Assert.IsInstanceOf <Menu>(testingTarget, "Should return Menu instance."); NUIApplication.GetDefaultWindow().GetDefaultLayer().Add(testingTarget); testingTarget.HorizontalPositionToAnchor = Menu.RelativePosition.Start; tlog.Debug(tag, "HorizontalPositionToAnchor :" + testingTarget.HorizontalPositionToAnchor); testingTarget.VerticalPositionToAnchor = Menu.RelativePosition.Center; tlog.Debug(tag, "HorizontalPositionToAnchor :" + testingTarget.HorizontalPositionToAnchor); // horizontalPosition == value testingTarget.HorizontalPositionToAnchor = Menu.RelativePosition.Center; tlog.Debug(tag, "HorizontalPositionToAnchor :" + testingTarget.HorizontalPositionToAnchor); List <MenuItem> items = new List <MenuItem>(); MenuItem item = new MenuItem(); items.Add(item); items.Add(item); testingTarget.Items = items; MenuItem item2 = new MenuItem(); items.Add(item2); testingTarget.Items = items; View content = new View() { Size = new Size2D(100, 30), }; testingTarget.MyContent = content; View anchor1 = new View() { Size = new Size(100, 30), BackgroundColor = Color.Cyan }; testingTarget.Anchor = anchor1; testingTarget.HorizontalPositionToAnchor = Menu.RelativePosition.Center; tlog.Debug(tag, "HorizontalPositionToAnchor :" + testingTarget.HorizontalPositionToAnchor); testingTarget.VerticalPositionToAnchor = Menu.RelativePosition.Start; tlog.Debug(tag, "HorizontalPositionToAnchor :" + testingTarget.HorizontalPositionToAnchor); View anchor2 = new View() { Size = new Size(100, 30), BackgroundColor = Color.Black }; testingTarget.Anchor = anchor2; // anchor == value testingTarget.Anchor = anchor2; try { // anchor == null testingTarget.Anchor = null; } catch (Exception e) { tlog.Debug(tag, e.Message.ToString()); Assert.Fail("Caught Exception : Failed!"); } NUIApplication.GetDefaultWindow().GetDefaultLayer().Remove(testingTarget); testingTarget.OnDispose(DisposeTypes.Explicit); tlog.Debug(tag, $"MenuGetRootView END (OK)"); }
public void Activate() { window = NUIApplication.GetDefaultWindow(); rootView = new ScrollableBase() { ScrollingDirection = ScrollableBase.Direction.Vertical, HideScrollbar = false, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; window.Add(rootView); var mainView = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 20), }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; rootView.Add(mainView); var absoluteViewTitle = new TextLabel() { Text = "AbsoluteLayout", WidthSpecification = LayoutParamPolicies.MatchParent, }; mainView.Add(absoluteViewTitle); var absoluteView = new View() { Layout = new AbsoluteLayout(), WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 300, BackgroundColor = Color.White, }; mainView.Add(absoluteView); var absoluteTopText = new TextEditor() { WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; absoluteTopText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"AbsoluteLayout Top Text has been changed to \"{args.TextEditor.Text}\"."); }; absoluteView.Add(absoluteTopText); var absoluteCenterText = new TextEditor() { Text = "Center\nNew Line", BackgroundColor = Color.Blue, ParentOrigin = new Position(0.5f, 0.5f, 0.5f), PivotPoint = new Position(0.5f, 0.5f, 0.5f), PositionUsesPivotPoint = true, }; absoluteCenterText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"AbsoluteLayout Center Text has been changed to \"{args.TextEditor.Text}\"."); }; absoluteView.Add(absoluteCenterText); var absoluteBottomText = new TextEditor() { Text = "Bottom\nNew Line", BackgroundColor = Color.Green, ParentOrigin = new Position(0.5f, 1.0f, 0.5f), PivotPoint = new Position(0.5f, 1.0f, 0.5f), PositionUsesPivotPoint = true, }; absoluteBottomText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"AbsoluteLayout Bottom Text has been changed to \"{args.TextEditor.Text}\"."); }; absoluteView.Add(absoluteBottomText); var linearViewTitle = new TextLabel() { Text = "LinearLayout", WidthSpecification = LayoutParamPolicies.MatchParent, }; mainView.Add(linearViewTitle); var linearView = new View() { Layout = new LinearLayout() { CellPadding = new Size2D(10, 0), }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; mainView.Add(linearView); var linearLeft = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 10), }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; linearView.Add(linearLeft); var linearLeftText1 = new TextEditor() { WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; linearLeftText1.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Left default size Text has been changed to \"{args.TextEditor.Text}\"."); }; linearLeft.Add(linearLeftText1); var linearLeftText2 = new TextEditor() { PixelSize = 16, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; linearLeftText2.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Left PixelSize 16 Text has been changed to \"{args.TextEditor.Text}\"."); }; linearLeft.Add(linearLeftText2); var linearLeftText3 = new TextEditor() { PixelSize = 64, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; linearLeftText3.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Left PixelSize 64 Text has been changed to \"{args.TextEditor.Text}\"."); }; linearLeft.Add(linearLeftText3); var linearLeftText4 = new TextEditor() { BackgroundColor = Color.Red, }; linearLeftText4.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Left Text with WrapContent WidthSpecification has been changed to \"{args.TextEditor.Text}\"."); }; linearLeft.Add(linearLeftText4); var linearRight = new View() { Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size2D(0, 10), }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; linearView.Add(linearRight); var linearRightText1 = new TextEditor() { Text = "Default\nNew Line", WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; linearRightText1.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Right default size Text has been changed to \"{args.TextEditor.Text}\"."); }; linearRight.Add(linearRightText1); var linearRightText2 = new TextEditor() { Text = "16\nNew Line", PixelSize = 16, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; linearRightText2.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Right PixelSize 16 Text has been changed to \"{args.TextEditor.Text}\"."); }; linearRight.Add(linearRightText2); var linearRightText3 = new TextEditor() { Text = "64\nNew Line", PixelSize = 64, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.Red, }; linearRightText3.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Right PixelSize 64 Text has been changed to \"{args.TextEditor.Text}\"."); }; linearRight.Add(linearRightText3); var linearRightText4 = new TextEditor() { Text = "WrapContent\nNew Line", BackgroundColor = Color.Red, }; linearRightText4.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"LinearLayout Right Text with WrapContent WidthSpecification has been changed to \"{args.TextEditor.Text}\"."); }; linearRight.Add(linearRightText4); var gridViewTitle = new TextLabel() { Text = "GridLayout", WidthSpecification = LayoutParamPolicies.MatchParent, }; mainView.Add(gridViewTitle); var gridView = new View() { Layout = new GridLayout() { Rows = 5, Columns = 2, RowSpacing = 10, ColumnSpacing = 10, }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; mainView.Add(gridView); var gridCol1Text1 = new TextEditor() { BackgroundColor = Color.Green, }; gridCol1Text1.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 1 default size Text has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol1Text1, 0); GridLayout.SetColumn(gridCol1Text1, 0); GridLayout.SetHorizontalStretch(gridCol1Text1, GridLayout.StretchFlags.ExpandAndFill); GridLayout.SetVerticalStretch(gridCol1Text1, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol1Text1); var gridCol1Text2 = new TextEditor() { PixelSize = 16, BackgroundColor = Color.Green, }; gridCol1Text2.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 1 PixelSize 16 Text has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol1Text2, 1); GridLayout.SetColumn(gridCol1Text2, 0); GridLayout.SetHorizontalStretch(gridCol1Text2, GridLayout.StretchFlags.ExpandAndFill); GridLayout.SetVerticalStretch(gridCol1Text2, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol1Text2); var gridCol1Text3 = new TextEditor() { PixelSize = 64, BackgroundColor = Color.Green, }; gridCol1Text3.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 1 PixelSize 64 Text has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol1Text3, 2); GridLayout.SetColumn(gridCol1Text3, 0); GridLayout.SetHorizontalStretch(gridCol1Text3, GridLayout.StretchFlags.ExpandAndFill); GridLayout.SetVerticalStretch(gridCol1Text3, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol1Text3); var gridCol1Text4 = new TextEditor() { BackgroundColor = Color.Green, }; gridCol1Text4.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 1 Text with Fill has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol1Text4, 3); GridLayout.SetColumn(gridCol1Text4, 0); GridLayout.SetHorizontalStretch(gridCol1Text4, GridLayout.StretchFlags.Fill); GridLayout.SetVerticalStretch(gridCol1Text4, GridLayout.StretchFlags.Fill); gridView.Add(gridCol1Text4); var gridCol1Text5 = new TextEditor() { BackgroundColor = Color.Green, }; gridCol1Text5.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 1 Text with Expand has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol1Text5, 4); GridLayout.SetColumn(gridCol1Text5, 0); GridLayout.SetHorizontalStretch(gridCol1Text5, GridLayout.StretchFlags.Expand); GridLayout.SetVerticalStretch(gridCol1Text5, GridLayout.StretchFlags.Expand); gridView.Add(gridCol1Text5); var gridCol2Text1 = new TextEditor() { Text = "Default\nNew Line", BackgroundColor = Color.Green, }; gridCol2Text1.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 2 default size Text has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol2Text1, 0); GridLayout.SetColumn(gridCol2Text1, 1); GridLayout.SetHorizontalStretch(gridCol2Text1, GridLayout.StretchFlags.ExpandAndFill); GridLayout.SetVerticalStretch(gridCol2Text1, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol2Text1); var gridCol2Text2 = new TextEditor() { Text = "16\nNew Line", PixelSize = 16, BackgroundColor = Color.Green, }; gridCol2Text2.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 2 PixelSize 16 Text has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol2Text2, 1); GridLayout.SetColumn(gridCol2Text2, 1); GridLayout.SetHorizontalStretch(gridCol2Text2, GridLayout.StretchFlags.ExpandAndFill); GridLayout.SetVerticalStretch(gridCol2Text2, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol2Text2); var gridCol2Text3 = new TextEditor() { Text = "64\nNew Line", PixelSize = 64, BackgroundColor = Color.Green, }; gridCol2Text3.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 2 PixelSize 64 Text has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol2Text3, 2); GridLayout.SetColumn(gridCol2Text3, 1); GridLayout.SetHorizontalStretch(gridCol2Text3, GridLayout.StretchFlags.ExpandAndFill); GridLayout.SetVerticalStretch(gridCol2Text3, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol2Text3); var gridCol2Text4 = new TextEditor() { Text = "Fill\nNew Line", BackgroundColor = Color.Green, }; gridCol2Text4.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 2 Text with Fill has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol2Text4, 3); GridLayout.SetColumn(gridCol2Text4, 1); GridLayout.SetHorizontalStretch(gridCol2Text4, GridLayout.StretchFlags.Fill); GridLayout.SetVerticalStretch(gridCol2Text4, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol2Text4); var gridCol2Text5 = new TextEditor() { Text = "Expand\nNew Line", BackgroundColor = Color.Green, }; gridCol2Text5.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"GridLayout Column 2 Text with Expand has been changed to \"{args.TextEditor.Text}\"."); }; GridLayout.SetRow(gridCol2Text5, 4); GridLayout.SetColumn(gridCol2Text5, 1); GridLayout.SetHorizontalStretch(gridCol2Text5, GridLayout.StretchFlags.Expand); GridLayout.SetVerticalStretch(gridCol2Text5, GridLayout.StretchFlags.ExpandAndFill); gridView.Add(gridCol2Text5); var relativeViewTitle = new TextLabel() { Text = "RelativeLayout", WidthSpecification = LayoutParamPolicies.MatchParent, }; mainView.Add(relativeViewTitle); var relativeView = new View() { Layout = new RelativeLayout(), WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; mainView.Add(relativeView); var relTopText = new TextEditor() { Text = "Top with Fill\nNew Line", HorizontalAlignment = HorizontalAlignment.Center, BackgroundColor = Color.Red, }; relTopText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"RelativeLayout Top Text has been changed to \"{args.TextEditor.Text}\"."); }; RelativeLayout.SetTopRelativeOffset(relTopText, 0.0f); RelativeLayout.SetBottomRelativeOffset(relTopText, 0.0f); RelativeLayout.SetLeftRelativeOffset(relTopText, 0.0f); RelativeLayout.SetRightRelativeOffset(relTopText, 1.0f); RelativeLayout.SetFillHorizontal(relTopText, true); relativeView.Add(relTopText); var relLeftText = new TextEditor() { Text = "Left\nNew Line", BackgroundColor = Color.Green, }; relLeftText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"RelativeLayout Left Text has been changed to \"{args.TextEditor.Text}\"."); }; RelativeLayout.SetTopTarget(relLeftText, relTopText); RelativeLayout.SetTopRelativeOffset(relLeftText, 1.0f); RelativeLayout.SetBottomTarget(relLeftText, relTopText); RelativeLayout.SetBottomRelativeOffset(relLeftText, 1.0f); RelativeLayout.SetLeftRelativeOffset(relLeftText, 0.0f); RelativeLayout.SetRightRelativeOffset(relLeftText, 0.0f); relativeView.Add(relLeftText); var relRightText = new TextEditor() { Text = "Right\nNew Line", BackgroundColor = Color.Blue, }; relRightText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"RelativeLayout Right Text has been changed to \"{args.TextEditor.Text}\"."); }; RelativeLayout.SetTopTarget(relRightText, relTopText); RelativeLayout.SetTopRelativeOffset(relRightText, 1.0f); RelativeLayout.SetBottomTarget(relRightText, relTopText); RelativeLayout.SetBottomRelativeOffset(relRightText, 1.0f); RelativeLayout.SetLeftRelativeOffset(relRightText, 1.0f); RelativeLayout.SetRightRelativeOffset(relRightText, 1.0f); RelativeLayout.SetHorizontalAlignment(relRightText, RelativeLayout.Alignment.End); relativeView.Add(relRightText); var relBottomText = new TextEditor() { Text = "Bottom\nNew Line", BackgroundColor = Color.Yellow, }; relBottomText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"RelativeLayout Bottom Text has been changed to \"{args.TextEditor.Text}\"."); }; RelativeLayout.SetTopRelativeOffset(relBottomText, 1.0f); RelativeLayout.SetBottomRelativeOffset(relBottomText, 1.0f); RelativeLayout.SetLeftTarget(relBottomText, relLeftText); RelativeLayout.SetLeftRelativeOffset(relBottomText, 1.0f); RelativeLayout.SetRightTarget(relBottomText, relRightText); RelativeLayout.SetRightRelativeOffset(relBottomText, 0.0f); RelativeLayout.SetHorizontalAlignment(relBottomText, RelativeLayout.Alignment.Center); RelativeLayout.SetVerticalAlignment(relBottomText, RelativeLayout.Alignment.End); relativeView.Add(relBottomText); var relCenterText = new TextEditor() { BackgroundColor = Color.Purple, }; relCenterText.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"RelativeLayout Center Text has been changed to \"{args.TextEditor.Text}\"."); }; RelativeLayout.SetTopTarget(relCenterText, relTopText); RelativeLayout.SetTopRelativeOffset(relCenterText, 1.0f); RelativeLayout.SetBottomTarget(relCenterText, relBottomText); RelativeLayout.SetBottomRelativeOffset(relCenterText, 0.0f); RelativeLayout.SetLeftTarget(relCenterText, relLeftText); RelativeLayout.SetLeftRelativeOffset(relCenterText, 1.0f); RelativeLayout.SetRightTarget(relCenterText, relRightText); RelativeLayout.SetRightRelativeOffset(relCenterText, 0.0f); RelativeLayout.SetFillHorizontal(relCenterText, true); relativeView.Add(relCenterText); var flexRowViewTitle = new TextLabel() { Text = "FlexLayout with Row Direction", WidthSpecification = LayoutParamPolicies.MatchParent, }; mainView.Add(flexRowViewTitle); var flexRowView = new View() { Layout = new FlexLayout() { Direction = FlexLayout.FlexDirection.Row, WrapType = FlexLayout.FlexWrapType.Wrap, Alignment = FlexLayout.AlignmentType.Center, ItemsAlignment = FlexLayout.AlignmentType.Center, Justification = FlexLayout.FlexJustification.SpaceEvenly, }, WidthSpecification = LayoutParamPolicies.MatchParent, BackgroundColor = Color.White, }; mainView.Add(flexRowView); var flexRowText1 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Red, }; flexRowText1.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Row First Text has been changed to \"{args.TextEditor.Text}\"."); }; flexRowView.Add(flexRowText1); var flexRowText2 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Green, }; flexRowText2.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Row Second Text has been changed to \"{args.TextEditor.Text}\"."); }; flexRowView.Add(flexRowText2); var flexRowText3 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Blue, }; flexRowText3.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Row Third Text has been changed to \"{args.TextEditor.Text}\"."); }; flexRowView.Add(flexRowText3); var flexRowText4 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Yellow, }; flexRowText4.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Row Fourth Text has been changed to \"{args.TextEditor.Text}\"."); }; flexRowView.Add(flexRowText4); var flexColViewTitle = new TextEditor() { Text = "FlexLayout with Column Direction", WidthSpecification = LayoutParamPolicies.MatchParent, }; mainView.Add(flexColViewTitle); var flexColView = new View() { Layout = new FlexLayout() { Direction = FlexLayout.FlexDirection.Column, WrapType = FlexLayout.FlexWrapType.Wrap, Alignment = FlexLayout.AlignmentType.Center, ItemsAlignment = FlexLayout.AlignmentType.Center, Justification = FlexLayout.FlexJustification.SpaceEvenly, }, WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 300, BackgroundColor = Color.White, }; mainView.Add(flexColView); var flexColText1 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Red, }; flexColText1.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Column First Text has been changed to \"{args.TextEditor.Text}\"."); }; flexColView.Add(flexColText1); var flexColText2 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Green, }; flexColText2.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Column Second Text has been changed to \"{args.TextEditor.Text}\"."); }; flexColView.Add(flexColText2); var flexColText3 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Blue, }; flexColText3.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Column Third Text has been changed to \"{args.TextEditor.Text}\"."); }; flexColView.Add(flexColText3); var flexColText4 = new TextEditor() { Text = "TextEditor\nNew Line", BackgroundColor = Color.Yellow, }; flexColText4.TextChanged += (object sender, TextEditor.TextChangedEventArgs args) => { global::System.Console.WriteLine($"FlexLayout with Column Fourth Text has been changed to \"{args.TextEditor.Text}\"."); }; flexColView.Add(flexColText4); }
public void Activate() { window = NUIApplication.GetDefaultWindow(); page = new GridTest3Page(); window.GetDefaultNavigator().Push(page); }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); // Create root view. root = new View() { Size = new Size(1920, 1080), BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f), Padding = new Extents(40, 40, 40, 40), Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, CellPadding = new Size(40, 40), LinearAlignment = LinearLayout.Alignment.Center, } }; window.Add(root); ///////////////////////////////////////////////Create by Property////////////////////////////////////////////////////////// left = new View() { Size = new Size(920, 800), Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical } }; //Create left description text. createText[0] = new TextLabel(); createText[0].Text = "Create RadioButton just by properties"; createText[0].TextColor = Color.White; createText[0].Size = new Size(800, 100); left.Add(createText[0]); leftbody = new View(); leftbody.Layout = new GridLayout() { Columns = 4 }; int num = 4; for (int i = 0; i < num; i++) { group[i] = new RadioButtonGroup(); modeText[i] = new TextLabel(); modeText[i].Text = mode[i]; modeText[i].Size = new Size(200, 48); modeText[i].HorizontalAlignment = HorizontalAlignment.Center; modeText[i].VerticalAlignment = VerticalAlignment.Center; leftbody.Add(modeText[i]); } for (int i = 0; i < num; i++) { // create utility radio button. utilityRadioButton[i] = new RadioButton(); var utilityStyle = utilityRadioButton[i].Style; utilityStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; utilityStyle.Icon.BackgroundImage = ""; utilityStyle.Icon.ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png", }; utilityRadioButton[i].ApplyStyle(utilityStyle); utilityRadioButton[i].Size = new Size(48, 48); utilityRadioButton[i].Icon.Size = new Size(48, 48); group[0].Add(utilityRadioButton[i]); // create family radio button. familyRadioButton[i] = new RadioButton(); var familyStyle = familyRadioButton[i].Style; familyStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; familyStyle.Icon.BackgroundImage = ""; familyStyle.Icon.ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", }; familyRadioButton[i].ApplyStyle(familyStyle); familyRadioButton[i].Size = new Size(48, 48); familyRadioButton[i].Icon.Size = new Size(48, 48); group[1].Add(familyRadioButton[i]); // create food radio button. foodRadioButton[i] = new RadioButton(); var foodStyle = foodRadioButton[i].Style; foodStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; foodStyle.Icon.BackgroundImage = ""; foodStyle.Icon.ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", }; foodRadioButton[i].ApplyStyle(foodStyle); foodRadioButton[i].Size = new Size(150, 48); foodRadioButton[i].Icon.Size = new Size(48, 48); group[2].Add(foodRadioButton[i]); // create kitchen radio button. kitchenRadioButton[i] = new RadioButton(); var kitchenStyle = kitchenRadioButton[i].Style; kitchenStyle.Icon.Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }; kitchenStyle.Icon.BackgroundImage = ""; kitchenStyle.Icon.ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", }; kitchenRadioButton[i].ApplyStyle(kitchenStyle); kitchenRadioButton[i].Size = new Size(48, 48); kitchenRadioButton[i].Icon.Size = new Size(48, 48); group[3].Add(kitchenRadioButton[i]); leftbody.Add(utilityRadioButton[i]); leftbody.Add(familyRadioButton[i]); leftbody.Add(foodRadioButton[i]); leftbody.Add(kitchenRadioButton[i]); } ///////////////////////////////////////////////Create by Attributes////////////////////////////////////////////////////////// right = new View() { Size = new Size(920, 800), Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, } }; rightbody = new View(); rightbody.Layout = new GridLayout() { Columns = 4 }; createText[1] = new TextLabel(); createText[1].Text = "Create RadioButton just by styles"; createText[1].TextColor = Color.White; createText[1].Size = new Size(800, 100); right.Add(createText[1]); for (int i = 0; i < num; i++) { group2[i] = new RadioButtonGroup(); modeText2[i] = new TextLabel(); modeText2[i].Text = mode[i]; modeText2[i].Size = new Size(200, 48); modeText2[i].HorizontalAlignment = HorizontalAlignment.Center; modeText2[i].VerticalAlignment = VerticalAlignment.Center; rightbody.Add(modeText2[i]); } //Create utility style of radio button. ButtonStyle utilityStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_on.png", }, }, }; //Create family style of radio button. ButtonStyle familyStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_24c447.png", }, }, }; //Create food style of radio button. ButtonStyle foodStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_ec7510.png", }, }, }; //Create kitchen style of radio button. ButtonStyle kitchenStyle2 = new ButtonStyle { Icon = new ImageViewStyle { Size = new Size(48, 48), Opacity = new Selector <float?> { Normal = 1.0f, Selected = 1.0f, Disabled = 0.4f, DisabledSelected = 0.4f }, ResourceUrl = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", Selected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", Disabled = CommonResource.GetFHResourcePath() + "9. Controller/controller_btn_radio_off.png", DisabledSelected = CommonResource.GetFHResourcePath() + "9. Controller/[Controller] App Primary Color/controller_btn_radio_on_9762d9.png", }, }, }; for (int i = 0; i < num; i++) { utilityRadioButton2[i] = new RadioButton(utilityStyle2); utilityRadioButton2[i].Size = new Size(48, 48); group2[0].Add(utilityRadioButton2[i]); familyRadioButton2[i] = new RadioButton(familyStyle2); familyRadioButton2[i].Size = new Size(48, 48); group2[1].Add(familyRadioButton2[i]); foodRadioButton2[i] = new RadioButton(foodStyle2); foodRadioButton2[i].Size = new Size(48, 48); group2[2].Add(foodRadioButton2[i]); kitchenRadioButton2[i] = new RadioButton(kitchenStyle2); kitchenRadioButton2[i].Size = new Size(48, 48); group2[3].Add(kitchenRadioButton2[i]); rightbody.Add(utilityRadioButton2[i]); rightbody.Add(familyRadioButton2[i]); rightbody.Add(foodRadioButton2[i]); rightbody.Add(kitchenRadioButton2[i]); } root.Add(left); root.Add(right); left.Add(leftbody); right.Add(rightbody); utilityRadioButton[2].IsEnabled = false; familyRadioButton[2].IsEnabled = false; foodRadioButton[2].IsEnabled = false; kitchenRadioButton[2].IsEnabled = false; utilityRadioButton2[2].IsEnabled = false; familyRadioButton2[2].IsEnabled = false; foodRadioButton2[2].IsEnabled = false; kitchenRadioButton2[2].IsEnabled = false; utilityRadioButton[3].IsEnabled = false; familyRadioButton[3].IsEnabled = false; foodRadioButton[3].IsEnabled = false; kitchenRadioButton[3].IsEnabled = false; utilityRadioButton[3].IsSelected = true; familyRadioButton[3].IsSelected = true; foodRadioButton[3].IsSelected = true; kitchenRadioButton[3].IsSelected = true; utilityRadioButton2[3].IsEnabled = false; familyRadioButton2[3].IsEnabled = false; foodRadioButton2[3].IsEnabled = false; kitchenRadioButton2[3].IsEnabled = false; utilityRadioButton2[3].IsSelected = true; familyRadioButton2[3].IsSelected = true; foodRadioButton2[3].IsSelected = true; kitchenRadioButton2[3].IsSelected = true; }
public void Activate() { window = NUIApplication.GetDefaultWindow(); page = new ScrollViewTest7Page(); window.GetDefaultNavigator().Push(page); }
public void Deactivate() { if (root != null) { int num = 4; for (int i = 0; i < num; i++) { leftbody.Remove(utilityRadioButton[i]); utilityRadioButton[i].Dispose(); utilityRadioButton[i] = null; leftbody.Remove(familyRadioButton[i]); familyRadioButton[i].Dispose(); familyRadioButton[i] = null; leftbody.Remove(foodRadioButton[i]); foodRadioButton[i].Dispose(); foodRadioButton[i] = null; leftbody.Remove(kitchenRadioButton[i]); kitchenRadioButton[i].Dispose(); kitchenRadioButton[i] = null; leftbody.Remove(modeText[i]); modeText[i].Dispose(); modeText[i] = null; rightbody.Remove(utilityRadioButton2[i]); utilityRadioButton2[i].Dispose(); utilityRadioButton2[i] = null; rightbody.Remove(familyRadioButton2[i]); familyRadioButton2[i].Dispose(); familyRadioButton2[i] = null; rightbody.Remove(foodRadioButton2[i]); foodRadioButton2[i].Dispose(); foodRadioButton2[i] = null; rightbody.Remove(kitchenRadioButton2[i]); kitchenRadioButton2[i].Dispose(); kitchenRadioButton2[i] = null; rightbody.Remove(modeText2[i]); modeText2[i].Dispose(); modeText2[i] = null; } left.Remove(createText[0]); createText[0].Dispose(); createText[0] = null; left.Remove(leftbody); leftbody.Dispose(); leftbody = null; right.Remove(createText[1]); createText[1].Dispose(); createText[1] = null; right.Remove(rightbody); rightbody.Dispose(); rightbody = null; root.Remove(left); left.Dispose(); left = null; root.Remove(right); right.Dispose(); right = null; NUIApplication.GetDefaultWindow().Remove(root); root.Dispose(); root = null; } }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); root = new View() { Size = new Size(1920, 1080), BackgroundColor = new Color(0.7f, 0.9f, 0.8f, 1.0f), Layout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Center, LinearOrientation = LinearLayout.Orientation.Horizontal, CellPadding = new Size(50, 50), } }; window.Add(root); window.KeyEvent += Window_KeyEvent; parent1 = new View() { Size = new Size(300, 900), Layout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Top, LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size(50, 50), } }; parent2 = new View() { Size = new Size(300, 900), Layout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Top, LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size(50, 50), } }; // Only show a text button. textButton = new Button(); textButton.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png"; textButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5); textButton.Size = new Size(300, 80); textButton.TextLabel.Text = "Button"; parent1.Add(textButton); //Only show an icon button. iconButton = new Button(); iconButton.Text = ""; iconButton.Name = "IconButton"; iconButton.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png"; iconButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5); iconButton.Size = new Size(80, 80); iconButton.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png"; parent2.Add(iconButton); iconButton.Clicked += (ojb, e) => { var btn = iconButton.Icon.GetParent() as Button; string name = btn.Name; }; parent3 = new View() { Size = new Size(600, 400), Layout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.Top, LinearOrientation = LinearLayout.Orientation.Vertical, CellPadding = new Size(50, 50), } }; //Show a button with icon and text. iconTextButton = new Button(); iconTextButton.Text = "IconTextButton"; iconTextButton.BackgroundImage = CommonResource.GetTVResourcePath() + "component/c_buttonbasic/c_basic_button_white_bg_normal_9patch.png"; iconTextButton.BackgroundImageBorder = new Rectangle(4, 4, 5, 5); iconTextButton.IconRelativeOrientation = Button.IconOrientation.Left; iconTextButton.Icon.ResourceUrl = CommonResource.GetTVResourcePath() + "component/c_radiobutton/c_radiobutton_white_check.png"; iconTextButton.IconPadding = new Extents(20, 20, 20, 20); iconTextButton.TextPadding = new Extents(20, 50, 20, 20); iconTextButton.Size = new Size(500, 300); parent3.Add(iconTextButton); ///////////////////////////////////////////////Create by Property////////////////////////////////////////////////////////// //Create utility basic style of button. var utilityBasicButtonStyle = new ButtonStyle() { Overlay = new ImageViewStyle() { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" }, Border = new Rectangle(5, 5, 5, 5) }, Text = new TextLabelStyle() { TextColor = new Selector <Color> { Normal = new Color(0, 0, 0, 1), Pressed = new Color(0, 0, 0, 0.7f), Selected = new Color(0.058f, 0.631f, 0.92f, 1), Disabled = new Color(0, 0, 0, 0.4f) }, Text = "UtilityBasicButton", PointSize = 20, }, BackgroundImage = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png", BackgroundImageBorder = new Rectangle(5, 5, 5, 5), }; utilityBasicButton = new Button(); utilityBasicButton.ApplyStyle(utilityBasicButtonStyle); utilityBasicButton.IsSelectable = true; utilityBasicButton.ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)); utilityBasicButton.Size = new Size(300, 80); utilityBasicButton.IsEnabled = false; parent1.Add(utilityBasicButton); //Create utility service style of button. var utilityServiceButtonStyle = new ButtonStyle() { Overlay = new ImageViewStyle() { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" }, Border = new Rectangle(5, 5, 5, 5) }, Text = new TextLabelStyle() { TextColor = new Selector <Color> { Normal = new Color(1, 1, 1, 1), Pressed = new Color(1, 1, 1, 0.7f), Disabled = new Color(1, 1, 1, 0.4f) }, Text = "ServiceBasicButton", PointSize = 20, }, BackgroundImage = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png", BackgroundImageBorder = new Rectangle(5, 5, 5, 5) }; utilityServiceButton = new Button(); utilityServiceButton.ApplyStyle(utilityServiceButtonStyle); utilityServiceButton.ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)); utilityServiceButton.Size = new Size(300, 80); parent1.Add(utilityServiceButton); //Create utility toggle style of button. var utilityToggleButtonStyle = new ButtonStyle() { BackgroundImage = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "3. Button/rectangle_toggle_btn_normal.png", Selected = CommonResource.GetFHResourcePath() + "3. Button/rectangle_point_btn_normal.png", }, Overlay = new ImageViewStyle() { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" } }, Text = new TextLabelStyle() { TextColor = new Selector <Color> { Normal = new Color(0.058f, 0.631f, 0.92f, 1), Selected = new Color(1, 1, 1, 1), }, Text = new Selector <string> { Normal = "Toggle Off", Selected = "Toggle On" }, PointSize = 20 }, BackgroundColor = new Selector <Color>() }; utilityToggleButton = new Button(); utilityToggleButton.ApplyStyle(utilityToggleButtonStyle); utilityToggleButton.IsSelectable = true; utilityToggleButton.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); utilityToggleButton.ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)); utilityToggleButton.OverlayImage.Border = new Rectangle(5, 5, 5, 5); utilityToggleButton.Size = new Size(300, 80); parent1.Add(utilityToggleButton); //Create utility oval style of button. var utilityOvalButtonStyle = new ButtonStyle() { BackgroundImage = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png", Selected = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_select.png", }, Overlay = new ImageViewStyle() { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png", Other = "" } }, Text = new TextLabelStyle() { Text = "", }, BackgroundColor = new Selector <Color>(), }; utilityOvalButton = new Button(); utilityOvalButton.ApplyStyle(utilityOvalButtonStyle); utilityOvalButton.IsSelectable = true; utilityOvalButton.BackgroundImageBorder = new Rectangle(5, 5, 5, 5); utilityOvalButton.ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png", new Rectangle(5, 5, 5, 5)); utilityOvalButton.OverlayImage.Border = new Rectangle(5, 5, 5, 5); utilityOvalButton.Size = new Size(104, 104); utilityOvalButton.TextLabel.PointSize = 20; parent1.Add(utilityOvalButton); ///////////////////////////////////////////////Create by Attributes////////////////////////////////////////////////////////// //Create family basic style of Button. ButtonStyle familyBasicButtonStyle = new ButtonStyle { IsSelectable = true, BackgroundImage = new Selector <string> { All = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_normal.png" }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)), Overlay = new ImageViewStyle { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" }, Border = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, }, Text = new TextLabelStyle { PointSize = new Selector <float?> { All = 20 }, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, TextColor = new Selector <Color> { Normal = new Color(0, 0, 0, 1), Pressed = new Color(0, 0, 0, 0.7f), Selected = new Color(0.141f, 0.769f, 0.278f, 1), Disabled = new Color(0, 0, 0, 0.4f), }, Text = "FamilyBasicButton", } }; familyBasicButton = new Button(familyBasicButtonStyle); familyBasicButton.Size = new Size(300, 80); parent2.Add(familyBasicButton); //Create family service style of button. ButtonStyle familyServiceButtonStyle = new ButtonStyle { IsSelectable = false, BackgroundImage = new Selector <string> { All = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png" }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)), Overlay = new ImageViewStyle { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" }, Border = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, }, Text = new TextLabelStyle { PointSize = new Selector <float?> { All = 20 }, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, TextColor = new Selector <Color> { Normal = new Color(1, 1, 1, 1), Pressed = new Color(1, 1, 1, 0.7f), Disabled = new Color(1, 1, 1, 0.4f), }, Text = "FamilySeviceButton" } }; familyServiceButton = new Button(familyServiceButtonStyle); familyServiceButton.Size = new Size(300, 80); parent2.Add(familyServiceButton); //Create family toggle style of button. ButtonStyle familyToggleButtonStyle = new ButtonStyle { IsSelectable = true, BackgroundImage = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_toggle_btn_normal_24c447.png", Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/rectangle_point_btn_normal_24c447.png", }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_shadow.png", new Rectangle(5, 5, 5, 5)), Overlay = new ImageViewStyle { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/rectangle_btn_press_overlay.png", Other = "" }, Border = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, }, Text = new TextLabelStyle { PointSize = new Selector <float?> { All = 20 }, HorizontalAlignment = HorizontalAlignment.Center, VerticalAlignment = VerticalAlignment.Center, WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, TextColor = new Selector <Color> { Normal = new Color(0.141f, 0.769f, 0.278f, 1), Selected = new Color(1, 1, 1, 1), }, Text = new Selector <string> { Normal = "Toggle Off", Selected = "Toggle On" } } }; familyToggleButton = new Button(familyToggleButtonStyle); familyToggleButton.Size = new Size(300, 80); parent2.Add(familyToggleButton); //Create family oval style of button. ButtonStyle familyOvalButtonStyle = new ButtonStyle { IsSelectable = true, BackgroundImage = new Selector <string> { Normal = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_normal.png", Selected = CommonResource.GetFHResourcePath() + "3. Button/[Button] App Primary Color/oval_toggle_btn_select_24c447.png", }, BackgroundImageBorder = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, ImageShadow = new ImageShadow(CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_shadow.png", new Rectangle(5, 5, 5, 5)), Overlay = new ImageViewStyle { ResourceUrl = new Selector <string> { Pressed = CommonResource.GetFHResourcePath() + "3. Button/oval_toggle_btn_press_overlay.png", Other = "" }, Border = new Selector <Rectangle> { All = new Rectangle(5, 5, 5, 5) }, }, }; familyOvalButton = new Button(familyOvalButtonStyle); familyOvalButton.Size = new Size(104, 104); parent2.Add(familyOvalButton); // Add three layout into root root.Add(parent1); root.Add(parent2); root.Add(parent3); }
public void Initialize() { NUIApplication.GetDefaultWindow().KeyEvent += OnKeyEvent; Size2D stageSize = NUIApplication.GetDefaultWindow().WindowSize; // Background mRootActor = CreateBackground("LauncherBackground"); // Add logo ImageView logo = new ImageView(LOGO_PATH); logo.Name = "LOGO_IMAGE"; logo.PositionUsesPivotPoint = true; logo.PivotPoint = PivotPoint.TopCenter; logo.ParentOrigin = new Position(0.5f, 0.1f, 0.5f); logo.WidthResizePolicy = ResizePolicyType.UseNaturalSize; logo.HeightResizePolicy = ResizePolicyType.UseNaturalSize; //// The logo should appear on top of everything. mRootActor.Add(logo); // Show version in a popup when log is tapped mLogoTapDetector = new TapGestureDetector(); mLogoTapDetector.Attach(logo); mLogoTapDetector.Detected += OnLogoTapped; // Scrollview occupying the majority of the screen mScrollView = new ScrollView(); mScrollView.PositionUsesPivotPoint = true; mScrollView.PivotPoint = PivotPoint.BottomCenter; mScrollView.ParentOrigin = new Vector3(0.5f, 1.0f - 0.05f, 0.5f); mScrollView.WidthResizePolicy = ResizePolicyType.FillToParent; mScrollView.HeightResizePolicy = ResizePolicyType.SizeRelativeToParent; mScrollView.SetSizeModeFactor(new Vector3(0.0f, 0.6f, 0.0f)); ushort buttonsPageMargin = (ushort)((1.0f - TABLE_RELATIVE_SIZE.X) * 0.5f * stageSize.Width); mScrollView.SetPadding(new PaddingType(buttonsPageMargin, buttonsPageMargin, 0, 0)); mScrollView.ScrollCompleted += OnScrollComplete; mScrollView.ScrollStarted += OnScrollStart; mPageWidth = stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f; // Populate background and bubbles - needs to be scrollViewLayer so scroll ends show View bubbleContainer = new View(); bubbleContainer.WidthResizePolicy = bubbleContainer.HeightResizePolicy = ResizePolicyType.FillToParent; bubbleContainer.PositionUsesPivotPoint = true; bubbleContainer.PivotPoint = PivotPoint.Center; bubbleContainer.ParentOrigin = ParentOrigin.Center; SetupBackground(bubbleContainer); mRootActor.Add(bubbleContainer); mRootActor.Add(mScrollView); // Add scroll view effect and setup constraints on pages ApplyScrollViewEffect(); // Add pages and tiles Populate(); if (mCurPage != mScrollView.GetCurrentPage()) { mScrollView.ScrollTo(mCurPage, 0.0f); } // Remove constraints for inner cube effect ApplyCubeEffectToPages(); // Set initial orientation uint degrees = 0; Rotate(degrees); // Background animation mAnimationTimer = new Timer(BACKGROUND_ANIMATION_DURATION); mAnimationTimer.Tick += PauseBackgroundAnimation; mAnimationTimer.Start(); mBackgroundAnimsPlaying = true; }
public void Activate() { Window window = NUIApplication.GetDefaultWindow(); TargetView = new View() { WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, }, }; window.Add(TargetView); var log = new LogOutput(); TargetView.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { log.AddLog($"TouchEvent on Layout"); } return(false); }; var margin = new View { SizeHeight = 50, WidthResizePolicy = ResizePolicyType.FillToParent }; TargetView.Add(margin); var container = new View { WidthResizePolicy = ResizePolicyType.FillToParent, SizeHeight = 400, BackgroundColor = Color.Gray, Layout = new AbsoluteLayout(), }; container.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { log.AddLog($"TouchEvent on Gray"); } return(false); }; TargetView.Add(container); var layer = new Layer(); window.AddLayer(layer); var overlayContainer = new MyView { WidthResizePolicy = ResizePolicyType.FillToParent, SizeHeight = 150, BackgroundColor = Color.Red, Layout = new AbsoluteLayout(), }; overlayContainer.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { log.AddLog($"TouchEvent on Red"); } return(false); }; var overlayContainer2 = new View { WidthResizePolicy = ResizePolicyType.FillToParent, SizeHeight = 200, BackgroundColor = Color.Yellow, Layout = new AbsoluteLayout(), }; tap = new TapGestureDetector(); tap.Detected += (s, e) => { if (e.TapGesture.State == Gesture.StateType.Started) { log.AddLog($"Gesture Detected on Yellow"); } }; tap.Attach(overlayContainer2); overlayContainer2.TouchEvent += (s, e) => { if (e.Touch.GetState(0) == PointStateType.Down) { log.AddLog($"TouchEvent on Yellow"); } return(false); }; layer.Add(overlayContainer); layer.Add(overlayContainer2); overlayContainer2.Position = new Position(0, 150); TargetView.RemovedFromWindow += (s, e) => { window.RemoveLayer(layer); }; TargetView.Add(log); }
private void Populate() { Vector2 stageSize = NUIApplication.GetDefaultWindow().WindowSize; mTotalPages = (uint)((mExampleList.Count() + EXAMPLES_PER_PAGE - 1) / EXAMPLES_PER_PAGE); // Populate ScrollView. if (mExampleList.Count() > 0) { if (mSortAlphabetically) { mExampleList.Sort(Example.CompareByTitle); } int pageCount = mExampleList.Count / (ROWS_PER_PAGE * EXAMPLES_PER_ROW) + ((0 == mExampleList.Count % (ROWS_PER_PAGE * EXAMPLES_PER_ROW)) ? 0 : 1); mPages = new View[pageCount]; int pageIndex = 0; uint exampleCount = 0; for (int t = 0; t < mTotalPages; t++) { // Create Table TableView page = new TableView(ROWS_PER_PAGE, EXAMPLES_PER_ROW); page.PositionUsesPivotPoint = true; page.PivotPoint = PivotPoint.Center; page.ParentOrigin = ParentOrigin.Center; page.WidthResizePolicy = page.HeightResizePolicy = ResizePolicyType.FillToParent; mScrollView.Add(page); // Calculate the number of images going across (columns) within a page, according to the screen resolution and dpi. const float margin = 2.0f; const float tileParentMultiplier = 1.0f / EXAMPLES_PER_ROW; for (uint row = 0; row < ROWS_PER_PAGE; row++) { for (uint column = 0; column < EXAMPLES_PER_ROW; column++) { Example example = mExampleList.ElementAt((int)exampleCount++); // Calculate the tiles relative position on the page (between 0 & 1 in each dimension). Vector2 position = new Vector2((float)(column) / (EXAMPLES_PER_ROW - 1.0f), (float)(row) / (EXAMPLES_PER_ROW - 1.0f)); View tile = CreateTile(example.Name, example.Title, new Vector3(tileParentMultiplier, tileParentMultiplier, 1.0f), position); tile.SetPadding(new PaddingType((int)margin, (int)margin, (int)margin, (int)margin)); page.AddChild(tile, new TableView.CellPosition(row, column)); tiles.Add(tile); if (exampleCount == mExampleList.Count) { break; } } if (exampleCount == mExampleList.Count) { break; } } mPages[pageIndex++] = page; if (exampleCount == mExampleList.Count) { break; } } } // Update Ruler info. mScrollRulerX = new RulerPtr(new FixedRuler(mPageWidth)); mScrollRulerY = new RulerPtr(new DefaultRuler()); mScrollRulerX.SetDomain(new RulerDomain(0.0f, (mTotalPages + 1) * stageSize.Width * TABLE_RELATIVE_SIZE.X * 0.5f, true)); mScrollRulerY.Disable(); mScrollView.SetRulerX(mScrollRulerX); mScrollView.SetRulerY(mScrollRulerY); }
public MainPage() : base() { ScrollableBase infoScroll = new ScrollableBase() { ScrollingDirection = ScrollableBase.Direction.Vertical, Size = new Size(Size), Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, }, }; Add(infoScroll); infoScroll.ContentContainer.Padding = new Extents(0, 0, 80, 0); List <object> dummyData = ItemData.CreateDummyItemData(50); Random r = new Random(); foreach (ItemData data in dummyData) { View item = new View() { Size = new Size(Size.Width, 260), Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, }, Padding = new Extents(15, 15, 0, 0), Margin = new Extents(0, 0, 15, 0), }; infoScroll.Add(item); View mainInformation = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 200, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, } }; item.Add(mainInformation); ImageView itemImage = new ImageView() { Size = new Size(200, 200), ResourceUrl = "./res/images/" + data.ImageUrl, DesiredWidth = 200, DesiredHeight = 200, BackgroundColor = new Color("#f0f0f0"), }; mainInformation.Add(itemImage); View detailInformation = new View() { WidthSpecification = 250, HeightSpecification = 200, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, } }; mainInformation.Add(detailInformation); View details = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 160, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Vertical, } }; detailInformation.Add(details); TextLabel itemName = new TextLabel() { Text = data.Name, WidthSpecification = LayoutParamPolicies.MatchParent, MultiLine = true, PixelSize = 16, Margin = new Extents(15, 15, 15, 15) }; details.Add(itemName); TextLabel itemPrice = new TextLabel() { Text = data.Price, WidthSpecification = LayoutParamPolicies.MatchParent, PixelSize = 24, Margin = new Extents(15, 15, 0, 0) }; details.Add(itemPrice); detailInformation.Add(new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 1, BackgroundColor = new Color("#f0f0f0"), }); View icons = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 40, Layout = new FlexLayout() { Direction = FlexLayout.FlexDirection.Row, ItemsAlignment = FlexLayout.AlignmentType.Center, Justification = FlexLayout.FlexJustification.FlexEnd, }, }; detailInformation.Add(icons); ImageView heart = new ImageView() { Size = new Size(40, 32), ResourceUrl = "./res/images/" + (r.Next(0, 10) % 2 == 0 ? "heart.png" : "heart_selected.png"), FittingMode = FittingModeType.ScaleToFill, Margin = new Extents(0, 10, 0, 0) }; icons.Add(heart); ImageView cart = new ImageView() { Size = new Size(40, 40), ResourceUrl = "./res/images/cart.svg", FittingMode = FittingModeType.ScaleToFill }; icons.Add(cart); detailInformation.Add(new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 1, BackgroundColor = new Color("#f0f0f0"), }); View additionalInformation = new View() { WidthSpecification = LayoutParamPolicies.MatchParent, HeightSpecification = 60, Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, CellPadding = new Size2D(15, 15), LinearAlignment = LinearLayout.Alignment.CenterVertical, }, }; item.Add(additionalInformation); TextLabel point = new TextLabel() { Text = "☆ " + ((float)r.Next(30, 50) / 10.0f) + "점", PixelSize = 16.0f, }; additionalInformation.Add(point); TextLabel views = new TextLabel() { Text = (r.Next(300, 4000)) + "건", PixelSize = 16.0f, }; additionalInformation.Add(views); if (r.Next(0, 10) % 2 == 0) { TextLabel quick = new TextLabel() { Text = "퀵배송", PixelSize = 16.0f, TextColor = new Color("#6c7080"), }; additionalInformation.Add(quick); } if (r.Next(0, 10) % 2 == 0) { TextLabel discount = new TextLabel() { Text = r.Next(0, 20) + "% 카드할인", PixelSize = 16.0f, TextColor = new Color("#6c7080"), }; additionalInformation.Add(discount); } mainInformation.TouchEvent += (object source, TouchEventArgs args) => { bool result = false; if (args.Touch.GetState(0) == PointStateType.Finished) { PageController.Instance.Go("ItemDetail", data); result = true; } return(result); }; View header = new View() { Size = new Size(NUIApplication.GetDefaultWindow().Size.Width, 80), BackgroundColor = new Color("#ffd040"), Layout = new LinearLayout() { LinearOrientation = LinearLayout.Orientation.Horizontal, LinearAlignment = LinearLayout.Alignment.CenterVertical, CellPadding = new Tizen.NUI.Vector2(15, 0), }, Padding = new Extents(15, 15, 0, 0), }; Add(header); TextLabel logo = new TextLabel() { Text = "Y-MART", PixelSize = 24, }; header.Add(logo); } BackKeyPressed += (object source, EventArgs args) => { NUIApplication.Current.Exit(); }; }
public void Activate() { window = NUIApplication.GetDefaultWindow(); window.GetDefaultNavigator().Push(new AnimatedVectorImageViewTestPage()); }