当前位置: 首页>>代码示例>>C#>>正文


C# List.ToList方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:patdohere,项目名称:FreeMoVR,代码行数:54,代码来源:MainWindow.xaml.cs

示例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;
            }
        }
开发者ID:martinkjelsmark,项目名称:Bookit,代码行数:31,代码来源:Activity.xaml.cs

示例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();
        }
开发者ID:Nabulion,项目名称:LeWebShop,代码行数:25,代码来源:EditWindow.xaml.cs

示例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, @"<[^>]+>|&nbsp;", "").Trim();
                            comments.Add(com);
                        }
                    }
                }
                commentData.ItemsSource = comments.ToList();
            }
        }
开发者ID:ziomal9191,项目名称:uekHD,代码行数:35,代码来源:DatabasePresentationWindow.xaml.cs

示例5: MainWindow

        public MainWindow()
        {
            InitializeComponent();
            rep = new Repository();
            List<Course> courses = new List<Course>();
            courses = rep.getCourses();
            comboStandardId.Items.SourceCollection = courses.ToList();

        }
开发者ID:Maldercito,项目名称:adat,代码行数:9,代码来源:1453203858$MainWindow.xaml.cs

示例6: UserList

        public UserList(List<UserDTO> users)
        {
            InitializeComponent();

            _users = users;
            
            if (_users != null)
                lstCustomers.ItemsSource = _users.ToList();
        }
开发者ID:martinkjelsmark,项目名称:Bookit,代码行数:9,代码来源:UserList.xaml.cs

示例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); }
 }
开发者ID:Kirk7by,项目名称:SysAnalyze,代码行数:12,代码来源:Page3.xaml.cs

示例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();
            }
        }
开发者ID:patdohere,项目名称:FreeMoVR,代码行数:39,代码来源:RunServer.xaml.cs

示例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();
        }
开发者ID:Nabulion,项目名称:LeWebShop,代码行数:17,代码来源:CreateWindow.xaml.cs

示例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, @"<[^>]+>|&nbsp;", "").Trim();
                            comments.Add(com);
                        }
                    }
                }
                commentData.ItemsSource = comments.ToList();
            }
        }
开发者ID:ziomal9191,项目名称:uekHD,代码行数:22,代码来源:DatabasePresentationWindow.xaml.cs

示例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!");
            }
        }
开发者ID:jonathan-w,项目名称:SAD-APP,代码行数:38,代码来源:lookupTweets.xaml.cs

示例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();
        }
开发者ID:hrhtspr,项目名称:SplatoonRecorder,代码行数:24,代码来源:AnalysisView.xaml.cs

示例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);
                }
            }
        }
开发者ID:lukaszw896,项目名称:Data-Mining-Project,代码行数:67,代码来源:MainWindow.xaml.cs

示例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());
                    }

                });
            }
        }
开发者ID:JuRogn,项目名称:OA,代码行数:31,代码来源:AddDistrbuteForm.xaml.cs

示例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);
 }
开发者ID:palome06,项目名称:psd48,代码行数:17,代码来源:Orchis40.xaml.cs


注:本文中的System.Windows.Documents.List.ToList方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。