public void MiscTest() { var rxCol = new ReactiveCollection <int> { 1, 10, 100 }; this.Convert(rxCol).Is(1, 10, 100); this.Convert(Unit.Default).Is(Unit.Default); Unit?nullUnit = null; this.Convert(nullUnit).Is(Unit.Default); }
/// <summary> /// Initializes a new instance of the MetricDefinition class. /// </summary> /// <param name="isDimensionRequired">Flag to indicate whether the /// dimension is required.</param> /// <param name="resourceId">the resource identifier of the resource /// that emitted the metric.</param> /// <param name="name">the name and the display name of the metric, /// i.e. it is a localizable string.</param> /// <param name="unit">the unit of the metric. Possible values include: /// 'Count', 'Bytes', 'Seconds', 'CountPerSecond', 'BytesPerSecond', /// 'Percent', 'MilliSeconds', 'ByteSeconds', 'Unspecified'</param> /// <param name="primaryAggregationType">the primary aggregation type /// value defining how to use the values for display. Possible values /// include: 'None', 'Average', 'Count', 'Minimum', 'Maximum', /// 'Total'</param> /// <param name="metricAvailabilities">the collection of what /// aggregation intervals are available to be queried.</param> /// <param name="id">the resource identifier of the metric /// definition.</param> /// <param name="dimensions">the name and the display name of the /// dimension, i.e. it is a localizable string.</param> public MetricDefinition(bool?isDimensionRequired = default(bool?), string resourceId = default(string), LocalizableString name = default(LocalizableString), Unit?unit = default(Unit?), AggregationType?primaryAggregationType = default(AggregationType?), IList <MetricAvailability> metricAvailabilities = default(IList <MetricAvailability>), string id = default(string), IList <LocalizableString> dimensions = default(IList <LocalizableString>)) { IsDimensionRequired = isDimensionRequired; ResourceId = resourceId; Name = name; Unit = unit; PrimaryAggregationType = primaryAggregationType; MetricAvailabilities = metricAvailabilities; Id = id; Dimensions = dimensions; CustomInit(); }
internal MetricDefinition(bool?isDimensionRequired, string resourceId, string @namespace, LocalizableString name, Unit?unit, AggregationType?primaryAggregationType, IReadOnlyList <AggregationType> supportedAggregationTypes, IReadOnlyList <MetricAvailability> metricAvailabilities, string id, IReadOnlyList <LocalizableString> dimensions) { IsDimensionRequired = isDimensionRequired; ResourceId = resourceId; Namespace = @namespace; Name = name; Unit = unit; PrimaryAggregationType = primaryAggregationType; SupportedAggregationTypes = supportedAggregationTypes; MetricAvailabilities = metricAvailabilities; Id = id; Dimensions = dimensions; }
private FormItemBlock( bool hideIfEmpty, string heading, bool useFormItemListMode, int? numberOfColumns, int defaultFormItemCellSpan, Unit? firstColumnWidth, Unit? secondColumnWidth, TableCellVerticalAlignment verticalAlignment, IEnumerable<FormItem> formItems) { this.hideIfEmpty = hideIfEmpty; this.heading = heading; this.useFormItemListMode = useFormItemListMode; this.numberOfColumns = numberOfColumns; this.defaultFormItemCellSpan = defaultFormItemCellSpan; this.firstColumnWidth = firstColumnWidth; this.secondColumnWidth = secondColumnWidth; this.verticalAlignment = verticalAlignment; this.formItems = ( formItems ?? new FormItem[ 0 ] ).ToList(); }
private FormItemBlock( bool hideIfEmpty, string heading, bool useFormItemListMode, int?numberOfColumns, int defaultFormItemCellSpan, Unit?firstColumnWidth, Unit?secondColumnWidth, TableCellVerticalAlignment verticalAlignment, IEnumerable <FormItem> formItems) { this.hideIfEmpty = hideIfEmpty; this.heading = heading; this.useFormItemListMode = useFormItemListMode; this.numberOfColumns = numberOfColumns; this.defaultFormItemCellSpan = defaultFormItemCellSpan; this.firstColumnWidth = firstColumnWidth; this.secondColumnWidth = secondColumnWidth; this.verticalAlignment = verticalAlignment; this.formItems = (formItems ?? new FormItem[0]).ToList(); }
public static DrawCommand Parse(ReadOnlySpan <char> text) { if (text.StartsWith("draw(".AsSpan())) { text = text.Slice(5, text.Length - 6); } var parser = new DrawArgumentReader(text); Alignment align = default; BlendMode blendMode = BlendMode.Normal; Unit? x = null; Unit? y = null; string fill = null; string stroke = null; var objects = new List <Shape>(); while (parser.TryRead(out var arg)) { // circle // if (arg.Name == null) { objects.Add(Shape.Parse(arg.Value.ToString())); } else { string value = arg.Value.ToString(); switch (arg.Name) { case "align": align = AlignmentHelper.Parse(value); break; case "blendMode": blendMode = BlendModeHelper.Parse(value); break; case "x": x = Unit.Parse(value); break; case "y": y = Unit.Parse(value); break; case "fill": fill = value; break; case "stroke": stroke = value; break; } } } return(new DrawCommand(align, x, y, blendMode, fill, stroke, objects.ToArray())); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Unit = await _context.Units.FirstOrDefaultAsync(m => m.Id == id); if (Unit == null) { return(NotFound()); } return(Page()); }
public Unit?GetEnemy2(Unit unit, Game game) { Unit?nearestEnemy = null; foreach (var other in game.Units) { if (other.PlayerId != unit.PlayerId) { if (!nearestEnemy.HasValue || unit.Id > nearestEnemy.Value.Id) { nearestEnemy = other; } } } return(nearestEnemy); }
public DrawCommand( Alignment align, Unit?x, Unit?y, BlendMode blendMode, string fill, string stroke, Shape[] objects) { Align = align; X = x; Y = y; BlendMode = blendMode; Fill = fill; Stroke = stroke; Objects = objects; }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Unit = await _context.Units.FindAsync(id); if (Unit != null) { _context.Units.Remove(Unit); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public Unit?GetEnemy(Unit unit, Game game) { Unit?nearestEnemy = null; foreach (var other in game.Units) { if (other.PlayerId != unit.PlayerId) { if (!nearestEnemy.HasValue || unit.Position.DistanceSqr(other.Position) < unit.Position.DistanceSqr(nearestEnemy.Value.Position)) { nearestEnemy = other; } } } return(nearestEnemy); }
// Adding a New User /// <summary> /// Gets password and "password again" form items. The validation sets this data value to the provided password, and ensures that the two form items contain /// identical, valid passwords. /// </summary> public static IReadOnlyCollection <FormItem> GetPasswordModificationFormItems( this DataValue <string> password, Unit?textBoxWidth = null, FormItemLabel firstLabel = null, FormItemLabel secondLabel = null) { var passwordAgain = new DataValue <string>(); var passwordAgainFormItem = FormItem.Create( secondLabel ?? "Password again", new EwfTextBox("", masksCharacters: true, disableBrowserAutoComplete: true), validationGetter: control => new EwfValidation((pbv, v) => passwordAgain.Value = control.GetPostBackValue(pbv))); if (textBoxWidth.HasValue) { passwordAgainFormItem.Control.Width = textBoxWidth.Value; } var passwordFormItem = FormItem.Create( firstLabel ?? "Password", new EwfTextBox("", masksCharacters: true, disableBrowserAutoComplete: true), validationGetter: control => new EwfValidation( (pbv, v) => { password.Value = control.GetPostBackValue(pbv); if (password.Value != passwordAgain.Value) { v.NoteErrorAndAddMessage("Passwords do not match."); } else { var strictProvider = SystemProvider as StrictFormsAuthUserManagementProvider; if (strictProvider != null) { strictProvider.ValidatePassword(v, password.Value); } else if (password.Value.Length < 7) { v.NoteErrorAndAddMessage("Passwords must be at least 7 characters long."); } } })); if (textBoxWidth.HasValue) { passwordFormItem.Control.Width = textBoxWidth.Value; } return(new[] { passwordFormItem, passwordAgainFormItem }); }
/// <summary> /// Looks for a unit with the <paramref name="id"/> property value, returning a value that indicates whether such value exists. /// </summary> /// <param name="id">A unit id property value.</param> /// <param name="value">When this method returns, contains the <see cref="Unit"/> associated with the <paramref name="id"/> property value.</param> /// <param name="abilities">A value indicating whether to include ability parsing.</param> /// <param name="subAbilities">A value indicating whether to include sub-ability parsing.</param> /// <returns><see langword="true"/> if the value was found; otherwise <see langword="false"/>.</returns> public bool TryGetUnitById(string?id, [NotNullWhen(true)] out Unit?value, bool abilities, bool subAbilities) { value = null; if (id is null) { return(false); } if (JsonDataDocument.RootElement.TryGetProperty(id, out JsonElement element)) { value = GetUnitData(id, element, abilities, subAbilities); return(true); } return(false); }
/// <summary> /// Add core properties of class /// </summary> private void _AddCoreProperty(PropertyInfo property, string prePath, DomainPropertyAttribute attribute, IList <object> mapProperties, IList <object> selectedMapProperties, StringCollection selectedConfig) { Unit?displayUnits = null; Unit?valueUnits = null; if (Attribute.IsDefined(property, typeof(UnitPropertyAttribute))) { UnitPropertyAttribute unitAttribute = (UnitPropertyAttribute)Attribute.GetCustomAttribute( property, typeof(UnitPropertyAttribute)); displayUnits = (RegionInfo.CurrentRegion.IsMetric) ? unitAttribute.DisplayUnitMetric : unitAttribute.DisplayUnitUS; valueUnits = unitAttribute.ValueUnits; } _AddPropertyTip(prePath, property.Name, attribute.Title, mapProperties, selectedMapProperties, selectedConfig, valueUnits, displayUnits); }
public static bool Parse(SeekableReader r, out Unit?unit) { #if EXTENDED_SYSTEM_PARSING if (Pair.Parse(r, out Pair p)) { unit = p; return(true); } #endif if (Star.Parse(r, out Star? s)) { unit = s; return(true); } unit = null; return(false); }
private void ReduceFirst() { Unit?previousUnit = null; var count = 0; var previousCount = -10; foreach (var element in _sequence) { if (previousUnit?.CanReactWith(element) ?? false) { _sequence.RemoveAt(count); _sequence.RemoveAt(previousCount); return; } previousCount = count; previousUnit = element; count++; } }
private bool PropertyLookup(string propertyId, string?propertyValue, [NotNullWhen(true)] out Unit?value, bool abilities, bool subAbilities) { value = null; if (propertyValue is null) { return(false); } foreach (JsonProperty unitProperty in JsonDataDocument.RootElement.EnumerateObject()) { if (unitProperty.Value.TryGetProperty(propertyId, out JsonElement nameElement) && nameElement.ValueEquals(propertyValue)) { value = GetUnitData(unitProperty.Name, unitProperty.Value, abilities, subAbilities); return(true); } } return(false); }
/// <summary> /// Compare this unit of measure to another /// </summary> /// <param name="other">UnitOfMeasure</param> /// <returns>True if equal</returns> public override bool Equals(Object other) { if (other == null || GetType() != other.GetType()) { return(false); } UnitOfMeasure otherUnit = (UnitOfMeasure)other; // same enumerations Unit?thisEnumeration = Enumeration; Unit?otherEnumeration = otherUnit.Enumeration; if (thisEnumeration != null && otherEnumeration != null && !thisEnumeration.Equals(otherEnumeration)) { return(false); } // same abscissa unit symbols string thisSymbol = AbscissaUnit.Symbol; string otherSymbol = otherUnit.AbscissaUnit.Symbol; if (!thisSymbol.Equals(otherSymbol)) { return(false); } // same factors if (ScalingFactor.CompareTo(otherUnit.ScalingFactor) != 0) { return(false); } // same offsets if (Offset.CompareTo(otherUnit.Offset) != 0) { return(false); } return(true); }
static void CreateMatrixColumns(List <TransactionMatrixColumn> cols, Unit?sectionWidth = null) { Unit?colWidth = null; if (sectionWidth != null) { Unit correction = new Unit { Millimeter = 10 }; colWidth = sectionWidth / cols.Count - correction; } Column column = _table.AddColumn(); //first empty col column.Format.Alignment = ParagraphAlignment.Center; if (colWidth != null) { column.Width = (Unit)colWidth; } for (var index = 0; index < cols.Count; index++) { column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } Row row = _table.AddRow(); FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, 0, "", true, ParagraphAlignment.Center, VerticalAlignment.Center, true, TableHeaderFont, fontSize: 11); for (var index = 0; index < cols.Count; index++) { var col = cols[index]; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index + 1, col.Name, true, ParagraphAlignment.Center, VerticalAlignment.Center, true, TableHeaderFont, fontSize: 11); } }
public bool Equals(Unit?other) { return(true); }
private double ConvertToUnit(double length, Unit?unit) { return((unit == Unit.Foot) ? length * 3.28084d : length); }
/// <summary> /// Creates a block with a classic "label on the left, value on the right" layout. /// </summary> public static FormItemBlock CreateFormItemTable( bool hideIfEmpty = false, string heading = "", Unit?firstColumnWidth = null, Unit?secondColumnWidth = null, IEnumerable <FormItem> formItems = null) { return(new FormItemBlock(hideIfEmpty, heading, false, null, 1, firstColumnWidth, secondColumnWidth, TableCellVerticalAlignment.NotSpecified, formItems)); }
public double GetHeight(Unit?unit, [Parent] ICharacter character) { return(ConvertToUnit(character.Height, unit)); }
public double GetLength(Unit?unit, [Parent] Starship starship) { return(ConvertToUnit(starship.Length, unit)); }
public UnitAction GetAction(Unit unit, Game game, Debug debug) { Unit?nearestEnemy = null; foreach (var other in game.Units) { if (other.PlayerId != unit.PlayerId) { if (!nearestEnemy.HasValue || DistanceSqr(unit.Position, other.Position) < DistanceSqr(unit.Position, nearestEnemy.Value.Position)) { nearestEnemy = other; } } } LootBox?nearestWeapon = null; foreach (var lootBox in game.LootBoxes) { if (lootBox.Item is Item.Weapon) { if (!nearestWeapon.HasValue || DistanceSqr(unit.Position, lootBox.Position) < DistanceSqr(unit.Position, nearestWeapon.Value.Position)) { nearestWeapon = lootBox; } } } Vec2Double targetPos = unit.Position; if (!unit.Weapon.HasValue && nearestWeapon.HasValue) { targetPos = nearestWeapon.Value.Position; } else if (nearestEnemy.HasValue) { targetPos = nearestEnemy.Value.Position; } debug.Draw(new CustomData.Log("Target pos: " + targetPos)); Vec2Double aim = new Vec2Double(0, 0); if (nearestEnemy.HasValue) { aim = new Vec2Double(nearestEnemy.Value.Position.X - unit.Position.X, nearestEnemy.Value.Position.Y - unit.Position.Y); } bool jump = targetPos.Y > unit.Position.Y; if (targetPos.X > unit.Position.X && game.Level.Tiles[(int)(unit.Position.X + 1)][(int)(unit.Position.Y)] == Tile.Wall) { jump = true; } if (targetPos.X < unit.Position.X && game.Level.Tiles[(int)(unit.Position.X - 1)][(int)(unit.Position.Y)] == Tile.Wall) { jump = true; } UnitAction action = new UnitAction(); action.Velocity = targetPos.X - unit.Position.X; action.Jump = jump; action.JumpDown = !jump; action.Aim = aim; action.Shoot = true; action.SwapWeapon = false; action.PlantMine = false; return(action); }
static void FillRow(Row row, ParagraphAlignment rowParAligment, bool rowBold, Color rowBackgroundColor, int cellIndex, string colText, bool colBold, ParagraphAlignment colParAligment, VerticalAlignment colVerAlignment, bool rowHeadingFormat = false, Color?fontColor = null, Unit?rowHeight = null, int?fontSize = null) { row.HeadingFormat = rowHeadingFormat; row.Format.Alignment = rowParAligment; row.Format.Font.Bold = rowBold; if (rowHeight != null) { row.Height = (float)rowHeight; } // if (fontColor != null) row.Format.Font.Color = (Color)fontColor; row.Shading.Color = rowBackgroundColor; row.Cells[cellIndex].AddParagraph(colText); row.Cells[cellIndex].Format.Font.Bold = colBold; if (fontSize != null) { row.Cells[cellIndex].Format.Font.Size = (int)fontSize; } row.Cells[cellIndex].Format.Alignment = colParAligment; row.Cells[cellIndex].VerticalAlignment = colVerAlignment; if (fontColor != null) { row.Cells[cellIndex].Format.Font.Color = (Color)fontColor; } }
static int CreateConcatcPage(FilterContactReport filter, int colCount) { // Each MigraDoc document needs at least one section. _section = _document.AddSection(); //_section.PageSetup = _document.DefaultPageSetup.Clone(); var pageSize = _document.DefaultPageSetup.Clone(); // pageSize.Orientation = colCount < 5 ? Orientation.Portrait : Orientation.Landscape; pageSize.Orientation = Orientation.Portrait; pageSize.PageFormat = PageFormat.A4; pageSize.LeftMargin = new Unit { Centimeter = 1.5 }; pageSize.RightMargin = new Unit { Centimeter = 1.5 }; pageSize.OddAndEvenPagesHeaderFooter = true; pageSize.StartingNumber = 1; _section.PageSetup = pageSize; Paragraph paragraph = _section.Headers.Primary.AddParagraph(); paragraph.AddText(filter.Name); paragraph.Format.Font.Size = 9; paragraph.Format.Alignment = ParagraphAlignment.Center; // Create the item table _table = _section.AddTable(); _table.Style = "Table"; _table.Borders.Color = TableBorder; _table.Borders.Width = 0.25; _table.Borders.Left.Width = 0.5; _table.Borders.Right.Width = 0.5; _table.Rows.LeftIndent = 0; _table.Rows.HeightRule = RowHeightRule.AtLeast; _table.Rows.Height = 12; Unit curPageWidth = new Unit { Centimeter = pageSize.Orientation == Orientation.Landscape ? 29.7 : 21 }; Unit?pageWidth = curPageWidth - _section.PageSetup.LeftMargin - _section.PageSetup.RightMargin; colCount = CreateColumns(filter, colCount, pageWidth); _table.SetEdge(0, 0, colCount, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty); //page num var style = _document.Styles[StyleNames.Footer]; style.ParagraphFormat.AddTabStop("9cm", TabAlignment.Center); style.Font.Name = "Verdana"; style.Font.Name = "Times New Roman"; style.Font.Size = 9; style.Font.Color = FontColor; // Create a paragraph with centered page number. See definition of style "Footer". Paragraph paragraph2 = new Paragraph(); paragraph2.Style = StyleNames.Footer; paragraph2.AddTab(); paragraph2.AddPageField(); // Add paragraph to footer for odd pages. _section.Footers.Primary.Add(paragraph2); // Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must // not belong to more than one other object. If you forget cloning an exception is thrown. _section.Footers.EvenPage.Add(paragraph2.Clone()); return(colCount); }
static int CreateColumns(FilterContactReport filter, int colsCount, Unit?sectionWidth = null) { Unit?colWidth = null; if (sectionWidth != null) { colWidth = sectionWidth / colsCount; } List <ReportColumn> checkedCols = new List <ReportColumn>(); Column column = _table.AddColumn(); //first name col column.Format.Alignment = ParagraphAlignment.Center; if (colWidth != null) { column.Width = (Unit)colWidth; } //create cols obj checkedCols = filter.Columns.Where(r => r.IsChecked).ToList(); //company if (checkedCols.Any(e => e.Column == ReportColumns.Company)) { column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } //Address if (checkedCols.Any(e => (int)e.Column >= 8 && (int)e.Column <= 12)) { //col for address if (checkedCols.Any(r => r.Column == ReportColumns.Address && r.IsChecked)) { column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } //col for city,state,zip, country if (checkedCols.Any(e => (int)e.Column >= 8 && (int)e.Column <= 12 && e.IsChecked)) { column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } } //Contact data foreach (ReportColumn col in checkedCols.Where(e => (int)e.Column <= 7).OrderBy(e => e.Column)) { column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } //fill col obj var startedIsnex = 1; Row row = _table.AddRow(); //Name FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, 0, Grouping.GetTranslation("new_report_Name"), true, ParagraphAlignment.Left, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); //Company if (checkedCols.Any(e => e.Column == ReportColumns.Company)) { startedIsnex++; var col = checkedCols.First(e => e.Column == ReportColumns.Company); FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, 1, Grouping.GetTranslation(Grouping.GetTranslation(col.Name)), true, ParagraphAlignment.Center, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); } //Address if (checkedCols.Any(e => (int)e.Column >= 8 && (int)e.Column <= 12)) { var colName = ""; var colPosition = checkedCols.Any(r => r.Column == ReportColumns.Company) ? 2 : 1; if (checkedCols.Any(e => e.Column == ReportColumns.Address && e.IsChecked)) { colName += Grouping.GetTranslation(checkedCols.First(e => e.Column == ReportColumns.Address).Name); startedIsnex++; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, colPosition, colName, true, ParagraphAlignment.Center, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); colPosition++; } colName = ""; if (checkedCols.Any(e => (int)e.Column >= 8 && (int)e.Column <= 12 && e.IsChecked)) { if (checkedCols.Any(e => e.Column == ReportColumns.City)) { colName += $"{Grouping.GetTranslation(checkedCols.First(e => e.Column == ReportColumns.City).Name)}"; } if (checkedCols.Any(e => e.Column == ReportColumns.State)) { colName += $"/{Grouping.GetTranslation(checkedCols.First(e => e.Column == ReportColumns.State).Name)}"; } if (checkedCols.Any(e => e.Column == ReportColumns.Zip)) { colName += $"/{Grouping.GetTranslation(checkedCols.First(e => e.Column == ReportColumns.Zip).Name)}"; } if (checkedCols.Any(e => e.Column == ReportColumns.Country)) { colName += $"/{Grouping.GetTranslation(checkedCols.First(e => e.Column == ReportColumns.Country).Name)}"; } startedIsnex++; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, colPosition, colName, true, ParagraphAlignment.Center, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); } } //Contact data checkedCols = checkedCols.Where(e => (int)e.Column <= 7).OrderBy(e => e.Column).ToList(); for (var i = 0; i < checkedCols.Count; i++) { var index = startedIsnex + i; ReportColumn col = checkedCols[i]; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index, Grouping.GetTranslation(Grouping.GetTranslation(col.Name)), true, ParagraphAlignment.Center, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); } var colCount = row.Cells.Count; return(colCount); }
public int CompareTo(Unit?other) { return(0); }
/// <summary> /// Looks for a unit with the <paramref name="hyperlinkId"/> property value, returning a value that indicates whether such value exists. /// </summary> /// <param name="hyperlinkId">A unit hyperlinkId property value.</param> /// <param name="value">When this method returns, contains the <see cref="Unit"/> associated with the <paramref name="hyperlinkId"/> property value.</param> /// <param name="abilities">A value indicating whether to include ability parsing.</param> /// <param name="subAbilities">A value indicating whether to include sub-ability parsing.</param> /// <returns><see langword="true"/> if the value was found; otherwise <see langword="false"/>.</returns> public bool TryGetUnitByHyperlinkId(string?hyperlinkId, [NotNullWhen(true)] out Unit?value, bool abilities, bool subAbilities) => PropertyLookup("hyperlinkId", hyperlinkId, out value, abilities, subAbilities);
static int CreateColumns(FilterTransactionReport filter, Unit?sectionWidth = null) { //for total Unit?colWidth = null; if (sectionWidth != null) { colWidth = sectionWidth / (filter.ReportType == TransFilterType.Payment ? 2 : 5); } List <ReportColumn> checkedCols = new List <ReportColumn>(); Column column = _table.AddColumn(); //first empty col column.Format.Alignment = ParagraphAlignment.Center; if (colWidth != null) { column.Width = (Unit)colWidth; } //create cols obj if (filter.view == TransFilterView.Details) { checkedCols = filter.Columns.Where(r => r.IsChecked && r.ColumnOnly).ToList(); for (var index = 0; index < checkedCols.Count; index++) { column = _table.AddColumn(); column.Format.Alignment = ParagraphAlignment.Right; } } if (filter.ReportType == TransFilterType.Payment) { //amount column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } if (filter.ReportType == TransFilterType.Bill) { //bill amount column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; //paid amount column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; //due amount column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; //unasignet amount column = _table.AddColumn(); if (colWidth != null) { column.Width = (Unit)colWidth; } column.Format.Alignment = ParagraphAlignment.Right; } //fill col obj Row row = _table.AddRow(); FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, 0, "", true, ParagraphAlignment.Left, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); if (filter.view == TransFilterView.Details) { for (var index = 0; index < checkedCols.Count; index++) { ReportColumn col = checkedCols[index]; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index + 1, Grouping.GetTranslation(Grouping.GetTranslation(col.Column.ToString())), true, ParagraphAlignment.Center, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); AddColToPositionList((TransactioReportColumns)col.TransactionColumn, index + 1); } } if (filter.ReportType == TransFilterType.Payment) { var index = checkedCols.Count + 1; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index, Grouping.GetTranslation("report_trans_amount"), true, ParagraphAlignment.Center, VerticalAlignment.Bottom, true, TableHeaderFont, fontSize: 11); } if (filter.ReportType == TransFilterType.Bill) { var index = checkedCols.Count + 1; FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index, Grouping.GetTranslation("report_trans_billAmount"), true, ParagraphAlignment.Center, VerticalAlignment.Center, true, TableHeaderFont, fontSize: 11); FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index + 1, Grouping.GetTranslation("report_trans_paidAmount"), true, ParagraphAlignment.Center, VerticalAlignment.Center, true, TableHeaderFont, fontSize: 11); FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index + 2, Grouping.GetTranslation("report_trans_dueAmount"), true, ParagraphAlignment.Center, VerticalAlignment.Center, true, TableHeaderFont, fontSize: 11); FillRow(row, ParagraphAlignment.Center, true, TableHeaderBackground, index + 3, Grouping.GetTranslation("report_trans_unasignedAmount"), true, ParagraphAlignment.Center, VerticalAlignment.Center, true, TableHeaderFont, fontSize: 11); } var colCount = row.Cells.Count; return(colCount); }