本文整理汇总了C#中System.Windows.Documents.List.Count方法的典型用法代码示例。如果您正苦于以下问题:C# List.Count方法的具体用法?C# List.Count怎么用?C# List.Count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Count方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: luhn_checksum
public static bool luhn_checksum(List<int> card_number_array)
{
int checksum = 0;
//adds up all the even placed digits
for (int i = 0; i < card_number_array.Count(); i = i + 2)
{
checksum += card_number_array[i];
}
int index2 = 0;
//now adds up (2 x odd placed digits)
for (int i = 1; i < card_number_array.Count(); i = i + 2)
{
index2 = card_number_array[i] * 2;
if (index2 >= 10)
{
index2 = index2 - 9; // if 2 x digit > 10
}
checksum += index2;
}
if (checksum % 10 == 0)
{
return true;
}
else
{
return false;
}
}
示例2: CellsToArray
private int[,] CellsToArray(List<List<Cell>> cells)
{
var result = new int[cells.Count(), cells.Max(cellsRow => cellsRow.Count())];
for (int x = 0; x < cells.Count(); ++x)
{
for (int y = 0; y < cells[x].Count(); ++y)
{
result[x, y] = cells[x][y].Value;
}
}
return result;
}
示例3: Histogram
public Histogram(List<double> vals, string name, double binSize = 0)
{
this.vals = vals;
InitializeComponent();
this.DataContext = this;
//this.YAxis = new LinearAxis(AxisPosition.Left, name);
if (binSize == 0) {
binSize = Math.Round( 3.49 * vals.StandardDev() * Math.Pow(vals.Count(), -.33333), 3);
}
this.title = name;
draw(binSize);
this.NumberOfDataPoints = vals.Count();
}
示例4: Results
public Results(List<Items> result, String searchWord)
{
InitializeComponent();
initResults = result;
resultList = result;
if(searchWord.Length == 0)
{
dialogMessage.Text = "You did not search for anything.\nPlease try again.";
keywordLabel.Text = searchWord;
resultSearch.Text = searchWord;
resultList = null;
return;
}
if(searchWord.Length != 0)
{
clearButton.Visibility = Visibility.Visible;
}
if (result.Count() > 10)
{
dialogMessage.Text = "Your search returned more than 10 results.\n\nYou may wish to make your search more specific to return less.";
resultsListBox.ItemsSource = result;
keywordLabel.Text = searchWord;
resultSearch.Text = searchWord;
sortLabel.Visibility = Visibility.Visible;
sortOptions.Visibility = Visibility.Visible;
locationLabel.Visibility = Visibility.Visible;
}
else if (result.Count() != 0)
{
resultsListBox.ItemsSource = result;
keywordLabel.Text = searchWord;
resultSearch.Text = searchWord;
sortLabel.Visibility = Visibility.Visible;
sortOptions.Visibility = Visibility.Visible;
locationLabel.Visibility = Visibility.Visible;
}
else
{
dialogMessage.Text = "Your search returned 0 results.\n\nThe product you're looking for may:\n - Not be sold here, or\n - You may have made a spelling mistake.";
keywordLabel.Text = searchWord;
resultSearch.Text = searchWord;
}
}
示例5: ChartLineUC
public ChartLineUC(List<DataPointCollection> ListDataPoints, string[] zstr, string strtitle)
{
InitializeComponent();
chartC.DataPointWidth = 2;
Title title = new Title();
title.Text = strtitle;
chartC.Titles.Add(title);
for (int i = 0; i < ListDataPoints.Count(); i++)
{
DataPointCollection dpc = ListDataPoints[i];
chartC.Series[i].DataPoints = dpc;
chartC.Series[i].LegendText = zstr[i];
chartC.Series[i].ShowInLegend = true;
chartC.Series[i].ToolTipText = string.Format("名称:#AxisXLabel {0}数值:#YValue {0}", System.Environment.NewLine);
chartC.Series[i].AutoFitToPlotArea = true;
chartC.Series[i].LabelEnabled = false;
chartC.Series[i].Bevel = false;
chartC.Series[i].ShadowEnabled = true;
chartC.Series[i].YValueFormatString = "######.## ";
chartC.Series[i].LightingEnabled = true;
chartC.Series[i].LabelText = " #AxisXLabel";
chartC.Series[i].LabelFontSize = 13;
chartC.Series[i].IncludePercentageInLegend = true;
}
}
示例6: Button_Click_1
private void Button_Click_1(object sender, RoutedEventArgs e)
{
List<ExportRowHelper> ExportColumnNames = new List<ExportRowHelper>();
foreach (var item in ufgMain.Children)
{
CheckBox cb = item as CheckBox;
if (cb.IsChecked.Value)
{
ExportColumnNames.Add(new ExportRowHelper() { ColumnName = cb.Tag.ToString(), ColumnValue = cb.Content.ToString() });
}
}
if (ExportColumnNames.Count() <= 0)
{
Common.MessageBox.Show("请选择需要导出的列");
return;
}
SaveFileDialog sfd = new SaveFileDialog();
sfd.FileName = string.Format("GlassID导出列表.xls");
if (sfd.ShowDialog() == true)
{
string filename = sfd.FileName;
string ErrMsg = string.Empty;
bool bSucc = false;
bSucc = _export.ExportGlassIDToExcel(_lst, ExportColumnNames, filename, ref ErrMsg);
if (bSucc)
{
var process = System.Diagnostics.Process.Start(filename);
}
else
Common.MessageBox.Show(ErrMsg);
}
this.Close();
}
示例7: GetLayerList
public static string[] GetLayerList(XElement xEle)
{
List<string> lst = new List<string>();
XNamespace aw = xEle.GetDefaultNamespace();
IEnumerable<XElement> de = from el in xEle.Descendants(aw + "Layer") select el;
foreach (XElement el in de)
{
if (el.Elements(aw + "Name").Count() > 0)
{
lst.Add(el.Elements(aw + "Name").First().Value);
}
}
if (lst.Count() > 0)
{
string[] lyrList = new string[lst.Count];
for (int i = 0; i < lst.Count; i++)
{
lyrList[i] = lst[i];
}
return lyrList;
}
return null;
}
示例8: ScoreWindow
public ScoreWindow(List<Game> games)
{
InitializeComponent();
int cols = 4;
int rows = games.Count();
for (int c = 0; c < cols; c++)
myTable.Columns.Add(new TableColumn());
TableRow tr0 = new TableRow();
tr0.Cells.Add(new TableCell(new Paragraph(new Run("Gra"))));
tr0.Cells.Add(new TableCell(new Paragraph(new Run("Minimalny pomiar"))));
tr0.Cells.Add(new TableCell(new Paragraph(new Run("Maksymalny pomiar"))));
tr0.Cells.Add(new TableCell(new Paragraph(new Run("Odchylenie standardowe"))));
TableRowGroup trg0 = new TableRowGroup();
trg0.Rows.Add(tr0);
myTable.RowGroups.Add(trg0);
foreach (Game g in games)
{
if (g.getMaximum() == Double.MinValue)
continue;
TableRow tr = new TableRow();
tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getName()))));
tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getMinimum().ToString("N3")))));
tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getMaximum().ToString("N3")))));
tr.Cells.Add(new TableCell(new Paragraph(new Run(g.getDeviation().ToString("N3")))));
TableRowGroup trg = new TableRowGroup();
trg.Rows.Add(tr);
myTable.RowGroups.Add(trg);
}
}
示例9: ZoomToShowAll
private void ZoomToShowAll(List<LineModule> sampleTrackingModules)
{
int countTlane = sampleTrackingModules.Count(a => a is LaneT);
mScale = 1;
if(countTlane >= 7)
{
mScale = 6;
}
if (countTlane >= 8)
{
mScale = 0.8;
}
if (countTlane >= 10)
{
mScale = 0.7;
}
if (countTlane >= 12)
{
mScale = 0.6;
}
if (countTlane >= 14)
{
mScale = 0.5;
}
viewbox.LayoutTransform = new ScaleTransform(mScale, mScale);
}
示例10: validado
private Boolean validado(Object obj)
{
ValidationContext validationContext = new ValidationContext(obj, null, null);
List<System.ComponentModel.DataAnnotations.ValidationResult> errors = new List<System.ComponentModel.DataAnnotations.ValidationResult>();
Validator.TryValidateObject(obj, validationContext, errors, true);
if (errors.Count() > 0)
{
string mensageErrores = string.Empty;
foreach (var error in errors)
{
error.MemberNames.First();
mensageErrores += error.ErrorMessage + Environment.NewLine;
}
MessageBox.Show(mensageErrores); return false;
}
else
{
return true;
}
}
示例11: foreach
// Напечатаем окно заказа:
private void НапечататьЗаказы(object sender, RoutedEventArgs e)
{
// Очистим окно и заново добавим,указав для каждого продукта:сколько его заказали
if (СписокЗаказов.Count>0)
{
var новыеЗаказы = new List<Заказ>();
foreach (var заказ in СписокЗаказов)
{
if (новыеЗаказы.Count(x => x == заказ) == 0)
новыеЗаказы.Add(заказ);
}
ОкноВывода.Items.Clear();
int sum = 0;
foreach (var заказ in новыеЗаказы)
{
var количетсво = СписокЗаказов.Count(x => x == заказ);
sum += заказ.цена * количетсво;
ОкноВывода.Items.Add(" " + заказ.продукт + "(" + заказ.цена + "р.): " + количетсво + "штук(и) = " + заказ.цена * количетсво);
}
ОкноВывода.Items.Add("Сумма: " + sum + "р.");
}
else
{
ОкноВывода.Items.Add("Заказов нет!");
}
}
示例12: foreach
// Напечатаем окно заказа:
private void Итого_Click(object sender, RoutedEventArgs e)
{
// Очистим окно и заново добавим,указав для каждого продукта:сколько его заказали
if (Заказы.Count>0)
{
var новыеЗаказы = new List<ПродуктЦена>();
foreach (var заказ in Заказы)
{
if (новыеЗаказы.Count(x => x == заказ) == 0)
новыеЗаказы.Add(заказ);
}
ОкноВывода.Items.Clear();
int sum = 0;
foreach (var заказ in новыеЗаказы)
{
var количетсво = Заказы.Count(x => x == заказ);
sum += заказ.цена * количетсво;
ОкноВывода.Items.Add("-> " + заказ.product + "(" + заказ.цена + "р.): " + количетсво + "штук(и) = " + заказ.цена * количетсво);
}
ОкноВывода.Items.Add("Сумма к оплате: " + sum + "р.");
}
else
{
ОкноВывода.Items.Add("Заказы отсутствуют");
}
}
示例13: BubbleCurrentSelection
private void BubbleCurrentSelection(object _nothing)
{
var slide = Globals.slide;
var currentDetails = Globals.conversationDetails;
string target = null;
var selection = new List<SelectedIdentity>();
foreach(var registeredCommand in Commands.DoWithCurrentSelection.RegisteredCommands)
registeredCommand.Execute((Action<SelectedIdentity>)(id=>{
target = id.target;
selection.Add(id);
}));
if (selection.Count() > 0)
{
var details = ConversationDetailsProviderFactory.Provider.AppendSlideAfter(Globals.slide, currentDetails.Jid, Slide.TYPE.THOUGHT);
var newSlide = details.Slides.Select(s => s.id).Max();
Commands.SendNewBubble.Execute(new TargettedBubbleContext
{
author = Globals.me,
context = selection,
privacy = "public",
slide = slide,
target = target,
thoughtSlide =newSlide
});
}
}
示例14: buttonSave_Click
private void buttonSave_Click(object sender, RoutedEventArgs e)
{
List<Figuur> GewijzigdeFiguren = new List<Figuur>();
foreach (Figuur f in figuren)
{
if (f.Changed == true)
GewijzigdeFiguren.Add(f);
f.Changed = false;
}
if(GewijzigdeFiguren.Count() != 0)
{
FiguurManager manager = new FiguurManager();
try
{
manager.SChrijfWijzigingen(GewijzigdeFiguren);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
GewijzigdeFiguren.Clear();
}
示例15: allButton_Click
private void allButton_Click(object sender, RoutedEventArgs e)
{
List<ManagePlaylist.File> tmp = new List<ManagePlaylist.File>();
filterAll(tmp);
playListBox.Items.Clear();
for (int i = 0; i < tmp.Count(); ++i)
{
playListBox.Items.Add(getName(tmp[i].Path));
}
}