本文整理汇总了C#中BindingList.Contains方法的典型用法代码示例。如果您正苦于以下问题:C# BindingList.Contains方法的具体用法?C# BindingList.Contains怎么用?C# BindingList.Contains使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BindingList
的用法示例。
在下文中一共展示了BindingList.Contains方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: groupEditFormFill
public void groupEditFormFill()
{
var list = new BindingList<string>();
var q = Query.EQ("_id", ObjectId.Parse(Properties.Settings.Default.groupID));
var resdoc = collection.FindOneAs<Group>(q);
foreach (var res in resdoc.days)
list.Add(res.ToString());
numTE.Text = resdoc.num;
lvlComboBox.Text = resdoc.lvl;
timeTE.Text = resdoc.time;
durationTE.Text = resdoc.duration;
for (int count = 0; count < daysSelector.Properties.Items.Count; count++)
{
if (list.Contains(daysSelector.Properties.Items[count].ToString()))
{
daysSelector.Properties.Items[count].CheckState = CheckState.Checked;
}
}
}
示例2: FreeCellGame
//.........这里部分代码省略.........
MyStatus.Update();
},
delegate
{
MyStatus.Moves++;
MyStatus.Update();
// we already are at the state we want to be
if (card.CurrentStack == FrozenTokens.CurrentStack)
return;
card.AnimatedMoveToStack(FrozenTokens.CurrentStack, null);
this.MyDeck.Sounds.deal();
}
);
};
#endregion
card.VisibleSide = Card.SideEnum.TopSide;
card.ValidateDragStart =
delegate
{
if (Cheat)
return true;
// cannot remove cards from goal stack
if (GoalStacks.Contains(card))
return false;
// cannot drag a pile of cards unless alternate colors and descending numbers
return card.SelectedCards.AllWithPrevious(RuleForStackingCardsInPlayStack);
};
card.ValidateDragStop =
CandidateStack =>
{
if (Cheat)
return true;
if (TempStacks.Contains(CandidateStack))
{
// temp only holds one card
if (CandidateStack.Cards.Count > 0)
return false;
// and only one card can be inserted
if (card.StackedCards.Length > 0)
return false;
return true;
}
if (PlayStacks.Contains(CandidateStack))
{
if (CandidateStack.Cards.Count == 0)
return true;
return (RuleForStackingCardsInPlayStack(CandidateStack.Cards.Last(), card));
示例3: SpiderGame
//.........这里部分代码省略.........
MyStatus.Moves++;
MyStatus.Score--;
MyStatus.Update();
}
CheckForWin();
};
c.ValidateDragStart +=
delegate
{
if (Cheat)
return true;
return c.SelectedCards.AllWithPrevious(
(Previous, Current) =>
{
if (Previous.Info.Suit != Current.Info.Suit)
return false;
return Previous.Rank + 1 == Current.Rank;
}
);
};
c.ValidateDragStop +=
CandidateStack =>
{
if (Cheat)
return true;
if (PlayStacks.Contains(CandidateStack))
{
if (CandidateStack.Cards.Count == 0)
return true;
var Candidate = CandidateStack.Last();
// we do not care about the suit
if (c.Rank == Candidate.Rank + 1)
//if (c.Info.Suit == Candidate.Info.Suit)
return true;
return false;
}
return false;
};
};
#endregion
System.Console.WriteLine("creating playstack... ");
var Margin = (DefaultWidth - CardInfo.Width * 10) / 11;
PlayStacks.AddRange(
Enumerable.Range(0, 10).ToArray(
i =>
new CardStack
{
Name = "PlayStack " + i,
示例4: GetShipClassesInOrbit
/// <summary>
/// Get a list of the shipclasses in orbit. this wll be needed to help prune repair/refit/scrap operation options.
/// </summary>
/// <param name="CurrentFaction">Current faction from the economics handler</param>
/// <param name="CurrentPopulation">Current Population from the economics handler.</param>
/// <param name="ClassesInOrbit">List of shipclasses in orbit around CurrentPopulation.</param>
private static void GetShipClassesInOrbit(Faction CurrentFaction, Population CurrentPopulation, ref BindingList<ShipClassTN> ClassesInOrbit)
{
ClassesInOrbit.Clear();
foreach (TaskGroupTN CurrentTaskGroup in CurrentPopulation.Planet.TaskGroupsInOrbit)
{
if (CurrentTaskGroup.TaskGroupFaction == CurrentFaction)
{
foreach (ShipTN CurrentShip in CurrentTaskGroup.Ships)
{
if (ClassesInOrbit.Contains(CurrentShip.ShipClass) == false)
ClassesInOrbit.Add(CurrentShip.ShipClass);
}
}
}
}
示例5: GetOrderedPlayListItems
private static BindingList<PlayListItem> GetOrderedPlayListItems(List<PlayListItem> list)
{
var result = new BindingList<PlayListItem>();
foreach (var playListItem in list.Where(playListItem => playListItem != null && !result.Contains(playListItem)))
{
if (playListItem.Group <= 0)
{
result.Add(playListItem);
continue;
}
result.Add(playListItem);
var item = playListItem;
foreach (var groupedItemToAdd in list.Where(p => p != item && p.Group == item.Group))
result.Add(groupedItemToAdd);
}
return result;
}
示例6: SolitaireGame
//.........这里部分代码省略.........
(Previous, Current) =>
{
if (Cheat)
return true;
if (Previous.Info.SuitColor == Current.Info.SuitColor)
return false;
if (Previous.Rank + 1 != Current.Rank)
return false;
return true;
};
#endregion
MyDeck.ApplyCardRules += delegate(Card card)
{
card.MovedByLocalPlayer +=
delegate
{
MyStatus.Moves++;
MyStatus.Update();
};
card.ValidateDragStart =
delegate
{
if (Cheat)
return true;
// cannot remove cards from goal stack
if (GoalStacks.Contains(card))
return false;
if (TempStacks.Contains(card))
{
return (card == ChoiceStack.LastOrDefault());
}
// cannot drag a pile of cards unless alternate colors and descending numbers
return card.SelectedCards.AllWithPrevious(RuleForStackingCardsInPlayStack);
};
card.ValidateDragStop =
CandidateStack =>
{
if (Cheat)
return true;
if (TempStacks.Contains(CandidateStack))
{
return false;
}
if (PlayStacks.Contains(CandidateStack))
{
if (CandidateStack.Cards.Count == 0)
return card.Info.Rank == CardInfo.RankEnum.RankKing;
return (RuleForStackingCardsInPlayStack(CandidateStack.Cards.Last(), card));
}
示例7: CheckLabelsListWithXml
private bool CheckLabelsListWithXml(out string summary_results)
{
TextWriter summary_file_csv = null;
TextWriter summary_file_html = null;
bool Is_LabelsList_Valid = true;
summary_results = "";
string[] str_temp;
try
{
DateTime start_time, end_time;
TimeSpan ts, ts_start, ts_end, total_time, total_time_inv;
string category, current_label, readline;
//Create Summary Lists
BindingList<string> List_Annotated = new BindingList<string>();
BindingList<string> List_NoAnnotated = new BindingList<string>();
BindingList<string> List_Invalid = new BindingList<string>();
BindingList<TimeSpan> List_Time = new BindingList<TimeSpan>();
BindingList<TimeSpan> List_Time_Inv = new BindingList<TimeSpan>();
BindingList<string> List_Current_XML;
//Create the files for summarizing results
// Create the csv file
if (File.Exists(Folder_audioannotation + "AnnotationSummary.csv"))
{ File.Delete(Folder_audioannotation + "AnnotationSummary.csv"); }
summary_file_csv = new StreamWriter(Folder_audioannotation + "AnnotationSummary.csv");
summary_file_csv.WriteLine("Label,Time(hh:mm:ss)");
// Create the html file
if (File.Exists(Folder_audioannotation + "AnnotationSummary.html"))
{ File.Delete(Folder_audioannotation + "AnnotationSummary.html"); }
summary_file_html = new StreamWriter(Folder_audioannotation + "AnnotationSummary.html");
summary_file_html.WriteLine("<table border=\"1\">\n");
summary_file_html.WriteLine("<tr><td>Label</td><td>Time(hh:mm:ss)</td></tr>");
// ---------- Load labels ------------------
int count = 0;
int index = 0;
for (int c = 1; c <= 2; c++)
{
//Initialize lists
List_Annotated.Clear();
List_NoAnnotated.Clear();
List_Invalid.Clear();
List_Time.Clear();
List_Time_Inv.Clear();
total_time = TimeSpan.Zero;
total_time_inv = TimeSpan.Zero;
//Indicate the category
if (c == 1)
{
count = LabelsList_1.Count;
List_Current_XML = list_category_1;
//category = "Postures";
category = list_category_name[0];
}
else
{
count = LabelsList_2.Count;
List_Current_XML = list_category_2;
//category = "Activities";
category = list_category_name[1];
}
//Read each item from the list
for (int i = 0; i < count; i++)
{
if (c == 1)
{ readline = LabelsList_1[i]; }
else
{ readline = LabelsList_2[i]; }
string[] tokens = readline.Split(';');
//Check the row has valid start/end times
if (tokens[0].CompareTo("ok") == 0)
{
current_label = tokens[5];
//filter labels comming from blank rows
if (current_label.Trim().CompareTo("") != 0)
{
//Check if the label is valid according to the Xml protocol list
//if not, flag the label as invalid
if (List_Current_XML.Contains(current_label))
//.........这里部分代码省略.........
示例8: bgw_RunWorkerCompleted
/// <summary>
/// Handles the RunWorkerCompleted event of the bgw control.
/// </summary>
/// <param name="sender">The source of the event.</param>
/// <param name="e">The <see cref="System.ComponentModel.RunWorkerCompletedEventArgs"/> instance containing the event data.</param>
private void bgw_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
{
this.initializing = false;
this.btnOK.Enabled = true;
this.layoutControlItemScrape.Visibility = LayoutVisibility.Always;
this.layoutControlItemProgress.Visibility = LayoutVisibility.Never;
grpMain.Enabled = true;
if (ImportMoviesFactory.ImportDuplicatesDatabase.Count > 0)
{
string movies = "";
BindingList<string> moviesCounted = new BindingList<string>();
foreach (var movie in ImportMoviesFactory.ImportDuplicatesDatabase)
{
var result = (from m in ImportMoviesFactory.ImportDuplicatesDatabase where (m.Title.ToLower().Trim() == movie.Title.ToLower().Trim()) select m).ToList();
if (result.Count > 1)
{
if (!moviesCounted.Contains(movie.Title))
{
movies += movie.Title + " (multiple), ";
moviesCounted.Add(movie.Title);
}
}
else
{
movies += movie.Title + ", ";
}
}
XtraMessageBox.Show(string.Format("{0} scanned movies already exists in the database:\n{1}",
ImportMoviesFactory.ImportDuplicatesDatabase.Count, movies.Substring(0, movies.Length - 2)), "Duplicate movies found");
InternalApps.Logs.Log.WriteToLog(LogSeverity.Info, 0, string.Format("{0} duplicate movies found: {1}",
ImportMoviesFactory.ImportDuplicatesDatabase.Count, movies.Substring(0, movies.Length - 2)), "ImportMoviesUC > RunWorkerCompleted");
}
}
示例9: BuildMasterTvMediaDatabase
/// <summary>
/// Builds the master tv media database.
/// </summary>
/// <param name="sender">The sender.</param>
/// <param name="e">The <see cref="System.ComponentModel.DoWorkEventArgs"/> instance containing the event data.</param>
private static void BuildMasterTvMediaDatabase(object sender, DoWorkEventArgs e)
{
masterTvMediaDatabase = new BindingList<string>();
foreach (var series in TvDBFactory.TvDatabase)
{
foreach (var season in series.Value.Seasons)
{
foreach (Episode episode in season.Value.Episodes)
{
string filePath = episode.CurrentFilenameAndPath;
if (!string.IsNullOrEmpty(filePath))
{
// var check = (from m in masterTvMediaDatabase where m == filePath select m).SingleOrDefault();
if (!masterTvMediaDatabase.Contains(filePath))
{
masterTvMediaDatabase.Add(filePath);
}
}
}
}
}
}
示例10: Spider
//.........这里部分代码省略.........
new CardStack(new Point(550, top), MyDeck.FetchCards(4)),
new CardStack(new Point(650, top), MyDeck.FetchCards(4)),
new CardStack(new Point(750, top), MyDeck.FetchCards(4)),
new CardStack(new Point(850, top), MyDeck.FetchCards(4)),
new CardStack(new Point(950, top), MyDeck.FetchCards(4))
);
PlayStacks.ForEach(
(System.Action<CardStack>)
delegate(CardStack s)
{
s.Cards.ListChanged +=
(sender, args) =>
{
if (args.ListChangedType == ListChangedType.ItemDeleted)
if (MyStatus.Ready)
s.RevealLastCard();
};
s.CardsMovedToStack +=
delegate
{
if (MyStatus.Ready)
{
MyStatus.Score--;
MyStatus.Moves++;
MyStatus.Update();
}
};
}
);
DealStacks.ListChanged +=
(sender, args) =>
{
if (args.ListChangedType == ListChangedType.ItemAdded)
{
var s = DealStacks[args.NewIndex];
s.CardMargin *= 0;
s.Update();
s.Click +=
delegate
{
if (DealStacks.Contains(s))
{
if (MyStatus.Ready)
DealRow(null);
}
else
{
System.Console.WriteLine("whoops wrong stack click ");
}
};
}
};
System.Console.WriteLine("creating dealstack... ");
var dealpoint = new Point(860, bottom);
while (MyDeck.UnusedCards.Count > 0)
{
DealStacks.Add(
new CardStack(dealpoint, MyDeck.FetchCards(10))
);
dealpoint -= new Point(10, 0);
}
DeadStacks.Add(new CardStack(new Point(150, bottom)));
if (CheatReveal)
DoCheatRevealAllCards();
MyDeck.ToConsole();
DealRow(
delegate
{
MyStatus.Ready = true;
MyStatus.Score = 500;
MyStatus.Moves = 0;
MyStatus.Visible = true;
MyStatus.Update();
}
);
}
示例11: FreeCell
//.........这里部分代码省略.........
delegate
{
TryAutoMove(e);
};
e.DoubleClick +=
delegate
{
TryAutoMove(e);
};
#endregion
e.Drag.DragStop +=
delegate
{
sounds.PlaySoundDrop();
};
e.Drag.DragStart +=
delegate
{
sounds.PlaySoundDrag();
};
// rules for starting a drag
e.Drag.DragStartValidate +=
delegate(Predicate p)
{
if (UseNoValidationCheat)
return;
// cannot remove cards from goal stack
if (GoalStacks.Contains(e.CurrentStack))
{
p.Value = false;
return;
}
// cannot drag a pile of cards
if (e.HasStackedCards)
p.Value = false;
};
// rules for ending a drag
e.ValidateDragStop +=
delegate(Predicate<CardStack> p)
{
if (UseNoValidationCheat)
return;
if (IsStackTypeAndDoesNotFit(e, PlayStacks, p, IsFitForPlayStack))
{
p.Target = null;
}
else if (IsStackTypeAndDoesNotFit(e, TempStacks, p, IsFitForTempStack))
{
p.Target = null;
}
else if (IsStackTypeAndDoesNotFit(e, GoalStacks, p, IsFitForGoalStack))
{
p.Target = null;
}