private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            // Constructor is too early for setting these properties.

            // The live sorting/grouping/filtering feature is a very expensive one so be careful to activate it only if needed
            // and only the one you actually need. It may be a good idea too to de-activate it when it’s no more needed.
            computersDataGrid.Items.IsLiveFiltering = true;
            foreach (string propertie in ObservableHost.GetLiveFilteringProperties())
            {
                computersDataGrid.Items.LiveFilteringProperties.Add(propertie);
            }

            projectsDataGrid.Items.IsLiveFiltering = true;
            foreach (string propertie in ObservableProject.GetLiveFilteringProperties())
            {
                projectsDataGrid.Items.LiveFilteringProperties.Add(propertie);
            }

            tasksDataGrid.Items.IsLiveFiltering = true;
            foreach (string propertie in ObservableTask.GetLiveFilteringProperties())
            {
                tasksDataGrid.Items.LiveFilteringProperties.Add(propertie);
            }

            transfersDataGrid.Items.IsLiveFiltering = true;
            foreach (string propertie in ObservableTransfer.GetLiveFilteringProperties())
            {
                transfersDataGrid.Items.LiveFilteringProperties.Add(propertie);
            }
        }
Example #2
0
        private async Task UpdateTransfers(HostState hostState)
        {
            await hostState.BoincState.UpdateFileTransfers();

            if (!_useObservableCollections)
            {
                return;
            }

            foreach (BoincRpc.FileTransfer fileTransfer in hostState.BoincState.FileTransfers)
            {
                ObservableTransfer transfer = Transfers.FirstOrDefault(tvm => tvm.HostId == hostState.Id && tvm.FileName == fileTransfer.Name);
                if (transfer == null)
                {
                    transfer = new ObservableTransfer(hostState, fileTransfer);
                    if (string.IsNullOrEmpty(SearchString))
                    {
                        Transfers.Add(transfer);
                    }
                    else
                    {
                        foreach (var content in transfer.GetContentsForFiltering())
                        {
                            if (content != null && content.IndexOf(SearchString, StringComparison.InvariantCultureIgnoreCase) != -1)
                            {
                                // The search string is found in any of the Models's property
                                Transfers.Add(transfer);
                                break;
                            }
                        }
                    }
                }
                else
                {
                    transfer.Update(fileTransfer);
                }
            }
        }
Example #3
0
 public TransferDetailViewModel(ObservableTransfer transfer)
 {
     Title    = transfer.FileName;
     Transfer = transfer;
 }