コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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());
            }
        }
コード例 #4
0
ファイル: MainWindow.xaml.cs プロジェクト: ranganathsb/Gooey
        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();
            };
        }
コード例 #5
0
        public void RefreshList()
        {
            modList.RefreshCollection();

            collectionView = _collectionViewSource.View;
            DG.DataContext = _collectionViewSource.View;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        public MainWindow()
        {
            InitializeComponent();
            Names myNames;

            System.ComponentModel.ICollectionView aView;
            myNames = (Names)(this.Resources["myNames"]);
            aView   = CollectionViewSource.GetDefaultView(myNames);
        }
コード例 #9
0
        public void SelectAllItems(System.ComponentModel.ICollectionView availableItemsCollectionView)
        {
            IList <Property> itemsList = new List <Property>(availableItemsCollectionView.Cast <Property>());

            foreach (Property obj in itemsList)
            {
                SelectItem(obj);
            }
        }
コード例 #10
0
        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));
        }
コード例 #11
0
 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();
     }
 }
コード例 #12
0
 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));
     }
 }
コード例 #13
0
ファイル: frmGlobalSearch.xaml.cs プロジェクト: jaywha/RApID
        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);
        }
コード例 #14
0
 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;
 }
コード例 #15
0
        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();
            }
        }
コード例 #16
0
 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));
         }
     }
 }
コード例 #17
0
        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;
        }
コード例 #18
0
        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;
            }
        }
コード例 #19
0
        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;
            }
        }
コード例 #20
0
        /// <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();
        }
コード例 #21
0
        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 = "";
            }
        }
コード例 #22
0
        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()));
                };
            }
        }
コード例 #23
0
        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
            };
        }
コード例 #24
0
        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()));
                };
            }
        }
コード例 #25
0
 private void BtnReload_Click(object sender, RoutedEventArgs e)
 {
     MainWindow.Share.Reload();
     System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(uiList.ItemsSource);
     view.Refresh();
 }
コード例 #26
0
 private void CloseDetail()
 {
     winDetail.Visibility = Visibility.Hidden;
     System.ComponentModel.ICollectionView view = CollectionViewSource.GetDefaultView(uiList.ItemsSource);
     view.Refresh();
 }
コード例 #27
0
 private void btnNext_Click(object sender, RoutedEventArgs e)
 {
     System.ComponentModel.ICollectionView navigationView = CollectionViewSource.GetDefaultView(phoneNumbersDataSet.PhoneNumbers);
     navigationView.MoveCurrentToNext();
 }
コード例 #28
0
 public static bool IsDefaultView(System.ComponentModel.ICollectionView view)
 {
     return(default(bool));
 }
コード例 #29
0
 /// <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;
 }
コード例 #30
0
 public void SelectAllItems(System.ComponentModel.ICollectionView availableItemsCollectionView)
 {
 }
コード例 #31
0
ファイル: ViewFilter.cs プロジェクト: mdjabirov/C1Decompiled
 // ** ctor
 public ViewFilter(System.ComponentModel.ICollectionView view)
 {
     _view = view;
 }