本文整理汇总了C#中System.Windows.Documents.List.ToList方法的典型用法代码示例。如果您正苦于以下问题:C# List.ToList方法的具体用法?C# List.ToList怎么用?C# List.ToList使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Documents.List
的用法示例。
在下文中一共展示了List.ToList方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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();
}
}
示例2: Activity
public Activity(UserDTO user)
{
_userDTO = user;
InitializeComponent();
try
{
label1.Content = "Hej " + user.name + ", vælg en aktivitet:";
var client = new RestClient("http://dkmkl-fusion-7/bookit");
var request = new RestRequest("users/"+ user.userId +"/activities", Method.GET);
request.AddHeader("Accept", "application/xml");
// or automatically deserialize result
// return content type is sniffed but can be explicitly set via RestClient.AddHandler();
RestResponse<List<ActivityDTO>> response = client.Execute<List<ActivityDTO>>(request);
if (response != null)
{
_activities = response.Data;
lstCustomers.ItemsSource = _activities.ToList();
}
}
catch (Exception ex)
{
lblError.Content = ex.Message;
}
}
示例3: EditWindow
public EditWindow(Service.Service service, int rowIndex, object selectedItem, DataGrid grid)
{
InitializeComponent();
this.selectedItem = selectedItem;
this.service = service;
this.rowIndex = rowIndex;
this.grid = grid;
this.grid.IsReadOnly = true;
List<String> categories = new List<String>();
categories.Add("Discount pris");
categories.Add("Hverdags oste");
categories.Add("Luxus oste");
categories.Add("Eksklusive oste");
categories.Add("Styk ost");
categories.Add("Osteborde");
comboBoxCategoryEdit.ItemsSource = categories.ToList();
TxtName.Text = service.filldata(service.getProducts()).Rows[rowIndex]["name"].ToString();
txtUnitprice.Text = service.filldata(service.getProducts()).Rows[rowIndex]["unitPrice"].ToString();
txtCountAvailable.Text = service.filldata(service.getProducts()).Rows[rowIndex]["countAvailable"].ToString();
txtCountry.Text = service.filldata(service.getProducts()).Rows[rowIndex]["country"].ToString();
txtDescription.Text = service.filldata(service.getProducts()).Rows[rowIndex]["description"].ToString();
}
示例4: DatabasePresentationWindow
public DatabasePresentationWindow()
{
InitializeComponent();
using (DatabaseContext siContext = new DatabaseContext())
{
var query = (from Product in siContext.Product
select Product).ToList();
List<Product> comments = new List<Product>();
foreach (var comment in query)
{
comments.Add(comment);
}
productsDb.ItemsSource = comments.ToList();
}
using (DatabaseContext siContext = new DatabaseContext())
{
var query = (from Product in siContext.Product
select Product.Comments).ToList();
List<CommentDb> comments = new List<CommentDb>();
foreach (var comment in query)
{
if (comment.Count > 0)
{
foreach (var com in comment)
{
com.Comment = Regex.Replace(com.Comment, @"<[^>]+>| ", "").Trim();
comments.Add(com);
}
}
}
commentData.ItemsSource = comments.ToList();
}
}
示例5: MainWindow
public MainWindow()
{
InitializeComponent();
rep = new Repository();
List<Course> courses = new List<Course>();
courses = rep.getCourses();
comboStandardId.Items.SourceCollection = courses.ToList();
}
示例6: UserList
public UserList(List<UserDTO> users)
{
InitializeComponent();
_users = users;
if (_users != null)
lstCustomers.ItemsSource = _users.ToList();
}
示例7: DataGridUpdateDate
public void DataGridUpdateDate()
{
try
{
using (BdModelContainer _context = new BdModelContainer())
{
Lvod= _context.ВодителиSet.ToList();
dGrid.ItemsSource = Lvod.ToList();
}
}
catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы" + ex.Message); }
}
示例8: runFleck
public void runFleck()
{
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();
}
}
示例9: CreateWindow
public CreateWindow(Service.Service service, DataGrid grid)
{
InitializeComponent();
this.grid = grid;
this.service = service;
this.grid.IsReadOnly = true;
List<String> categories = new List<String>();
categories.Add("Discount pris");
categories.Add("Hverdags oste");
categories.Add("Luxus oste");
categories.Add("Eksklusive oste");
categories.Add("Styk ost");
categories.Add("Osteborde");
comboBoxCategory.ItemsSource = categories.ToList();
}
示例10: dataGrid1_SelectionChanged
private void dataGrid1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
using (DatabaseContext siContext = new DatabaseContext())
{
var query = (from Product in siContext.Product
select Product.Comments).ToList();
List<CommentDb> comments = new List<CommentDb>();
foreach (var comment in query)
{
if (comment.Count > 0)
{
foreach (var com in comment)
{
com.Comment = Regex.Replace(com.Comment, @"<[^>]+>| ", "").Trim();
comments.Add(com);
}
}
}
commentData.ItemsSource = comments.ToList();
}
}
示例11: twitter_DownloadStringCompleted
void twitter_DownloadStringCompleted(object senders, DownloadStringCompletedEventArgs e)
{
int count = 0;
try
{
List<TwitterItem> contentList = new List<TwitterItem>();
JArray ja = new JArray();
try
{
ja = JArray.Parse("[ " + e.Result + " ]");
}
catch
{
MessageBox.Show("Error getting data from twitter, The data was invalid", "Error", MessageBoxButton.OK);
}
//
for (count = 0; count < ja.Count; count++)
{
for (int i = 0; i < ja[count]["results"].Count(); i++)
{
TwitterItem content = new TwitterItem();
content.ImageSource = ja[count]["results"][i]["profile_image_url"].ToString();
content.UserName = ja[count]["results"][i]["from_user"].ToString();
content.Message = ja[count]["results"][i]["text"].ToString();
contentList.Add(content);
}
}
tweetList.ItemsSource = contentList.ToList();
}
catch
{
MessageBox.Show("A network error has occured, please try again!");
}
}
示例12: AnalysisView
public AnalysisView(string name)
{
InitializeComponent();
var bd = new Binding() { Source = MainWindow.Names };
this.name.SetBinding(ComboBox.ItemsSourceProperty, bd);
this.name.Text = name;
Datas = new List<BattleData>();
NowView = Datas.ToList();
viewCount.ItemsSource = Enum.GetValues(typeof(ViewCount));
viewCount.SelectedIndex = 0;
tab.SelectedIndex = 0;
var cv = new WinRatioConverter();
winratiolist.Columns.Clear();
winratiolist.Columns.Add(new DataGridTextColumn() { Binding = new Binding("Weapon") });
foreach (var item in MainWindow.Stages.Concat(new[]{"すべて"}))
{
var mb = new MultiBinding() { Converter=cv};
mb.Bindings.Add(new Binding("Datas[" + item + "].WinRatio"));
mb.Bindings.Add(new Binding("Datas[" + item + "].Count"));
winratiolist.Columns.Add(new DataGridTextColumn() { Header = item,Binding = mb });
}
ReadData();
}
示例13: CutSequenceCandidates
private void CutSequenceCandidates(List<List<int>> candidatesK, int k)
{
foreach (List<int> itemset in candidatesK.ToList())
{
List<int[]> subsets = new List<int[]>();
int[] subset = new int[k - 1];
//I add manualy one subset which is k-1 last items
for (int i = 0; i < k - 1; i++)
{
subset[i] = itemset[i + 1];
}
subsets.Add(subset);
//here I add the rest of possible subsets
for (int i = 1; i < k; i++)
{
int index = 1;
subset = new int[k - 1];
subset[0] = itemset[0];
for (int j = 1; j < k; j++)
{
if (j != i)
{
subset[index] = itemset[j];
index++;
}
}
subsets.Add(subset);
}
//I've got all subsets. Now I'll check whether they are in the k-1 frequent
//list
bool areAllSubsetsFrequent = true;
foreach (int[] ss in subsets)
{
bool isFrequentSubset = false;
foreach (List<int> fs in largeSequences[k - 2])
{
int i;
for (i = 0; i < k - 1; i++)
{
if (fs[i] != ss[i])
{
break;
}
}
//if we didn't break the loop than value of i should equal to k-1
//which means that checked set was the same as some from frequent itemset
if (i == k - 1)
{
isFrequentSubset = true;
break;
}
}
if (isFrequentSubset == false)
{
areAllSubsetsFrequent = false;
break;
}
}
if (areAllSubsetsFrequent == false)
{
candidatesK.Remove(itemset);
}
}
}
示例14: GetCompanyExtOrgObj
private void GetCompanyExtOrgObj(List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> LstOldCompanys, List<SMT.Saas.Tools.OrganizationWS.T_HR_COMPANY> LstCompanys)
{
if (LstCompanys.Count() > 0)
{
LstCompanys.ToList().ForEach(child =>
{
StrCompanyIDsList.Add(child.COMPANYID);
//issuanceExtOrgObj.Add(item);
ExtOrgObj objSecond = new ExtOrgObj();
objSecond.ObjectID = child.COMPANYID;
objSecond.ObjectName = child.CNAME;
objSecond.ObjectType = SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company;
var ExistEnts = from ext in entall
where ext.ObjectID == child.COMPANYID
&& ext.ObjectType == SMT.SaaS.FrameworkUI.OrgTreeItemTypes.Company
select ext;
if (ExistEnts.Count() == 0)
{
entall.Add(objSecond);
}
var ents = from childcompany in LstOldCompanys
where childcompany.T_HR_COMPANY2 != null && childcompany.T_HR_COMPANY2.COMPANYID == child.COMPANYID
select childcompany;
if (ents.Count() > 0)
{
GetCompanyExtOrgObj(LstOldCompanys,ents.ToList());
}
});
}
}
示例15: InsertCard
private void InsertCard(List<Ruban> comers, double xb, double yb)
{
if (comers.Count > ORCHIS_CAP)
{
comers.RemoveRange(0, comers.Count - ORCHIS_CAP);
OrchisAni(onBoards.ToList(), EMPTY_LIST, comers.ToList(), xb, yb);
}
else if (onBoards.Count + comers.Count > ORCHIS_CAP)
{
int diff = onBoards.Count + comers.Count - ORCHIS_CAP;
List<Ruban> take = onBoards.GetRange(0, diff).ToList();
List<Ruban> leave = onBoards.GetRange(diff, onBoards.Count - diff).ToList();
OrchisAni(take, leave, comers.ToList(), xb, yb);
}
else
OrchisAni(EMPTY_LIST, onBoards.ToList(), comers.ToList(), xb, yb);
}