本文整理汇总了C#中System.Windows.Documents.List.Clear方法的典型用法代码示例。如果您正苦于以下问题:C# List.Clear方法的具体用法?C# List.Clear怎么用?C# List.Clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Clear方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CForm
public CForm(OrderEntity source)
{
orderEntity = source;
Type type = typeof(OrderSource<>).MakeGenericType(new Type[] { source.OrderType });
OrderSource = Activator.CreateInstance(type) as IOrderSource;
if (string.IsNullOrEmpty(source.OrderID))
{
OperationType = OperationTypes.New;
this.GridToolBar_Delete.Visibility = Visibility.Collapsed;
}
else
{
OperationType = OperationTypes.Edit;
}
InitializeComponent();
List<string[]> FInfo = new List<string[]>();
FInfo.Add(new string[]{"单据编号", "OrderCode", "OrderCode", "0", "0"});
FInfo.Add(new string[] { "状态", "OrderStates", "OrderStates", "0", "0" });
FInfo.Add(new string[] { "创建人", "CreateUser", "CreateUser", "0", "0" });
FInfo.Add(new string[] { "创建时间", "CreateDate", "CreateDate", "0", "0" });
this.GForm.LeftFForm.Items = GetFieldItems(FInfo);
this.GForm.LeftFForm.InitForm();
FInfo.Clear();
FInfo.Add(new string[] { "单据类型", "OrderType", "OrderType", "0", "0" });
FInfo.Add(new string[] { "申请人", "Applicant", "Applicant", "3", "1" });
FInfo.Add(new string[] { "申请部门", "AppliedDepartMent", "AppliedDepartMentData", "2", "1" });
FInfo.Add(new string[] { "申请公司", "Company", "CompanyData", "2", "1" });
this.GForm.RightForm.Items = GetFieldItems(FInfo);
this.GForm.RightForm.InitForm();
FInfo.Clear();
FInfo.Add(new string[] { "备注", "Remark", "Remark", "4", "0" });
this.GFormRemark.Items = GetFieldItems(FInfo);
this.GFormRemark.InitForm();
FInfo.Clear();
FInfo.Add(new string[] { "编号", "SerialNumber", "75", "1" });
FInfo.Add(new string[] { "预算项目", "ObjectName", "200", "1" });
FInfo.Add(new string[] { "可用金额", "UsableMoney", "100", "1" });
FInfo.Add(new string[] { "已用金额", "UsedMoney", "100", "0" });
FInfo.Add(new string[] { "费用类型", "ChargeType", "100", "1" });
this.AGrid.Items= GetDataGridItem(FInfo);
this.AGrid.InitGrid();
BindingData();
}
示例2: TokenizeMessage
public static List<object> TokenizeMessage(string message)
{
var tokens = new List<object>();
try
{
//TODO - better Regex
var r = new Regex("<(.|\n)*?>", RegexOptions.IgnoreCase | RegexOptions.Multiline | RegexOptions.ExplicitCapture);
var split = r.Split(message);
foreach (var t in split)
{
if (!string.IsNullOrWhiteSpace(t))
{
Uri uri = null;
if (Uri.TryCreate(t, UriKind.Absolute, out uri))
{
tokens.Add(uri);
}
else
{
tokens.Add(t);
}
}
}
}
catch (Exception ex)
{
tokens.Clear();
tokens.Add(message);
}
return tokens;
}
示例3: txtAuto_TextChanged
private void txtAuto_TextChanged(object sender, TextChangedEventArgs e)
{
string typedString = txtAuto.Text;
List<string> autoList = new List<string>();
autoList.Clear();
foreach (string item in nameList)
{
if (!string.IsNullOrEmpty(txtAuto.Text))
{
if (item.StartsWith(typedString))
{
autoList.Add(item);
}
}
}
if (autoList.Count > 0)
{
lbSuggestion.ItemsSource = autoList;
lbSuggestion.Visibility = Visibility.Visible;
}
else if (txtAuto.Text.Equals(""))
{
lbSuggestion.Visibility = Visibility.Collapsed;
lbSuggestion.ItemsSource = null;
}
else
{
lbSuggestion.Visibility = Visibility.Collapsed;
lbSuggestion.ItemsSource = null;
}
}
示例4: orgClient_GetCompanyActivedCompleted
void orgClient_GetCompanyActivedCompleted(object sender, SMT.Saas.Tools.OrganizationWS.GetCompanyActivedCompletedEventArgs e)
{
if (e.Error != null && e.Error.Message != "")
{
//loadbar.Stop();//有错误停止转圈
ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("ERROR"),
Utility.GetResourceStr("CONFIRM"), MessageIcon.Error);
return;
}
else
{
if (e.Result == null)
{
return;
}
ObservableCollection<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> entTemps = e.Result;
allCompanys = new List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY>();
allCompanys.Clear();
var ents = entTemps.OrderBy(c => c.FATHERID);
ents.ForEach(item =>
{
allCompanys.Add(item);
});
UICache.CreateCache("SYS_CompanyInfo", allCompanys);
orgClient.GetDepartmentActivedAsync(SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
}
}
示例5: 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();
}
示例6: previewButton_Click
private void previewButton_Click(object sender, RoutedEventArgs e)
{
string context="";
double duration=0;
double numberofchars = 0;
int speedfromui = Convert.ToInt32(speedslider.Value);
animation = new List<Paragraph>();
SubLine line = _lines.OrderByDescending(x => x.Context.Length).ToList()[0];
context = HtmlTools.RemoveHtmlTags(line.Context.Replace("</br>", Environment.NewLine));
numberofchars = Convert.ToDouble(context.Length);
duration = line.Duration * 1000;
double speed = speedfromui+50;
double b = (speed) / 50d;
keytime = (duration / numberofchars) /b;
var color1 = Color1ColorPicker.SelectedColor.Value;
var color2 = Color2ColorPicker.SelectedColor.Value;
animation.Clear();
for (int i = 0; i <=context.Length; i++)
{
Run c1 = new Run(context.Substring(0,i));
c1.Foreground =new SolidColorBrush(color1);
Run c2 = new Run(context.Substring(i, context.Length - i));
c2.Foreground = new SolidColorBrush(color2);
Paragraph para = new Paragraph();
para.Inlines.Add(c1);
para.Inlines.Add(c2);
animation.Add(para);
}
RunPreveiw();
}
示例7: CreateTextBox
private static void CreateTextBox(List<DependencyObject> list, List<Inline> current, IHtmlTextBlock textBlock)
{
if (current.Count > 0)
{
var p = new Paragraph();
foreach (var r in current)
p.Inlines.Add(r);
#if !WINRT
var tb = new RichTextBox();
tb.Background = textBlock.Background;
tb.Margin = new Thickness(-12, textBlock.ParagraphMargin, -12, textBlock.ParagraphMargin);
#else
var tb = new RichTextBlock();
tb.IsTextSelectionEnabled = false;
tb.Margin = new Thickness(0, textBlock.ParagraphMargin, 0, textBlock.ParagraphMargin);
#endif
tb.Blocks.Add(p);
tb.Foreground = textBlock.Foreground;
tb.FontSize = textBlock.FontSize;
tb.FontFamily = textBlock.FontFamily;
list.Add(tb);
current.Clear();
}
}
示例8: Filter
// todo probably use LINQ here.
public override List<Point> Filter(List<Point> points)
{
if (points.Count == 0) return points;
List<Point> resultPoints = points;
if (points.Count > 2 * screenRect.Width)
{
resultPoints = new List<Point>();
List<Point> currentChain = new List<Point>();
double currentX = Math.Floor(points[0].X);
foreach (Point p in points)
{
if (Math.Floor(p.X) == currentX)
{
currentChain.Add(p);
}
else
{
// Analyse current chain
if (currentChain.Count <= 2)
{
resultPoints.AddRange(currentChain);
}
else
{
Point first = MinByX(currentChain);
Point last = MaxByX(currentChain);
Point min = MinByY(currentChain);
Point max = MaxByY(currentChain);
resultPoints.Add(first);
Point smaller = min.X < max.X ? min : max;
Point greater = min.X > max.X ? min : max;
if (smaller != resultPoints[resultPoints.Count-1])
{
resultPoints.Add(smaller);
}
if (greater != resultPoints[resultPoints.Count-1])
{
resultPoints.Add(greater);
}
if (last != resultPoints[resultPoints.Count-1])
{
resultPoints.Add(last);
}
}
currentChain.Clear();
currentChain.Add(p);
currentX = Math.Floor(p.X);
}
}
}
return resultPoints;
}
示例9: Validate
public bool Validate(object instance)
{
_validationResults = _validationResults ?? new List<ValidationResult>();
_validationResults.Clear();
var isValid = Validator.TryValidateObject(instance, new ValidationContext(instance, null, null), _validationResults, true);
return isValid;
}
示例10: SendItemToWindow
public SendItemToWindow(int gameIndex, ushort id, uint maxCount)
{
InitializeComponent();
upDownItemCount.Minimum = 0;
upDownItemCount.Value = 1;
upDownItemCount.Maximum = (int)maxCount;
itemID = id;
pocketTypes = new List<ItemTypes>();
loaded = false;
count = 1;
for (int i = -1; i < PokeManager.NumGameSaves; i++) {
if (i == gameIndex) {
comboBoxGame.SetGameSaveVisible(i, false);
continue;
}
IGameSave game = PokeManager.GetGameSaveAt(i);
if (game.GameType != GameTypes.Any && !ItemDatabase.GetItemFromID(id).Exclusives.HasFlag((GameTypeFlags)(1 << ((int)game.GameType - 1)))) {
comboBoxGame.SetGameSaveVisible(i, false);
}
}
pocketTypes.Clear();
comboBoxPocket.Items.Clear();
/*if (this.gameIndex == -1) {
pocketTypes.Add(ItemDatabase.GetItemFromID(itemID).PocketType);
comboBoxPocket.Items.Add(ItemDatabase.GetPocketName(ItemDatabase.GetItemFromID(itemID).PocketType));
comboBoxPocket.SelectedIndex = 0;
}
else {
pocketTypes.Add(ItemTypes.PC);
pocketTypes.Add(ItemDatabase.GetItemFromID(itemID).PocketType);
comboBoxPocket.Items.Add(ItemDatabase.GetPocketName(ItemTypes.PC));
comboBoxPocket.Items.Add(ItemDatabase.GetPocketName(ItemDatabase.GetItemFromID(itemID).PocketType));
comboBoxPocket.SelectedIndex = 1;
}*/
this.gameIndex = PokeManager.LastGameInDialogIndex;
if (this.gameIndex == -2 || !comboBoxGame.IsGameSaveVisible(this.gameIndex)) {
//comboBoxGame.SelectedIndex = 0;
this.gameIndex = comboBoxGame.SelectedGameIndex;
}
else {
comboBoxGame.SelectedGameIndex = this.gameIndex;
}
loaded = true;
GameChanged(null, null);
}
示例11: Window_Loaded
private void Window_Loaded(object sender, RoutedEventArgs e)
{
List<int> colh = new List<int>();
Globals.LoadUsers();
colh.Add(2);
colh.Add(3);
colh.Add(8);
colh.Add(9);
admin.LoadUsers(Globals.users, colh);
colh.Clear();
admin.UserSelected += new EventHandler(UserSelected);
}
示例12: btnDraw_Click
private void btnDraw_Click(object sender, RoutedEventArgs e)
{
int drawNum = 0;
List<int> lottoRivi = new List<int>();
if (Int32.TryParse(txtDrawNum.Text, out drawNum))
{
for (int i = 0; i < drawNum; i++)
{
lottoRivi = lottoKone.ArvoRivi(cmbType.Text);
lottoRivi.Sort();
lottoRivi.ForEach(Tulosta);
lottoRivi.Clear();
txtResult.Text += Environment.NewLine;
}
}
}
示例13: MainWindow
public MainWindow()
{
InitializeComponent();
ODRList.ItemsSource = outputDataRates;
ODRList.SelectedIndex = 3;
mySocketServer = new SocketServer();
Point[] pts = {new Point(20.0f, 10.0f),
new Point(10.0f, 20.0f),
new Point(15.0f, 20.0f),
new Point(15.0f, 50.0f),
new Point(25.0f, 50.0f),
new Point(25.0f, 20.0f),
new Point(30.0f, 20.0f),
new Point(20.0f, 10.0f)};
List<Point> curvePoints = new List<Point>();
curvePoints.AddRange(pts);
dongleIncomingTrafficArrow = new Polygon();
dongleIncomingTrafficArrow.Points = new PointCollection(curvePoints);
dongleIncomingTrafficArrow.StrokeThickness = 2;
dongleIncomingTrafficArrow.HorizontalAlignment = HorizontalAlignment.Left;
dongleIncomingTrafficArrow.VerticalAlignment = VerticalAlignment.Center;
DongleTrafficCanvas.Children.Add(dongleIncomingTrafficArrow);
curvePoints.Clear();
Point[] pts2 = {new Point(35.0f, 10.0f),
new Point(35.0f, 40.0f),
new Point(30.0f, 40.0f),
new Point(40.0f, 50.0f),
new Point(50.0f, 40.0f),
new Point(45.0f, 40.0f),
new Point(45.0f, 10.0f),
new Point(35.0f, 10.0f)};
curvePoints.AddRange(pts2);
dongleOutgoingTrafficArrow = new Polygon();
dongleOutgoingTrafficArrow.Points = new PointCollection(curvePoints);
dongleOutgoingTrafficArrow.StrokeThickness = 2;
dongleOutgoingTrafficArrow.HorizontalAlignment = HorizontalAlignment.Right;
dongleOutgoingTrafficArrow.VerticalAlignment = VerticalAlignment.Center;
DongleTrafficCanvas.Children.Add(dongleOutgoingTrafficArrow);
CompositionTarget.Rendering += CompositionTarget_Rendering;
}
示例14: PopulateComboBox
private void PopulateComboBox(object sender, bool dev)
{
List<string> data = new List<string>();
if (dev == false)
{
data.Add("Florida");
data.Add("Southeast");
data.Add("Texas");
data.Add("Puerto Rico");
}
else
{
data.Clear();
data.Add("FL Dev");
data.Add("SE Dev");
data.Add("TX Dev");
data.Add("PR Dev");
}
var comboBox = sender as ComboBox;
comboBox.ItemsSource = data;
comboBox.SelectedIndex = 0;
}
示例15: AttributeSet
/// <summary>
/// Constructor
/// </summary>
/// <param name="active">whether or not the effects are active</param>
/// <param name="effects">effect list</param>
public AttributeSet(string prefix, List<IEffect> effects)
{
// Get which effects to use aliases for
List<String> keys = new List<String>();
List<String> ids = new List<String>();
foreach (IEffect effect in effects) {
string id = effect.GetKey() + ";" + effect.GetTarget();
if (ids.Contains(id)) continue;
else ids.Add(id);
if (keys.Contains(effect.GetKey())) {
aliasedKeys.Add(effect.GetKey());
}
else keys.Add(effect.GetKey());
}
// Get the list of attributes
List<Attribute> unaliased = new List<Attribute>();
keys.Clear();
foreach (IEffect effect in effects) {
effect.GetAttributes(unaliased);
// Apply prefixes and aliases
foreach (Attribute attribute in unaliased) {
string key = attribute.Key;
if (aliasedKeys.Contains(effect.GetKey())) {
key = effect.GetTarget() + " " + key;
}
key = prefix + key;
// Prevent duplicates
if (keys.Contains(key)) continue;
else keys.Add(key);
attributes.Add(new Attribute(key, attribute.Initial, attribute.Scale));
}
unaliased.Clear();
}
}