public WidgetView CreateWidget(string res) { _widgetView = _viewManager.AddWidget(res, "", 360, 360, 0); _widgetView.WidgetContentUpdated += OnWidgetContentUpdated; _widgetView.Size2D = new Size2D(360, 360); _widgetView.ParentOrigin = ParentOrigin.TopLeft; _widgetView.PivotPoint = PivotPoint.TopLeft; _widgetView.PositionUsesPivotPoint = true; return(_widgetView); }
void Initialize() { var appWindow = Window.Instance; ImageView background = new ImageView(DirectoryInfo.Resource + "/images/bg.png"); appWindow.Add(background); //Setting the background parameters so that it occupies the entire application window background.Size2D = new Size2D(appWindow.Size.Width, appWindow.Size.Height); background.Position2D = new Position2D(0, 0); View widgetsList = new View() { WidthResizePolicy = ResizePolicyType.FillToParent, HeightResizePolicy = ResizePolicyType.FillToParent, Layout = new LinearLayout() { LinearAlignment = LinearLayout.Alignment.CenterVertical, LinearOrientation = LinearLayout.Orientation.Horizontal, CellPadding = new Size2D(20, 20), Padding = new Extents(30, 30, 30, 30) } }; WidgetViewManager widgetViewManager = new WidgetViewManager(this, this.ApplicationInfo.ApplicationId); var galleryWidget = widgetViewManager.AddWidget("org.tizen.gallery.widget", "", Window.Instance.WindowSize.Width / 2 - 40, Window.Instance.WindowSize.Height, 0); var contactsWidget = widgetViewManager.AddWidget("org.tizen.contacts.widget", "", Window.Instance.WindowSize.Width / 2 - 40, Window.Instance.WindowSize.Height, 0); widgetsList.Add(galleryWidget); widgetsList.Add(contactsWidget); Window.Instance.GetDefaultLayer().Add(widgetsList); }
void Initialize() { Window window = GetDefaultWindow(); window.KeyEvent += OnKeyEvent; window.TouchEvent += OnTouchEvent; rootView = new View(); rootView.BackgroundColor = Color.White; rootView.Size = Window.Instance.Size; rootView.PivotPoint = PivotPoint.Center; window.GetDefaultLayer().Add(rootView); TextLabel sampleLabel = new TextLabel("Widget Viewer "); sampleLabel.FontFamily = "SamsungOneUI 500"; sampleLabel.PointSize = 8; sampleLabel.TextColor = Color.Black; sampleLabel.SizeWidth = 300; sampleLabel.PivotPoint = PivotPoint.Center; rootView.Add(sampleLabel); Bundle bundle = new Bundle(); bundle.AddItem("COUNT", "1"); String encodedBundle = bundle.Encode(); WidgetViewManager widgetViewManager = new WidgetViewManager(this, this.ApplicationInfo.ApplicationId); WidgetView myWidgetView = widgetViewManager.AddWidget("*****@*****.**", encodedBundle, 600, 600, 3.0f); myWidgetView.Position = new Position(50, 100); window.GetDefaultLayer().Add(myWidgetView); myWidgetView.WidgetContentUpdated += OnWidgetContentUpdatedCB; }
public void Initialize() { Window window = Window.Instance; window.BackgroundColor = Color.White; Tizen.Log.Debug("NUI", "### DP1"); Layer layer = new Layer(); layer.Behavior = Layer.LayerBehavior.Layer3D; window.AddLayer(layer); Tizen.Log.Debug("NUI", "### DP2"); _container = new View(); _container.ParentOrigin = ParentOrigin.Center; _container.PivotPoint = PivotPoint.Center; _container.Size2D = new Size2D(400, 400); Tizen.Log.Debug("NUI", "### DP3"); _widgetButton = new PushButton(); _widgetButton.LabelText = "Widget"; _widgetButton.ParentOrigin = ParentOrigin.BottomLeft; _widgetButton.PivotPoint = PivotPoint.BottomLeft; _widgetButton.PositionUsesAnchorPoint = true; _widgetButton.Size2D = new Size2D(200, 100); window.Add(_widgetButton); _widgetButton.Clicked += (obj, e) => { _widgetView = _widgetViewManager.AddWidget("widget-efl.example", "", 450, 700, -1); //_widgetView.PositionUsesPivotPoint = true; //_widgetView.ParentOrigin = ParentOrigin.Center; _widgetView.PivotPoint = PivotPoint.TopLeft; _widgetView.PositionUsesAnchorPoint = true; _widgetView.BackgroundColor = Color.Yellow; _widgetView.WidgetAdded += (sender, eargs) => { _widgetButton.LabelText = "Quit"; window.Add(_widgetView); }; _widgetView.WidgetDeleted += (sender, eargs) => { window.Remove(_widgetView); _widgetButton.LabelText = "Button"; }; _instanceID = _widgetView.InstanceID; return(false); }; _deletedButton = new PushButton(); _deletedButton.LabelText = "Buton"; _deletedButton.ParentOrigin = ParentOrigin.BottomRight; _deletedButton.PivotPoint = PivotPoint.BottomRight; _deletedButton.PositionUsesAnchorPoint = true; _deletedButton.Size2D = new Size2D(200, 100); window.Add(_deletedButton); _deletedButton.Clicked += (obj, e) => { OnTerminate(); return(true); }; layer.Add(_container); Tizen.Log.Debug("NUI", "### widget view manager create start"); _widgetViewManager = new WidgetViewManager(this, "org.tizen.example.NUISamples.TizenTV"); if (!_widgetViewManager) { Tizen.Log.Fatal("NUI", "### Widget is not enabled!"); } Tizen.Log.Debug("NUI", "### widget view manager create sucess"); }