本文整理汇总了C#中System.Windows.Documents.List.Concat方法的典型用法代码示例。如果您正苦于以下问题:C# List.Concat方法的具体用法?C# List.Concat怎么用?C# List.Concat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.Concat方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: describeException
protected List<string> describeException(Exception e)
{
var list = new List<string> { "caused by" };
if (e != null)
{
list.Add(e.Message);
list.Add(e.StackTrace);
if (e.InnerException != null)
{
list.Concat(describeException(e.InnerException));
}
}
return list;
}
示例2: OpenGameWindow
public void OpenGameWindow(ConversationDC conv)
{
List<string> allPlayers = new List<string>();
allPlayers.Add(conv.Host.Login);
var logins = (from p in conv.Participants select p.Login).ToList();
allPlayers = allPlayers.Concat<string>(logins).ToList();
GameLaunching(allPlayers, conv.ConversationId);
}
示例3: LoadFriends
public void LoadFriends()
{
var onlineFriends = from f in friends where f.PlayerStatus == "Online" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
var offlineFriends = from f in friends where f.PlayerStatus == "Offline" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
var absentFriends = from f in friends where f.PlayerStatus == "Absent" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
var inPartyFriends = from f in friends where f.PlayerStatus == "InParty" && f.Pseudonym.Contains(_friendsFilter.Text) select f;
var orderedFriends = new List<PlayerDC>();
playerDCViewSource.Source = orderedFriends.Concat(onlineFriends).Concat(absentFriends).Concat(inPartyFriends).Concat(offlineFriends);
playerDCViewSource.View.Refresh();
}
示例4: NotifyFriendshipEstablishment
public void NotifyFriendshipEstablishment(PlayerDC playerDC)
{
var q = (from r in friendshipRequests
where r.PlayerId == playerDC.PlayerId
select r).ToList();
if (q.Count > 0)
{
RemoveFriendshipRequestFromList(q.ElementAt(0));
}
q = (from f in friends
where f.PlayerId == playerDC.PlayerId
select f).ToList();
if (q.Count == 0)
{
addFriendsPage.playerDCViewSource.Source = new List<PlayerDC>();
addFriendsPage.playerDCViewSource.View.Refresh();
var newFriendsList = new List<PlayerDC>() { playerDC };
friends = newFriendsList.Concat(friends);
LoadFriends();
playerDCViewSource.View.Refresh();
}
}
示例5: QuickSortFunction
public DateTime[] QuickSortFunction()
{
int[] MyArrayofTicks= QuickSortFunction(ArrayOfElements.ToArray(), 0, (ArrayOfElements.Count - 1), (ArrayOfElements.Count / 2));
List<DateTime> ListOfSortedDateTime = new List<DateTime>();
foreach (int MyInt in MyArrayofTicks)
{
var JustConcatenate = ListOfSortedDateTime.Concat(DictionaryOfIntAndDateTime[MyInt]);
ListOfSortedDateTime = JustConcatenate.ToList();
}
return ListOfSortedDateTime.ToArray();
}
示例6: taskText_PreviewKeyUp
private void taskText_PreviewKeyUp(object sender, KeyEventArgs e)
{
if (e.Key == Key.Enter)
{
if (_updating == null)
{
_taskList.Add(new Task(taskText.Text.Trim()));
}
else
{
_taskList.Update(_updating, new Task(taskText.Text.Trim()));
_updating = null;
}
taskText.Text = "";
FilterAndSort(_currentSort);
Intellisense.IsOpen = false;
return;
}
if (Intellisense.IsOpen && !IntellisenseList.IsFocused)
{
switch (e.Key)
{
case Key.Down:
IntellisenseList.Focus();
Keyboard.Focus(IntellisenseList);
IntellisenseList.SelectedIndex = 0;
break;
case Key.Escape:
case Key.Space:
Intellisense.IsOpen = false;
break;
default:
var word = FindIntelliWord();
IntellisenseList.Items.Filter = (o) => o.ToString().Contains(word);
break;
}
}
else
{
switch (e.Key)
{
case Key.Enter:
if (_updating == null)
{
_taskList.Add(new Task(taskText.Text.Trim()));
}
else
{
_taskList.Update(_updating, new Task(taskText.Text.Trim()));
_updating = null;
}
taskText.Text = "";
FilterAndSort(_currentSort);
break;
case Key.Escape:
_updating = null;
taskText.Text = "";
this.lbTasks.Focus();
break;
case Key.OemPlus:
List<string> projects = new List<string>();
foreach (var task in _taskList.Tasks)
projects = projects.Concat(task.Projects).ToList();
var pos = taskText.CaretIndex;
ShowIntellisense(projects.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(pos));
break;
case Key.D2:
List<string> contexts = new List<string>();
foreach (var task in _taskList.Tasks)
contexts = contexts.Concat(task.Contexts).ToList();
pos = taskText.CaretIndex;
ShowIntellisense(contexts.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(pos));
break;
}
}
}
示例7: DrawPoint
private void DrawPoint(List<Vector2Ext> points, Color color)
{
bitmap.FillPolygon(
points.Concat(new List<Vector2Ext> {points.First()})
.SelectMany(x=>x.AsArray()).ToArray(), color);
}
示例8: NotifyGameOver
public void NotifyGameOver(bool isDraw, List<Player> winners)
{
Application.Current.Dispatcher.Invoke((ThreadStart)delegate()
{
Uri uri = GameSoundLocator.GetSystemSound("GameOver");
GameSoundPlayer.PlaySoundEffect(uri);
GameSoundPlayer.PlayBackgroundMusic(null);
List<Player> drawers;
List<Player> losers;
if (isDraw)
{
Trace.Assert(winners.Count == 0);
drawers = Game.CurrentGame.Players;
losers = new List<Player>();
}
else
{
drawers = new List<Player>();
losers = new List<Player>(Game.CurrentGame.Players.Except(winners));
}
bool delayWindow = true;
if (winners.Contains(GameModel.MainPlayerModel.Player))
{
PlayAnimation(new WinAnimation());
}
else if (losers.Contains(GameModel.MainPlayerModel.Player))
{
PlayAnimation(new LoseAnimation());
}
else delayWindow = false;
LobbyViewModel.Instance.OnChat -= chatEventHandler;
ObservableCollection<GameResultViewModel> model = new ObservableCollection<GameResultViewModel>();
foreach (Player player in winners.Concat(losers).Concat(drawers))
{
var m = new GameResultViewModel();
m.Player = player;
if (winners.Contains(player))
{
m.Result = GameResult.Win;
// @todo : fix this.
m.GainedExperience = "+15";
m.GainedTechPoints = "+0";
}
else if (losers.Contains(player))
{
m.Result = GameResult.Lose;
// @todo : fix this.
m.GainedExperience = "-3";
m.GainedTechPoints = "+0";
}
else if (drawers.Contains(player))
{
m.Result = GameResult.Draw;
// @todo : fix this.
m.GainedExperience = "+3";
m.GainedTechPoints = "+0";
}
model.Add(m);
}
gameResultBox.DataContext = model;
gameResultWindow.Content = gameResultBox;
gameResultWindow.Closed += (o, e) =>
{
var handler = OnGameCompleted;
if (handler != null)
{
handler(this, new EventArgs());
}
};
if (delayWindow)
{
DispatcherTimer timer = new DispatcherTimer();
timer.Tick += (o, e) =>
{
gameResultWindow.Show();
timer.Stop();
};
timer.Interval = TimeSpan.FromSeconds(2);
timer.Start();
}
else
{
gameResultWindow.Show();
}
});
}
示例9: getTimeLine
TimeLine getTimeLine()
{
DateTime LastDeadline=DateTime.Now.AddHours(1);
List<BusyTimeLine> MyTotalBusySlots=new List<BusyTimeLine>(0);
//var Holder=new List();
foreach (KeyValuePair<string, CalendarEvent> MyCalendarEvent in AllEventDictionary)
{
var Holder = MyTotalBusySlots.Concat(GetBusySlotPerCalendarEvent(MyCalendarEvent.Value));
MyTotalBusySlots = Holder.ToList();
/*foreach (SubCalendarEvent MySubCalendarEvent in MyCalendarEvent.Value.AllEvents)
{
if (MySubCalendarEvent.End > LastDeadline)
{
LastDeadline = MySubCalendarEvent.End;
}
MyTotalBusySlots.Add(MySubCalendarEvent.ActiveSlot);
}*/
}
MyTotalBusySlots = SortBusyTimeline(MyTotalBusySlots, true);
TimeLine MyTimeLine = new TimeLine(DateTime.Now, DateTime.Now.AddHours(1));
if (MyTotalBusySlots.Count > 0)
{
MyTimeLine = new TimeLine(DateTime.Now, MyTotalBusySlots[MyTotalBusySlots.Count - 1].End);
}
MyTimeLine.OccupiedSlots = MyTotalBusySlots.ToArray();
return MyTimeLine;
}
示例10: GetBusySlotPerCalendarEvent
BusyTimeLine[] GetBusySlotPerCalendarEvent(CalendarEvent MyEvent)
{
int i=0;
List<BusyTimeLine> MyTotalSubEventBusySlots = new List<BusyTimeLine>(0);
BusyTimeLine[] ArrayOfBusySlotsInRepeat = new BusyTimeLine[0];
DateTime LastDeadline = DateTime.Now.AddHours(1);
if (MyEvent.RepetitionStatus)
{
ArrayOfBusySlotsInRepeat = GetBusySlotsPerRepeat(MyEvent.Repeat);
}
/*for (;i<MyEvent.AllEvents.Length;i++)
{
{*/
foreach (SubCalendarEvent MySubCalendarEvent in MyEvent.AllEvents)
{
if (!MyEvent.RepetitionStatus)
{ MyTotalSubEventBusySlots.Add(MySubCalendarEvent.ActiveSlot); }
}
//MyTotalSubEventBusySlots.Add(MyEvent.AllEvents[i].ActiveSlot);
/*}
}*/
//BusyTimeLine[] ConcatenatSumOfAllBusySlots = new BusyTimeLine[ArrayOfBusySlotsInRepeat.Length + MyTotalSubEventBusySlots.Count];
/*
i = 0;
for (; i < ArrayOfBusySlotsInRepeat.Length; i++)
{
ConcatenatSumOfAllBusySlots[i] = ArrayOfBusySlotsInRepeat[i];
}
i = ArrayOfBusySlotsInRepeat.Length;
int LengthOfConcatenatSumOfAllBusySlots = ConcatenatSumOfAllBusySlots.Length;
int j = 0;
j = i;
for (; j < LengthOfConcatenatSumOfAllBusySlots;)
{
ConcatenatSumOfAllBusySlots[j] = MyTotalSubEventBusySlots[i];
i++;
j++;
}*/
var Holder = MyTotalSubEventBusySlots.Concat(ArrayOfBusySlotsInRepeat);
BusyTimeLine[] ConcatenatSumOfAllBusySlots = Holder.ToArray();
//ArrayOfBusySlotsInRepeat.CopyTo(ConcatenatSumOfAllBusySlots, 0);
//MyTotalSubEventBusySlots.CopyTo(ConcatenatSumOfAllBusySlots, ConcatenatSumOfAllBusySlots.Length);
//ArrayOfBusySlotsInRepeat.CopyTo(ConcatenatSumOfAllBusySlots, 0);
return ConcatenatSumOfAllBusySlots;
}
示例11: BuildDicitionaryOfTimeLineAndSubcalendarEvents
private Dictionary<TimeLine, List<SubCalendarEvent>> BuildDicitionaryOfTimeLineAndSubcalendarEvents(List<SubCalendarEvent> MyInterferringSubCalendarEvents, Dictionary<TimeLine, Dictionary<CalendarEvent,List<SubCalendarEvent>>> DicitonaryTimeLineAndPertinentCalendarEventDictionary, CalendarEvent MyEvent)
{
List<TimeLine> MyListOfFreeTimelines = DicitonaryTimeLineAndPertinentCalendarEventDictionary.Keys.ToList();
Dictionary<TimeLine,List<SubCalendarEvent>> DictionaryofTimeLineAndPertinentSubcalendar= new System.Collections.Generic.Dictionary<TimeLine,System.Collections.Generic.List<SubCalendarEvent>>();
foreach (TimeLine MyTimeLine in MyListOfFreeTimelines)
{
//Dictionary<TimeLine, Dictionary<CalendarEvent, List<SubCalendarEvent>>> DicitonaryTimeLineAndPertinentCalendarEventDictionary1;
Dictionary<CalendarEvent,List<SubCalendarEvent>> MyListOfDictionaryOfCalendarEventAndSubCalendarEvent=DicitonaryTimeLineAndPertinentCalendarEventDictionary[MyTimeLine];
List<CalendarEvent> MyListOfPertitnentCalendars = MyListOfDictionaryOfCalendarEventAndSubCalendarEvent.Keys.ToList();
MyListOfPertitnentCalendars = MyListOfPertitnentCalendars.OrderBy(obj => obj.End).ToList();
List<SubCalendarEvent> MyListOfPertinentSubEvent = new List<SubCalendarEvent>();
foreach (CalendarEvent MyCalendarEvent in MyListOfPertitnentCalendars)
{
List<SubCalendarEvent> InterFerringSubCalendarEventS = MyListOfDictionaryOfCalendarEventAndSubCalendarEvent[MyCalendarEvent];
if (MyCalendarEvent.Repeat.Enable)
{
List<CalendarEvent> MyListOfAffectedRepeatingCalendarEvent = getClashingCalendarEvent(MyCalendarEvent.Repeat.RecurringCalendarEvents.ToList(), MyTimeLine);
List<SubCalendarEvent> ListOfAffectedSubcalendarEvents = new System.Collections.Generic.List<SubCalendarEvent>();
foreach (CalendarEvent MyRepeatCalendarEvent in MyListOfAffectedRepeatingCalendarEvent)
{
SubCalendarEvent[] MyListOfSubCalendarEvents = MyRepeatCalendarEvent.AllEvents;
foreach (SubCalendarEvent PosibleClashingSubCalEvent in MyListOfSubCalendarEvents )
{
foreach(SubCalendarEvent eachInterFerringSubCalendarEvent in InterFerringSubCalendarEventS)
{
if (PosibleClashingSubCalEvent.ID == eachInterFerringSubCalendarEvent.ID)
{
ListOfAffectedSubcalendarEvents.Add(eachInterFerringSubCalendarEvent);
}
}
}
}
var MyTempHolder = MyListOfPertinentSubEvent.Concat(ListOfAffectedSubcalendarEvents);
MyListOfPertinentSubEvent = MyTempHolder.ToList();
}
else
{
var MyTempHolder = MyListOfPertinentSubEvent.Concat(MyListOfDictionaryOfCalendarEventAndSubCalendarEvent[MyCalendarEvent]);
MyListOfPertinentSubEvent=MyTempHolder.ToList();
}
}
//var ConcatVar = MyListOfPertinentSubEvent.Concat(TempSubCalendarEventsForMyCalendarEvent.ToList());
//MyListOfPertinentSubEvent = ConcatVar.ToList();
DictionaryofTimeLineAndPertinentSubcalendar.Add(MyTimeLine, MyListOfPertinentSubEvent);
}
return DictionaryofTimeLineAndPertinentSubcalendar;
/*foreach(TimeLine MyTimeLine in MyListOfFreeTimelines)
{
List<SubCalendarEvent> MyTimeLineListToWorkWith = getIntersectionList(MyInterferringSubCalendarEvents, DictionsryofTimeLineAndPertinentSubcalenda[MyTimeLine]);
}
*/
}
示例12: GeneratePalette
/// <summary>
/// Generates the palette.
/// </summary>
/// <returns></returns>
private Color[] GeneratePalette()
{
List<Color> colors = new List<Color>();
for (int c = 0; c < 256; c++)
colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));
for (int c = 0; c < 256; c++)
colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
for (int c = 255; c >= 0; c--)
colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
for (int c = 0; c < 256; c++)
colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
for (int c = 255; c >= 0; c--)
colors.Add(Color.FromArgb(0xff, 0, 0xff, (byte)c));
for (int c = 0; c < 256; c++)
colors.Add(Color.FromArgb(0xff, 0, (byte)c, 0xff));
for (int c = 255; c >= 0; c--)
colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0xff));
for (int c = 0; c < 256; c++)
colors.Add(Color.FromArgb(0xff, 0xff, 0, (byte)c));
for (int c = 0; c < 256; c++)
colors.Add(Color.FromArgb(0xff, (byte)c, 0, 0));
var half =
colors.Concat(
colors.Reverse<Color>());
return half.Concat(half).ToArray();
}
示例13: Button31_OnClick
private void Button31_OnClick(object sender, RoutedEventArgs e)
{
var count = 0;
var zjnamestr = "";
var zjlblist1 = new List<string>();
var zjlblist2 = new List<string>();
var zjclasslist = 专家可评标专业分类.评审专业;
foreach (var zjclass in zjclasslist)
{
zjlblist1.Add(zjclass.分类名);
zjlblist2 = zjlblist2.Concat(zjclass.子分类).ToList();
}
var zjlist = 用户管理.查询用户<专家>(0, 0, includeDisabled: false);
//foreach (var zj in zjlist)
//{
// if (!string.IsNullOrWhiteSpace(zj.身份信息.姓名))
// {
// zj.身份信息.姓名 = zj.身份信息.姓名.Replace(" ", "").Replace(" ", "");
// 用户管理.更新用户<专家>(zj, false);
// zjnamestr += zj.身份信息.姓名 + " " + zj.身份信息.性别 + " " + zj.身份信息.出生年月 + " " +
// zj.Id + "\r\n";
// }
// else
// {
// zjnamestr += "删除专家ID:" + zj.Id + "\r\n";
// }
//}
foreach(var item in zjlist)
{
string temp = "";
foreach(var item1 in item.可参评物资类别列表)
{
temp +=item1.一级分类+"|";
}
zjnamestr += item.身份信息.姓名 + " " + item.身份信息.出生年月.ToString("yyyy-MM-dd") + " " + item.学历信息.专业技术职称 + " " + item.身份信息.专家级别 + " " + item.联系方式.手机 + " " + item.学历信息.毕业院校 + " " +"可评标类别:"+ temp +"\r\n";
}
MessageBox.Show(count.ToString());
textBox1.Text = zjnamestr;
}
示例14: taskText_PreviewKeyUp
//.........这里部分代码省略.........
case 0: // couldn't determine scenario
case 1: // completed
case 2: // has creation date
case 4: // has creation date
break; // lets just leave the task alone
case 3: // add in the creation date
split[1] = thisDay.ToString("yyyy-MM-dd") + " " + split[1]; // squeeze in the date
taskdetail = "";
for (int i = 0; i < split.Count(); i++) // rebuild the task
{
taskdetail += split[i] + " ";
}
break;
case 5: // add in the creation date
split[0] = thisDay.ToString("yyyy-MM-dd") + " " + split[0]; // squeeze in the date
taskdetail = "";
for (int i = 0; i < split.Count(); i++) // rebuild the task
{
taskdetail += split[i] + " ";
}
break;
default:
break; // anything else just leave the task alone
}
_taskList.Add(new Task(taskdetail.Trim()));
}
catch (TaskException ex)
{
MessageBox.Show(ex.Message);
}
}
else
{
_taskList.Update(_updating, new Task(taskText.Text.Trim()));
_updating = null;
}
taskText.Text = "";
FilterAndSort(_currentSort);
Intellisense.IsOpen = false;
return;
}
if (Intellisense.IsOpen && !IntellisenseList.IsFocused)
{
if (taskText.CaretIndex <= _intelliPos) // we've moved behind the symbol, drop out of intellisense
{
Intellisense.IsOpen = false;
return;
}
switch (e.Key)
{
case Key.Down:
IntellisenseList.Focus();
Keyboard.Focus(IntellisenseList);
IntellisenseList.SelectedIndex = 0;
break;
case Key.Escape:
case Key.Space:
Intellisense.IsOpen = false;
break;
default:
var word = FindIntelliWord();
IntellisenseList.Items.Filter = (o) => o.ToString().Contains(word);
break;
}
}
else
{
switch (e.Key)
{
case Key.Escape:
_updating = null;
taskText.Text = "";
this.lbTasks.Focus();
break;
case Key.OemPlus:
List<string> projects = new List<string>();
_taskList.Tasks.Each(task => projects = projects.Concat(task.Projects).ToList());
_intelliPos = taskText.CaretIndex - 1;
ShowIntellisense(projects.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(_intelliPos));
break;
case Key.D2:
List<string> contexts = new List<string>();
_taskList.Tasks.Each(task => contexts = contexts.Concat(task.Contexts).ToList());
_intelliPos = taskText.CaretIndex - 1;
ShowIntellisense(contexts.Distinct().OrderBy(s => s), taskText.GetRectFromCharacterIndex(_intelliPos));
break;
}
}
}
示例15: GetAccountReplays
private List<FileInfo> GetAccountReplays(DirectoryInfo account)
{
List<FileInfo> replays = new List<FileInfo>();
account.GetDirectories().All(d =>
{
replays = replays.Concat(GetAccountReplays(d)).ToList();
return true;
});
account.GetFiles().All(f =>
{
if (f.Extension.CompareTo(".SC2Replay") == 0)
{
replays.Add(f);
}
return true;
});
return replays;
}