本文整理汇总了C#中System.Windows.Documents.List.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# List.Remove方法的具体用法?C# List.Remove怎么用?C# List.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Remove方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditDrinksPage
public EditDrinksPage()
{
InitializeComponent();
DataContext = App.ViewModel;
Drink TapToAdd = new Drink() { Name = "Tap to add a drink", Size = 0, mg = 0, drinkId = 1, IsActive = false };
Drink AddedDrinks = new Drink() { Name = "------ Added Drinks ------", Size = 0, mg = 0 };
var drinkList = new List<Drink>(App.ViewModel.drinkList);
int i;
for (i = 0; i < drinkList.Count; i++)
{
if ((drinkList[i] as Drink).Name == "Tap to add a drink")
{
var drink = (drinkList[i] as Drink);
if (drinkList.Contains(drink))
drinkList.Remove(drink);
}
else if ((drinkList[i] as Drink).Name == "------ Added Drinks ------")
{
var drink = (drinkList[i] as Drink);
if (drinkList.Contains(drink))
drinkList.Remove(drink);
}
}
drinkList.Remove(TapToAdd);
if (drinkList.Contains(AddedDrinks))
drinkList.Remove(AddedDrinks);
drinksListBox.ItemsSource = drinkList;
}
示例2: TreatmentForm
public TreatmentForm()
{
InitializeComponent();
db = DentalSmileDBFactory.GetInstance();
phases = Smile.Phases = db.SelectAllPhases();
//phases = Smile.GetPhases();
phases.Remove(Smile.GetPhase(Smile.SCANNING));
phases.Remove(Smile.GetPhase(Smile.MANIPULATION));
phaseCombo.ItemsSource = phases;
roomTextBox.Text = Smile.Room;
}
示例3: CalcAgeChampions
// takes list of participants sorted by place in age division, returns top 3..ish
List<AgeChampion> CalcAgeChampions(List<AgeChampion> champions, List<Participant> participants, int place = 1)
{
Participant p = participants.First();
participants.Remove(p);
// no points scored, cannot be a champion
if (ParticipantPoints(p) == 0)
return champions;
champions.Add(new AgeChampion(p, place, ParticipantPoints(p)));
// no more possible champions
if (participants.Count == 0)
return champions;
// if the same number of points, equal age champion w/ same place
if (champions.Last().Points == ParticipantPoints(participants.First()))
CalcAgeChampions(champions, participants, place);
// room for more champions
else if (champions.Count < 3)
CalcAgeChampions(champions, participants, place + 1);
return champions;
}
示例4: CollectionOperation
void CollectionOperation()
{
List<string> lists = new List<string>();
for (int i = 0; i < 100; i++)
{
lists.Add("string" + i);
}
try
{
//foreach (string str in lists)
//{
// if (str.Contains("0"))
// lists.Remove(str);
//}
for (int i = 0; i < lists.Count; i++)
{
if (lists[i].Contains("0"))
lists.Remove(lists[i]);
}
Tbox.Text= lists.Count.ToString();
}
catch (Exception ex)
{
Tbox.Text = ex.ToString();
}
}
示例5: BlackListCtrl
//*******************
//* BLACKLIST CTRL *
//*******************
List<string> BlackListCtrl(List<string> orgCtrl)
{
List<string> edCtrl = new List<string>(orgCtrl);
//search whole element
int skipTwo = 2;
foreach (string line in orgCtrl)
{
//skip two times till after the 1st {
if (skipTwo > 0 || line.Equals("}"))
{
skipTwo--;
continue;
}
bool removeLine = false;
//bool ourObj = false;
foreach (string keyWord in keyWords_org_list)
{
if (line.Contains(keyWord))
{
removeLine = true;
//ourObj = true;
break;
}
}
if (removeLine)
edCtrl.Remove(line);
//if (ourObj)
//FoundCtrl = true;
}
return edCtrl;
}
示例6: 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;
}
示例7: SetComponentLinks
internal void SetComponentLinks(IEnumerable<AbstractEndpoint.IAbstractComponentLink> componentLinks)
{
var links = new List<ComponentsOrderingViewModel>();
var setOrder = new Action(() =>
{
var worker = new BackgroundWorker();
worker.DoWork += (e, s) =>
{
foreach (var cl in links.AsEnumerable().Reverse())
{
cl.Link.Order = links.IndexOf(cl) + 1;
}
};
worker.RunWorkerAsync();
});
foreach (var cl in componentLinks.OrderBy(x => x.Order))
{
var vm = new ComponentsOrderingViewModel { Link = cl };
links.Add(vm);
vm.UpCommand = new RelayCommand(
() =>
{
var prevIndex = links.IndexOf(vm);
links.Remove(vm);
links.Insert(prevIndex - 1, vm);
this.ComponentList.ItemsSource = null;
this.ComponentList.ItemsSource = links;
this.ComponentList.SelectedItem = vm;
setOrder();
}, () => links.IndexOf(vm) > 0);
vm.DownCommand = new RelayCommand(
() =>
{
var prevIndex = links.IndexOf(vm);
links.Remove(vm);
links.Insert(prevIndex + 1, vm);
this.ComponentList.ItemsSource = null;
this.ComponentList.ItemsSource = links;
this.ComponentList.SelectedItem = vm;
setOrder();
}, () => links.IndexOf(vm) < links.Count - 1);
}
this.ComponentList.ItemsSource = links;
}
示例8: AddToSearchHistory
private void AddToSearchHistory(ref List<string> history, string newSearch)
{
if (history.Contains(newSearch))
history.Remove(newSearch);
if (history.Count == 100)
history.RemoveAt(99);
history.Insert(0, newSearch);
}
示例9: MainWindow
public MainWindow()
{
//hardcoded vJoyFeeder class for testing, is this where we want to call the class?
vJoyFeeder vj = new vJoyFeeder();
InitializeComponent();
//var server = new WebSocketServer("http://localhost:8080");
//server.Start(socket =>
//{
// socket.OnOpen = () => Console.WriteLine("Open!");
// socket.OnClose = () => Console.WriteLine("Close!");
// //socket.OnMessage = message => socket.Send(message);
//});
FleckLog.Level = LogLevel.Debug;
var allSockets = new List<IWebSocketConnection>();
var server = new WebSocketServer("localhost:8181");
server.Start(socket =>
{
socket.OnOpen = () =>
{
Console.WriteLine("Open!");
allSockets.Add(socket);
};
socket.OnClose = () =>
{
Console.WriteLine("Close!");
allSockets.Remove(socket);
};
socket.OnMessage = message =>
{
// This is the only line of code that outputs to console. Each instruction given to parser will return a string, which
// can then be used in the windows APP UI.
//Console.WriteLine(vj.parseInstructionString(message));
allSockets.ToList().ForEach(s => s.Send("Echo: " + message));
allSockets.ToList().ForEach(s => s.Send("Return: " + vj.parseInstructionString(message)));
};
});
var input = Console.ReadLine();
while (input != "exit")
{
foreach (var socket in allSockets.ToList())
{
socket.Send(input);
}
input = Console.ReadLine();
}
}
示例10: ColorPicker
static ColorPicker()
{
colorsList = new List<ColorNamePair>();
Type t = typeof(Colors);
PropertyInfo[] properties = t.GetProperties();
foreach (PropertyInfo property in properties)
{
ColorNamePair c = new ColorNamePair(property.Name, (Color)property.GetValue(null, null));
colorsList.Add(c);
}
ColorNamePair transparent = colorsList.Find(c => c.Name == "Transparent");
colorsList.Remove(transparent);
}
示例11: SetNonOverflowButton
public void SetNonOverflowButton(ToolboxButton button)
{
ToolboxButton currentNonOverflowButton = this.Children.OfType<ToolboxButton>().First();
if (currentNonOverflowButton != button)
{
List<ToolboxButton> allButtons = new List<ToolboxButton>();
allButtons.Add(currentNonOverflowButton);
foreach (ToolboxButton item in Overflow.Items)
allButtons.Add(item);
allButtons.Remove(button);
allButtons.Sort(delegate(ToolboxButton one, ToolboxButton two) { return one.DisplayIndex.CompareTo(two.DisplayIndex); });
Overflow.Items.Clear();
allButtons.ForEach(delegate(ToolboxButton item) { Overflow.Items.Add(item); });
}
}
示例12: tbxParticipant_TextChanged
private void tbxParticipant_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox textBox = (TextBox)sender;
List<char> lettersList = textBox.Text.ToList();
List<char> checkedList = new List<Char>(lettersList);
foreach (char letter in lettersList)
{
if (!Char.IsLetter(letter))
{
checkedList.Remove(letter);
}
}
textBox.Text = new string(checkedList.ToArray());
}
示例13: GetEyeIndex
static int GetEyeIndex(IEnumerable<Dot> dots)
{
List<int> indices = new List<int>() { 1, 2, 3 };
foreach (Dot d in dots)
{
int index = (int)d.Tag;
if (indices.Contains(index))
indices.Remove(index);
}
if (indices.Count != 1)
{
LogEvent.Engine.Write("Error: indices exclusion failed");
return -1;
}
return indices[0];
}
示例14: GroupToEdges
public IEnumerable<Edge> GroupToEdges(List<Point> points)
{
List<Edge> edges = new List<Edge>();
while (points.Any())
{
creatingTime.Start();
var point = points.First();
points.Remove(point);
var edge = new Edge(point);
creatingTime.Stop();
edges.Add(GrowEdge(edge, points));
}
return edges;
}
示例15: load
public void load()
{
listBox1.Items.Clear();
textBlock1.Text = attrId;
//Load Process data
List<string> ppId = new List<string>();
foreach (var o in Factory.Instance.getAllPostProcessObj())
{
string _id = (string)o.GetType().GetProperty("id").GetValue(o, null);
string type = (string)o.GetType().Name;
string val = _id + " (" + type + ")";
ppId.Add(val);
}
if (this.rule != null)
{
if (this.rule.postProcessTriggerGroup != null)
{
var gr = (from x in this.rule.postProcessTriggerGroup where x.id == this.attrId select x).FirstOrDefault();
if (gr != null)
{
if (gr.postProcessTrigger != null)
{
foreach (var pp in gr.postProcessTrigger)
{
listBox1.Items.Add(pp.id + " (" + pp.type.ToString() + ")");
string val = pp.id + " (" + pp.type.ToString() + ")";
ppId.Remove(val);
}
}
}
}
}
cmbPp.Items.Clear();
foreach (string p in ppId)
cmbPp.Items.Add(p);
}