/// <summary> /// The add result to scores table. /// </summary> /// <param name="dataset"> /// The dataset. /// </param> /// <param name="chemicalResult"> /// The chemical result. /// </param> /// <param name="target"> /// The target. /// </param> /// <param name="table"> /// The table. /// </param> /// <param name="colDef"> /// The col def. /// </param> /// <returns> /// The <see cref="int"/>. /// </returns> public static int AddResultToScoresTable(string dataset, CrossSectionWorkflowResult chemicalResult, IImsTarget target, NumericTable table, IList<string> colDef) { TableRow dict = new TableRow(dataset + target); dict.Name += "(" + chemicalResult.AnalysisStatus + ")"; dict.Add(colDef[1], chemicalResult.AverageObservedPeakStatistics.IntensityScore); dict.Add(colDef[2], chemicalResult.AverageObservedPeakStatistics.IsotopicScore); dict.Add(colDef[3], chemicalResult.AverageObservedPeakStatistics.PeakShapeScore); dict.Add(colDef[0], chemicalResult.AverageVoltageGroupStability); dict.Add(colDef[4], chemicalResult.AssociationHypothesisInfo.ProbabilityOfHypothesisGivenData); table.Add(dict); return 1; }
public MatchScreen( Vector2f WindowSize, Match Match, IEnumerable <Army> FollowedArmies, TileRenderer TileRenderer, UnitConfigurationRenderer UnitRenderer, FactionRenderer FactionRenderer) : base(WindowSize, Match.Map, TileRenderer) { Match.OnStartPhase += _EventBuffer.Hook <StartTurnComponentEventArgs>(HandleNewTurn).Invoke; Match.OnExecuteOrder += _EventBuffer.Hook <ExecuteOrderEventArgs>(HandleOrderExecuted).Invoke; this.UnitRenderer = UnitRenderer; this.FactionRenderer = FactionRenderer; _FollowedArmies = new HashSet <Army>(FollowedArmies); _FogOfWar = Match.Scenario.Rules.FogOfWar; _FogOfWarHandler = _EventBuffer.Hook <SightUpdatedEventArgs>(HandleSightUpdated); EventHandler <NewUnitEventArgs> addUnitHandler = _EventBuffer.Hook <NewUnitEventArgs>(AddUnit).Invoke; foreach (Army a in Match.Armies) { a.OnUnitAdded += addUnitHandler; foreach (Unit u in a.Units) { AddUnit(u); } } for (int i = 0; i < Match.Scenario.TurnConfiguration.Turns; ++i) { _TurnCounter.Add(new Checkbox("overlay-turn-counter-box") { Enabled = false }); } _FinishButton.Position = Size - _FinishButton.Size - new Vector2f(32, 32); _FinishButton.OnClick += HandleFinishClicked; _InfoDisplay.Position = _FinishButton.Position - new Vector2f(0, _InfoDisplay.Size.Y + 16); _VictoryConditionDisplay.Position = _InfoDisplay.Position - new Vector2f(0, _VictoryConditionDisplay.Size.Y + 16); _ActionDisplay.Position = new Vector2f(WindowSize.X - _ActionDisplay.Size.X - 16, 16); _TransformedItems.Add(_StackLayer); _Items.Add(_FinishButton); _Items.Add(_InfoDisplay); _Items.Add(_VictoryConditionDisplay); _Items.Add(_TurnCounter); _Items.Add(_ActionDisplay); }
void ReadDataJson(string content, TableContent d) { var td = JsonManager.ReadJsonString(content); var names = new Dictionary <string, bool>(); foreach (var r in td) { foreach (var n in r.Keys) { var n1 = n.ToLower(); if (names.ContainsKey(n1)) { continue; } names.Add(n1, true); } } d.Schema.AddRange(names.Keys); foreach (var r in td) { var tr = new TableRow(); var comparer = StringComparer.OrdinalIgnoreCase; var r1 = new Dictionary <string, object>(r, comparer); foreach (var n in names.Keys) { if (r1.ContainsKey(n)) { tr.Add(r1[n]); } } d.Rows.Add(tr); } }
/// <summary> /// /// </summary> /// <param name="tableRowItem"></param> /// <param name="rowConverterParams"></param> /// <returns></returns> public IHTMLItem Convert(TableRowItem tableRowItem, RowConverterParamsV3 rowConverterParams) { if (tableRowItem == null) { throw new ArgumentNullException("tableRowItem"); } var tableRow = new TableRow(HTMLElementType.HTML5); foreach (var element in tableRowItem.Cells) { if (element is TableHeadingItem) { var th = element as TableHeadingItem; var cell = new TableHeaderCell(HTMLElementType.HTML5); var paragraphConverter = new ParagraphConverterV3(); var cellData = paragraphConverter.Convert(th, new ParagraphConverterParamsV3 { ResultType = ParagraphConvTargetEnumV3.Paragraph, Settings = rowConverterParams.Settings, StartSection = false }); if (cellData.SubElements() != null) { foreach (var subElement in cellData.SubElements()) { cell.Add(subElement); } } else { cell.Add(cellData); } //cell.Add(new SimpleHTML5Text { Text = th.Text }); if (th.ColSpan.HasValue) { cell.ColSpan.Value = th.ColSpan.ToString(); } if (th.RowSpan.HasValue) { cell.RowSpan.Value = th.RowSpan.ToString(); } switch (th.Align) { case TableAlignmentsEnum.Center: cell.Align.Value = "center"; break; case TableAlignmentsEnum.Left: cell.Align.Value = "left"; break; case TableAlignmentsEnum.Right: cell.Align.Value = "right"; break; } switch (th.VAlign) { case TableVAlignmentsEnum.Top: cell.VAlign.Value = "top"; break; case TableVAlignmentsEnum.Middle: cell.VAlign.Value = "middle"; break; case TableVAlignmentsEnum.Bottom: cell.VAlign.Value = "bottom"; break; } tableRow.Add(cell); } else if (element is TableCellItem) { var td = element as TableCellItem; var cell = new TableData(HTMLElementType.HTML5); var paragraphConverter = new ParagraphConverterV3(); var cellData = paragraphConverter.Convert(td, new ParagraphConverterParamsV3 { ResultType = ParagraphConvTargetEnumV3.Paragraph, Settings = rowConverterParams.Settings, StartSection = false }); if (cellData.SubElements() != null) { foreach (var subElement in cellData.SubElements()) { cell.Add(subElement); } } else { cell.Add(cellData); } //cell.Add(new SimpleHTML5Text { Text = td.Text }); if (td.ColSpan.HasValue) { cell.ColSpan.Value = td.ColSpan.ToString(); } if (td.RowSpan.HasValue) { cell.RowSpan.Value = td.RowSpan.ToString(); } switch (td.Align) { case TableAlignmentsEnum.Center: cell.Align.Value = "center"; break; case TableAlignmentsEnum.Left: cell.Align.Value = "left"; break; case TableAlignmentsEnum.Right: cell.Align.Value = "right"; break; } switch (td.VAlign) { case TableVAlignmentsEnum.Top: cell.VAlign.Value = "top"; break; case TableVAlignmentsEnum.Middle: cell.VAlign.Value = "middle"; break; case TableVAlignmentsEnum.Bottom: cell.VAlign.Value = "bottom"; break; } tableRow.Add(cell); } else { // invalid structure , we ignore Logger.Log.ErrorFormat("Invalid/unexpected table row sub element type : {0}", element.GetType()); //continue; } } tableRow.Align.Value = tableRowItem.Align ?? "left"; return(tableRow); }
public static void NewValuePairList(ICollection <SectionBase> SectionBaseList, string Desciption, string Value, string Heading, int HeaderStrength = 1) { XElement Header = null; if (!string.IsNullOrWhiteSpace(Heading)) { Header = new XElement(GetHeaderStrength(HeaderStrength)); Header.Value = Heading; } XElement TableDataDesc = null; if (!string.IsNullOrWhiteSpace(Desciption)) { XElement SpanDesc = new XElement(span); XElement Bold = new XElement(b); SpanDesc.Add(Bold); Bold.Value = string.Format("{0}: ", Desciption); TableDataDesc = new XElement(td); TableDataDesc.Add(SpanDesc); } XElement TableDataValue = null; if (!string.IsNullOrWhiteSpace(Value)) { XElement SpanValue = new XElement(span); SpanValue.Value = Value; TableDataValue = new XElement(td); TableDataValue.Add(SpanValue); } XElement TableRow = null; if (TableDataDesc != null) { if (TableRow == null) { TableRow = new XElement(tr); } TableRow.Add(TableDataDesc); } if (TableDataValue != null) { if (TableRow == null) { TableRow = new XElement(tr); } TableRow.Add(TableDataValue); } SectionBase SectionBase = SectionBaseList.LastOrDefault(); if (SectionBase != null) { SectionBase.End(); } ValuePair oValuePair = new ValuePair(); if (Header != null) { oValuePair.Heading = Header; } if (TableRow != null) { oValuePair.ElementList.Add(TableRow); } if (oValuePair != null) { SectionBaseList.Add(oValuePair); } }
public static void Add(this TableRow Row, string text) => Row.Add(new TableCell { text });