本文整理汇总了C#中System.Windows.Documents.List.Reverse方法的典型用法代码示例。如果您正苦于以下问题:C# List.Reverse方法的具体用法?C# List.Reverse怎么用?C# List.Reverse使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Reverse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GenerateTypePath
public static List<TypeIndexAssociation> GenerateTypePath(FrameworkElement element)
{
List<TypeIndexAssociation> typePath = new List<TypeIndexAssociation>();
while (element != null)
{
int index = 0;
if (VisualTreeHelper.GetParent(element) != null)
{
DependencyObject parent = VisualTreeHelper.GetParent(element);
if (parent is Panel)
{
index = ((Panel)parent).Children.IndexOf(element);
}
}
typePath.Add(new TypeIndexAssociation() { ElementType = element.GetType(), Index = index });
element = VisualTreeHelper.GetParent(element) as FrameworkElement;
}
typePath.Reverse();
return typePath;
}
示例2: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
var viewModel = value as ItemHoverViewModel;
if (viewModel == null || !viewModel.HasRequirements)
{
return null;
}
var paragraph = new Paragraph();
foreach (var requirement in viewModel.Requirements)
{
var runs = new List<Run>
{
new Run(requirement.Name) {Foreground = Brushes.Gray},
new Run(" ") {Foreground = Brushes.Gray},
new Run(requirement.Value) {Foreground = Brushes.White}
};
if (!requirement.NameFirst)
runs.Reverse();
if (paragraph.Inlines.Count > 0)
{
paragraph.Inlines.Add(new Run(", ") { Foreground = Brushes.Gray });
}
paragraph.Inlines.AddRange(runs);
}
paragraph.Inlines.InsertBefore(paragraph.Inlines.FirstInline, new Run("Requires ") { Foreground = Brushes.Gray });
return new FlowDocument(paragraph);
}
示例3: BookmarkEditor
public BookmarkEditor(Comisor.MainWindow mainWindow, string strName, string strPath, string strCurrentPath = "")
{
InitializeComponent();
this.main = mainWindow;
this.Title = Comisor.Resource.Bookmark_Editor;
lbName.Content = Comisor.Resource.Bookmark_Name + ":";
lbPath.Content = Comisor.Resource.Bookmark_FilePath + ":";
List<string> nameOption = new List<string>();
nameOption.AddRange(strPath.Split(new char[] { '\\' }, StringSplitOptions.RemoveEmptyEntries));
nameOption.Reverse();
nameOption.Insert(0, strName);
ys.DataProcessor.RemoveSame(ref nameOption);
cbName.ItemsSource = nameOption;
cbName.SelectedIndex = 0;
List<string> pathOption = new List<string>();
pathOption.Add(strPath);
if (strCurrentPath != "") pathOption.Add(strCurrentPath);
ys.DataProcessor.RemoveSame(ref pathOption);
cbPath.Focus();
cbPath.ItemsSource = pathOption;
cbPath.SelectedIndex = 0;
ckbShortcut.Content = Comisor.Resource.Bookmark_CreatShortcut;
btnOK.Content = mainWindow.resource.imgOK;
btnCancel.Content = mainWindow.resource.imgCancel;
this.PreviewKeyDown += new KeyEventHandler(InputBox_PreviewKeyDown);
}
示例4: SayActionErrors
public void SayActionErrors(List<Pose.JointError> errorList, int nFrames)
{
errorList.Sort((s1, s2) => s1.mag.CompareTo(s2.mag));
errorList.Reverse();
Dictionary<string, int> errorDict = new Dictionary<string, int>();
for (int i = 0; i < errorList.Count; i++)
{
string text = "";
Pose.JointError err = errorList[i];
text += "Your " + getStringFromJointType(err.joint) + " was " + getStringFromErrorType(err.error);
if (err.frame < nFrames / 3)
{
text += " at the beginning. ";
}
else if (err.frame < 2 * nFrames / 3)
{
text += " during the middle. ";
}
else
{
text += " near the end. ";
}
if (errorDict.ContainsKey(text))
{
errorDict[text] += 1;
}
else
{
errorDict[text] = 1;
}
}
List<string> comments = errorDict.Keys.ToList();
comments.Sort((k1, k2) => errorDict[k1].CompareTo(errorDict[k2]));
comments.Reverse();
string speech = "";
for (int i = 0; i < Math.Min(numberErrorsMentioned, comments.Count); i++)
{
if (errorDict[comments[i]] < frameErrorMinimum)
{
break;
}
speech += comments[i];
}
if (speech.Equals(""))
{
speech = "No significant errors found.";
}
Speak(speech);
}
示例5: LoadListData
void LoadListData()
{
ManageAppBarButtons();
MainViewModel mvm = new MainViewModel();
List<DictionaryRecord> data = new List<DictionaryRecord>(list);
switch (list.SortOrder)
{
case DictionaryRecordList.ListSortOrder.ReverseChronological:
data.Reverse();
break;
case DictionaryRecordList.ListSortOrder.Alphabetical:
default:
data.Sort();
break;
}
mvm.LoadData(data);
this.DataContext = mvm;
}
示例6: showChart
public void showChart()
{
int tempNumber1 = getResult(DateTime.Now.Year.ToString());
int tempNumber2 = getResult((DateTime.Now.Year-1).ToString());
List<KeyValuePair<string, int>> valueList = new List<KeyValuePair<string, int>>();
List<KeyValuePair<string, int>> valueList2 = new List<KeyValuePair<string, int>>();
List<KeyValuePair<string, double>> valueListFinal = new List<KeyValuePair<string, double>>();
List<KeyValuePair<string, double>> valueListFinal2 = new List<KeyValuePair<string, double>>();
var dataSourceList = new List<List<KeyValuePair<string,double>>>();
valueList = Controller.salesStatistics[DateTime.Now.Year.ToString()];
valueList.Reverse();
valueList2 = Controller.salesStatistics[(DateTime.Now.Year - 1).ToString()];
valueList2.Reverse();
foreach (var item in valueList)
{
double temp1 = 0;
temp1 = item.Value;
temp1 = temp1 / tempNumber2;
temp1 = temp1 * 100;
valueListFinal.Add(new KeyValuePair<string, double>(item.Key, Math.Round(temp1)));
}
foreach (var item in valueList2)
{
double temp2 = 0;
temp2 = item.Value;
temp2 = temp2 / tempNumber1;
temp2 = temp2 * 100;
valueListFinal2.Add(new KeyValuePair<string, double>(item.Key, Math.Round(temp2)));
}
dataSourceList.Add(valueListFinal);
dataSourceList.Add(valueListFinal2);
columnChart.DataContext = dataSourceList;
et.Title = DateTime.Now.Year.ToString();
to.Title = (DateTime.Now.Year - 1).ToString();
columnChart.BorderThickness = new Thickness(0, 0, 0, 0);
saleLbl.Content = "Salgsstatistik for " + (DateTime.Now.Year - 1).ToString() + "/" + DateTime.Now.Year.ToString();
}
示例7: Convert
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Requirement requirement = value as Requirement;
Run name = new Run(requirement.Name) { Foreground = Brushes.Gray };
Run v = new Run(requirement.Value) { Foreground = Brushes.White, FontWeight = FontWeights.Bold };
Paragraph paragraph = new Paragraph();
List<Run> runs = new List<Run>();
runs.Add(name);
runs.Add(new Run(" ") { Foreground = Brushes.Gray });
runs.Add(v);
if (!requirement.NameFirst)
runs.Reverse();
paragraph.Inlines.Add(new Run("Requires ") { Foreground = Brushes.Gray });
paragraph.Inlines.AddRange(runs);
return new FlowDocument(paragraph);
}
示例8: AllNodesWindow
public AllNodesWindow(List<Node> results, int expanded, int total)
{
InitializeComponent();
expandedCount.Text += expanded.ToString();
genCount.Text += total.ToString();
List<Data> source = new List<Data>();
int count = 0;
foreach (Node n in results)
{
source.Add(new Data()
{
rowNum = ++count,
hValue = n.hValue,
gValue = n.gValue,
fValue = n.fValue,
action = n.action,
state = stringifyState(n),
thisNode = n
});
}
grid.ItemsSource = source.Reverse<Data>();
//grid.DataContext = results[0];
}
示例9: deleteGroup_Click
private void deleteGroup_Click(object sender, RoutedEventArgs e)
{
if (m_currentGroup != null)
{
//remove entries with m_currentGroup
List<int> indices = new List<int>();
for (int i = 0; i < m_entryItems.Count;i++ )
{
if (m_entryItems[i].Entry.Group == m_currentGroup)
indices.Add(i);
}
indices.Reverse();
foreach (int i in indices)
{
m_entryItems.RemoveAt(i);
}
//delete group
DictionaryEntities.Singleton.Groups.DeleteObject(m_currentGroup);
}
}
示例10: Button_Click
private void Button_Click(object sender, RoutedEventArgs e)
{
List<int> card_number_array = new List<int>();
if (validatenumber(CreditCardNumber.Text, out card_number_array) == true) //Checks to see if actual number
{
card_number_array.Reverse();
if (luhn_checksum(card_number_array)) //Checks input number
{
ValidationTest.Foreground = Brushes.Green;
ValidationTest.Content = "Number passes the Luhn Algorithm";
string[] bankNames = GetInformation(CreditCardNumber.Text); //Get bank & card info
Type.Content = "Type: " + bankNames[1]; //Displays info
Bank.Content = "Issuing Bank: " + bankNames[2];
ValidationTest.Visibility = Visibility.Visible;
Type.Visibility = Visibility.Visible;
Bank.Visibility = Visibility.Visible;
}
else
{
ValidationTest.Foreground = Brushes.Red; //Displays algorithm failed messages
ValidationTest.Content = "Number fails the Luhn Algorithm";
ValidationTest.Visibility = Visibility.Visible;
}
}
else
{
ValidationTest.Content = "Invalid input";
}
}
示例11: calcScore
/*
* Errechnet den Score anhand der Anzahl gelöschten Zeile und der Höhe
*/
private int calcScore(List<int> linesToRemove)
{
linesToRemove.Reverse();
double tmpScore = 0;
for (int i = 1; i <= linesToRemove.Count; i++)
{
switch (getLevel())
{
case 0: tmpScore += Math.Pow(50 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 1: tmpScore += Math.Pow(100 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 2: tmpScore += Math.Pow(150 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 3: tmpScore += Math.Pow(200 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 4: tmpScore += Math.Pow(250 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 5: tmpScore += Math.Pow(300 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 6: tmpScore += Math.Pow(350 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 7: tmpScore += Math.Pow(400 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 8: tmpScore += Math.Pow(450 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
case 9: tmpScore += Math.Pow(500 + calcHeight(linesToRemove[i - 1]), calcLines(i)); break;
}
}
return (int)tmpScore;
}
示例12: getRecordList
public List<Record> getRecordList(int option)
{
List<Record> refNoSet = new List<Record>();
string StrCmd;
switch (option)
{
case (0):
{
StrCmd = "SELECT top " + (MainWindow.listsize + 1) + " reportNo, patientName,gender, ward, bht, age, months, specimen,testDate,severity FROM Table1 where testdate >= '" + MainWindow.topdate + "' AND iif(testdate = '" + MainWindow.topdate + "' ,dateid > " + MainWindow.topid + ",1) AND" + MainWindow.searchPhrase + " order by testdate asc,dateid ASC";
break;
}
case (1):
default:
{
if (MainWindow.bottomdate != "")
StrCmd = "SELECT top " + (MainWindow.listsize + 1) + " reportNo, patientName,gender, ward, bht, age, months, specimen,testDate,severity FROM Table1 where testdate <= '" + MainWindow.bottomdate + "' AND iif(testdate = '" + MainWindow.bottomdate + "' ,dateid <= " + MainWindow.bottomid + ",1) AND" + MainWindow.searchPhrase + " order by testdate desc,dateid DESC";
else
StrCmd = "SELECT top " + (MainWindow.listsize + 1) + " reportNo, patientName,gender, ward, bht, age, months, specimen,testDate,severity FROM Table1 WHERE " + MainWindow.searchPhrase + " order by testdate desc, dateid desc";
break;
}
}
OleDbCommand Cmd = new OleDbCommand(StrCmd, MyConn);
OleDbDataReader ObjReader = Cmd.ExecuteReader();
String name, gender, date, reportNo, bht, ward, severity;
String[] specimen;
int age, months;
while (ObjReader.Read())
{
name = ObjReader["patientName"].ToString();
gender = ObjReader["gender"].ToString();
ward = ObjReader["ward"].ToString();
bht = ObjReader["bht"].ToString();
date = ObjReader["testDate"].ToString();
reportNo = ObjReader["reportNo"].ToString();
severity = ObjReader["severity"].ToString(); //**
age = Int32.Parse(ObjReader["age"].ToString());
months = Int32.Parse(ObjReader["months"].ToString());
specimen = Record.StringToArray(ObjReader["specimen"].ToString());
refNoSet.Add(new Record(reportNo, ward, bht, "", name, age, months, gender, specimen, "", "", "", date, "", severity, ""));
}
if (refNoSet.Count > 0)
{
int tmp = MainWindow.topid;
string temp = MainWindow.topdate;
string StrCmd2;
if (option == 1)
StrCmd2 = "SELECT * FROM Table1 WHERE reportNo = '" + refNoSet.Last().Reference_No + "'";
else
StrCmd2 = "SELECT * FROM Table1 WHERE reportNo = '" + refNoSet[(MainWindow.listsize - 1)].Reference_No + "'";
string StrCmd3 = "SELECT * FROM Table1 WHERE reportNo = '" + refNoSet.First().Reference_No + "'";
OleDbCommand Cmd2 = new OleDbCommand(StrCmd2, MyConn);
OleDbDataReader ObjReader2 = Cmd2.ExecuteReader();
if (ObjReader2 == null)
{
MainWindow.hasmore = false;
Console.WriteLine();////////////////////////////////////error in connecting to the database
return null;
}
else
{
ObjReader2.Read();
MainWindow.bottomdate = ObjReader2["testdate"].ToString();
MainWindow.bottomid = Int32.Parse(ObjReader2["dateid"].ToString());
OleDbCommand Cmd3 = new OleDbCommand(StrCmd3, MyConn);
OleDbDataReader ObjReader3 = Cmd3.ExecuteReader();
if (ObjReader3 == null)
{
MainWindow.hasmore = false;
Console.WriteLine();////////////////////////////////////error in connecting to the database
return null;
}
else
{
ObjReader3.Read();
MainWindow.topdate = ObjReader3["testdate"].ToString();
MainWindow.topid = Int32.Parse(ObjReader3["dateid"].ToString());
}
if (refNoSet.Count == (MainWindow.listsize + 1))
{
MainWindow.hasmore = true;
refNoSet.Remove(refNoSet.Last());
}
else
MainWindow.hasmore = false;
if (option == 0)
{
MainWindow.topdate = MainWindow.bottomdate;
MainWindow.bottomdate = temp;
MainWindow.topid = MainWindow.bottomid;
MainWindow.bottomid = tmp;
refNoSet.Reverse();
}
return refNoSet;
}
}
else
{
MainWindow.hasmore = false;
return null;
//.........这里部分代码省略.........
示例13: OnConnectNodesCommandExecuted
void OnConnectNodesCommandExecuted(object sender, ExecutedRoutedEventArgs e)
{
using (EditingScope es = (EditingScope)this.ModelItem.BeginEdit(SR.FCCreateLink))
{
List<ModelItem> selectedFlowchartItems = new List<ModelItem>(this.Context.Items.GetValue<Selection>().SelectedObjects);
selectedFlowchartItems.Reverse();
CreateLinks(selectedFlowchartItems);
es.Complete();
}
}
示例14: get_to_new_condition
private void get_to_new_condition(City_E newmaincity)
{
List<City_E> Oldlist = cities_EL;
maincity_e.is_centralcity = false;
newmaincity.is_centralcity = true;
// maincity_e = newmaincity;
City_E oldmaincity=maincity_e;
time_circle.tc_e.MouseLeftButtonDown -= tc_e_MouseLeftButtonDown;
time_circle.tc_e.MouseMove -= ellipse_MouseMove;
time_circle.tc_e.MouseLeftButtonUp -= ellipse_MouseLeftButtonUp;
canvas1.MouseWheel-= canvas1_MouseWheel;
canvas1.MouseLeftButtonDown -= canvas1_MouseLeftButtonDown;
canvas1.MouseMove -= canvas1_MouseMove;
canvas1.MouseLeftButtonUp -= canvas1_MouseLeftButtonUp;
bu_change.button.Click -= changebutton_MouseLeftButtonDown;
for (int i = 0; i < cities_EL.Count; i++)
{
// if (cities_EL[i] != chosencity)
{
canvas1.Children.Remove(cities_EL[i].ellipse);
canvas1.Children.Remove(cities_EL[i].line_entity);
canvas1.Children.Remove(cities_EL[i].textblock);
cities_EL[i].ellipse.MouseEnter -= city_e_MouseEnter;
cities_EL[i].ellipse.MouseLeave -= ellipse_e_MouseLeave;
cities_EL[i].ellipse.MouseLeftButtonDown -= ellipse_MouseLeftButtonDown;
cities_EL[i].ellipse.MouseMove -= ellipse_MouseMove;
cities_EL[i].ellipse.MouseLeftButtonUp -= ellipse_MouseLeftButtonUp;
}
}
cities_EL = new List<City_E>();
position_compute.angle_set = 0;
position_compute.now_set_color_number = 0;
for (int i = 0; i < Oldlist.Count; i++)
{
cities_EL.Add(Oldlist[i]);
if (cities_EL[i].is_centralcity == true)//set new maincity
maincity_e = cities_EL[i];
// cities_EL[i].create_linetomaincity(10, 10, canvas1);
cities_EL[i].create_ellipse_oncavas(canvas1, cities_EL[i].x_center, cities_EL[i].y_center);
position_compute.set_ellipse_fillbrushcolor(cities_EL[i]);
}
//animation
sb = new Storyboard();
maincity_e.addellipse_to_storyBoard(sb, oldmaincity.x_center, oldmaincity.y_center);
sb.Begin(); //make the maincity to center
for (int i = 0; i < cities_EL.Count; i++)
{
random_set_citytime_value(cities_EL[i]);
}
cities_EL.Reverse();
Storyboard sb1 = new Storyboard();
position_compute.angle_set = 0;
position_compute.cities_number = cities_EL.Count;
for (int i = 0; i < cities_EL.Count; i++)
{
if (cities_EL[i] != maincity_e)
{
double angle1 = position_compute.angle_compute();
cities_EL[i].angle_remember = angle1;
double dx1 = position_compute.compute_x_relatetomaincity(cities_EL[i].actual_distance[cities_EL[i].which_distance], maincity_e.x_center, angle1);
double dy1 = position_compute.compute_Y_relateto_maincity(cities_EL[i].actual_distance[cities_EL[i].which_distance], maincity_e.y_center, angle1);
cities_EL[i].angle_remember = angle1;
cities_EL[i].addellipse_to_storyBoard(sb1, dx1, dy1);
//cities_EL[i].set_line_position(maincity_e.x_center, maincity_e.y_center, dx1 + 12.5, dy1 + 12.5);
}
}
sb1.BeginTime=TimeSpan.FromSeconds(0.65);
sb1.Begin();
//set line
Storyboard sb2 = new Storyboard();
for (int i = 0; i < cities_EL.Count; i++)
{
cities_EL[i].create_linetomaincity(maincity_e.x_center, maincity_e.y_center, canvas1);
cities_EL[i].line_entity.X1 = maincity_e.x_center;
cities_EL[i].line_entity.X2 = maincity_e.x_center;
cities_EL[i].line_entity.Y1 = maincity_e.y_center;
cities_EL[i].line_entity.Y2 = maincity_e.y_center;
cities_EL[i].line_entity.Opacity=0;
if(cities_EL[i].is_centralcity==false)
cities_EL[i].set_line_position(maincity_e.x_center, maincity_e.y_center, cities_EL[i].x_center, cities_EL[i].y_center);
cities_EL[i].ellipse.MouseEnter += new MouseEventHandler(city_e_MouseEnter);
cities_EL[i].ellipse.MouseLeave += new MouseEventHandler(ellipse_e_MouseLeave);
cities_EL[i].ellipse.MouseLeftButtonDown += new MouseButtonEventHandler(ellipse_MouseLeftButtonDown);
cities_EL[i].ellipse.MouseMove += new MouseEventHandler(ellipse_MouseMove);
cities_EL[i].ellipse.MouseLeftButtonUp += new MouseButtonEventHandler(ellipse_MouseLeftButtonUp);
if(cities_EL[i]!=maincity_e)
cities_EL[i].is_centralcity = false;
cities_EL[i].add_line_storyboard(sb2);
}
sb2.BeginTime=TimeSpan.FromSeconds(1.4);
sb2.Begin();
//.........这里部分代码省略.........
示例15: GetBreadCrumbItems
private void GetBreadCrumbItems(List<ShellObject> items)
{
ShellObject lastmanstanding = items[0];
items.Reverse();
foreach (ShellObject thing in items)
{
bool isSearch = false;
try
{
isSearch = thing.IsSearchFolder;
}
catch
{
isSearch = false;
}
BreadcrumbBarItem duh = new BreadcrumbBarItem();
if (!isSearch)
{
duh.LoadDirectory(thing);
}
else
{
thing.Thumbnail.FormatOption = ShellThumbnailFormatOption.IconOnly;
thing.Thumbnail.CurrentSize = new Size(16, 16);
duh.pathName.Text = thing.GetDisplayName(DisplayNameType.Default);
duh.PathImage.Source = thing.Thumbnail.BitmapSource;
duh.MenuBorder.Visibility = System.Windows.Visibility.Collapsed;
duh.grid1.Visibility = System.Windows.Visibility.Collapsed;
}
duh.NavigateRequested += new BreadcrumbBarItem.PathEventHandler(duh_NavigateRequested);
this.stackPanel1.Children.Add(duh);
if (thing == lastmanstanding)
{
furthestrightitem = duh;
duh.BringIntoView();
}
}
}