本文整理汇总了C#中System.Windows.Documents.List.InsertRange方法的典型用法代码示例。如果您正苦于以下问题:C# List.InsertRange方法的具体用法?C# List.InsertRange怎么用?C# List.InsertRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.InsertRange方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConvertTagsToHtml
public IEnumerable<string> ConvertTagsToHtml(string[] lines)
{
var tables = new Dictionary<string, List<string>>();
var lastLine = "";
var tableCount = 0;
var list = new List<string>();
foreach (var line in lines)
{
if (line.StartsWith("<F>") && line.Length > 3)
list.Add(string.Format("<span>{0}</span>", line[3].ToString().PadLeft(lines.Max(x => x.Length), line[3])));
if (line.StartsWith("<T>"))
list.Add(string.Format("<B>{0}</B>", RemoveTag(line)));
if (line.StartsWith("<C") && line.Length > 3 && (line[2] == '>' || char.IsDigit(line[2])))
list.Add(string.Format("<span>{0}</span>", RemoveTag(line)));
if (line.StartsWith("<L") && line.Length > 3 && (line[2] == '>' || char.IsDigit(line[2])))
list.Add(string.Format("<span>{0}</span>", RemoveTag(line)));
if (line.StartsWith("<EB>"))
list.Add("<B>");
if (line.StartsWith("<DB>"))
list.Add("</B>");
if (line.StartsWith("<J") && line.Length > 3 && (line[2] == '>' || char.IsDigit(line[2])))
{
if (!lastLine.StartsWith("<J"))
{
tableCount++;
list.Add("tbl" + tableCount);
}
var tableName = "tbl" + tableCount;
if (!tables.ContainsKey(tableName))
tables.Add(tableName, new List<string>());
tables[tableName].Add(RemoveTag(line));
}
if (!line.Contains("<") && !string.IsNullOrEmpty(line.Trim()))
list.Add(line);
lastLine = line;
}
foreach (var table in tables)
{
list.InsertRange(list.IndexOf(table.Key), GetTableLines(table.Value, Printer.CharsPerLine));
list.Remove(table.Key);
}
for (int i = 0; i < list.Count; i++)
{
list[i] = list[i].TrimEnd();
if ((!list[i].ToLower().EndsWith("<BR>") && RemoveTag(list[i]).Trim().Length > 0) || list[i].Trim().Length == 0)
list[i] += "<BR>";
list[i] = list[i].Replace(" ", " ");
}
return list;
}
示例2: UpdateMapLayout
public void UpdateMapLayout()
{
List<Personnage> mespersos = new List<Personnage>();
mespersos.InsertRange(0, conf.EquipeRouge.Joueurs);
mespersos.InsertRange(0, conf.EquipeVerte.Joueurs);
List<Quete> mesquetes = new List<Quete>();
mesquetes.InsertRange(0, conf.EquipeRouge.Quetes);
mesquetes.InsertRange(0, conf.EquipeVerte.Quetes);
ChessBoard.Children.Clear();
for (int x = 0; x < Parametres.nbColonne; ++x)
{
for (int y = 0; y < Parametres.nbLigne; ++y)
{
ZoneAbstraite zone = conf.Plateau.GetZone(new Position(x, y));
if (zone != null)
{
//List<ZoneAbstraite> meszones = conf.Plateau.GetNeighbourZones(zone.point);
ChessBoard.Children.Add(design.GetCaseImage(zone, mespersos, mesquetes));
}
}
}
/***
* Affichage des personnages
***/
//this.personnages.ClearValue(TextBlock.TextProperty);
personnages.Document.Blocks.Clear();
String textEquipeRouge = conf.EquipeRouge.Nom + "\n";
String textEquipeVerte = conf.EquipeVerte.Nom + "\n";
foreach (Personnage p in mespersos)
{
if (p.equipe == TypeEquipe.Rouge)
textEquipeRouge += p.Nom + " (" + p.PointsDeVie + "pv)";
else
textEquipeVerte += p.Nom + " (" + p.PointsDeVie + "pv)";
}
textEquipeRouge += "\n\n";
textEquipeVerte += "\n\n";
#region ajout des couleurs et du style de la fenêtre personnages
TextRange styleEquipeRouge = new TextRange(personnages.Document.ContentEnd, personnages.Document.ContentEnd);
styleEquipeRouge.Text = textEquipeRouge;
styleEquipeRouge.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Red);
styleEquipeRouge.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
TextRange styleEquipeVerte = new TextRange(personnages.Document.ContentEnd, personnages.Document.ContentEnd);
styleEquipeVerte.Text = textEquipeVerte;
styleEquipeVerte.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Green);
styleEquipeVerte.ApplyPropertyValue(TextElement.FontWeightProperty, FontWeights.Bold);
#endregion
/***
* Fin affichage des personnages
***/
this.Refresh();
UpdateLayout();
}
示例3: GetDoughnut3D
//.........这里部分代码省略.........
bottomFace.Width = 2 * doughnutParams.OuterRadius;
bottomFace.Height = 2 * doughnutParams.OuterRadius * doughnutParams.YAxisScaling;
bottomFace.SetValue(Canvas.LeftProperty, (Double)(doughnutParams.Center.X - topFace.Width / 2));
bottomFace.SetValue(Canvas.TopProperty, (Double)(doughnutParams.Center.Y - topFace.Height / 2));
gg = new GeometryGroup();
gg.Children.Add(new EllipseGeometry() { Center = new Point(topFace.Width / 2, topFace.Height / 2), RadiusX = topFace.Width, RadiusY = topFace.Height });
gg.Children.Add(new EllipseGeometry() { Center = new Point(topFace.Width / 2, topFace.Height / 2), RadiusX = doughnutParams.InnerRadius, RadiusY = topFace.Height - 2 * (doughnutParams.OuterRadius - doughnutParams.InnerRadius) });
bottomFace.Clip = gg;
pieFaces.Add(bottomFace);
faces.Parts.Add(bottomFace);
}
else
{
topFace = GetDoughnutFace(doughnutParams, centroid, topInnerArcStart, topInnerArcStop, topOuterArcStart, topOuterArcStop, true);
pieFaces.Add(topFace);
faces.Parts.Add(topFace);
bottomFace = GetDoughnutFace(doughnutParams, centroid, bottomInnerArcStart, bottomInnerArcStop, bottomOuterArcStart, bottomOuterArcStop, false);
pieFaces.Add(bottomFace);
faces.Parts.Add(bottomFace);
rightFace = GetPieSide(doughnutParams, centroid, topInnerArcStart, bottomInnerArcStart, topOuterArcStart, bottomOuterArcStart);
pieFaces.Add(rightFace);
faces.Parts.Add(rightFace);
leftFace = GetPieSide(doughnutParams, centroid, topInnerArcStop, bottomInnerArcStop, topOuterArcStop, bottomOuterArcStop);
pieFaces.Add(leftFace);
faces.Parts.Add(leftFace);
}
List<Shape> curvedSurface = GetDoughnutCurvedFace(doughnutParams, centroid, topFaceCenter, bottomFaceCenter);
pieFaces.InsertRange(pieFaces.Count, curvedSurface);
foreach (FrameworkElement fe in curvedSurface)
faces.Parts.Add(fe);
labelLinePath = CreateLabelLine(currentDataSeries, doughnutParams, center, ref unExplodedPoints, ref explodedPoints);
if ((doughnutParams.TagReference as DataPoint).InternalYValue == 0)
return new List<Shape>();
//Top face ZIndex
topFace.SetValue(Canvas.ZIndexProperty, (Int32)(50000));
//BottomFace ZIndex
bottomFace.SetValue(Canvas.ZIndexProperty, (Int32)(-50000));
if (!(doughnutParams.StartAngle == doughnutParams.StopAngle && doughnutParams.IsLargerArc))
{
// ZIndex of curved face
if (doughnutParams.StartAngle >= Math.PI && doughnutParams.StartAngle <= Math.PI * 2 && doughnutParams.StopAngle >= Math.PI && doughnutParams.StopAngle <= Math.PI * 2 && doughnutParams.IsLargerArc)
{
_elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
_elementPositionData.Add(new ElementPositionData(curvedSurface[0], 0, Math.PI));
_elementPositionData.Add(new ElementPositionData(curvedSurface[1], doughnutParams.StartAngle, 0));
_elementPositionData.Add(new ElementPositionData(curvedSurface[2], Math.PI, doughnutParams.StopAngle));
_elementPositionData.Add(new ElementPositionData(leftFace, doughnutParams.StopAngle, doughnutParams.StopAngle));
if (labelLinePath != null)
_elementPositionData.Add(new ElementPositionData(labelLinePath, 0, Math.PI));
}
else if (doughnutParams.StartAngle >= 0 && doughnutParams.StartAngle <= Math.PI && doughnutParams.StopAngle >= 0 && doughnutParams.StopAngle <= Math.PI && doughnutParams.IsLargerArc)
{
_elementPositionData.Add(new ElementPositionData(rightFace, doughnutParams.StartAngle, doughnutParams.StartAngle));
_elementPositionData.Add(new ElementPositionData(curvedSurface[0], doughnutParams.StartAngle, Math.PI));
_elementPositionData.Add(new ElementPositionData(curvedSurface[1], Math.PI * 2, doughnutParams.StopAngle));
示例4: GetPie3D
//.........这里部分代码省略.........
bottomFace.Width = 2 * pieParams.OuterRadius;
bottomFace.Height = 2 * pieParams.OuterRadius * pieParams.YAxisScaling;
bottomFace.SetValue(Canvas.LeftProperty, (Double)(pieParams.Center.X - topFace.Width / 2));
bottomFace.SetValue(Canvas.TopProperty, (Double)(pieParams.Center.Y - topFace.Height / 2 + yOffset));
pieFaces.Add(bottomFace);
faces.Parts.Add(bottomFace);
}
else
{
topFace = GetPieFace(pieParams, centroid, topFaceCenter, topArcStart, topArcStop);
pieFaces.Add(topFace);
faces.Parts.Add(topFace);
bottomFace = GetPieFace(pieParams, centroid, bottomFaceCenter, bottomArcStart, bottomArcStop);
pieFaces.Add(bottomFace);
faces.Parts.Add(bottomFace);
rightFace = GetPieSide(pieParams, centroid, topFaceCenter, bottomFaceCenter, topArcStart, bottomArcStart);
pieFaces.Add(rightFace);
faces.Parts.Add(rightFace);
leftFace = GetPieSide(pieParams, centroid, topFaceCenter, bottomFaceCenter, topArcStop, bottomArcStop);
pieFaces.Add(leftFace);
faces.Parts.Add(leftFace);
}
labelLinePath = CreateLabelLine(currentDataSeries, pieParams, center, ref unExplodedPoints, ref explodedPoints);
if ((pieParams.TagReference as DataPoint).InternalYValue == 0)
return new List<Shape>();
List<Shape> curvedSurface = GetPieOuterCurvedFace(pieParams, centroid, topFaceCenter, bottomFaceCenter);
pieFaces.InsertRange(pieFaces.Count, curvedSurface.ToList());
foreach (FrameworkElement fe in curvedSurface)
faces.Parts.Add(fe);
//Top face ZIndex
topFace.SetValue(Canvas.ZIndexProperty, (Int32)(50000));
//BottomFace ZIndex
bottomFace.SetValue(Canvas.ZIndexProperty, (Int32)(-50000));
if (pieParams.StartAngle == pieParams.StopAngle && pieParams.IsLargerArc)
{
}
else
{
// ZIndex of curved face
if (pieParams.StartAngle >= Math.PI && pieParams.StartAngle <= Math.PI * 2 && pieParams.StopAngle >= Math.PI && pieParams.StopAngle <= Math.PI * 2 && pieParams.IsLargerArc)
{
_elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
_elementPositionData.Add(new ElementPositionData(curvedSurface[0], 0, Math.PI));
_elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
if (labelLinePath != null)
_elementPositionData.Add(new ElementPositionData(labelLinePath, 0, Math.PI));
}
else if (pieParams.StartAngle >= 0 && pieParams.StartAngle <= Math.PI && pieParams.StopAngle >= 0 && pieParams.StopAngle <= Math.PI && pieParams.IsLargerArc)
{
_elementPositionData.Add(new ElementPositionData(rightFace, pieParams.StartAngle, pieParams.StartAngle));
_elementPositionData.Add(new ElementPositionData(curvedSurface[0], pieParams.StartAngle, Math.PI));
_elementPositionData.Add(new ElementPositionData(curvedSurface[1], 0, pieParams.StopAngle));
_elementPositionData.Add(new ElementPositionData(leftFace, pieParams.StopAngle, pieParams.StopAngle));
if (labelLinePath != null)
示例5: FncShowPopup
public void FncShowPopup(clsPageInfo objPageInfo)
{
try
{
List<string> buddies = new List<string>();
List<string> modules = new List<string>();
foreach (clsTabInfo objtab in objPageInfo.objaTabs)
{
foreach (clsPodInfo objpod in objtab.objaPods)
{
buddies.InsertRange(buddies.Count, objpod.straPodBuddies);
modules.Add(objpod.strPodTitle);
}
}
objPopup.FnvLoadpopup(objPageInfo.strFrom, modules, buddies);
}
catch (Exception ex)
{
VMuktiAPI.VMuktiHelper.ExceptionHandler(ex, "FncShowPopup()", "pgHome.xaml.cs");
}
}
示例6: AddChatImpl
// Actually adds the nodes to the chat window.
private void AddChatImpl(List<ChatNode> nodes)
{
if (IncludeTimestamp)
{
DateTime now = DateTime.Now;
string timestamp = string.Format(CultureInfo.CurrentCulture, m_timestampFormat, now.Hour, now.Minute, now.Second);
ChatNode ts = new ChatNode(timestamp, m_tsColor);
nodes.InsertRange(0, new ChatNode[] { ts, new ChatNode(" ", Color.Black) });
}
Paragraph element = ParseChatNodesIntoParagraph(nodes.ToArray());
ThreadStart invokee = delegate
{
display.Document.Blocks.Add(element);
if (display.Viewer.Selection.IsEmpty)
display.Viewer.FindFirstVisualDescendantOfType<ScrollViewer>().ScrollToBottom();
};
display.Dispatcher.BeginInvoke(invokee);
UpdateParagraphs();
}
示例7: CalculateControlPointsOfADataSeries
/// <summary>
/// Calculate ControlPoints of a DataSeries
/// </summary>
/// <param name="chart">Chart</param>
/// <param name="plotGroup">Corresponding plotGroup</param>
/// <param name="dataPoints">List of DataPoints</param>
/// <returns>ControlPoints</returns>
internal static Point[] CalculateControlPointsOfADataSeries(Chart chart, PlotGroup plotGroup, List<DataPoint> dataPoints)
{
List<Point> tempCPoints = new List<Point>();
if (chart != null && chart.InternalSeries != null && plotGroup != null && dataPoints.Count > 0)
{
Double minimumZVal, maximumZVal;
List<DataSeries> seriesList = chart.InternalSeries;
CalculateMaxAndMinZValueFromAllSeries(ref seriesList, out minimumZVal, out maximumZVal);
Double tempAxisMinimum = plotGroup._initialAxisXMin;
Double tempAxisMaximum = plotGroup._initialAxisXMax;
dataPoints = dataPoints.OrderBy(a => a.ZValue).ToList();
DataPoint dataPointHavingMaxZVal = dataPoints.Last();
Double maxBubbleRadius = CalculateBubbleSize(dataPointHavingMaxZVal, minimumZVal, maximumZVal);
foreach (DataPoint dataPoint in dataPoints)
{
// Double maxBubbleRadius = CalculateBubbleSize(dataPoint, minimumZVal, maximumZVal);
List<Point> controlPointsOfDp = CalculateControlPointsOfDataPoint(dataPoint, plotGroup, maxBubbleRadius, minimumZVal, maximumZVal, plotGroup.AxisX, plotGroup.AxisY);
tempCPoints.InsertRange(0, controlPointsOfDp);
}
if (tempCPoints.Count > 0)
{
tempCPoints = tempCPoints.OrderBy(x => x.X).ToList();
}
// tempCPoints.Clear();
}
return tempCPoints.ToArray();
}
示例8: ItemsFind
private List<object> ItemsFind(string sPattern)
{
List<object> aRetVal = new List<object>();
List<object> aStartedWith = new List<object>();
sPattern = sPattern.ToLower();
string sValue;
foreach (object o in aItemsSource)
{
sValue = _cPropertyTarget.GetValue(o, null).ToString().ToLower().Trim();
if (sValue.Contains(sPattern))
{
if (sValue.StartsWith(sPattern))
aStartedWith.Add(o);
else
aRetVal.Add(o);
}
}
aRetVal.InsertRange(0, aStartedWith);
return aRetVal;
}