public bool AddWidgetToTab(string tabId, string widgetId) { var layout = _context.GetLayoutForTab(tabId); if (layout == null) { return(false); } var widget = Queryable.FirstOrDefault(_context.Widget, e => e.WidgetId == widgetId); var firstLayoutRow = Enumerable.OrderBy <LayoutRow, int>(layout.LayoutRows, e => e.RowIndex).FirstOrDefault(); var placement = new WidgetPlacement { Collapsed = false, LayoutRowId = firstLayoutRow.LayoutRowId, ColumnIndex = 0, WidgetId = widgetId, Widget = widget, UseTemplate = widget.UseTemplate, UseSettings = widget.UseSettings, WidgetIndex = firstLayoutRow.WidgetPlacements.Count + 1 }; _context.WidgetPlacement.Add(placement); return(_context.SaveChanges() > 0); }
void Pack(Widget widget, bool?expand, WidgetPlacement align, PackOrigin ptype) { if (expand.HasValue) { if (direction == Orientation.Vertical) { widget.ExpandVertical = expand.Value; } else { widget.ExpandHorizontal = expand.Value; } } if (align != default(WidgetPlacement)) { if (direction == Orientation.Vertical) { widget.VerticalPlacement = align; } else { widget.HorizontalPlacement = align; } } if (widget == null) { throw new ArgumentNullException("widget"); } var p = new BoxPlacement((WidgetBackendHost)BackendHost, widget); p.PackOrigin = ptype; children.Add(p); }
public async Task <bool> AddWidgetToTabAsync(string tabId, string widgetId) { var layout = await _context.GetLayoutForTabAsync(tabId); if (layout == null) { return(false); } var widget = await _context.Widget.FirstOrDefaultAsync(e => e.WidgetId == widgetId); var firstLayoutRow = Enumerable.OrderBy <LayoutRow, int>(layout.LayoutRows, e => e.RowIndex).FirstOrDefault(); var placement = new WidgetPlacement { Collapsed = false, LayoutRowId = firstLayoutRow.LayoutRowId, ColumnIndex = 0, WidgetId = widgetId, Widget = widget, UseTemplate = widget.UseTemplate, UseSettings = widget.UseSettings, WidgetIndex = firstLayoutRow.WidgetPlacements.Count + 1 }; await _context.WidgetPlacement.AddAsync(placement); return(await _context.SaveChangesAsync(new CancellationToken()) > 0); }
protected override void AlignWidgetOtherTo(WidgetPlacement placement) { base.AlignWidgetOtherTo(placement); var alignment = NGUIText.Alignment.Center; switch (placement) { case WidgetPlacement.Above: case WidgetPlacement.Below: case WidgetPlacement.Over: break; case WidgetPlacement.Left: case WidgetPlacement.AboveLeft: case WidgetPlacement.BelowLeft: alignment = NGUIText.Alignment.Right; break; case WidgetPlacement.Right: case WidgetPlacement.AboveRight: case WidgetPlacement.BelowRight: alignment = NGUIText.Alignment.Left; break; case WidgetPlacement.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(placement)); } Widget.alignment = alignment; }
public IViewComponentResult Invoke(WidgetPlacement placement) { var widgetModel = new WidgetModel { Placement = placement }; return(this.WidgetView(widgetModel)); }
public void PackEnd(Widget widget, bool expand = false, WidgetPlacement hpos = WidgetPlacement.Fill, WidgetPlacement vpos = WidgetPlacement.Fill, double marginLeft = -1, double marginTop = -1, double marginRight = -1, double marginBottom = -1, double margin = -1) { if (widget == null) { throw new ArgumentNullException("widget"); } Pack(widget, expand, vpos, hpos, marginLeft, marginTop, marginRight, marginBottom, margin, PackOrigin.End); }
public IViewComponentResult Invoke(WidgetPlacement placement) { var model = new ChartModel { Placement = placement }; return(View(model)); }
public void PackEnd(Widget widget, bool expand, bool fill) { if (widget == null) { throw new ArgumentNullException("widget"); } WidgetPlacement align = fill ? WidgetPlacement.Fill : WidgetPlacement.Center; Pack(widget, expand, align, PackOrigin.End); }
public IViewComponentResult Invoke(WidgetPlacement placement) { var infoViewModel = new GeneralInfoModel { Placement = placement, Percentage = 90, Icon = "fas fa-cogs fa-5x p-3" }; return(this.WidgetView(infoViewModel)); }
public WidgetSettings() { isFirstStart = true; acceptedLicense = false; uiScale = 1.0; selectedTabIndex = 1; top = 100; left = 100; autoStart = false; portfolioDogecoins = 0; placement = WidgetPlacement.OnDesktop; }
public static double GetValue(this WidgetPlacement al) { switch (al) { case WidgetPlacement.Center: return(0.5); case WidgetPlacement.End: return(1); default: return(0); } }
public async Task <AddWidgetResponse> AddWidgetToTabAsync(string tabId, string widgetId) { var result = new AddWidgetResponse { Success = false }; var layout = await _context.GetLayoutForTabAsync(tabId); if (layout == null) { return(result); } var fullWidget = await _context.GetWidgetAsync(widgetId); var firstLayoutRow = layout.LayoutRows.OrderBy(e => e.RowIndex).FirstOrDefault(); var placement = new WidgetPlacement { Collapsed = false, LayoutRowId = firstLayoutRow.LayoutRowId, ColumnIndex = 0, WidgetId = widgetId, Widget = fullWidget, UseTemplate = fullWidget.UseTemplate, UseSettings = fullWidget.UseSettings, WidgetIndex = firstLayoutRow.WidgetPlacements.Count + 1, WidgetSettings = fullWidget.WidgetDefaults.Select(def => new WidgetSetting { Value = def.DefaultValue, WidgetDefaultId = def.WidgetDefaultId, WidgetDefault = def }).ToList() }; await _context.WidgetPlacement.AddAsync(placement); result.Success = await _context.SaveChangesAsync(new CancellationToken()) > 0; result.PlacementId = placement.WidgetPlacementId; return(result); }
void Pack(Widget widget, bool expand, WidgetPlacement vpos, WidgetPlacement hpos, double marginLeft, double marginTop, double marginRight, double marginBottom, double margin, PackOrigin ptype) { WidgetPlacement align; if (direction == Orientation.Horizontal) { align = hpos; if (vpos != default(WidgetPlacement)) { widget.VerticalPlacement = vpos; } } else { align = vpos; if (hpos != default(WidgetPlacement)) { widget.HorizontalPlacement = hpos; } } if (margin != -1) { widget.Margin = margin; } if (marginLeft != -1) { widget.MarginLeft = marginLeft; } if (marginTop != -1) { widget.MarginTop = marginTop; } if (marginTop != -1) { widget.MarginRight = marginRight; } if (marginBottom != -1) { widget.MarginBottom = marginBottom; } Pack(widget, expand, align, PackOrigin.Start); }
public AddWidgetResponse AddWidgetToTab(string tabId, string widgetId) { var result = new AddWidgetResponse { Success = false }; var layout = _context.GetLayoutForTab(tabId); if (layout == null) { return(result); } var widget = _context.GetWidget(widgetId); var firstLayoutRow = layout.LayoutRows.OrderBy(e => e.RowIndex).FirstOrDefault(); var placement = new WidgetPlacement { Collapsed = false, LayoutRowId = firstLayoutRow.LayoutRowId, ColumnIndex = 0, WidgetId = widgetId, Widget = widget, UseTemplate = widget.UseTemplate, UseSettings = widget.UseSettings, WidgetIndex = firstLayoutRow.WidgetPlacements.Count + 1, WidgetSettings = widget.WidgetDefaults.Select(def => new WidgetSetting { Value = def.DefaultValue, WidgetDefaultId = def.WidgetDefaultId, WidgetDefault = def }).ToList() }; _context.WidgetPlacement.Add(placement); result.Success = _context.SaveChanges() > 0; result.PlacementId = placement.WidgetPlacementId; return(result); }
public IViewComponentResult Invoke(WidgetPlacement placement) { var model = new TableModel { Placement = placement, Products = new List <Product> { new Product { Id = 1, Title = "Product1", Price = new decimal(15.00) }, new Product { Id = 2, Title = "Product2", Price = new decimal(45.00) }, new Product { Id = 3, Title = "Product3", Price = new decimal(120.00) } } }; return(this.WidgetView(model)); }
public Vector3 GetOffset(WidgetPlacement placement) { switch (placement) { case WidgetPlacement.Above: return new Vector3(Constants.ZeroF, _collider.bounds.extents.y, Constants.ZeroF); case WidgetPlacement.AboveLeft: return new Vector3(-_collider.bounds.extents.x, _collider.bounds.extents.y, Constants.ZeroF); case WidgetPlacement.AboveRight: return new Vector3(_collider.bounds.extents.x, _collider.bounds.extents.y, Constants.ZeroF); case WidgetPlacement.Below: return new Vector3(Constants.ZeroF, -_collider.bounds.extents.y, Constants.ZeroF); case WidgetPlacement.BelowLeft: return new Vector3(-_collider.bounds.extents.x, -_collider.bounds.extents.y, Constants.ZeroF); case WidgetPlacement.BelowRight: return new Vector3(_collider.bounds.extents.x, -_collider.bounds.extents.y, Constants.ZeroF); case WidgetPlacement.Left: return new Vector3(-_collider.bounds.extents.x, Constants.ZeroF, Constants.ZeroF); case WidgetPlacement.Right: return new Vector3(_collider.bounds.extents.x, Constants.ZeroF, Constants.ZeroF); case WidgetPlacement.Over: return Vector3.zero; case WidgetPlacement.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(placement)); } }
public Vector3 GetOffset(WidgetPlacement placement) { // 5.4.16 Currently only used as an IWidgetTrackable for invisible CameraLosChangedListeners D.AssertEqual(WidgetPlacement.Over, placement); return Vector3.zero; }
/// <summary> /// Aligns the widget's pivot value to reflect the assigned placement value. /// </summary> /// <param name="placement">The placement.</param> /// <exception cref="System.NotImplementedException"></exception> private void AlignWidgetPivotTo(WidgetPlacement placement) { var pivot = UIWidget.Pivot.Center; switch (placement) { case WidgetPlacement.Above: pivot = UIWidget.Pivot.Bottom; break; case WidgetPlacement.Below: pivot = UIWidget.Pivot.Top; break; case WidgetPlacement.Left: pivot = UIWidget.Pivot.Right; break; case WidgetPlacement.Right: pivot = UIWidget.Pivot.Left; break; case WidgetPlacement.AboveLeft: pivot = UIWidget.Pivot.BottomRight; break; case WidgetPlacement.AboveRight: pivot = UIWidget.Pivot.BottomLeft; break; case WidgetPlacement.BelowLeft: pivot = UIWidget.Pivot.TopRight; break; case WidgetPlacement.BelowRight: pivot = UIWidget.Pivot.TopLeft; break; case WidgetPlacement.Over: break; case WidgetPlacement.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(placement)); } Widget.rawPivot = pivot; }
public void SetTarget(IWidgetTrackable target, WidgetPlacement labelPlacement = WidgetPlacement.Below) { _target = target; if (_enableTrackingLabel && _trackingLabel == null) { _trackingLabel = InitializeTrackingLabel(); } if (_trackingLabel != null) { if (_trackingLabel.Target != target) { // eliminates PropertyChanged not changed warning _trackingLabel.Target = target; } _trackingLabel.Placement = labelPlacement; } UpdatePosition(); }
public void PackEnd(Widget widget, bool expand, bool fill) { WidgetPlacement align = fill ? WidgetPlacement.Fill : WidgetPlacement.Center; Pack(widget, expand, align, PackOrigin.End); }
public void PackEnd(Widget widget, bool expand = false, WidgetPlacement hpos = WidgetPlacement.Fill, WidgetPlacement vpos = WidgetPlacement.Fill, double marginLeft = -1, double marginTop = -1, double marginRight = -1, double marginBottom = -1, double margin = -1) { Pack(widget, expand, vpos, hpos, marginLeft, marginTop, marginRight, marginBottom, margin, PackOrigin.End); }
public void Add(Widget widget, int left, int top, int rowspan = 1, int colspan = 1, bool hexpand = false, bool vexpand = false, WidgetPlacement hpos = WidgetPlacement.Fill, WidgetPlacement vpos = WidgetPlacement.Fill, double marginLeft = -1, double marginTop = -1, double marginRight = -1, double marginBottom = -1, double margin = -1) { if (vpos != default(WidgetPlacement)) { widget.VerticalPlacement = vpos; } if (hpos != default(WidgetPlacement)) { widget.HorizontalPlacement = hpos; } widget.ExpandHorizontal = hexpand; widget.ExpandVertical = vexpand; if (margin != -1) { widget.Margin = margin; } if (marginLeft != -1) { widget.MarginLeft = marginLeft; } if (marginTop != -1) { widget.MarginTop = marginTop; } if (marginTop != -1) { widget.MarginRight = marginRight; } if (marginBottom != -1) { widget.MarginBottom = marginBottom; } var p = new TablePlacement((WidgetBackendHost)BackendHost, widget) { Left = left, Right = left + colspan, Top = top, Bottom = top + rowspan }; placements.Add(p); }
public IViewComponentResult Invoke(WidgetPlacement placement) { return(View(placement)); }
/// <summary> /// Base method does nothing. Derived classes should override this method if their widget has /// other settings to align to the placement value. eg. Text alignment for Labels. /// </summary> /// <param name="placement">The placement.</param> protected virtual void AlignWidgetOtherTo(WidgetPlacement placement) { }
protected override void AlignWidgetOtherTo(WidgetPlacement placement) { base.AlignWidgetOtherTo(placement); // reposition the collider to account for the widget's pivot generated by the placement value NGUITools.UpdateWidgetCollider(WidgetTransform.gameObject); }
public Vector3 GetOffset(WidgetPlacement placement) { float circumRadius = Mathf.Sqrt(2) * Radius / 2F; // distance to hypotenus of right triangle switch (placement) { case WidgetPlacement.Above: return new Vector3(Constants.ZeroF, Radius, Constants.ZeroF); case WidgetPlacement.AboveLeft: return new Vector3(-circumRadius, circumRadius, Constants.ZeroF); case WidgetPlacement.AboveRight: return new Vector3(circumRadius, circumRadius, Constants.ZeroF); case WidgetPlacement.Below: return new Vector3(Constants.ZeroF, -Radius, Constants.ZeroF); case WidgetPlacement.BelowLeft: return new Vector3(-circumRadius, -circumRadius, Constants.ZeroF); case WidgetPlacement.BelowRight: return new Vector3(circumRadius, -circumRadius, Constants.ZeroF); case WidgetPlacement.Left: return new Vector3(-Radius, Constants.ZeroF, Constants.ZeroF); case WidgetPlacement.Right: return new Vector3(Radius, Constants.ZeroF, Constants.ZeroF); case WidgetPlacement.Over: return Vector3.zero; case WidgetPlacement.None: default: throw new NotImplementedException(ErrorMessages.UnanticipatedSwitchValue.Inject(placement)); } }