FlowDocument doc1 = new FlowDocument(); FlowDocument doc2 = new FlowDocument(); List docs = new List { doc1, doc2 }; List objList = docs.ToList(); In this example, we create two new FlowDocument elements and add them to the List called "docs". We then call the ToList method on "docs" to create a new List called "objList". The "objList" contains both FlowDocument elements.Package library: System.Windows.Documents is part of the .NET Framework.Example 2:List numbers = new List { 1, 2, 3, 4, 5 }; List objList = numbers.ToList(); In this example, we create a List called "numbers" with five integer values. We then call the ToList method on "numbers" to create a new List called "objList". The "objList" contains the same five integer values as "numbers". Package library: System is part of the .NET Framework. C# (CSharp) System.Windows.Documents List.ToList - 28 examples found. These are the top rated real world C# (CSharp) examples of System.Windows.Documents.List.ToList extracted from open source projects. You can rate examples to help us improve the quality of examples. Frequently Used Methods Show Hide Add(30) Sort(30) ElementAt(30) First(30) FirstOrDefault(30) ToArray(30) AddRange(30) IndexOf(30) Insert(30) Last(30) Count(30) Max(30) OrderBy(30) OrderByDescending(30) Remove(30) RemoveAt(30) Reverse(30) Select(30) Distinct(30) ForEach(30) Any(30) Where(30) Clear(30) Contains(30) ToList(28) Min(25) FindAll(23) Find(21) Concat(19) GroupBy(18) Sum(16) RemoveRange(12) Skip(11) RemoveAll(11) GetType(11) FindIndex(10) AsEnumerable(10) Reposition(10) ConvertAll(9) Take(9) Except(9) Average(9) InsertRange(8) Exists(8) GetRange(8) Graph(6) All(6) GetValue(6) SelectMany(6) Single(4) Frequently Used Methods Add (30) Sort (30) ElementAt (30) First (30) FirstOrDefault (30) ToArray (30) AddRange (30) IndexOf (30) Insert (30) Last (30) Frequently Used Methods Count (30) Max (30) OrderBy (30) OrderByDescending (30) Remove (30) RemoveAt (30) Reverse (30) Select (30) Distinct (30) ForEach (30) Any (30) Where (30) Clear (30) Contains (30) ToList (28) Min (25) FindAll (23) Find (21) Concat (19) GroupBy (18) Frequently Used Methods Any (30) Where (30) Clear (30) Contains (30) ToList (28) Min (25) FindAll (23) Find (21) Concat (19) GroupBy (18) Sum (16) RemoveRange (12) Skip (11) RemoveAll (11) GetType (11) FindIndex (10) AsEnumerable (10) Reposition (10) ConvertAll (9) Take (9) Except (9) Average (9) InsertRange (8) Exists (8) GetRange (8) Graph (6) All (6) GetValue (6) SelectMany (6) Single (4) Related in langs PluginMonitoringHost_Host (PHP) zen_get_tax_rate_value (PHP) ttyrec_w_find_format (C++) IS_SYSRAM_ADDRESS (C++) Parse (Go) NextSunrise (Go) PooledDataSource (Java) Book (Java) emit_event (Python) PageCapture (Python) Frequently Used Methods Sum (16) RemoveRange (12) Skip (11) RemoveAll (11) GetType (11) FindIndex (10) AsEnumerable (10) Reposition (10) ConvertAll (9) Take (9) Except (9) Average (9) InsertRange (8) Exists (8) GetRange (8) Graph (6) All (6) GetValue (6) SelectMany (6) Single (4) ElementAtOrDefault (4) Aggregate (4) ToDictionary (4) GetEnumerator (4) Join (4) Shuffle (4) ToString (3) OfType (3) ToEmptyIfNull (2) TrimExcess (2) AsParallel (2) SingleOrDefault (2) LastOrDefault (2) TrueForAll (2) BinarySearch (2) Cast (2) Equals (2) SequenceEqual (2) Union (1) ToFBEntityList (1) Related conexionBD.clases.clinica IdTableStringKey DsnVm Device ICatSnapshotsRequest Counter DummyInstrument NodeDisplay[ DummyScanner DocumentAssembler Example #1 0 Show file File: MainWindow.xaml.cs Project: patdohere/FreeMoVR 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(); } } Example #2 0 Show file File: Activity.xaml.cs Project: martinkjelsmark/Bookit 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; } } Example #3 0 Show file File: EditWindow.xaml.cs Project: Nabulion/LeWebShop 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(); } Example #4 0 Show file File: DatabasePresentationWindow.xaml.cs Project: ziomal9191/uekHD 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(); } } Example #5 0 Show file File: 1453203858$MainWindow.xaml.cs Project: Maldercito/adat public MainWindow() { InitializeComponent(); rep = new Repository(); List<Course> courses = new List<Course>(); courses = rep.getCourses(); comboStandardId.Items.SourceCollection = courses.ToList(); } Example #6 0 Show file File: UserList.xaml.cs Project: martinkjelsmark/Bookit public UserList(List<UserDTO> users) { InitializeComponent(); _users = users; if (_users != null) lstCustomers.ItemsSource = _users.ToList(); } Example #7 0 Show file File: Page3.xaml.cs Project: Kirk7by/SysAnalyze public void DataGridUpdateDate() { try { using (BdModelContainer _context = new BdModelContainer()) { Lvod= _context.ВодителиSet.ToList(); dGrid.ItemsSource = Lvod.ToList(); } } catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы" + ex.Message); } } Example #8 0 Show file File: RunServer.xaml.cs Project: patdohere/FreeMoVR 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(); } } Example #9 0 Show file File: CreateWindow.xaml.cs Project: Nabulion/LeWebShop 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(); } Example #10 0 Show file File: DatabasePresentationWindow.xaml.cs Project: ziomal9191/uekHD 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(); } } Example #11 0 Show file File: lookupTweets.xaml.cs Project: jonathan-w/SAD-APP 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!"); } } Example #12 0 Show file File: AnalysisView.xaml.cs Project: hrhtspr/SplatoonRecorder 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(); } Example #13 0 Show file File: MainWindow.xaml.cs Project: lukaszw896/Data-Mining-Project 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); } } } Example #14 0 Show file File: AddDistrbuteForm.xaml.cs Project: JuRogn/OA 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()); } }); } } Example #15 0 Show file File: Orchis40.xaml.cs Project: palome06/psd48 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); } Example #16 0 Show file File: UCSpares.xaml.cs Project: bashlykevich/Bycar public List<SpareView> FilterSpares( int SearchFieldIndex, string SearchText, bool RemainsOnly, int GroupID, string BrandName) { List<SpareView> ResultList = new List<SpareView>(); int BrandID = 0; if (BrandName.Length > 0) BrandID = da.GetBrandIDByName(BrandName); if (GroupID == 0) { ResultList = SpareContainer.Instance.Spares; } else if (GroupID > 0 && (!(BrandID > 0))) { if (GroupID > 0) { List<SpareView> tmps = SpareContainer.Instance.Spares.ToList(); List<SpareView> tmps1 = tmps.Where(x => x != null).ToList(); ResultList = tmps1.Where(x => (x.GroupID == GroupID) || (x.spare_group1_id == GroupID) || (x.spare_group2_id == GroupID) || (x.spare_group3_id == GroupID)).ToList(); } } else if (BrandID > 0) { if (GroupID > 0) { List<SpareView> tmps = SpareContainer.Instance.Spares.ToList(); List<SpareView> tmps1 = tmps.Where(x => x != null).ToList(); ResultList = tmps1.Where(x => ((x.GroupID == GroupID) || (x.spare_group1_id == GroupID) || (x.spare_group2_id == GroupID) || (x.spare_group3_id == GroupID)) && (x.BrandID == BrandID)).ToList(); } } //bool RemainsOnly, if (RemainsOnly) { ResultList = ResultList.Where(i => i.QRest > 0).ToList(); } //int SearchFieldIndex, //string SearchText, if (SearchText.Length > 0) { // разобрать в завимосости от выбранного для поиска поле switch (SearchFieldIndex) { case 0:// ПОИСК ПО КОДУ ResultList = ResultList.Where(s => s.code != null).Where(s => s.code.ToLower().Contains(SearchText.ToLower())).ToList(); break; case 1:// ПОИСК ПО НАИМЕНОВАНИЮ ResultList = ResultList.Where(s => s.name.ToLower().Contains(SearchText.ToLower())).ToList(); break; case 2:// ПОИСК ПО КОДУ ШАТЕ-М ResultList = ResultList.Where(s => s.codeShatem != null).Where(s => s.codeShatem.ToLower().Contains(SearchText.ToLower())).ToList(); break; } } return ResultList.ToList(); } Example #17 0 Show file File: MasterEntityContactUtilsViewModel.cs Project: asanyaga/BuildTest protected async Task<bool> SaveContacts(MasterEntity entity) { using (var c = NestedContainer) { if(!ContactsList.Any(n => n.IsDirty)) return true; _proxy = Using<IDistributorServiceProxy>(c); ResponseBool response = new ResponseBool { Success = false }; var itemsToSave = new List<ContactItem>(); foreach (var item in ContactsList.Where(n => n.IsDirty)) { var contactItem = new ContactItem { MasterId = item.Contact.Id, DateOfBirth = item.Contact.DateOfBirth, MaritalStatusMasterId = (int)item.Contact.MStatus, BusinessPhone = item.Contact.BusinessPhone, ChildrenNames = item.Contact.ChildrenNames, City = item.Contact.City, Company = item.Contact.Company, ContactClassification = (int)item.Contact.ContactClassification, ContactOwnerType = item.Contact.ContactOwnerType, ContactOwnerMasterId = entity.Id, DateCreated = item.Contact._DateCreated, Email = item.Contact.Email, Fax = item.Contact.Fax, Firstname = item.Contact.Firstname, HomePhone = item.Contact.HomePhone, HomeTown = item.Contact.HomeTown, JobTitle = item.Contact.JobTitle, Lastname = item.Contact.Lastname, MobilePhone = item.Contact.MobilePhone, PhysicalAddress = item.Contact.PhysicalAddress, PostalAddress = item.Contact.PostalAddress, SpouseName = item.Contact.SpouseName, WorkExtPhone = item.Contact.WorkExtPhone, DateLastUpdated = DateTime.Now, StatusId = (int)EntityStatus.Active, IsNew = item.IsNew }; if (item.Contact.ContactType != null) contactItem.ContactTypeMasterId = item.Contact.ContactType.Id; itemsToSave.Add(contactItem); } if (itemsToSave.Count > 0) { response = await _proxy.ContactsAddAsync(itemsToSave.ToList()); MessageBox.Show(response.ErrorInfo, "Agrimanagr: Manage contacts", MessageBoxButton.OK, MessageBoxImage.Information); } else response.Success = true; return response.Success; } } Example #18 0 Show file File: SmoothStreamingElement.cs Project: kaltura/chromeless-silverlight void element_MediaOpened(object sender, RoutedEventArgs e) { if (this.element.IsLive) { this.element.StartSeekToLive(); } foreach (SegmentInfo segment in this.element.ManifestInfo.Segments) { audioTracks = new List<StreamInfo>(); textTracks = new List<StreamInfo>(); IList<StreamInfo> streamInfoList = segment.AvailableStreams; List<StreamInfo> selectStreams = segment.SelectedStreams.ToList<StreamInfo>(); foreach (StreamInfo stream in streamInfoList) { if (stream.Type == MediaStreamType.Video) { playingStream = stream; tracks = stream.AvailableTracks.ToList<TrackInfo>(); ManifestEventArgs args = new ManifestEventArgs(tracks.ToList<Object>()); BitratesReady(this, args); } else if (stream.Type == MediaStreamType.Audio) { audioTracks.Add(stream); } //subtitles else if (stream.Type == MediaStreamType.Script && stream.Subtype == "CAPT") { textTracks.Add(stream); } } if (MediaOpened != null) { MediaOpened(sender, e); } ManifestEventArgs audioArgs = new ManifestEventArgs(audioTracks.ToList<Object>()); AudioTracksReady(this, audioArgs); ManifestEventArgs textArgs = new ManifestEventArgs(textTracks.ToList<Object>()); TextTracksReady(this, textArgs); } } Example #19 0 Show file File: LearnSystem.xaml.cs Project: Kirk7by/KirKirnator private void DataGridUpdate() { showEltmtnts(); switch (SelectBut) { case selectedButtons.HeroesBut: List<PHero> Hp = new List<PHero>(); foreach (var item in new Repository().GetHeroesSource().ToList()) { Hp.Add(new PHero { NameHeroes = item.NameHeroes, WeigthHero = item.WeigthHero }); } dgrid.ItemsSource = Hp.ToList(); break; case selectedButtons.QuestionsBut: // var a = (new Repository().GetQuestionsSource()).Select(d => new { d.NameQestion }).Distinct().ToList(); var a = new Repository().GetQuestionsSource(); List<PQuestions> Pq = new List<PQuestions>(); foreach(var ia in a.Select(d => new { d.NameQestion }).Distinct()) { int summary = 0; foreach(var ia2 in a) { if(ia2.NameQestion==ia.NameQestion) { summary = (int)ia2.OtvetSelected + summary; } } Pq.Add(new PQuestions { NameQestion = ia.NameQestion, TotalWeight = summary }); } dgrid.ItemsSource = Pq.ToList(); break; case selectedButtons.DominatingBut: dgrid.ItemsSource = (new Repository().GetQuestionsSource()).Select(d => new { d.NameQestion, d.NameHeroes, d.OtvetQuest1, d.OtvetQuest2, d.OtvetQuest3, d.OtvetQuest4, d.OtvetQuest5, d.OtvetSelected }).ToList(); break; case selectedButtons.QuestionTree: break; case selectedButtons.HeroesLearnClear: // List<PHero> Hl = new List<PHero>(); foreach (var item in new Repository().GetHeroesSource().ToList()) { Hl.Add(new PHero { NameHeroes = item.NameHeroes, WeigthHero = item.WeigthHero }); } GridHeroLearnDataGrid1.ItemsSource = Hl.ToList(); break; } } Example #20 0 Show file File: SmoothStreamingElement.cs Project: acampos/chromeless-silverlight void element_ManifestReady(object sender, EventArgs e) { foreach (SegmentInfo segment in this.element.ManifestInfo.Segments) { audioTracks = new List<StreamInfo>(); IList<StreamInfo> streamInfoList = segment.AvailableStreams; foreach (StreamInfo stream in streamInfoList) { if (stream.Type == MediaStreamType.Video) { playingStream = stream; tracks = stream.AvailableTracks.ToList<TrackInfo>(); ManifestEventArgs args = new ManifestEventArgs( tracks.ToList<Object>() ); BitratesReady(this, args); } else if (stream.Type == MediaStreamType.Audio) { audioTracks.Add(stream); } } ManifestEventArgs audioArgs = new ManifestEventArgs(audioTracks.ToList<Object>()); AudioTracksReady(this, audioArgs); } } Example #21 0 Show file File: SelectMultiCardsDlg.xaml.cs Project: octgn/OCTGN public SelectMultiCardsDlg(List<int> cardList, List<int> cardList2, string prompt, string title, int? minValue, int? maxValue, string boxLabel, string boxLabel2) { InitializeComponent(); slider.Value = Prefs.GetGameSetting(Program.GameEngine.Definition, "sliderValue", 175); Title = title; this.Height = Math.Min(System.Windows.SystemParameters.PrimaryScreenHeight * 0.80, 860); this.Width = Math.Min(System.Windows.SystemParameters.PrimaryScreenWidth * 0.80, 860); promptLbl.Text = prompt; if (string.IsNullOrEmpty(prompt)) promptBox.Visibility = Visibility.Collapsed; boxLbl.Text = boxLabel; boxLbl2.Text = boxLabel2; Task.Factory.StartNew(() => { if (cardList == null) cardList = new List<int>(); _min = minValue; _max = maxValue; allCards = cardList.ToList(); if (cardList2 != null) allCards2 = cardList2.ToList(); Dispatcher.BeginInvoke(new Action(() => { allList.ItemsSource = allCards; allList2.ItemsSource = allCards2; if (allCards2 != null) // multi-box will always have drag/drop { if (_max == null) _max = allCards.Count + allCards2.Count; // max value will be the total count of both lists if (_min == null) _min = 0; // min value will be the lowest value possible if (_min > _max) _min = _max; // prevent oddities where user set the min value higher than max AllowSelect = (_min <= allCards.Count && allCards.Count <= _max); } else // only one box, check if drag/drop is allowed { if (_max == null) _max = 1; if (_min == null) _min = 1; if (_min > _max) _min = _max; // prevent oddities where user set the min value higher than max allList2.Visibility = Visibility.Collapsed; // hides the second box box2GridRow.Height = new GridLength(0); // hides the second box if (_max <= 0) // a maximum value of 0 means that we want to reorganize the group, not select cards from it { selectButton.IsEnabled = true; AllowSelect = true; } else if (_min == 1 && _max == 1) // only allow a single choice { allList.PreviewMouseLeftButtonDown -= DragDropDown; allList.SelectionChanged += CardSelected; allList.MouseDoubleClick += SelectClicked; // double clicking the card will auto-confirm it } else //allow multiple choice { allList.PreviewMouseLeftButtonDown -= DragDropDown; allList.SelectionChanged += CardSelected; allList.SelectionMode = SelectionMode.Multiple; if (_min == 0) AllowSelect = true; } } })); }); } Example #22 0 Show file File: CashDeskManagerAllDetails.xaml.cs Project: sreenandini/test_buildscripts public CashDeskManagerAllDetails(List<rsp_CDM_GetCashierTransactionsDetails_New> lstTickets, DateTime startDate, DateTime endDate, string FooterText, int userNo, int RouteNo) { try { InitializeComponent(); lstCashierTransactionsDetails = lstTickets.ToList(); dtTickets = lstTickets.ToDataSet<rsp_CDM_GetCashierTransactionsDetails_New>("DetailsView"); if (!Security.SecurityHelper.HasAccess("BMC.Presentation.CashDeskManager.UserControls.CashDeskManagerAllDetails.lvViewAll.TicketValue")) { lstTickets.ForEach((x) => { if (x.Ticket.Trim().Length > 8) x.Ticket = x.Ticket.Trim().Remove(x.Ticket.Trim().Length - 4, 4) + "****"; }); } this.DataContext = lstTickets; this.StartDate = startDate; this.EndDate = endDate; this.sFooterText = FooterText; this.user = userNo; this.iRoute_No = RouteNo; objCashDeskManager = CashDeskManagerBusinessObject.CreateInstance(); } catch (Exception ex) { ExceptionManager.Publish(ex); } } Example #23 0 Show file File: ChartArea.cs Project: zhangzy0193/visifire public void PositionIndicator(Chart chart, MouseEventArgs e, Double xValueAtMousePos, Double internalYValue) { #region Set position for Indicator if (Chart.IndicatorEnabled) { /*Double xOffset = Double.NaN, yOffset = Double.NaN; if (e != null) { Double x1 = e.GetPosition(Chart._toolTipCanvas).X; Double x2 = e.GetPosition(Chart._plotAreaGrid).X; Double y1 = e.GetPosition(Chart._toolTipCanvas).Y; Double y2 = e.GetPosition(Chart._plotAreaGrid).Y; xOffset = Math.Abs(x1 - x2); yOffset = Math.Abs(y1 - y2); } chart.PlotArea.GetPlotAreaStartPosition(); Double xx1 = (Double)Chart.PlotArea.GetValue(Canvas.LeftProperty); Double yy1 = (Double)Chart.PlotArea.GetValue(Canvas.TopProperty); System.Diagnostics.Debug.WriteLine("XOffset=" + xOffset.ToString() + ", " + yOffset.ToString()); System.Diagnostics.Debug.WriteLine("XOffset=" + xx1.ToString() + ", " + yy1.ToString()); xOffset = xx1; yOffset = yy1;*/ Double xOffset = (Double)Chart.PlotArea.GetValue(Canvas.LeftProperty); Double yOffset = (Double)Chart.PlotArea.GetValue(Canvas.TopProperty); // Find and set reference of the nearest DataPoint from mouse pointer position // and ignore all Datapoints where if nearestDataPoint is null of its parent List<DataPoint> listOfNearestDataPoints; if (e == null) listOfNearestDataPoints = (from ds in chart.InternalSeries where !RenderHelper.IsAxisIndependentCType(ds) && !RenderHelper.IsCircularCType(ds) select ds.FindNearestDataPointFromValues(xValueAtMousePos, internalYValue)) .Where(dp => (dp != null && dp.Parent._nearestDataPoint != null)).ToList(); else listOfNearestDataPoints = (from ds in chart.InternalSeries where !RenderHelper.IsAxisIndependentCType(ds) && !RenderHelper.IsCircularCType(ds) select ds.FindNearestDataPointFromMousePointer(e)) .Where(dp => (dp != null && dp.Parent._nearestDataPoint != null)).ToList(); // Prepare ToolTips and Create a new list of nearest DataPoints List<DataPoint> selectedNearestDataPoints = new List<DataPoint>(); // Prepare ToolTips and Create a new list of nearest DataPoints foreach (DataPoint nearestDataPoint in listOfNearestDataPoints) { DataSeries dataSeries = nearestDataPoint.Parent; if (dataSeries.ToolTipElement != null) { dataSeries.SetToolTipProperties(nearestDataPoint); //if (!String.IsNullOrEmpty(dataSeries.ToolTipElement.Text)) { selectedNearestDataPoints.Add(nearestDataPoint); } } // Setup ToolTip dataSeries.HideToolTip(); } if (e != null) xValueAtMousePos = RenderHelper.CalculateInternalXValueFromPixelPos(chart, chart.ChartArea.AxisX, e); DataPoint nearestDataPoint1 = RenderHelper.GetNearestDataPointAlongXAxis(selectedNearestDataPoints, chart.ChartArea.AxisX, xValueAtMousePos); // Sorted list of nearest DataPoints ascending order of visualPosition along y-axis List<DataPoint> finalSetOfDataPoints = new List<DataPoint>(); if (nearestDataPoint1 != null) finalSetOfDataPoints = (from dataPoint in selectedNearestDataPoints where dataPoint.InternalXValue == nearestDataPoint1.InternalXValue orderby dataPoint._visualPosition.Y ascending select dataPoint) .TakeWhile(dp => dp.Parent.HideToolTip()).ToList(); System.Diagnostics.Debug.WriteLine("NearestDataPoints Count : " + finalSetOfDataPoints.Count); // System.Diagnostics.Debug.WriteLine("YValue : " + finalSetOfDataPoints[0].YValue); // Clear all unwated temporary list listOfNearestDataPoints = null; selectedNearestDataPoints = null; // System.Diagnostics.Debug.WriteLine("NearestDataPoints Count : " + listOfNearestDataPoints.Count); if (finalSetOfDataPoints.Count > 0) { CreateIndicators(); //_axisIndicatorElement.Visibility = Visibility.Visible; _verticalLineIndicator.Visibility = Visibility.Visible; _axisCallOutContainer.Visibility = Visibility.Visible; _axisIndicatorBorderElement.Visibility = Visibility.Visible; ArrangeToolTips4DataSeries(finalSetOfDataPoints.ToList(), xOffset, yOffset); foreach (DataPoint dp in finalSetOfDataPoints) { DataSeries dataSeries = dp.Parent; Double offset = AxisX.GetScrollBarValueFromOffset(AxisX.CurrentScrollScrollBarOffset); offset = GetScrollingOffsetOfAxis(AxisX, offset); if (AxisX.AxisOrientation == AxisOrientation.Vertical) { if (dp._visualPosition.Y - offset > PlotAreaCanvas.Height || dp._visualPosition.Y - offset < 0) { dataSeries.HideToolTip(); DisableIndicators(); } } else { if (dp._visualPosition.X - offset > PlotAreaCanvas.Width || dp._visualPosition.X - offset < 0) { dataSeries.HideToolTip(); DisableIndicators(); } } } if (Chart._toolTipCanvas.Clip != null) { Rect clipRect = new Rect(0, -PLANK_DEPTH, Chart.ActualWidth, Chart.ActualHeight + PLANK_DEPTH); RectangleGeometry clipRectangle = Chart._toolTipCanvas.Clip as RectangleGeometry; if (!clipRectangle.Rect.Equals(clipRect)) clipRectangle.Rect = clipRect; } else { RectangleGeometry clipRectangle = new RectangleGeometry(); clipRectangle.Rect = new Rect(0, -PLANK_DEPTH, Chart.ActualWidth, Chart.ActualHeight + PLANK_DEPTH); Chart._toolTipCanvas.Clip = clipRectangle; } } } #endregion } Example #24 0 Show file File: HaulierControl.xaml.cs Project: ratsil/bethe.helpers private void ProcessItemsSource() { if (null == _ui_icLeft || null == _ui_icRight) return; List<object> aItems = new List<object>((IEnumerable<object>)aItemsSource); if (null != aItemsSelected) { List<object> aSelected = new List<object>(((IEnumerable<object>)aItemsSelected).Where(o => aItems.Contains(o))); aItems = aItems.Where(o => !aSelected.Contains(o)).ToList(); _ui_icRight.ItemsSource = aSelected.ToList(); } _ui_icLeft.ItemsSource = _ui_Search.aItemsSourceInitial = aItems.ToList(); _ui_icRight.Tag = null; } Example #25 0 Show file File: MainWindow.xaml.cs.old.cs Project: jerbio/My24HourTimerWPF //, List<SubCalendarEvent> usedSubCalendarEvensts) List<List<List<SubCalendarEvent>>> generateTreeCallsToSnugArray(List<SubCalendarEvent> AvailableSubCalendarEvents, List<TimeLine> AllTimeLines, int TimeLineIndex, List<List<SubCalendarEvent>> SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar, Dictionary<TimeLine, List<SubCalendarEvent>> DictionaryOfTimelineAndSubcalendarEvents) { /* * Name: jerome Biotidara * Description: This function is responsible for generating the snug possibilities for a list containing all timelines it takes 5 elements as its parameters. -AvailableSubCalendarEvents ->The remaining List of subcalendar events. -AllTimeLines->A list of the Timelines that needto be populated with the desired snug possibility -TimeLineIndex->An Index keeping track of what timeline the funciton is current working on -FullTimeLineWithSnugListOfSubcalendarEvents->is a list containing A list of subcalendarEvents for each TimeLine * -PertainingSnugPossibilityForTimieline-> is a list of snugpossibilities that apply to a TimeLine in a TimeLineIndex * -DictionaryOfTimelineAndSubcalendarEvents-> A dictionary of TimeLine and interferring subcalendarevents */ //if (ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Count >= maxHackConstant) { //return ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack; } if (AvailableSubCalendarEvents.Count > MaxNumberOfInterferringSubcalEvents) { MaxNumberOfInterferringSubcalEvents = AvailableSubCalendarEvents.Count; } if (TimeLineIndex > LargestTimeIndex) { LargestTimeIndex = TimeLineIndex; } if (TimeLineIndex == 8) { int Haha = 1; Haha += 1; } List<List<List<SubCalendarEvent>>> ListOfAllSnugPossibilitiesInRespectiveTImeLines = new System.Collections.Generic.List<System.Collections.Generic.List<System.Collections.Generic.List<SubCalendarEvent>>>(); if (AllTimeLines.Count < 1) { return null; } if ((TimeLineIndex >= AllTimeLines.Count) && (AvailableSubCalendarEvents.Count > 0)) { LogInfo += ("Couldnt Find For this timeLine timeLine\n"); } if ((TimeLineIndex >= AllTimeLines.Count) || (AvailableSubCalendarEvents.Count < 1)) { if (TimeLineIndex < AllTimeLines.Count) { LogInfo += ("Weird Exit\n"); } ListOfAllSnugPossibilitiesInRespectiveTImeLines.Add(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar); return ListOfAllSnugPossibilitiesInRespectiveTImeLines; } List<TimeSpanWithID> MySubcalendarEventTimespans = new System.Collections.Generic.List<TimeSpanWithID>(); List<SubCalendarEvent> MyPertinentSubcalendarEvents = Utility.ListPartOfList(AvailableSubCalendarEvents, DictionaryOfTimelineAndSubcalendarEvents[AllTimeLines[TimeLineIndex]]); List<SubCalendarEvent> ConstrainedToList = ConstrainedList(AllTimeLines[TimeLineIndex], MyPertinentSubcalendarEvents); MyPertinentSubcalendarEvents = Utility.NotInList_NoEffect(MyPertinentSubcalendarEvents, ConstrainedToList);//this removes the constrained Items from the Subcalendar list foreach (SubCalendarEvent MySubcalendarevent in MyPertinentSubcalendarEvents) { MySubcalendarEventTimespans.Add(new TimeSpanWithID(MySubcalendarevent.ActiveDuration, new EventID(MySubcalendarevent.ID))); } List<TimeSpanWithID> ConstrainedMySubcalendarEventTimespans = new System.Collections.Generic.List<TimeSpanWithID>(); foreach (SubCalendarEvent MyConstrainedSubcalendarevent in ConstrainedToList) { ConstrainedMySubcalendarEventTimespans.Add(new TimeSpanWithID(MyConstrainedSubcalendarevent.ActiveDuration, new EventID(MyConstrainedSubcalendarevent.ID))); } TimeSpan TotalimeOccupieByConstrained = SubCalendarEvent.TotalActiveDuration(ConstrainedToList); if(TimeLineIndex==2) { ; } Stopwatch sw = new Stopwatch(); sw.Start(); // ... SnugArray MySnugArray = new SnugArray(new List<TimeSpanWithID>(), MySubcalendarEventTimespans, AllTimeLines[TimeLineIndex].TimelineSpan - TotalimeOccupieByConstrained); //SnugArray MySnugArray = new SnugArray(ConstrainedMySubcalendarEventTimespans, MySubcalendarEventTimespans, AllTimeLines[TimeLineIndex].TimelineSpan); List<List<TimeSpanWithID>> AllSnugPossibilities = MySnugArray.MySnugPossibleEntries; /* AllSnugPossibilities looks like this * {{43,23,54},{43,54,23},{23,43,54}...} where each digit is a time span and remember it generates every permutation. */ List<List<SubCalendarEvent>> SubcalendarMyList = BuildListMatchingTimelineAndSubCalendarEvent(AllSnugPossibilities, MyPertinentSubcalendarEvents, ConstrainedToList); sw.Stop(); /* the function BuildListMatchingTimelineAndSubCalendarEvent builds a list of Subcalendar events for each timespan. * assuming subCal0 has TimeSpan =43 * assuming subCal1 has TimeSpan =23 * assuming subCal2 has TimeSpan =54 * assuming subCal3 has TimeSpan =43 * assuming subCal4 has TimeSpan =23 * assuming subCal5 has TimeSpan =23 * SubcalendarMyList will have the array {{{SubCal0,Subcal3},{subCal1,subCal4,subCal5},{subCal2}},{{SubCal0,Subcal3},{subCal2},{subCal1,subCal4,subCal5}},{{subCal1,subCal4,subCal5},{SubCal0,Subcal3},{subCal2}}...} */ //List<List<SubCalendarEvent>> SerialIzedListOfSubCalendarEvents = SerializeListOfMatchingSubcalendarEvents(SubcalendarMyList); List<List<SubCalendarEvent>> SerialIzedListOfSubCalendarEvents = SubcalendarMyList; List<SubCalendarEvent> AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = new List<SubCalendarEvent>(); if (SerialIzedListOfSubCalendarEvents.Count > 0) { foreach (List<SubCalendarEvent> AlreadyAssignedSubCalendarEvent in SerialIzedListOfSubCalendarEvents) { AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = Utility.NotInList(AvailableSubCalendarEvents.ToList(), AlreadyAssignedSubCalendarEvent); SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar[TimeLineIndex] = AlreadyAssignedSubCalendarEvent; if (checkSumOfTimeEvent(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar) >= MaxNumberOfInterferringSubcalEvents) { ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Add(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar); //if (ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Count >= maxHackConstant) { //return ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack; } } ListOfAllSnugPossibilitiesInRespectiveTImeLines.AddRange(generateTreeCallsToSnugArray(AvailableSubCalendarEventsAfterRemovingAssingedSnugElements, AllTimeLines, TimeLineIndex + 1, SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar.ToList(), DictionaryOfTimelineAndSubcalendarEvents)); //ListOfAllSnugPossibilitiesInRespectiveTImeLines = MyHolder.ToList(); } } else { AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = Utility.NotInList(AvailableSubCalendarEvents.ToList(), new List<SubCalendarEvent>());//Hack this can be optimized... the whole "notinlist" call can be optimized as a call to AvailableSubCalendarEvents. Review to see if references to func are affected. ListOfAllSnugPossibilitiesInRespectiveTImeLines.AddRange(generateTreeCallsToSnugArray(AvailableSubCalendarEventsAfterRemovingAssingedSnugElements, AllTimeLines, TimeLineIndex + 1, SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar.ToList(), DictionaryOfTimelineAndSubcalendarEvents)); } if (AvailableSubCalendarEventsAfterRemovingAssingedSnugElements.Count < 1) { ; } return ListOfAllSnugPossibilitiesInRespectiveTImeLines; } Example #26 0 Show file File: DayScheduler.xaml.cs Project: EnriqueRivera/AgendaProject private void PaintAllEvents() { int eventsCount = 0; if (_scheduler != null && _scheduler.Events != null) { IEnumerable<Event> eventList = TodayEvents .Where(ev => ev.EventInfo.StartEvent.Date == ev.EventInfo.EndEvent.Date) .OrderBy(ev => ev.EventInfo.IsCanceled) .ThenBy(ev => ev.EventInfo.StartEvent); column.Children.Clear(); double columnWidth = EventsGrid.ColumnDefinitions[1].Width.Value; foreach (Event e in eventList) { List<Event> concurrentEvents = new List<Event>(); GetConcurrentEvents(e, concurrentEvents); concurrentEvents = concurrentEvents .OrderBy(ev => ev.EventInfo.StartEvent) .ThenBy(ev => ev.EventInfo.EndEvent) .ToList(); double marginTop = _oneHourHeight * ((e.EventInfo.StartEvent.Hour + (e.EventInfo.StartEvent.Minute / 60.0)) - _minHour); double width = columnWidth / (concurrentEvents.Count()); double marginLeft = width * concurrentEvents.ToList().FindIndex(ev => ev.Id == e.Id); EventUserControl wEvent = new EventUserControl(e); wEvent.Width = width; wEvent.Height = e.EventInfo.EndEvent.Subtract(e.EventInfo.StartEvent).TotalHours * _oneHourHeight; wEvent.Margin = new Thickness(marginLeft, marginTop, 0, 0); wEvent.BorderElement.BorderThickness = new Thickness(_eventSelected == e.Id ? _selectedEventBorderThickness : 1.0); wEvent.MouseLeftButtonDown += ((object sender, MouseButtonEventArgs ea) => { ea.Handled = true; SelectEvent(sender as EventUserControl); OnEventMouseLeftButtonDown(sender, wEvent.Event); }); wEvent.MouseRightButtonDown += ((object sender, MouseButtonEventArgs ea) => { SelectEvent(sender as EventUserControl); ContextMenu cm = this.FindResource("SchedulerContextMenu") as ContextMenu; if (UserLoggedIn.IsAdmin == false) { foreach (var item in cm.Items) { if (item is MenuItem && (item as MenuItem).Tag.ToString() == "VIEW_EVENT_STATUS_CHANGES") { cm.Items.Remove(item as MenuItem); break; } } } cm.Tag = e; cm.IsOpen = (e.EventInfo.IsCanceled == false && e.EventInfo.IsCompleted == false) || UserLoggedIn.IsAdmin; }); column.Children.Add(wEvent); eventsCount++; } } dayLabel.Content = _currentDay.ToString("D") + " (Citas: " + eventsCount + ")"; } Example #27 0 Show file File: DatabasePresentationWindow.xaml.cs Project: ziomal9191/uekHD private void productSelectionChanged(object sender, SelectionChangedEventArgs e) { using (DatabaseContext siContext = new DatabaseContext()) { if (productsDb.SelectedItem is Product) { var item = (Product)productsDb.SelectedItem; var getProduct = from Product in siContext.Product where Product.Model.Equals(item.Model) select Product.Comments; List<CommentDb> comments = new List<CommentDb>(); foreach (var comment in getProduct) { if (comment.Count > 0) { foreach (var com in comment) { com.Comment = Regex.Replace(com.Comment, @"<[^>]+>| ", "").Trim(); comments.Add(com); } } } commentData.ItemsSource = comments.ToList(); } else { commentData.ItemsSource = new List<Product>(); } } } Example #28 0 Show file File: Page1.xaml.cs Project: Kirk7by/SysAnalyze public void DataGridUpdateDate() { try { using (BdModelContainer _context = new BdModelContainer()) { Lput = _context.Путевые_листыSet.ToList(); dGrid.ItemsSource = Lput.ToList(); } } catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы: " + ex.Message); } }
List numbers = new List { 1, 2, 3, 4, 5 }; List objList = numbers.ToList(); In this example, we create a List called "numbers" with five integer values. We then call the ToList method on "numbers" to create a new List called "objList". The "objList" contains the same five integer values as "numbers". Package library: System is part of the .NET Framework. C# (CSharp) System.Windows.Documents List.ToList - 28 examples found. These are the top rated real world C# (CSharp) examples of System.Windows.Documents.List.ToList extracted from open source projects. You can rate examples to help us improve the quality of examples. Frequently Used Methods Show Hide Add(30) Sort(30) ElementAt(30) First(30) FirstOrDefault(30) ToArray(30) AddRange(30) IndexOf(30) Insert(30) Last(30) Count(30) Max(30) OrderBy(30) OrderByDescending(30) Remove(30) RemoveAt(30) Reverse(30) Select(30) Distinct(30) ForEach(30) Any(30) Where(30) Clear(30) Contains(30) ToList(28) Min(25) FindAll(23) Find(21) Concat(19) GroupBy(18) Sum(16) RemoveRange(12) Skip(11) RemoveAll(11) GetType(11) FindIndex(10) AsEnumerable(10) Reposition(10) ConvertAll(9) Take(9) Except(9) Average(9) InsertRange(8) Exists(8) GetRange(8) Graph(6) All(6) GetValue(6) SelectMany(6) Single(4) Frequently Used Methods Add (30) Sort (30) ElementAt (30) First (30) FirstOrDefault (30) ToArray (30) AddRange (30) IndexOf (30) Insert (30) Last (30) Frequently Used Methods Count (30) Max (30) OrderBy (30) OrderByDescending (30) Remove (30) RemoveAt (30) Reverse (30) Select (30) Distinct (30) ForEach (30) Any (30) Where (30) Clear (30) Contains (30) ToList (28) Min (25) FindAll (23) Find (21) Concat (19) GroupBy (18) Frequently Used Methods Any (30) Where (30) Clear (30) Contains (30) ToList (28) Min (25) FindAll (23) Find (21) Concat (19) GroupBy (18) Sum (16) RemoveRange (12) Skip (11) RemoveAll (11) GetType (11) FindIndex (10) AsEnumerable (10) Reposition (10) ConvertAll (9) Take (9) Except (9) Average (9) InsertRange (8) Exists (8) GetRange (8) Graph (6) All (6) GetValue (6) SelectMany (6) Single (4) Related in langs PluginMonitoringHost_Host (PHP) zen_get_tax_rate_value (PHP) ttyrec_w_find_format (C++) IS_SYSRAM_ADDRESS (C++) Parse (Go) NextSunrise (Go) PooledDataSource (Java) Book (Java) emit_event (Python) PageCapture (Python) Frequently Used Methods Sum (16) RemoveRange (12) Skip (11) RemoveAll (11) GetType (11) FindIndex (10) AsEnumerable (10) Reposition (10) ConvertAll (9) Take (9) Except (9) Average (9) InsertRange (8) Exists (8) GetRange (8) Graph (6) All (6) GetValue (6) SelectMany (6) Single (4) ElementAtOrDefault (4) Aggregate (4) ToDictionary (4) GetEnumerator (4) Join (4) Shuffle (4) ToString (3) OfType (3) ToEmptyIfNull (2) TrimExcess (2) AsParallel (2) SingleOrDefault (2) LastOrDefault (2) TrueForAll (2) BinarySearch (2) Cast (2) Equals (2) SequenceEqual (2) Union (1) ToFBEntityList (1) Related conexionBD.clases.clinica IdTableStringKey DsnVm Device ICatSnapshotsRequest Counter DummyInstrument NodeDisplay[ DummyScanner DocumentAssembler Example #1 0 Show file File: MainWindow.xaml.cs Project: patdohere/FreeMoVR 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(); } } Example #2 0 Show file File: Activity.xaml.cs Project: martinkjelsmark/Bookit 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; } } Example #3 0 Show file File: EditWindow.xaml.cs Project: Nabulion/LeWebShop 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(); } Example #4 0 Show file File: DatabasePresentationWindow.xaml.cs Project: ziomal9191/uekHD 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(); } } Example #5 0 Show file File: 1453203858$MainWindow.xaml.cs Project: Maldercito/adat public MainWindow() { InitializeComponent(); rep = new Repository(); List<Course> courses = new List<Course>(); courses = rep.getCourses(); comboStandardId.Items.SourceCollection = courses.ToList(); } Example #6 0 Show file File: UserList.xaml.cs Project: martinkjelsmark/Bookit public UserList(List<UserDTO> users) { InitializeComponent(); _users = users; if (_users != null) lstCustomers.ItemsSource = _users.ToList(); } Example #7 0 Show file File: Page3.xaml.cs Project: Kirk7by/SysAnalyze public void DataGridUpdateDate() { try { using (BdModelContainer _context = new BdModelContainer()) { Lvod= _context.ВодителиSet.ToList(); dGrid.ItemsSource = Lvod.ToList(); } } catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы" + ex.Message); } } Example #8 0 Show file File: RunServer.xaml.cs Project: patdohere/FreeMoVR 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(); } } Example #9 0 Show file File: CreateWindow.xaml.cs Project: Nabulion/LeWebShop 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(); } Example #10 0 Show file File: DatabasePresentationWindow.xaml.cs Project: ziomal9191/uekHD 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(); } } Example #11 0 Show file File: lookupTweets.xaml.cs Project: jonathan-w/SAD-APP 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!"); } } Example #12 0 Show file File: AnalysisView.xaml.cs Project: hrhtspr/SplatoonRecorder 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(); } Example #13 0 Show file File: MainWindow.xaml.cs Project: lukaszw896/Data-Mining-Project 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); } } } Example #14 0 Show file File: AddDistrbuteForm.xaml.cs Project: JuRogn/OA 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()); } }); } } Example #15 0 Show file File: Orchis40.xaml.cs Project: palome06/psd48 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); } Example #16 0 Show file File: UCSpares.xaml.cs Project: bashlykevich/Bycar public List<SpareView> FilterSpares( int SearchFieldIndex, string SearchText, bool RemainsOnly, int GroupID, string BrandName) { List<SpareView> ResultList = new List<SpareView>(); int BrandID = 0; if (BrandName.Length > 0) BrandID = da.GetBrandIDByName(BrandName); if (GroupID == 0) { ResultList = SpareContainer.Instance.Spares; } else if (GroupID > 0 && (!(BrandID > 0))) { if (GroupID > 0) { List<SpareView> tmps = SpareContainer.Instance.Spares.ToList(); List<SpareView> tmps1 = tmps.Where(x => x != null).ToList(); ResultList = tmps1.Where(x => (x.GroupID == GroupID) || (x.spare_group1_id == GroupID) || (x.spare_group2_id == GroupID) || (x.spare_group3_id == GroupID)).ToList(); } } else if (BrandID > 0) { if (GroupID > 0) { List<SpareView> tmps = SpareContainer.Instance.Spares.ToList(); List<SpareView> tmps1 = tmps.Where(x => x != null).ToList(); ResultList = tmps1.Where(x => ((x.GroupID == GroupID) || (x.spare_group1_id == GroupID) || (x.spare_group2_id == GroupID) || (x.spare_group3_id == GroupID)) && (x.BrandID == BrandID)).ToList(); } } //bool RemainsOnly, if (RemainsOnly) { ResultList = ResultList.Where(i => i.QRest > 0).ToList(); } //int SearchFieldIndex, //string SearchText, if (SearchText.Length > 0) { // разобрать в завимосости от выбранного для поиска поле switch (SearchFieldIndex) { case 0:// ПОИСК ПО КОДУ ResultList = ResultList.Where(s => s.code != null).Where(s => s.code.ToLower().Contains(SearchText.ToLower())).ToList(); break; case 1:// ПОИСК ПО НАИМЕНОВАНИЮ ResultList = ResultList.Where(s => s.name.ToLower().Contains(SearchText.ToLower())).ToList(); break; case 2:// ПОИСК ПО КОДУ ШАТЕ-М ResultList = ResultList.Where(s => s.codeShatem != null).Where(s => s.codeShatem.ToLower().Contains(SearchText.ToLower())).ToList(); break; } } return ResultList.ToList(); } Example #17 0 Show file File: MasterEntityContactUtilsViewModel.cs Project: asanyaga/BuildTest protected async Task<bool> SaveContacts(MasterEntity entity) { using (var c = NestedContainer) { if(!ContactsList.Any(n => n.IsDirty)) return true; _proxy = Using<IDistributorServiceProxy>(c); ResponseBool response = new ResponseBool { Success = false }; var itemsToSave = new List<ContactItem>(); foreach (var item in ContactsList.Where(n => n.IsDirty)) { var contactItem = new ContactItem { MasterId = item.Contact.Id, DateOfBirth = item.Contact.DateOfBirth, MaritalStatusMasterId = (int)item.Contact.MStatus, BusinessPhone = item.Contact.BusinessPhone, ChildrenNames = item.Contact.ChildrenNames, City = item.Contact.City, Company = item.Contact.Company, ContactClassification = (int)item.Contact.ContactClassification, ContactOwnerType = item.Contact.ContactOwnerType, ContactOwnerMasterId = entity.Id, DateCreated = item.Contact._DateCreated, Email = item.Contact.Email, Fax = item.Contact.Fax, Firstname = item.Contact.Firstname, HomePhone = item.Contact.HomePhone, HomeTown = item.Contact.HomeTown, JobTitle = item.Contact.JobTitle, Lastname = item.Contact.Lastname, MobilePhone = item.Contact.MobilePhone, PhysicalAddress = item.Contact.PhysicalAddress, PostalAddress = item.Contact.PostalAddress, SpouseName = item.Contact.SpouseName, WorkExtPhone = item.Contact.WorkExtPhone, DateLastUpdated = DateTime.Now, StatusId = (int)EntityStatus.Active, IsNew = item.IsNew }; if (item.Contact.ContactType != null) contactItem.ContactTypeMasterId = item.Contact.ContactType.Id; itemsToSave.Add(contactItem); } if (itemsToSave.Count > 0) { response = await _proxy.ContactsAddAsync(itemsToSave.ToList()); MessageBox.Show(response.ErrorInfo, "Agrimanagr: Manage contacts", MessageBoxButton.OK, MessageBoxImage.Information); } else response.Success = true; return response.Success; } } Example #18 0 Show file File: SmoothStreamingElement.cs Project: kaltura/chromeless-silverlight void element_MediaOpened(object sender, RoutedEventArgs e) { if (this.element.IsLive) { this.element.StartSeekToLive(); } foreach (SegmentInfo segment in this.element.ManifestInfo.Segments) { audioTracks = new List<StreamInfo>(); textTracks = new List<StreamInfo>(); IList<StreamInfo> streamInfoList = segment.AvailableStreams; List<StreamInfo> selectStreams = segment.SelectedStreams.ToList<StreamInfo>(); foreach (StreamInfo stream in streamInfoList) { if (stream.Type == MediaStreamType.Video) { playingStream = stream; tracks = stream.AvailableTracks.ToList<TrackInfo>(); ManifestEventArgs args = new ManifestEventArgs(tracks.ToList<Object>()); BitratesReady(this, args); } else if (stream.Type == MediaStreamType.Audio) { audioTracks.Add(stream); } //subtitles else if (stream.Type == MediaStreamType.Script && stream.Subtype == "CAPT") { textTracks.Add(stream); } } if (MediaOpened != null) { MediaOpened(sender, e); } ManifestEventArgs audioArgs = new ManifestEventArgs(audioTracks.ToList<Object>()); AudioTracksReady(this, audioArgs); ManifestEventArgs textArgs = new ManifestEventArgs(textTracks.ToList<Object>()); TextTracksReady(this, textArgs); } } Example #19 0 Show file File: LearnSystem.xaml.cs Project: Kirk7by/KirKirnator private void DataGridUpdate() { showEltmtnts(); switch (SelectBut) { case selectedButtons.HeroesBut: List<PHero> Hp = new List<PHero>(); foreach (var item in new Repository().GetHeroesSource().ToList()) { Hp.Add(new PHero { NameHeroes = item.NameHeroes, WeigthHero = item.WeigthHero }); } dgrid.ItemsSource = Hp.ToList(); break; case selectedButtons.QuestionsBut: // var a = (new Repository().GetQuestionsSource()).Select(d => new { d.NameQestion }).Distinct().ToList(); var a = new Repository().GetQuestionsSource(); List<PQuestions> Pq = new List<PQuestions>(); foreach(var ia in a.Select(d => new { d.NameQestion }).Distinct()) { int summary = 0; foreach(var ia2 in a) { if(ia2.NameQestion==ia.NameQestion) { summary = (int)ia2.OtvetSelected + summary; } } Pq.Add(new PQuestions { NameQestion = ia.NameQestion, TotalWeight = summary }); } dgrid.ItemsSource = Pq.ToList(); break; case selectedButtons.DominatingBut: dgrid.ItemsSource = (new Repository().GetQuestionsSource()).Select(d => new { d.NameQestion, d.NameHeroes, d.OtvetQuest1, d.OtvetQuest2, d.OtvetQuest3, d.OtvetQuest4, d.OtvetQuest5, d.OtvetSelected }).ToList(); break; case selectedButtons.QuestionTree: break; case selectedButtons.HeroesLearnClear: // List<PHero> Hl = new List<PHero>(); foreach (var item in new Repository().GetHeroesSource().ToList()) { Hl.Add(new PHero { NameHeroes = item.NameHeroes, WeigthHero = item.WeigthHero }); } GridHeroLearnDataGrid1.ItemsSource = Hl.ToList(); break; } } Example #20 0 Show file File: SmoothStreamingElement.cs Project: acampos/chromeless-silverlight void element_ManifestReady(object sender, EventArgs e) { foreach (SegmentInfo segment in this.element.ManifestInfo.Segments) { audioTracks = new List<StreamInfo>(); IList<StreamInfo> streamInfoList = segment.AvailableStreams; foreach (StreamInfo stream in streamInfoList) { if (stream.Type == MediaStreamType.Video) { playingStream = stream; tracks = stream.AvailableTracks.ToList<TrackInfo>(); ManifestEventArgs args = new ManifestEventArgs( tracks.ToList<Object>() ); BitratesReady(this, args); } else if (stream.Type == MediaStreamType.Audio) { audioTracks.Add(stream); } } ManifestEventArgs audioArgs = new ManifestEventArgs(audioTracks.ToList<Object>()); AudioTracksReady(this, audioArgs); } } Example #21 0 Show file File: SelectMultiCardsDlg.xaml.cs Project: octgn/OCTGN public SelectMultiCardsDlg(List<int> cardList, List<int> cardList2, string prompt, string title, int? minValue, int? maxValue, string boxLabel, string boxLabel2) { InitializeComponent(); slider.Value = Prefs.GetGameSetting(Program.GameEngine.Definition, "sliderValue", 175); Title = title; this.Height = Math.Min(System.Windows.SystemParameters.PrimaryScreenHeight * 0.80, 860); this.Width = Math.Min(System.Windows.SystemParameters.PrimaryScreenWidth * 0.80, 860); promptLbl.Text = prompt; if (string.IsNullOrEmpty(prompt)) promptBox.Visibility = Visibility.Collapsed; boxLbl.Text = boxLabel; boxLbl2.Text = boxLabel2; Task.Factory.StartNew(() => { if (cardList == null) cardList = new List<int>(); _min = minValue; _max = maxValue; allCards = cardList.ToList(); if (cardList2 != null) allCards2 = cardList2.ToList(); Dispatcher.BeginInvoke(new Action(() => { allList.ItemsSource = allCards; allList2.ItemsSource = allCards2; if (allCards2 != null) // multi-box will always have drag/drop { if (_max == null) _max = allCards.Count + allCards2.Count; // max value will be the total count of both lists if (_min == null) _min = 0; // min value will be the lowest value possible if (_min > _max) _min = _max; // prevent oddities where user set the min value higher than max AllowSelect = (_min <= allCards.Count && allCards.Count <= _max); } else // only one box, check if drag/drop is allowed { if (_max == null) _max = 1; if (_min == null) _min = 1; if (_min > _max) _min = _max; // prevent oddities where user set the min value higher than max allList2.Visibility = Visibility.Collapsed; // hides the second box box2GridRow.Height = new GridLength(0); // hides the second box if (_max <= 0) // a maximum value of 0 means that we want to reorganize the group, not select cards from it { selectButton.IsEnabled = true; AllowSelect = true; } else if (_min == 1 && _max == 1) // only allow a single choice { allList.PreviewMouseLeftButtonDown -= DragDropDown; allList.SelectionChanged += CardSelected; allList.MouseDoubleClick += SelectClicked; // double clicking the card will auto-confirm it } else //allow multiple choice { allList.PreviewMouseLeftButtonDown -= DragDropDown; allList.SelectionChanged += CardSelected; allList.SelectionMode = SelectionMode.Multiple; if (_min == 0) AllowSelect = true; } } })); }); } Example #22 0 Show file File: CashDeskManagerAllDetails.xaml.cs Project: sreenandini/test_buildscripts public CashDeskManagerAllDetails(List<rsp_CDM_GetCashierTransactionsDetails_New> lstTickets, DateTime startDate, DateTime endDate, string FooterText, int userNo, int RouteNo) { try { InitializeComponent(); lstCashierTransactionsDetails = lstTickets.ToList(); dtTickets = lstTickets.ToDataSet<rsp_CDM_GetCashierTransactionsDetails_New>("DetailsView"); if (!Security.SecurityHelper.HasAccess("BMC.Presentation.CashDeskManager.UserControls.CashDeskManagerAllDetails.lvViewAll.TicketValue")) { lstTickets.ForEach((x) => { if (x.Ticket.Trim().Length > 8) x.Ticket = x.Ticket.Trim().Remove(x.Ticket.Trim().Length - 4, 4) + "****"; }); } this.DataContext = lstTickets; this.StartDate = startDate; this.EndDate = endDate; this.sFooterText = FooterText; this.user = userNo; this.iRoute_No = RouteNo; objCashDeskManager = CashDeskManagerBusinessObject.CreateInstance(); } catch (Exception ex) { ExceptionManager.Publish(ex); } } Example #23 0 Show file File: ChartArea.cs Project: zhangzy0193/visifire public void PositionIndicator(Chart chart, MouseEventArgs e, Double xValueAtMousePos, Double internalYValue) { #region Set position for Indicator if (Chart.IndicatorEnabled) { /*Double xOffset = Double.NaN, yOffset = Double.NaN; if (e != null) { Double x1 = e.GetPosition(Chart._toolTipCanvas).X; Double x2 = e.GetPosition(Chart._plotAreaGrid).X; Double y1 = e.GetPosition(Chart._toolTipCanvas).Y; Double y2 = e.GetPosition(Chart._plotAreaGrid).Y; xOffset = Math.Abs(x1 - x2); yOffset = Math.Abs(y1 - y2); } chart.PlotArea.GetPlotAreaStartPosition(); Double xx1 = (Double)Chart.PlotArea.GetValue(Canvas.LeftProperty); Double yy1 = (Double)Chart.PlotArea.GetValue(Canvas.TopProperty); System.Diagnostics.Debug.WriteLine("XOffset=" + xOffset.ToString() + ", " + yOffset.ToString()); System.Diagnostics.Debug.WriteLine("XOffset=" + xx1.ToString() + ", " + yy1.ToString()); xOffset = xx1; yOffset = yy1;*/ Double xOffset = (Double)Chart.PlotArea.GetValue(Canvas.LeftProperty); Double yOffset = (Double)Chart.PlotArea.GetValue(Canvas.TopProperty); // Find and set reference of the nearest DataPoint from mouse pointer position // and ignore all Datapoints where if nearestDataPoint is null of its parent List<DataPoint> listOfNearestDataPoints; if (e == null) listOfNearestDataPoints = (from ds in chart.InternalSeries where !RenderHelper.IsAxisIndependentCType(ds) && !RenderHelper.IsCircularCType(ds) select ds.FindNearestDataPointFromValues(xValueAtMousePos, internalYValue)) .Where(dp => (dp != null && dp.Parent._nearestDataPoint != null)).ToList(); else listOfNearestDataPoints = (from ds in chart.InternalSeries where !RenderHelper.IsAxisIndependentCType(ds) && !RenderHelper.IsCircularCType(ds) select ds.FindNearestDataPointFromMousePointer(e)) .Where(dp => (dp != null && dp.Parent._nearestDataPoint != null)).ToList(); // Prepare ToolTips and Create a new list of nearest DataPoints List<DataPoint> selectedNearestDataPoints = new List<DataPoint>(); // Prepare ToolTips and Create a new list of nearest DataPoints foreach (DataPoint nearestDataPoint in listOfNearestDataPoints) { DataSeries dataSeries = nearestDataPoint.Parent; if (dataSeries.ToolTipElement != null) { dataSeries.SetToolTipProperties(nearestDataPoint); //if (!String.IsNullOrEmpty(dataSeries.ToolTipElement.Text)) { selectedNearestDataPoints.Add(nearestDataPoint); } } // Setup ToolTip dataSeries.HideToolTip(); } if (e != null) xValueAtMousePos = RenderHelper.CalculateInternalXValueFromPixelPos(chart, chart.ChartArea.AxisX, e); DataPoint nearestDataPoint1 = RenderHelper.GetNearestDataPointAlongXAxis(selectedNearestDataPoints, chart.ChartArea.AxisX, xValueAtMousePos); // Sorted list of nearest DataPoints ascending order of visualPosition along y-axis List<DataPoint> finalSetOfDataPoints = new List<DataPoint>(); if (nearestDataPoint1 != null) finalSetOfDataPoints = (from dataPoint in selectedNearestDataPoints where dataPoint.InternalXValue == nearestDataPoint1.InternalXValue orderby dataPoint._visualPosition.Y ascending select dataPoint) .TakeWhile(dp => dp.Parent.HideToolTip()).ToList(); System.Diagnostics.Debug.WriteLine("NearestDataPoints Count : " + finalSetOfDataPoints.Count); // System.Diagnostics.Debug.WriteLine("YValue : " + finalSetOfDataPoints[0].YValue); // Clear all unwated temporary list listOfNearestDataPoints = null; selectedNearestDataPoints = null; // System.Diagnostics.Debug.WriteLine("NearestDataPoints Count : " + listOfNearestDataPoints.Count); if (finalSetOfDataPoints.Count > 0) { CreateIndicators(); //_axisIndicatorElement.Visibility = Visibility.Visible; _verticalLineIndicator.Visibility = Visibility.Visible; _axisCallOutContainer.Visibility = Visibility.Visible; _axisIndicatorBorderElement.Visibility = Visibility.Visible; ArrangeToolTips4DataSeries(finalSetOfDataPoints.ToList(), xOffset, yOffset); foreach (DataPoint dp in finalSetOfDataPoints) { DataSeries dataSeries = dp.Parent; Double offset = AxisX.GetScrollBarValueFromOffset(AxisX.CurrentScrollScrollBarOffset); offset = GetScrollingOffsetOfAxis(AxisX, offset); if (AxisX.AxisOrientation == AxisOrientation.Vertical) { if (dp._visualPosition.Y - offset > PlotAreaCanvas.Height || dp._visualPosition.Y - offset < 0) { dataSeries.HideToolTip(); DisableIndicators(); } } else { if (dp._visualPosition.X - offset > PlotAreaCanvas.Width || dp._visualPosition.X - offset < 0) { dataSeries.HideToolTip(); DisableIndicators(); } } } if (Chart._toolTipCanvas.Clip != null) { Rect clipRect = new Rect(0, -PLANK_DEPTH, Chart.ActualWidth, Chart.ActualHeight + PLANK_DEPTH); RectangleGeometry clipRectangle = Chart._toolTipCanvas.Clip as RectangleGeometry; if (!clipRectangle.Rect.Equals(clipRect)) clipRectangle.Rect = clipRect; } else { RectangleGeometry clipRectangle = new RectangleGeometry(); clipRectangle.Rect = new Rect(0, -PLANK_DEPTH, Chart.ActualWidth, Chart.ActualHeight + PLANK_DEPTH); Chart._toolTipCanvas.Clip = clipRectangle; } } } #endregion } Example #24 0 Show file File: HaulierControl.xaml.cs Project: ratsil/bethe.helpers private void ProcessItemsSource() { if (null == _ui_icLeft || null == _ui_icRight) return; List<object> aItems = new List<object>((IEnumerable<object>)aItemsSource); if (null != aItemsSelected) { List<object> aSelected = new List<object>(((IEnumerable<object>)aItemsSelected).Where(o => aItems.Contains(o))); aItems = aItems.Where(o => !aSelected.Contains(o)).ToList(); _ui_icRight.ItemsSource = aSelected.ToList(); } _ui_icLeft.ItemsSource = _ui_Search.aItemsSourceInitial = aItems.ToList(); _ui_icRight.Tag = null; } Example #25 0 Show file File: MainWindow.xaml.cs.old.cs Project: jerbio/My24HourTimerWPF //, List<SubCalendarEvent> usedSubCalendarEvensts) List<List<List<SubCalendarEvent>>> generateTreeCallsToSnugArray(List<SubCalendarEvent> AvailableSubCalendarEvents, List<TimeLine> AllTimeLines, int TimeLineIndex, List<List<SubCalendarEvent>> SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar, Dictionary<TimeLine, List<SubCalendarEvent>> DictionaryOfTimelineAndSubcalendarEvents) { /* * Name: jerome Biotidara * Description: This function is responsible for generating the snug possibilities for a list containing all timelines it takes 5 elements as its parameters. -AvailableSubCalendarEvents ->The remaining List of subcalendar events. -AllTimeLines->A list of the Timelines that needto be populated with the desired snug possibility -TimeLineIndex->An Index keeping track of what timeline the funciton is current working on -FullTimeLineWithSnugListOfSubcalendarEvents->is a list containing A list of subcalendarEvents for each TimeLine * -PertainingSnugPossibilityForTimieline-> is a list of snugpossibilities that apply to a TimeLine in a TimeLineIndex * -DictionaryOfTimelineAndSubcalendarEvents-> A dictionary of TimeLine and interferring subcalendarevents */ //if (ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Count >= maxHackConstant) { //return ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack; } if (AvailableSubCalendarEvents.Count > MaxNumberOfInterferringSubcalEvents) { MaxNumberOfInterferringSubcalEvents = AvailableSubCalendarEvents.Count; } if (TimeLineIndex > LargestTimeIndex) { LargestTimeIndex = TimeLineIndex; } if (TimeLineIndex == 8) { int Haha = 1; Haha += 1; } List<List<List<SubCalendarEvent>>> ListOfAllSnugPossibilitiesInRespectiveTImeLines = new System.Collections.Generic.List<System.Collections.Generic.List<System.Collections.Generic.List<SubCalendarEvent>>>(); if (AllTimeLines.Count < 1) { return null; } if ((TimeLineIndex >= AllTimeLines.Count) && (AvailableSubCalendarEvents.Count > 0)) { LogInfo += ("Couldnt Find For this timeLine timeLine\n"); } if ((TimeLineIndex >= AllTimeLines.Count) || (AvailableSubCalendarEvents.Count < 1)) { if (TimeLineIndex < AllTimeLines.Count) { LogInfo += ("Weird Exit\n"); } ListOfAllSnugPossibilitiesInRespectiveTImeLines.Add(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar); return ListOfAllSnugPossibilitiesInRespectiveTImeLines; } List<TimeSpanWithID> MySubcalendarEventTimespans = new System.Collections.Generic.List<TimeSpanWithID>(); List<SubCalendarEvent> MyPertinentSubcalendarEvents = Utility.ListPartOfList(AvailableSubCalendarEvents, DictionaryOfTimelineAndSubcalendarEvents[AllTimeLines[TimeLineIndex]]); List<SubCalendarEvent> ConstrainedToList = ConstrainedList(AllTimeLines[TimeLineIndex], MyPertinentSubcalendarEvents); MyPertinentSubcalendarEvents = Utility.NotInList_NoEffect(MyPertinentSubcalendarEvents, ConstrainedToList);//this removes the constrained Items from the Subcalendar list foreach (SubCalendarEvent MySubcalendarevent in MyPertinentSubcalendarEvents) { MySubcalendarEventTimespans.Add(new TimeSpanWithID(MySubcalendarevent.ActiveDuration, new EventID(MySubcalendarevent.ID))); } List<TimeSpanWithID> ConstrainedMySubcalendarEventTimespans = new System.Collections.Generic.List<TimeSpanWithID>(); foreach (SubCalendarEvent MyConstrainedSubcalendarevent in ConstrainedToList) { ConstrainedMySubcalendarEventTimespans.Add(new TimeSpanWithID(MyConstrainedSubcalendarevent.ActiveDuration, new EventID(MyConstrainedSubcalendarevent.ID))); } TimeSpan TotalimeOccupieByConstrained = SubCalendarEvent.TotalActiveDuration(ConstrainedToList); if(TimeLineIndex==2) { ; } Stopwatch sw = new Stopwatch(); sw.Start(); // ... SnugArray MySnugArray = new SnugArray(new List<TimeSpanWithID>(), MySubcalendarEventTimespans, AllTimeLines[TimeLineIndex].TimelineSpan - TotalimeOccupieByConstrained); //SnugArray MySnugArray = new SnugArray(ConstrainedMySubcalendarEventTimespans, MySubcalendarEventTimespans, AllTimeLines[TimeLineIndex].TimelineSpan); List<List<TimeSpanWithID>> AllSnugPossibilities = MySnugArray.MySnugPossibleEntries; /* AllSnugPossibilities looks like this * {{43,23,54},{43,54,23},{23,43,54}...} where each digit is a time span and remember it generates every permutation. */ List<List<SubCalendarEvent>> SubcalendarMyList = BuildListMatchingTimelineAndSubCalendarEvent(AllSnugPossibilities, MyPertinentSubcalendarEvents, ConstrainedToList); sw.Stop(); /* the function BuildListMatchingTimelineAndSubCalendarEvent builds a list of Subcalendar events for each timespan. * assuming subCal0 has TimeSpan =43 * assuming subCal1 has TimeSpan =23 * assuming subCal2 has TimeSpan =54 * assuming subCal3 has TimeSpan =43 * assuming subCal4 has TimeSpan =23 * assuming subCal5 has TimeSpan =23 * SubcalendarMyList will have the array {{{SubCal0,Subcal3},{subCal1,subCal4,subCal5},{subCal2}},{{SubCal0,Subcal3},{subCal2},{subCal1,subCal4,subCal5}},{{subCal1,subCal4,subCal5},{SubCal0,Subcal3},{subCal2}}...} */ //List<List<SubCalendarEvent>> SerialIzedListOfSubCalendarEvents = SerializeListOfMatchingSubcalendarEvents(SubcalendarMyList); List<List<SubCalendarEvent>> SerialIzedListOfSubCalendarEvents = SubcalendarMyList; List<SubCalendarEvent> AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = new List<SubCalendarEvent>(); if (SerialIzedListOfSubCalendarEvents.Count > 0) { foreach (List<SubCalendarEvent> AlreadyAssignedSubCalendarEvent in SerialIzedListOfSubCalendarEvents) { AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = Utility.NotInList(AvailableSubCalendarEvents.ToList(), AlreadyAssignedSubCalendarEvent); SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar[TimeLineIndex] = AlreadyAssignedSubCalendarEvent; if (checkSumOfTimeEvent(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar) >= MaxNumberOfInterferringSubcalEvents) { ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Add(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar); //if (ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Count >= maxHackConstant) { //return ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack; } } ListOfAllSnugPossibilitiesInRespectiveTImeLines.AddRange(generateTreeCallsToSnugArray(AvailableSubCalendarEventsAfterRemovingAssingedSnugElements, AllTimeLines, TimeLineIndex + 1, SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar.ToList(), DictionaryOfTimelineAndSubcalendarEvents)); //ListOfAllSnugPossibilitiesInRespectiveTImeLines = MyHolder.ToList(); } } else { AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = Utility.NotInList(AvailableSubCalendarEvents.ToList(), new List<SubCalendarEvent>());//Hack this can be optimized... the whole "notinlist" call can be optimized as a call to AvailableSubCalendarEvents. Review to see if references to func are affected. ListOfAllSnugPossibilitiesInRespectiveTImeLines.AddRange(generateTreeCallsToSnugArray(AvailableSubCalendarEventsAfterRemovingAssingedSnugElements, AllTimeLines, TimeLineIndex + 1, SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar.ToList(), DictionaryOfTimelineAndSubcalendarEvents)); } if (AvailableSubCalendarEventsAfterRemovingAssingedSnugElements.Count < 1) { ; } return ListOfAllSnugPossibilitiesInRespectiveTImeLines; } Example #26 0 Show file File: DayScheduler.xaml.cs Project: EnriqueRivera/AgendaProject private void PaintAllEvents() { int eventsCount = 0; if (_scheduler != null && _scheduler.Events != null) { IEnumerable<Event> eventList = TodayEvents .Where(ev => ev.EventInfo.StartEvent.Date == ev.EventInfo.EndEvent.Date) .OrderBy(ev => ev.EventInfo.IsCanceled) .ThenBy(ev => ev.EventInfo.StartEvent); column.Children.Clear(); double columnWidth = EventsGrid.ColumnDefinitions[1].Width.Value; foreach (Event e in eventList) { List<Event> concurrentEvents = new List<Event>(); GetConcurrentEvents(e, concurrentEvents); concurrentEvents = concurrentEvents .OrderBy(ev => ev.EventInfo.StartEvent) .ThenBy(ev => ev.EventInfo.EndEvent) .ToList(); double marginTop = _oneHourHeight * ((e.EventInfo.StartEvent.Hour + (e.EventInfo.StartEvent.Minute / 60.0)) - _minHour); double width = columnWidth / (concurrentEvents.Count()); double marginLeft = width * concurrentEvents.ToList().FindIndex(ev => ev.Id == e.Id); EventUserControl wEvent = new EventUserControl(e); wEvent.Width = width; wEvent.Height = e.EventInfo.EndEvent.Subtract(e.EventInfo.StartEvent).TotalHours * _oneHourHeight; wEvent.Margin = new Thickness(marginLeft, marginTop, 0, 0); wEvent.BorderElement.BorderThickness = new Thickness(_eventSelected == e.Id ? _selectedEventBorderThickness : 1.0); wEvent.MouseLeftButtonDown += ((object sender, MouseButtonEventArgs ea) => { ea.Handled = true; SelectEvent(sender as EventUserControl); OnEventMouseLeftButtonDown(sender, wEvent.Event); }); wEvent.MouseRightButtonDown += ((object sender, MouseButtonEventArgs ea) => { SelectEvent(sender as EventUserControl); ContextMenu cm = this.FindResource("SchedulerContextMenu") as ContextMenu; if (UserLoggedIn.IsAdmin == false) { foreach (var item in cm.Items) { if (item is MenuItem && (item as MenuItem).Tag.ToString() == "VIEW_EVENT_STATUS_CHANGES") { cm.Items.Remove(item as MenuItem); break; } } } cm.Tag = e; cm.IsOpen = (e.EventInfo.IsCanceled == false && e.EventInfo.IsCompleted == false) || UserLoggedIn.IsAdmin; }); column.Children.Add(wEvent); eventsCount++; } } dayLabel.Content = _currentDay.ToString("D") + " (Citas: " + eventsCount + ")"; } Example #27 0 Show file File: DatabasePresentationWindow.xaml.cs Project: ziomal9191/uekHD private void productSelectionChanged(object sender, SelectionChangedEventArgs e) { using (DatabaseContext siContext = new DatabaseContext()) { if (productsDb.SelectedItem is Product) { var item = (Product)productsDb.SelectedItem; var getProduct = from Product in siContext.Product where Product.Model.Equals(item.Model) select Product.Comments; List<CommentDb> comments = new List<CommentDb>(); foreach (var comment in getProduct) { if (comment.Count > 0) { foreach (var com in comment) { com.Comment = Regex.Replace(com.Comment, @"<[^>]+>| ", "").Trim(); comments.Add(com); } } } commentData.ItemsSource = comments.ToList(); } else { commentData.ItemsSource = new List<Product>(); } } } Example #28 0 Show file File: Page1.xaml.cs Project: Kirk7by/SysAnalyze public void DataGridUpdateDate() { try { using (BdModelContainer _context = new BdModelContainer()) { Lput = _context.Путевые_листыSet.ToList(); dGrid.ItemsSource = Lput.ToList(); } } catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы: " + ex.Message); } }
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(); } }
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; } }
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(); }
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(); } }
public MainWindow() { InitializeComponent(); rep = new Repository(); List<Course> courses = new List<Course>(); courses = rep.getCourses(); comboStandardId.Items.SourceCollection = courses.ToList(); }
public UserList(List<UserDTO> users) { InitializeComponent(); _users = users; if (_users != null) lstCustomers.ItemsSource = _users.ToList(); }
public void DataGridUpdateDate() { try { using (BdModelContainer _context = new BdModelContainer()) { Lvod= _context.ВодителиSet.ToList(); dGrid.ItemsSource = Lvod.ToList(); } } catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы" + ex.Message); } }
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(); } }
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(); }
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(); } }
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!"); } }
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(); }
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); } } }
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()); } }); } }
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); }
public List<SpareView> FilterSpares( int SearchFieldIndex, string SearchText, bool RemainsOnly, int GroupID, string BrandName) { List<SpareView> ResultList = new List<SpareView>(); int BrandID = 0; if (BrandName.Length > 0) BrandID = da.GetBrandIDByName(BrandName); if (GroupID == 0) { ResultList = SpareContainer.Instance.Spares; } else if (GroupID > 0 && (!(BrandID > 0))) { if (GroupID > 0) { List<SpareView> tmps = SpareContainer.Instance.Spares.ToList(); List<SpareView> tmps1 = tmps.Where(x => x != null).ToList(); ResultList = tmps1.Where(x => (x.GroupID == GroupID) || (x.spare_group1_id == GroupID) || (x.spare_group2_id == GroupID) || (x.spare_group3_id == GroupID)).ToList(); } } else if (BrandID > 0) { if (GroupID > 0) { List<SpareView> tmps = SpareContainer.Instance.Spares.ToList(); List<SpareView> tmps1 = tmps.Where(x => x != null).ToList(); ResultList = tmps1.Where(x => ((x.GroupID == GroupID) || (x.spare_group1_id == GroupID) || (x.spare_group2_id == GroupID) || (x.spare_group3_id == GroupID)) && (x.BrandID == BrandID)).ToList(); } } //bool RemainsOnly, if (RemainsOnly) { ResultList = ResultList.Where(i => i.QRest > 0).ToList(); } //int SearchFieldIndex, //string SearchText, if (SearchText.Length > 0) { // разобрать в завимосости от выбранного для поиска поле switch (SearchFieldIndex) { case 0:// ПОИСК ПО КОДУ ResultList = ResultList.Where(s => s.code != null).Where(s => s.code.ToLower().Contains(SearchText.ToLower())).ToList(); break; case 1:// ПОИСК ПО НАИМЕНОВАНИЮ ResultList = ResultList.Where(s => s.name.ToLower().Contains(SearchText.ToLower())).ToList(); break; case 2:// ПОИСК ПО КОДУ ШАТЕ-М ResultList = ResultList.Where(s => s.codeShatem != null).Where(s => s.codeShatem.ToLower().Contains(SearchText.ToLower())).ToList(); break; } } return ResultList.ToList(); }
protected async Task<bool> SaveContacts(MasterEntity entity) { using (var c = NestedContainer) { if(!ContactsList.Any(n => n.IsDirty)) return true; _proxy = Using<IDistributorServiceProxy>(c); ResponseBool response = new ResponseBool { Success = false }; var itemsToSave = new List<ContactItem>(); foreach (var item in ContactsList.Where(n => n.IsDirty)) { var contactItem = new ContactItem { MasterId = item.Contact.Id, DateOfBirth = item.Contact.DateOfBirth, MaritalStatusMasterId = (int)item.Contact.MStatus, BusinessPhone = item.Contact.BusinessPhone, ChildrenNames = item.Contact.ChildrenNames, City = item.Contact.City, Company = item.Contact.Company, ContactClassification = (int)item.Contact.ContactClassification, ContactOwnerType = item.Contact.ContactOwnerType, ContactOwnerMasterId = entity.Id, DateCreated = item.Contact._DateCreated, Email = item.Contact.Email, Fax = item.Contact.Fax, Firstname = item.Contact.Firstname, HomePhone = item.Contact.HomePhone, HomeTown = item.Contact.HomeTown, JobTitle = item.Contact.JobTitle, Lastname = item.Contact.Lastname, MobilePhone = item.Contact.MobilePhone, PhysicalAddress = item.Contact.PhysicalAddress, PostalAddress = item.Contact.PostalAddress, SpouseName = item.Contact.SpouseName, WorkExtPhone = item.Contact.WorkExtPhone, DateLastUpdated = DateTime.Now, StatusId = (int)EntityStatus.Active, IsNew = item.IsNew }; if (item.Contact.ContactType != null) contactItem.ContactTypeMasterId = item.Contact.ContactType.Id; itemsToSave.Add(contactItem); } if (itemsToSave.Count > 0) { response = await _proxy.ContactsAddAsync(itemsToSave.ToList()); MessageBox.Show(response.ErrorInfo, "Agrimanagr: Manage contacts", MessageBoxButton.OK, MessageBoxImage.Information); } else response.Success = true; return response.Success; } }
void element_MediaOpened(object sender, RoutedEventArgs e) { if (this.element.IsLive) { this.element.StartSeekToLive(); } foreach (SegmentInfo segment in this.element.ManifestInfo.Segments) { audioTracks = new List<StreamInfo>(); textTracks = new List<StreamInfo>(); IList<StreamInfo> streamInfoList = segment.AvailableStreams; List<StreamInfo> selectStreams = segment.SelectedStreams.ToList<StreamInfo>(); foreach (StreamInfo stream in streamInfoList) { if (stream.Type == MediaStreamType.Video) { playingStream = stream; tracks = stream.AvailableTracks.ToList<TrackInfo>(); ManifestEventArgs args = new ManifestEventArgs(tracks.ToList<Object>()); BitratesReady(this, args); } else if (stream.Type == MediaStreamType.Audio) { audioTracks.Add(stream); } //subtitles else if (stream.Type == MediaStreamType.Script && stream.Subtype == "CAPT") { textTracks.Add(stream); } } if (MediaOpened != null) { MediaOpened(sender, e); } ManifestEventArgs audioArgs = new ManifestEventArgs(audioTracks.ToList<Object>()); AudioTracksReady(this, audioArgs); ManifestEventArgs textArgs = new ManifestEventArgs(textTracks.ToList<Object>()); TextTracksReady(this, textArgs); } }
private void DataGridUpdate() { showEltmtnts(); switch (SelectBut) { case selectedButtons.HeroesBut: List<PHero> Hp = new List<PHero>(); foreach (var item in new Repository().GetHeroesSource().ToList()) { Hp.Add(new PHero { NameHeroes = item.NameHeroes, WeigthHero = item.WeigthHero }); } dgrid.ItemsSource = Hp.ToList(); break; case selectedButtons.QuestionsBut: // var a = (new Repository().GetQuestionsSource()).Select(d => new { d.NameQestion }).Distinct().ToList(); var a = new Repository().GetQuestionsSource(); List<PQuestions> Pq = new List<PQuestions>(); foreach(var ia in a.Select(d => new { d.NameQestion }).Distinct()) { int summary = 0; foreach(var ia2 in a) { if(ia2.NameQestion==ia.NameQestion) { summary = (int)ia2.OtvetSelected + summary; } } Pq.Add(new PQuestions { NameQestion = ia.NameQestion, TotalWeight = summary }); } dgrid.ItemsSource = Pq.ToList(); break; case selectedButtons.DominatingBut: dgrid.ItemsSource = (new Repository().GetQuestionsSource()).Select(d => new { d.NameQestion, d.NameHeroes, d.OtvetQuest1, d.OtvetQuest2, d.OtvetQuest3, d.OtvetQuest4, d.OtvetQuest5, d.OtvetSelected }).ToList(); break; case selectedButtons.QuestionTree: break; case selectedButtons.HeroesLearnClear: // List<PHero> Hl = new List<PHero>(); foreach (var item in new Repository().GetHeroesSource().ToList()) { Hl.Add(new PHero { NameHeroes = item.NameHeroes, WeigthHero = item.WeigthHero }); } GridHeroLearnDataGrid1.ItemsSource = Hl.ToList(); break; } }
void element_ManifestReady(object sender, EventArgs e) { foreach (SegmentInfo segment in this.element.ManifestInfo.Segments) { audioTracks = new List<StreamInfo>(); IList<StreamInfo> streamInfoList = segment.AvailableStreams; foreach (StreamInfo stream in streamInfoList) { if (stream.Type == MediaStreamType.Video) { playingStream = stream; tracks = stream.AvailableTracks.ToList<TrackInfo>(); ManifestEventArgs args = new ManifestEventArgs( tracks.ToList<Object>() ); BitratesReady(this, args); } else if (stream.Type == MediaStreamType.Audio) { audioTracks.Add(stream); } } ManifestEventArgs audioArgs = new ManifestEventArgs(audioTracks.ToList<Object>()); AudioTracksReady(this, audioArgs); } }
public SelectMultiCardsDlg(List<int> cardList, List<int> cardList2, string prompt, string title, int? minValue, int? maxValue, string boxLabel, string boxLabel2) { InitializeComponent(); slider.Value = Prefs.GetGameSetting(Program.GameEngine.Definition, "sliderValue", 175); Title = title; this.Height = Math.Min(System.Windows.SystemParameters.PrimaryScreenHeight * 0.80, 860); this.Width = Math.Min(System.Windows.SystemParameters.PrimaryScreenWidth * 0.80, 860); promptLbl.Text = prompt; if (string.IsNullOrEmpty(prompt)) promptBox.Visibility = Visibility.Collapsed; boxLbl.Text = boxLabel; boxLbl2.Text = boxLabel2; Task.Factory.StartNew(() => { if (cardList == null) cardList = new List<int>(); _min = minValue; _max = maxValue; allCards = cardList.ToList(); if (cardList2 != null) allCards2 = cardList2.ToList(); Dispatcher.BeginInvoke(new Action(() => { allList.ItemsSource = allCards; allList2.ItemsSource = allCards2; if (allCards2 != null) // multi-box will always have drag/drop { if (_max == null) _max = allCards.Count + allCards2.Count; // max value will be the total count of both lists if (_min == null) _min = 0; // min value will be the lowest value possible if (_min > _max) _min = _max; // prevent oddities where user set the min value higher than max AllowSelect = (_min <= allCards.Count && allCards.Count <= _max); } else // only one box, check if drag/drop is allowed { if (_max == null) _max = 1; if (_min == null) _min = 1; if (_min > _max) _min = _max; // prevent oddities where user set the min value higher than max allList2.Visibility = Visibility.Collapsed; // hides the second box box2GridRow.Height = new GridLength(0); // hides the second box if (_max <= 0) // a maximum value of 0 means that we want to reorganize the group, not select cards from it { selectButton.IsEnabled = true; AllowSelect = true; } else if (_min == 1 && _max == 1) // only allow a single choice { allList.PreviewMouseLeftButtonDown -= DragDropDown; allList.SelectionChanged += CardSelected; allList.MouseDoubleClick += SelectClicked; // double clicking the card will auto-confirm it } else //allow multiple choice { allList.PreviewMouseLeftButtonDown -= DragDropDown; allList.SelectionChanged += CardSelected; allList.SelectionMode = SelectionMode.Multiple; if (_min == 0) AllowSelect = true; } } })); }); }
public CashDeskManagerAllDetails(List<rsp_CDM_GetCashierTransactionsDetails_New> lstTickets, DateTime startDate, DateTime endDate, string FooterText, int userNo, int RouteNo) { try { InitializeComponent(); lstCashierTransactionsDetails = lstTickets.ToList(); dtTickets = lstTickets.ToDataSet<rsp_CDM_GetCashierTransactionsDetails_New>("DetailsView"); if (!Security.SecurityHelper.HasAccess("BMC.Presentation.CashDeskManager.UserControls.CashDeskManagerAllDetails.lvViewAll.TicketValue")) { lstTickets.ForEach((x) => { if (x.Ticket.Trim().Length > 8) x.Ticket = x.Ticket.Trim().Remove(x.Ticket.Trim().Length - 4, 4) + "****"; }); } this.DataContext = lstTickets; this.StartDate = startDate; this.EndDate = endDate; this.sFooterText = FooterText; this.user = userNo; this.iRoute_No = RouteNo; objCashDeskManager = CashDeskManagerBusinessObject.CreateInstance(); } catch (Exception ex) { ExceptionManager.Publish(ex); } }
public void PositionIndicator(Chart chart, MouseEventArgs e, Double xValueAtMousePos, Double internalYValue) { #region Set position for Indicator if (Chart.IndicatorEnabled) { /*Double xOffset = Double.NaN, yOffset = Double.NaN; if (e != null) { Double x1 = e.GetPosition(Chart._toolTipCanvas).X; Double x2 = e.GetPosition(Chart._plotAreaGrid).X; Double y1 = e.GetPosition(Chart._toolTipCanvas).Y; Double y2 = e.GetPosition(Chart._plotAreaGrid).Y; xOffset = Math.Abs(x1 - x2); yOffset = Math.Abs(y1 - y2); } chart.PlotArea.GetPlotAreaStartPosition(); Double xx1 = (Double)Chart.PlotArea.GetValue(Canvas.LeftProperty); Double yy1 = (Double)Chart.PlotArea.GetValue(Canvas.TopProperty); System.Diagnostics.Debug.WriteLine("XOffset=" + xOffset.ToString() + ", " + yOffset.ToString()); System.Diagnostics.Debug.WriteLine("XOffset=" + xx1.ToString() + ", " + yy1.ToString()); xOffset = xx1; yOffset = yy1;*/ Double xOffset = (Double)Chart.PlotArea.GetValue(Canvas.LeftProperty); Double yOffset = (Double)Chart.PlotArea.GetValue(Canvas.TopProperty); // Find and set reference of the nearest DataPoint from mouse pointer position // and ignore all Datapoints where if nearestDataPoint is null of its parent List<DataPoint> listOfNearestDataPoints; if (e == null) listOfNearestDataPoints = (from ds in chart.InternalSeries where !RenderHelper.IsAxisIndependentCType(ds) && !RenderHelper.IsCircularCType(ds) select ds.FindNearestDataPointFromValues(xValueAtMousePos, internalYValue)) .Where(dp => (dp != null && dp.Parent._nearestDataPoint != null)).ToList(); else listOfNearestDataPoints = (from ds in chart.InternalSeries where !RenderHelper.IsAxisIndependentCType(ds) && !RenderHelper.IsCircularCType(ds) select ds.FindNearestDataPointFromMousePointer(e)) .Where(dp => (dp != null && dp.Parent._nearestDataPoint != null)).ToList(); // Prepare ToolTips and Create a new list of nearest DataPoints List<DataPoint> selectedNearestDataPoints = new List<DataPoint>(); // Prepare ToolTips and Create a new list of nearest DataPoints foreach (DataPoint nearestDataPoint in listOfNearestDataPoints) { DataSeries dataSeries = nearestDataPoint.Parent; if (dataSeries.ToolTipElement != null) { dataSeries.SetToolTipProperties(nearestDataPoint); //if (!String.IsNullOrEmpty(dataSeries.ToolTipElement.Text)) { selectedNearestDataPoints.Add(nearestDataPoint); } } // Setup ToolTip dataSeries.HideToolTip(); } if (e != null) xValueAtMousePos = RenderHelper.CalculateInternalXValueFromPixelPos(chart, chart.ChartArea.AxisX, e); DataPoint nearestDataPoint1 = RenderHelper.GetNearestDataPointAlongXAxis(selectedNearestDataPoints, chart.ChartArea.AxisX, xValueAtMousePos); // Sorted list of nearest DataPoints ascending order of visualPosition along y-axis List<DataPoint> finalSetOfDataPoints = new List<DataPoint>(); if (nearestDataPoint1 != null) finalSetOfDataPoints = (from dataPoint in selectedNearestDataPoints where dataPoint.InternalXValue == nearestDataPoint1.InternalXValue orderby dataPoint._visualPosition.Y ascending select dataPoint) .TakeWhile(dp => dp.Parent.HideToolTip()).ToList(); System.Diagnostics.Debug.WriteLine("NearestDataPoints Count : " + finalSetOfDataPoints.Count); // System.Diagnostics.Debug.WriteLine("YValue : " + finalSetOfDataPoints[0].YValue); // Clear all unwated temporary list listOfNearestDataPoints = null; selectedNearestDataPoints = null; // System.Diagnostics.Debug.WriteLine("NearestDataPoints Count : " + listOfNearestDataPoints.Count); if (finalSetOfDataPoints.Count > 0) { CreateIndicators(); //_axisIndicatorElement.Visibility = Visibility.Visible; _verticalLineIndicator.Visibility = Visibility.Visible; _axisCallOutContainer.Visibility = Visibility.Visible; _axisIndicatorBorderElement.Visibility = Visibility.Visible; ArrangeToolTips4DataSeries(finalSetOfDataPoints.ToList(), xOffset, yOffset); foreach (DataPoint dp in finalSetOfDataPoints) { DataSeries dataSeries = dp.Parent; Double offset = AxisX.GetScrollBarValueFromOffset(AxisX.CurrentScrollScrollBarOffset); offset = GetScrollingOffsetOfAxis(AxisX, offset); if (AxisX.AxisOrientation == AxisOrientation.Vertical) { if (dp._visualPosition.Y - offset > PlotAreaCanvas.Height || dp._visualPosition.Y - offset < 0) { dataSeries.HideToolTip(); DisableIndicators(); } } else { if (dp._visualPosition.X - offset > PlotAreaCanvas.Width || dp._visualPosition.X - offset < 0) { dataSeries.HideToolTip(); DisableIndicators(); } } } if (Chart._toolTipCanvas.Clip != null) { Rect clipRect = new Rect(0, -PLANK_DEPTH, Chart.ActualWidth, Chart.ActualHeight + PLANK_DEPTH); RectangleGeometry clipRectangle = Chart._toolTipCanvas.Clip as RectangleGeometry; if (!clipRectangle.Rect.Equals(clipRect)) clipRectangle.Rect = clipRect; } else { RectangleGeometry clipRectangle = new RectangleGeometry(); clipRectangle.Rect = new Rect(0, -PLANK_DEPTH, Chart.ActualWidth, Chart.ActualHeight + PLANK_DEPTH); Chart._toolTipCanvas.Clip = clipRectangle; } } } #endregion }
private void ProcessItemsSource() { if (null == _ui_icLeft || null == _ui_icRight) return; List<object> aItems = new List<object>((IEnumerable<object>)aItemsSource); if (null != aItemsSelected) { List<object> aSelected = new List<object>(((IEnumerable<object>)aItemsSelected).Where(o => aItems.Contains(o))); aItems = aItems.Where(o => !aSelected.Contains(o)).ToList(); _ui_icRight.ItemsSource = aSelected.ToList(); } _ui_icLeft.ItemsSource = _ui_Search.aItemsSourceInitial = aItems.ToList(); _ui_icRight.Tag = null; }
//, List<SubCalendarEvent> usedSubCalendarEvensts) List<List<List<SubCalendarEvent>>> generateTreeCallsToSnugArray(List<SubCalendarEvent> AvailableSubCalendarEvents, List<TimeLine> AllTimeLines, int TimeLineIndex, List<List<SubCalendarEvent>> SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar, Dictionary<TimeLine, List<SubCalendarEvent>> DictionaryOfTimelineAndSubcalendarEvents) { /* * Name: jerome Biotidara * Description: This function is responsible for generating the snug possibilities for a list containing all timelines it takes 5 elements as its parameters. -AvailableSubCalendarEvents ->The remaining List of subcalendar events. -AllTimeLines->A list of the Timelines that needto be populated with the desired snug possibility -TimeLineIndex->An Index keeping track of what timeline the funciton is current working on -FullTimeLineWithSnugListOfSubcalendarEvents->is a list containing A list of subcalendarEvents for each TimeLine * -PertainingSnugPossibilityForTimieline-> is a list of snugpossibilities that apply to a TimeLine in a TimeLineIndex * -DictionaryOfTimelineAndSubcalendarEvents-> A dictionary of TimeLine and interferring subcalendarevents */ //if (ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Count >= maxHackConstant) { //return ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack; } if (AvailableSubCalendarEvents.Count > MaxNumberOfInterferringSubcalEvents) { MaxNumberOfInterferringSubcalEvents = AvailableSubCalendarEvents.Count; } if (TimeLineIndex > LargestTimeIndex) { LargestTimeIndex = TimeLineIndex; } if (TimeLineIndex == 8) { int Haha = 1; Haha += 1; } List<List<List<SubCalendarEvent>>> ListOfAllSnugPossibilitiesInRespectiveTImeLines = new System.Collections.Generic.List<System.Collections.Generic.List<System.Collections.Generic.List<SubCalendarEvent>>>(); if (AllTimeLines.Count < 1) { return null; } if ((TimeLineIndex >= AllTimeLines.Count) && (AvailableSubCalendarEvents.Count > 0)) { LogInfo += ("Couldnt Find For this timeLine timeLine\n"); } if ((TimeLineIndex >= AllTimeLines.Count) || (AvailableSubCalendarEvents.Count < 1)) { if (TimeLineIndex < AllTimeLines.Count) { LogInfo += ("Weird Exit\n"); } ListOfAllSnugPossibilitiesInRespectiveTImeLines.Add(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar); return ListOfAllSnugPossibilitiesInRespectiveTImeLines; } List<TimeSpanWithID> MySubcalendarEventTimespans = new System.Collections.Generic.List<TimeSpanWithID>(); List<SubCalendarEvent> MyPertinentSubcalendarEvents = Utility.ListPartOfList(AvailableSubCalendarEvents, DictionaryOfTimelineAndSubcalendarEvents[AllTimeLines[TimeLineIndex]]); List<SubCalendarEvent> ConstrainedToList = ConstrainedList(AllTimeLines[TimeLineIndex], MyPertinentSubcalendarEvents); MyPertinentSubcalendarEvents = Utility.NotInList_NoEffect(MyPertinentSubcalendarEvents, ConstrainedToList);//this removes the constrained Items from the Subcalendar list foreach (SubCalendarEvent MySubcalendarevent in MyPertinentSubcalendarEvents) { MySubcalendarEventTimespans.Add(new TimeSpanWithID(MySubcalendarevent.ActiveDuration, new EventID(MySubcalendarevent.ID))); } List<TimeSpanWithID> ConstrainedMySubcalendarEventTimespans = new System.Collections.Generic.List<TimeSpanWithID>(); foreach (SubCalendarEvent MyConstrainedSubcalendarevent in ConstrainedToList) { ConstrainedMySubcalendarEventTimespans.Add(new TimeSpanWithID(MyConstrainedSubcalendarevent.ActiveDuration, new EventID(MyConstrainedSubcalendarevent.ID))); } TimeSpan TotalimeOccupieByConstrained = SubCalendarEvent.TotalActiveDuration(ConstrainedToList); if(TimeLineIndex==2) { ; } Stopwatch sw = new Stopwatch(); sw.Start(); // ... SnugArray MySnugArray = new SnugArray(new List<TimeSpanWithID>(), MySubcalendarEventTimespans, AllTimeLines[TimeLineIndex].TimelineSpan - TotalimeOccupieByConstrained); //SnugArray MySnugArray = new SnugArray(ConstrainedMySubcalendarEventTimespans, MySubcalendarEventTimespans, AllTimeLines[TimeLineIndex].TimelineSpan); List<List<TimeSpanWithID>> AllSnugPossibilities = MySnugArray.MySnugPossibleEntries; /* AllSnugPossibilities looks like this * {{43,23,54},{43,54,23},{23,43,54}...} where each digit is a time span and remember it generates every permutation. */ List<List<SubCalendarEvent>> SubcalendarMyList = BuildListMatchingTimelineAndSubCalendarEvent(AllSnugPossibilities, MyPertinentSubcalendarEvents, ConstrainedToList); sw.Stop(); /* the function BuildListMatchingTimelineAndSubCalendarEvent builds a list of Subcalendar events for each timespan. * assuming subCal0 has TimeSpan =43 * assuming subCal1 has TimeSpan =23 * assuming subCal2 has TimeSpan =54 * assuming subCal3 has TimeSpan =43 * assuming subCal4 has TimeSpan =23 * assuming subCal5 has TimeSpan =23 * SubcalendarMyList will have the array {{{SubCal0,Subcal3},{subCal1,subCal4,subCal5},{subCal2}},{{SubCal0,Subcal3},{subCal2},{subCal1,subCal4,subCal5}},{{subCal1,subCal4,subCal5},{SubCal0,Subcal3},{subCal2}}...} */ //List<List<SubCalendarEvent>> SerialIzedListOfSubCalendarEvents = SerializeListOfMatchingSubcalendarEvents(SubcalendarMyList); List<List<SubCalendarEvent>> SerialIzedListOfSubCalendarEvents = SubcalendarMyList; List<SubCalendarEvent> AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = new List<SubCalendarEvent>(); if (SerialIzedListOfSubCalendarEvents.Count > 0) { foreach (List<SubCalendarEvent> AlreadyAssignedSubCalendarEvent in SerialIzedListOfSubCalendarEvents) { AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = Utility.NotInList(AvailableSubCalendarEvents.ToList(), AlreadyAssignedSubCalendarEvent); SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar[TimeLineIndex] = AlreadyAssignedSubCalendarEvent; if (checkSumOfTimeEvent(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar) >= MaxNumberOfInterferringSubcalEvents) { ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Add(SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar); //if (ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack.Count >= maxHackConstant) { //return ListOfAllSnugPossibilitiesInRespectiveTImeLines_hack; } } ListOfAllSnugPossibilitiesInRespectiveTImeLines.AddRange(generateTreeCallsToSnugArray(AvailableSubCalendarEventsAfterRemovingAssingedSnugElements, AllTimeLines, TimeLineIndex + 1, SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar.ToList(), DictionaryOfTimelineAndSubcalendarEvents)); //ListOfAllSnugPossibilitiesInRespectiveTImeLines = MyHolder.ToList(); } } else { AvailableSubCalendarEventsAfterRemovingAssingedSnugElements = Utility.NotInList(AvailableSubCalendarEvents.ToList(), new List<SubCalendarEvent>());//Hack this can be optimized... the whole "notinlist" call can be optimized as a call to AvailableSubCalendarEvents. Review to see if references to func are affected. ListOfAllSnugPossibilitiesInRespectiveTImeLines.AddRange(generateTreeCallsToSnugArray(AvailableSubCalendarEventsAfterRemovingAssingedSnugElements, AllTimeLines, TimeLineIndex + 1, SubCalendarEventsPopulatedIntoTimeLineIndex_SoFar.ToList(), DictionaryOfTimelineAndSubcalendarEvents)); } if (AvailableSubCalendarEventsAfterRemovingAssingedSnugElements.Count < 1) { ; } return ListOfAllSnugPossibilitiesInRespectiveTImeLines; }
private void PaintAllEvents() { int eventsCount = 0; if (_scheduler != null && _scheduler.Events != null) { IEnumerable<Event> eventList = TodayEvents .Where(ev => ev.EventInfo.StartEvent.Date == ev.EventInfo.EndEvent.Date) .OrderBy(ev => ev.EventInfo.IsCanceled) .ThenBy(ev => ev.EventInfo.StartEvent); column.Children.Clear(); double columnWidth = EventsGrid.ColumnDefinitions[1].Width.Value; foreach (Event e in eventList) { List<Event> concurrentEvents = new List<Event>(); GetConcurrentEvents(e, concurrentEvents); concurrentEvents = concurrentEvents .OrderBy(ev => ev.EventInfo.StartEvent) .ThenBy(ev => ev.EventInfo.EndEvent) .ToList(); double marginTop = _oneHourHeight * ((e.EventInfo.StartEvent.Hour + (e.EventInfo.StartEvent.Minute / 60.0)) - _minHour); double width = columnWidth / (concurrentEvents.Count()); double marginLeft = width * concurrentEvents.ToList().FindIndex(ev => ev.Id == e.Id); EventUserControl wEvent = new EventUserControl(e); wEvent.Width = width; wEvent.Height = e.EventInfo.EndEvent.Subtract(e.EventInfo.StartEvent).TotalHours * _oneHourHeight; wEvent.Margin = new Thickness(marginLeft, marginTop, 0, 0); wEvent.BorderElement.BorderThickness = new Thickness(_eventSelected == e.Id ? _selectedEventBorderThickness : 1.0); wEvent.MouseLeftButtonDown += ((object sender, MouseButtonEventArgs ea) => { ea.Handled = true; SelectEvent(sender as EventUserControl); OnEventMouseLeftButtonDown(sender, wEvent.Event); }); wEvent.MouseRightButtonDown += ((object sender, MouseButtonEventArgs ea) => { SelectEvent(sender as EventUserControl); ContextMenu cm = this.FindResource("SchedulerContextMenu") as ContextMenu; if (UserLoggedIn.IsAdmin == false) { foreach (var item in cm.Items) { if (item is MenuItem && (item as MenuItem).Tag.ToString() == "VIEW_EVENT_STATUS_CHANGES") { cm.Items.Remove(item as MenuItem); break; } } } cm.Tag = e; cm.IsOpen = (e.EventInfo.IsCanceled == false && e.EventInfo.IsCompleted == false) || UserLoggedIn.IsAdmin; }); column.Children.Add(wEvent); eventsCount++; } } dayLabel.Content = _currentDay.ToString("D") + " (Citas: " + eventsCount + ")"; }
private void productSelectionChanged(object sender, SelectionChangedEventArgs e) { using (DatabaseContext siContext = new DatabaseContext()) { if (productsDb.SelectedItem is Product) { var item = (Product)productsDb.SelectedItem; var getProduct = from Product in siContext.Product where Product.Model.Equals(item.Model) select Product.Comments; List<CommentDb> comments = new List<CommentDb>(); foreach (var comment in getProduct) { if (comment.Count > 0) { foreach (var com in comment) { com.Comment = Regex.Replace(com.Comment, @"<[^>]+>| ", "").Trim(); comments.Add(com); } } } commentData.ItemsSource = comments.ToList(); } else { commentData.ItemsSource = new List<Product>(); } } }
public void DataGridUpdateDate() { try { using (BdModelContainer _context = new BdModelContainer()) { Lput = _context.Путевые_листыSet.ToList(); dGrid.ItemsSource = Lput.ToList(); } } catch (Exception ex) { MessageBox.Show("Ошибка выгрузки таблицы: " + ex.Message); } }