public PlexTrack FromTracks(System.ComponentModel.ICollectionView tracks, int current = -1) { lock (tracks) { this.tracks.Clear(); foreach (var track in tracks) { this.tracks.Add(track as PlexTrack); } } if (current < 0) { var playback = PlaybackManager.GetInstance(); current = playback.IsShuffle ? new Random().Next(0, this.tracks.Count - 1) : current; } ResetPlayedIndexes(); var currentTrack = Play(current); TrackChanged?.Invoke(this, new EventArgs()); return(currentTrack); }
GetQueryController( System.Windows.Controls.DataGrid dataGrid, FilterData filterData, IEnumerable itemsSource) { if (dataGrid == null) { throw new ArgumentNullException(nameof(dataGrid)); } var query = DataGridExtensions.GetDataGridFilterQueryController(dataGrid); if (query == null) { //clear the filter if exists begin System.ComponentModel.ICollectionView view = System.Windows.Data.CollectionViewSource.GetDefaultView(dataGrid.ItemsSource); if (view != null) { view.Filter = null; } //clear the filter if exists end query = new QueryController(); DataGridExtensions.SetDataGridFilterQueryController(dataGrid, query); } query.ColumnFilterData = filterData; query.ItemsSource = itemsSource; query.CallingThreadDispatcher = dataGrid.Dispatcher; query.UseBackgroundWorker = DataGridExtensions.GetUseBackgroundWorkerForFiltering(dataGrid); return(query); }
private void _uxFilter_TextChanged(object sender, TextChangedEventArgs e) { try { string filter = _uxFilter.Text; System.ComponentModel.ICollectionView cv = CollectionViewSource.GetDefaultView(savedViewpoints); if (filter == "") { cv.Filter = null; } else { cv.Filter = o => { KeyValuePair <SavedViewpoint, string> model = (KeyValuePair <SavedViewpoint, string>)o; bool savedViewppointNameFilter = (model.Key.DisplayName == null) ? false : model.Key.DisplayName.ToUpper().Contains(filter.ToUpper()); bool issueTitleFilter = (model.Value == null) ? false : model.Value.ToUpper().Contains(filter.ToUpper()); return(savedViewppointNameFilter || issueTitleFilter); }; } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public TextSearchFilter(System.ComponentModel.ICollectionView filteredview, TextBox textbox) { string FilteredText = ""; filteredview.Filter = delegate(object obj) { if (String.IsNullOrEmpty(FilteredText)) { return(true); } string str = obj as string; if (String.IsNullOrEmpty(str)) { return(false); } int index = str.IndexOf(FilteredText, 0, StringComparison.InvariantCultureIgnoreCase); return(index > 1); }; textbox.TextChanged += delegate { FilteredText = textbox.Text; filteredview.Refresh(); }; }
public void RefreshList() { modList.RefreshCollection(); collectionView = _collectionViewSource.View; DG.DataContext = _collectionViewSource.View; }
public productionReport() { InitializeComponent(); //list Production reports in a given directory DirectoryInfo dinfo = new DirectoryInfo(@"..\..\..\..\..\Reports\Production Reports"); FileInfo[] Files = dinfo.GetFiles(); //file list to string for filter purposes var fileList = Files.ToList(); //show all files before filtering listBox.ItemsSource = fileList; //pull parts list from the database GCIDB.Initialize(); GCIDB.OpenConnection(); partNames = GCIDB.GetPartList(); partName_listBox1.ItemsSource = partNames; //create view then filter, doesnt includes batch view, which is changed in the System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(listBox.ItemsSource); view.Filter = CustomFilter; System.ComponentModel.ICollectionView partName_view = CollectionViewSource.GetDefaultView(partName_listBox1.ItemsSource); partName_view.Filter = partName_CustomFilter; }
public lifetimeReport() { InitializeComponent(); DirectoryInfo dinfo = new DirectoryInfo(@"..\..\..\..\..\Reports\Lifetime Reports"); FileInfo[] Files = dinfo.GetFiles(); //file list to string for filter purposes var fileList = Files.ToList(); //show all files before filtering files_listbox.ItemsSource = fileList; //get part names GCIDB.Initialize(); GCIDB.OpenConnection(); partNames = GCIDB.GetPartList(); partName_listbox.ItemsSource = partNames; System.ComponentModel.ICollectionView file_view = CollectionViewSource.GetDefaultView(files_listbox.ItemsSource); file_view.Filter = files_CustomFilter; //filter for partnames System.ComponentModel.ICollectionView partName_view = CollectionViewSource.GetDefaultView(partName_listbox.ItemsSource); partName_view.Filter = partName_CustomFilter; }
public MainWindow() { InitializeComponent(); Names myNames; System.ComponentModel.ICollectionView aView; myNames = (Names)(this.Resources["myNames"]); aView = CollectionViewSource.GetDefaultView(myNames); }
public void SelectAllItems(System.ComponentModel.ICollectionView availableItemsCollectionView) { IList <Property> itemsList = new List <Property>(availableItemsCollectionView.Cast <Property>()); foreach (Property obj in itemsList) { SelectItem(obj); } }
public PersonnelViewModel(Personnel personnel, ScoutTypeViewModel stv) : base(stv, true) { this.personnel = personnel; // sorting System.ComponentModel.ICollectionView view = System.Windows.Data.CollectionViewSource.GetDefaultView(Children); view.SortDescriptions.Add(new System.ComponentModel.SortDescription("FormationName", System.ComponentModel.ListSortDirection.Ascending)); }
private void RemovePreparationStep_Click(object sender, RoutedEventArgs e) { if (sender is Button button && int.TryParse(button.Tag.ToString(), out int index)) { CreateEditRecipeViewModel vm = DataContext as CreateEditRecipeViewModel; vm.Recipe.PreparationSteps.RemoveAt(index); System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(preparationStepsList.ItemsSource); view.Refresh(); } }
private void ClearFilter() { System.ComponentModel.ICollectionView dataView = CollectionViewSource.GetDefaultView(thumbList.ItemsSource); dataView.Filter = null; dataView.Refresh(); if (Progress != null) { Progress.ProgressMessage(String.Format("Displaying all {0} items.", ReportData.Rows.Count)); } }
private void ApplyFilters(object sender, RoutedEventArgs e) { System.ComponentModel.ICollectionView dataView = CollectionViewSource.GetDefaultView(dgSubmissions.ItemsSource); lblLoadingIndicator.Visibility = Visibility.Visible; lblLoadingIndicator.Content = "Applying filters..."; progData.Visibility = Visibility.Visible; dataView.Filter = (obj) => { Record row = obj as Record; var allowRow = true; if (!string.IsNullOrEmpty(txtPartNumber.Text.Trim())) { allowRow = allowRow && row.PartNumber.Contains(txtPartNumber.Text.Trim()); } if (!string.IsNullOrEmpty(txtOrderNumber.Text.Trim())) { allowRow = allowRow && row.OrderNumber.Equals(txtOrderNumber.Text.Trim()); } if (!string.IsNullOrEmpty(txtSerialNumber.Text.Trim())) { allowRow = allowRow && row.SerialNumber.Equals(txtSerialNumber.Text.Trim()); } if (!string.IsNullOrEmpty(txtCustomerNumber.Text.Trim())) { allowRow = allowRow && (row.CustomerNumber == int.Parse(txtCustomerNumber.Text.Trim())); } if (dpStartDate.SelectedDate.HasValue) { allowRow = allowRow && (row.DateReceived >= dpStartDate.SelectedDate.Value); } if (dpEndDate.SelectedDate.HasValue) { allowRow = allowRow && (row.DateReceived >= dpEndDate.SelectedDate.Value); } return(allowRow); }; dataView.Refresh(); progData.Visibility = Visibility.Collapsed; lblLoadingIndicator.Visibility = Visibility.Collapsed; lblLoadingIndicator.Content = ""; ToggleFiltersEnabled(false); }
public BaseItemDialog(IDictionary <string, PoEBaseItemData> dict) { InitializeComponent(); OKButton.IsEnabled = false; System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(dict); if (view.GroupDescriptions.Count == 0) { view.GroupDescriptions.Add(new PropertyGroupDescription("Value.item_class")); } view.Filter = NameFilter; ItemNameView.ItemsSource = dict; }
void sort(string sortby, System.ComponentModel.ListSortDirection listSortDirection) { System.ComponentModel.ICollectionView dataView = CollectionViewSource.GetDefaultView(dataGrid.ItemsSource); if (dataView != null) { dataView.SortDescriptions.Clear(); System.ComponentModel.SortDescription sd = new System.ComponentModel.SortDescription(sortby, listSortDirection); dataView.SortDescriptions.Add(sd); dataView.Refresh(); } }
private void Controller_OnSweepingProgressChanged(object sender, double e) { this.SweepingProgress = e; if (e == 1) { System.ComponentModel.ICollectionView col = Controller.PLC.Channels[0].CurveInsertionLoss; foreach (var it in Controller.PLC.Channels[0].InsertionLoss) { Console.WriteLine(string.Format("{0:F3} {1:F3}", it.X, it.Y)); } } }
public TestEditor() { InitializeComponent(); GCIDB.Initialize(); GCIDB.OpenConnection(); List <string> partNames = GCIDB.GetPartList(); part_listBox.ItemsSource = partNames; System.ComponentModel.ICollectionView partName_view = CollectionViewSource.GetDefaultView(part_listBox.ItemsSource); partName_view.Filter = partName_CustomFilter; }
private void delete_button_Click(object sender, RoutedEventArgs e) { MessageBox.Show($"name: , board: {SelectedPartName.Length}, {SelectedBoardName.Length}"); if (SelectedPartName.Length > 0 && SelectedBoardName.Length > 0) { GCIDB.DeleteBoard(SelectedPartName, SelectedBoardName); GCIDB.Initialize(); GCIDB.OpenConnection(); List <string> partNames = GCIDB.GetPartList(); part_listBox.ItemsSource = partNames; System.ComponentModel.ICollectionView partName_view = CollectionViewSource.GetDefaultView(part_listBox.ItemsSource); partName_view.Filter = partName_CustomFilter; } }
private void partName_listbox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (partName_listbox.SelectedIndex == -1) { MessageBox.Show("Select a Part Name!"); } else { //pull batch names from the DB, then render the view for filtering SelectedPartName = partName_listbox.SelectedItem.ToString(); GCIDB.Initialize(); GCIDB.OpenConnection(); batchNames = GCIDB.GetBatchNameList(SelectedPartName); batchName_listbox.ItemsSource = batchNames; System.ComponentModel.ICollectionView batchName_view = CollectionViewSource.GetDefaultView(batchName_listbox.ItemsSource); batchName_view.Filter = batchName_CustomFilter; } }
/// <summary> /// Updates the data in the DataGrid based on the data in this object's FolderData object /// </summary> public void updateTableListing() { List <dataEntry> lde = new List <dataEntry>(); //add the Files foreach (System.IO.FileInfo file in folderData.files) { lde.Add(new dataEntry() { Name = getIcon(file.Extension) + " " + file.Name, Percentage = Math.Round(file.Length / folderData.total_size, 9) * 100, Size = formatSize(file.Length) }); } //add the folders foreach (FolderData f in folderData.subFolders) { lde.Add(new dataEntry() { Name = "📁 " + f.path.Name, Percentage = Math.Round(f.total_size / folderData.total_size, 9) * 100, Size = formatSize(f.total_size) }); } //add folders that still need to be sized foreach (DirectoryInfo di in folderData.sfdi) { if (!folderData.sfDict.ContainsKey(di.Name)) { lde.Add(new dataEntry() { Name = "📁 " + di.Name + " (sizing)", Percentage = -1, Size = "Unknown" }); } } dg.ItemsSource = lde; //sort the grid by percentage System.ComponentModel.ICollectionView dataView = CollectionViewSource.GetDefaultView(dg.ItemsSource); dataView.SortDescriptions.Clear(); dataView.SortDescriptions.Add(new System.ComponentModel.SortDescription("Percentage", System.ComponentModel.ListSortDirection.Descending)); dg.Items.Refresh(); }
private async void EditPreparationStep_Click(object sender, RoutedEventArgs e) { if (sender is Button button && int.TryParse(button.Tag.ToString(), out int index)) { CreateEditRecipeViewModel vm = DataContext as CreateEditRecipeViewModel; vm.IsEditPreparationStep = true; string preparationStepCurrent = vm.Recipe.PreparationSteps[index]; vm.NewPreparationStepText = preparationStepCurrent; var result = await dialogHost.ShowDialog(dialog_preparationStep, delegate(object dialogSender, DialogOpenedEventArgs args) { }); vm.Recipe.PreparationSteps[index] = vm.NewPreparationStepText; System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(preparationStepsList.ItemsSource); view.Refresh(); vm.NewPreparationStepText = ""; } }
private void txbSearch_TextChanged(object sender, TextChangedEventArgs e) { TextBox txt = (TextBox)sender; string filter = txbSearch.Text; System.ComponentModel.ICollectionView cv = CollectionViewSource.GetDefaultView(userList.ItemsSource); if (filter == "") { cv.Filter = null; } else { cv.Filter = o => { User u = o as User; return(u.FullName.ToString().ToUpper().Contains(filter.ToUpper())); }; } }
public CategoryProductsViewModel() { if (App.ClientCache == null) { return; } _scope = App.ClientCache.CreateScope(); // These live views will be used by the CategoryProductsView // to display categories and products. Categories = from c in _scope.GetItems <Category>() select new CategoryViewModel() { CategoryID = c.CategoryID, CategoryName = c.CategoryName }; // Products are filtered by CategoryID on the server. // Filtering is performed automatically when the current Category changes. // The product suppliers are fetched along with the products. Products = from p in _scope.GetItems <Product>().AsFilteredBound(p => p.CategoryID) .BindFilterKey(Categories, "CurrentItem.CategoryID").Include("Supplier") select new ProductViewModel() { ProductID = p.ProductID, ProductName = p.ProductName, CategoryID = p.CategoryID, CategoryName = p.Category.CategoryName, SupplierID = p.SupplierID, SupplierName = p.Supplier.CompanyName, UnitPrice = p.UnitPrice, QuantityPerUnit = p.QuantityPerUnit, UnitsInStock = p.UnitsInStock, UnitsOnOrder = p.UnitsOnOrder }; }
private void txbSearch_TextChanged(object sender, TextChangedEventArgs e) { TextBox txt = (TextBox)sender; string filter = txbSearch.Text; System.ComponentModel.ICollectionView cv = CollectionViewSource.GetDefaultView(DataGridOrders.ItemsSource); if (filter == "") { cv.Filter = null; } else { cv.Filter = o => { DAL.Entities.Order p = o as DAL.Entities.Order; return(p.ReceiptId.ToString().ToUpper().Contains(filter.ToUpper()) || p.User.FullName.ToUpper().Contains(filter.ToUpper()) || p.Worker.ToUpper().Contains(filter.ToUpper())); }; } }
private void BtnReload_Click(object sender, RoutedEventArgs e) { MainWindow.Share.Reload(); System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(uiList.ItemsSource); view.Refresh(); }
private void CloseDetail() { winDetail.Visibility = Visibility.Hidden; System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(uiList.ItemsSource); view.Refresh(); }
private void btnNext_Click(object sender, RoutedEventArgs e) { System.ComponentModel.ICollectionView navigationView = CollectionViewSource.GetDefaultView(phoneNumbersDataSet.PhoneNumbers); navigationView.MoveCurrentToNext(); }
public static bool IsDefaultView(System.ComponentModel.ICollectionView view) { return(default(bool)); }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_Loaded(object sender, RoutedEventArgs e) { listViewTimbres.ItemsSource = CombiViewModel.Combi.Timbres.TimbresCollection; System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(listViewTimbres.ItemsSource); view.Filter = bank => true; }
public void SelectAllItems(System.ComponentModel.ICollectionView availableItemsCollectionView) { }
// ** ctor public ViewFilter(System.ComponentModel.ICollectionView view) { _view = view; }