/// <inheritdoc/> protected internal override void ConstractClasses() { base.ConstractClasses(); CssClasses.Insert(1, StackDirection.ToString().ToLower()); CssClasses.Insert(0, "ui"); CssClasses.Add("segments"); }
/// <summary> /// Revert the order of the stack (bottom element is now top element) /// </summary> /// <returns>true for success /// If stack is empty - return false /// </returns> public bool Revert() { lock (_lock) { if (!_db.StackStrings.Any()) { return(false); } _stackDirection = _stackDirection switch { StackDirection.IN_ORDER => StackDirection.REVERTED, StackDirection.REVERTED => StackDirection.IN_ORDER, _ => throw new ArgumentOutOfRangeException() }; var loadedConfiguration = _db.Configurations.FirstOrDefault(); if (loadedConfiguration != null) { loadedConfiguration.StackDirection = _stackDirection; _db.SaveChanges(); } return(true); } }
public UIListComponent( TModel model, Expression <Func <TModel, List <TItem> > > listSelector, Action <UIComponent, TItem> itemTemplate, StackDirection stackDirection = StackDirection.Vertical) : base(nameof(UIListComponent <TModel, TItem>), true) { _itemTemplate = itemTemplate; _list = listSelector.Compile().Invoke(model); DefaultAttributes.StackDirection = stackDirection; _count = 0; }
public static UIComponent ListFor <TModel, TItem>( this UIComponent component, TModel model, Expression <Func <TModel, List <TItem> > > listSelector, Action <UIComponent, TItem> itemTemplate, StackDirection stackDirection = StackDirection.Vertical ) { return(AddNode(component, new UIListComponent <TModel, TItem>( model, listSelector, itemTemplate, stackDirection), null)); }
public UIAttributes() { Background = Color.Transparent; Color = Color.Black; BorderColor = Color.Black; FontSize = 1; Grow = 1; Position = Position.Relative; Sizing = Sizing.Proportion; Overflow = Overflow.Show; StackDirection = StackDirection.None; TextWrap = TextWrap.Wrap; JustifyText = JustifyText.Center; VerticalAlignText = VerticalAlignText.Center; FontScaleMode = FontScaleMode.FontSizeScale; }
/// <summary> /// Load stack direction configuration. If not exist - create and save /// </summary> private void loadConfiguration() { if (!_db.Configurations.Any()) { _db.Configurations.Add(new StackConfiguration(_stackDirection)); _db.SaveChanges(); } else { var loadedConfiguration = _db.Configurations.FirstOrDefault(); if (loadedConfiguration != null) { _stackDirection = loadedConfiguration.StackDirection; } } }
// Auto Shape Position public static void StackAutoShapes(StackDirection stackDirection, float span) { try { if (Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange.Count <= 1) { return; } } catch { } List <Excel.Shape> selectedShapes = new List <Excel.Shape>(); foreach (Excel.Shape s in Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange) { selectedShapes.Add(s); } if (stackDirection == StackDirection.Horizontal) { selectedShapes.Sort((a, b) => a.Left.CompareTo(b.Left)); for (int i = 1; i < selectedShapes.Count; i++) { var upperShape = selectedShapes[i - 1]; selectedShapes[i].Left = upperShape.Left + upperShape.Width + span; } } else if (stackDirection == StackDirection.Vertical) { selectedShapes.Sort((a, b) => a.Top.CompareTo(b.Top)); for (int i = 1; i < selectedShapes.Count; i++) { var upperShape = selectedShapes[i - 1]; selectedShapes[i].Top = upperShape.Top + upperShape.Height + span; } } }
public StackConfiguration(StackDirection stackDirection) { StackDirection = stackDirection; }
public StackPane(StackDirection direction) { Direction = direction; _children = new List <StackPaneChild>(); }