Ejemplo n.º 1
0
        // Notes:
        //  - The exchange has a total and a held value.
        //  - For a given fund, the maximum it can be allocated is the exchange's 'available' amount
        //    plus the held amount of the fund, because the funds total includes it's held amount.

        public FundAllocationsUI(Window owner, Model model)
        {
            InitializeComponent();
            Icon  = owner?.Icon;
            Owner = owner;
            Model = model;

            Filter    = new CoinFilter(x => (CoinDataAdapter)x);
            Exchanges = new ListCollectionView(model.TradingExchanges.ToList());
            Funds     = new ListCollectionView(model.Funds)
            {
                Filter = x => ((Fund)x).Id != Fund.Main
            };
            Coins = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData))
            {
                Filter = Filter.Predicate
            };

            Exchanges.CurrentChanged += delegate { Coins.Refresh(); };
            Funds.CurrentChanged     += delegate { Coins.Refresh(); };
            Filter.PropertyChanged   += delegate { Coins.Refresh(); };

            Accept      = Command.Create(this, Close);
            DataContext = this;
        }
Ejemplo n.º 2
0
 private void ClassComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (spellView != null)
     {
         spellView.Refresh();
     }
 }
Ejemplo n.º 3
0
        public void Update(SortArgument sort_argument)
        {
            // Find comparer
            var comparer = comparers.Find(c => c.Property == sort_argument.Property);

            if (sort_argument.Direction.HasValue) // Sort direction is NOT null, so this is either a new sort property or an old property that must change direction
            {
                if (comparer != null)             // This is an old property that must change direction
                {
                    comparer.Direction = sort_argument.Direction.Value;
                    view.Refresh();
                }
                else // This is a new sort property that must be added
                {
                    Add(factory.Create(sort_argument));
                }
            }
            else // Sort direction is null, so old comparers/sorters must be removed
            {
                if (comparer != null)
                {
                    Remove(comparer);
                }
            }
        }
Ejemplo n.º 4
0
 void  Character_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "IsHidden" || e.PropertyName == "IsIdle")
     {
         _CurrentPlayerView.Refresh();
     }
 }
Ejemplo n.º 5
0
        public GridFunds(Model model)
        {
            InitializeComponent();
            m_grid.MouseRightButtonUp += DataGrid_.ColumnVisibility;
            DockControl = new DockControl(this, "Funds");

            Model     = model;
            Filter    = new CoinFilter(x => (CoinDataAdapter)x);
            Exchanges = CollectionViewSource.GetDefaultView(model.Exchanges);            // { Filter = x => !(x is CrossExchange) };
            CoinsView = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData))
            {
                Filter = Filter.Predicate
            };
            Funds = new ListCollectionView(model.Funds);

            //Exchanges.MoveCurrentToFirst();
            Exchanges.CurrentChanged += delegate { CoinsView.Refresh(); };
            Filter.PropertyChanged   += delegate { CoinsView.Refresh(); };

            // Commands
            CreateNewFund         = Command.Create(this, CreateNewFundInternal);
            RemoveFund            = Command.Create(this, RemoveFundInternal);
            ResetSort             = Command.Create(this, ResetSortInternal);
            ShowFundAllocationsUI = Command.Create(this, ShowFundAllocationsUIInternal);

            CreateFundColumns();
            DataContext = this;
        }
Ejemplo n.º 6
0
 private void FitterGeneralText_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (lcv == null)
     {
         return;
     }
     lcv.Refresh();
 }
 private void FitterSearchComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     if (lcv == null)
     {
         return;
     }
     lcv.Refresh();
 }
Ejemplo n.º 8
0
        // Update world ID and refresh display
        private void setWorldId(int worldId)
        {
            if (eventContainer.ItemsSource == null)
            {
                eventContainer.Items.Clear();
                eventContainer.ItemsSource = eventView;
            }

            this.worldId = worldId;
            eventDictionary.Clear();
            eventList.Clear();
            ((EventItemComparer)eventView.CustomSort).updateCurrentTimestamp();
            eventView.Refresh();
            updateTimers();
        }
Ejemplo n.º 9
0
        private void TesterDataGrid_Sorting(object sender, DataGridSortingEventArgs e)
        {
            if (IsGroupingEnabledCheckBox.IsChecked == false)
            {
                return;
            }

            var column     = e.Column;
            var headerName = column.Header.ToString();

            if (ShouldBeGrouped(headerName) == false)
            {
                return;
            }

            e.Handled = true;

            var sortDirection = column.SortDirection == ListSortDirection.Ascending ?
                                ListSortDirection.Descending : ListSortDirection.Ascending;

            DataGridSortAndGroupBehaviour(headerName, sortDirection);

            ListCollectionView source = (sender as System.Windows.Controls.DataGrid).ItemsSource as ListCollectionView;

            if (source == null)
            {
                return;
            }

            column.SortDirection = sortDirection;
            source.Refresh();
        }
Ejemplo n.º 10
0
        public BackTestingBalancesUI(Window owner, Model model)
        {
            InitializeComponent();
            Owner = owner;
            Icon  = owner?.Icon;

            InitialBalances = new ExchToBalance();
            Exchanges       = new ListCollectionView(model.TradingExchanges.ToList());
            Coins           = new ListCollectionView(ListAdapter.Create(model.Coins, x => new CoinDataAdapter(this, x), x => x.CoinData));

            Exchanges.CurrentChanged += delegate { Coins.Refresh(); };

            // Commands
            Accept = Command.Create(this, AcceptInternal);

            // Initialise the initial balance from settings
            foreach (var exch_data in SettingsData.Settings.BackTesting.AccountBalances.Exchanges)
            {
                foreach (var bal_data in exch_data.Balances)
                {
                    InitialBalances[exch_data.ExchangeName][bal_data.Symbol] = bal_data.Total;
                }
            }

            DataContext = this;
        }
        private void Sort(GridViewColumnHeader columnHeader, ListSortDirection direction)
        {
            String columnName = columnHeader.Content as String;

            String memberName = "";

            if (columnHeader.Content as String == "Loan #")
            {
                memberName = "LoanNumber";
            }
            else
            {
                var dmb = columnHeader.Column.DisplayMemberBinding;
                if (dmb is Binding)
                {
                    memberName = (dmb as Binding).Path.Path.ToString();
                }
            }

            if (!String.IsNullOrEmpty(memberName))
            {
                ListCollectionView dataView = CollectionViewSource.GetDefaultView(lvw.ItemsSource) as ListCollectionView;
                dataView.SortDescriptions.Clear();
                SortDescription sd = new SortDescription(memberName, direction);
                dataView.SortDescriptions.Add(sd);
                dataView.Refresh();
            }
        }
        private void FilterFields(string text)
        {
            ListCollectionView dataView = CollectionViewSource.GetDefaultView(lvwFields.ItemsSource) as ListCollectionView;

            if (String.IsNullOrEmpty(text))
            {
                dataView.Filter = null;
                return;
            }

            text            = text.ToLower();
            dataView.Filter = (obj) => {
                var field = obj as FieldDescriptor;

                if (field != null)
                {
                    if (field.DisplayName.ToLower().Contains(text))
                    {
                        return(true);
                    }

                    if (field.Description.ToLower().Contains(text))
                    {
                        return(true);
                    }

                    return(false);
                }
                return(true);
            };

            dataView.Refresh();
        }
        /// <summary>
        /// Removes all items from list collection view.
        /// </summary>
        /// <param name="theViewToUpdate">The view to update.</param>
        public static void RemoveAllItemsFromListCollectionView(this ListCollectionView theViewToUpdate)
        {
            //remove new item place holder

            if (theViewToUpdate.NewItemPlaceholderPosition != NewItemPlaceholderPosition.None)
            {
                theViewToUpdate.NewItemPlaceholderPosition = NewItemPlaceholderPosition.None;
            }

            if (theViewToUpdate.Count > 0)
            {
                int index = 0;

                var theItem = theViewToUpdate.GetItemAt(index);

                while (theItem != null)
                {
                    theViewToUpdate.Remove(theItem);

                    if (theViewToUpdate.Count > 0)
                    {
                        theItem = theViewToUpdate.GetItemAt(index);
                    }

                    else
                    {
                        theItem = null;
                    }
                }

                theViewToUpdate.Refresh();
            }
        }
Ejemplo n.º 14
0
        private void UpdateMyMusicList(MyMusicListItem myMusicListItem)
        {
            FieldCollection fc = new FieldCollection();

            int internalFieldsCount = 0;

            foreach (Field field in internalFields)
            {
                if (this.trackListFields.SingleOrDefault(x => x.Field == field) == null)
                {
                    fc.Add(field);
                    internalFieldsCount++;
                }
            }

            fc.AddRange(this.trackListFields.GetFields());

            int soundFileIndex = fc.IndexOf(Field.TrackSoundFile);

            DataBaseView view = TrackView.CreateView(DataBase, fc, trackListSort, myMusicListItem.ID);

            object[] values = view.Read();

            FillRowValues(myMusicListItem, values, soundFileIndex, internalFieldsCount);

            ListCollectionView lcv = this.dataGrid.ItemsSource as ListCollectionView;

            lcv.Refresh();
        }
Ejemplo n.º 15
0
        public MainWindowVm()
        {
            Logger.Info("Initializing MainWindow View Model");
            TagEditorVm      = new TagEditorVm();
            BpmCalc          = new BpmTapper();
            CurrentSongIndex = 0;
            MainPlayer       = new NAudioPlayer(App.Configuration.MainPlayerDeviceNum, true);
            PreviewPlayer    = new NAudioPlayer(App.Configuration.SecondaryPlayerDeviceNum,
                                                App.Configuration.UpdatePlaycountOnPreview);
            MainPlayer.Volume    = App.Configuration.MainPlayerVolume;
            PreviewPlayer.Volume = App.Configuration.SecondaryPlayerVolume;

            MainPlayer.SongCompletedEvent += (sender, args) =>
            {
                Logger.Info("Song completed; playing next song");
                NextCmd.Execute(null);
            };

            MainPlayer.PropertyChanged    += MainPlayerPropertyChanged;
            PreviewPlayer.PropertyChanged += PreviewPlayerPropertyChanged;

            _columnManager = new ColumnManager();

            BindingOperations.EnableCollectionSynchronization(
                App.SongDb.Songs,
                (App.SongDb.Songs as ICollection).SyncRoot);
            BindingOperations.EnableCollectionSynchronization(
                App.SongDb.GroupCategories,
                (App.SongDb.GroupCategories as ICollection).SyncRoot);

            lock ((App.SongDb.Songs as ICollection).SyncRoot)
            {
                DisplayedSongs = new ListCollectionView(App.SongDb.Songs);
            }

            lock ((App.SongDb.GroupCategories as ICollection).SyncRoot)
            {
                AddGroupDescriptions(0, App.SongDb.GroupCategories);
                App.SongDb.GroupCategories.CollectionChanged +=
                    GroupCategoriesCollectionChanged;
                lock (_displayedSongs)
                {
                    DisplayedSongs.Filter = SongFilter;
                    DisplayedSongs.Refresh();
                }
            }

            lock ((App.SongDb.Columns as ICollection).SyncRoot)
            {
                ((App.SongDb.Columns) as INotifyCollectionChanged).CollectionChanged
                    += OnColumnsChange;
                foreach (var col in App.SongDb.Columns)
                {
                    AddColumn(col);
                }
            }

            SongQueue = new ObservableCollection <Song>();
            Logger.Info("Done initializing MainWindow view model");
        }
Ejemplo n.º 16
0
 private void ActionPropertyChanged(object sender, PropertyChangedEventArgs e)
 {
     if (_propertiesThatCauseRefresh.Contains(e.PropertyName))
     {
         _view.Refresh();
     }
 }
Ejemplo n.º 17
0
        private void OnLangClick(object sender, RoutedEventArgs e)
        {
            if (ReferenceEquals(sender, RussianLang))
            {
                EnglishLang.IsChecked = !RussianLang.IsChecked;
            }
            else
            {
                RussianLang.IsChecked = !EnglishLang.IsChecked;
            }

            SelectedLanguage = EnglishLang.IsChecked == true ? Languages.English : Languages.Russian;

            _featuresView.CustomSort = new LanguageSorter(SelectedLanguage);
            _featuresView.Refresh();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// удаляем элемент из listview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click_1(object sender, RoutedEventArgs e)
        {
            //if (DeleteRequest != null)
            //{

            //    DeleteRequest.Raise(
            //        new Confirmation()
            //            {
            //                Title = "Remove label?",
            //                Content = "Are you sure you want to delete the note?"
            //            },
            //            (x) =>
            //            {
            //                if (x.Confirmed)
            //                {
            models.Label labelToCombo = (sender as Button).DataContext as models.Label;
            _labelsForCombobox.Add(labelToCombo);
            _labelsForListView.Remove(labelToCombo);
            //}

            _labelCollectionView.Refresh();
            //            }
            //        );
            //}
        }
Ejemplo n.º 19
0
        private void viewModel_SequenceUpdated(object sender, EventArgs e)
        {
            CollectionViewSource source = (CollectionViewSource)(this.Resources["SequenceView"]);
            ListCollectionView   view   = (ListCollectionView)source.View;

            if (view != null && view.Groups != null && view.Groups.Count > 0)
            {
                view.Refresh();
                CollectionViewGroup cvg = view.Groups.First() as CollectionViewGroup;
                if (cvg.Name.ToString() == Constants.HOLDING_CHARACTERS_GROUP_NAME && view.Groups.Count > 1)
                {
                    cvg = view.Groups[1] as CollectionViewGroup;
                }
                GroupItem groupItem = this.SequenceViewListBox.ItemContainerGenerator.ContainerFromItem(cvg) as GroupItem;
                if (groupItem != null)
                {
                    groupItem.UpdateLayout();
                    Expander expander = Helper.GetDescendantByType(groupItem, typeof(Expander)) as Expander;
                    if (expander != null)
                    {
                        expander.IsExpanded = true;
                    }
                }
            }
        }
        private void viewModel_RosterUpdated(object sender, EventArgs e)
        {
            CollectionViewSource source = (CollectionViewSource)(this.Resources["ParticipantsView"]);
            ListCollectionView   view   = (ListCollectionView)source.View;

            if (view != null && view.Groups != null && view.Groups.Count > 1)
            {
                view.Refresh();
                foreach (CollectionViewGroup cvg in view.Groups)
                {
                    if (rosterGroupExpansionStates.ContainsKey(cvg.Name.ToString()))
                    {
                        bool isExpanded = rosterGroupExpansionStates[cvg.Name.ToString()];
                        if (isExpanded)
                        {
                            GroupItem groupItem = this.RosterViewListBox.ItemContainerGenerator.ContainerFromItem(cvg) as GroupItem;
                            if (groupItem != null)
                            {
                                groupItem.UpdateLayout();
                                Expander expander = ControlUtilities.GetDescendantByType(groupItem, typeof(Expander)) as Expander;
                                if (expander != null)
                                {
                                    expander.IsExpanded = true;
                                }
                            }
                        }
                    }
                }
            }
        }
 private void Control_Changed(object sender, TextChangedEventArgs e)
 {
     if (dgListers.ItemsSource != null)
     {
         ListCollectionView view = (ListCollectionView)CollectionViewSource.GetDefaultView(dgListers.ItemsSource);
         view.Filter = delegate(object item)
         {
             Lister l = (Lister)item;
             if (txtFirstName.Text != "" && !l.FirstName.Contains(txtFirstName.Text))
             {
                 return(false);
             }
             if (txtLastName.Text != "" && !l.LastName.Contains(txtLastName.Text))
             {
                 return(false);
             }
             if (cmboGender.SelectedIndex > 0)
             {
                 return((cmboGender.SelectedIndex == 1) ? (l.Gender == "ذكر") : (l.Gender == "أنثى"));
             }
             return(true);
         };
         view.Refresh();
     }
 }
Ejemplo n.º 22
0
 private void FeatFilterTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (_FeatsView != null)
     {
         _FeatsView.Refresh();
     }
 }
Ejemplo n.º 23
0
        private void Sort(String columnName, ListSortDirection direction)
        {
            string memberName = "";

            switch (columnName)
            {
            case "Code":
                memberName = "RefCode";
                break;

            case "Year":
                memberName = "YearOfPub";
                break;

            case "Journal":
                memberName = "JournalName";
                break;

            case "Page(s)":
                memberName = "Pages";
                break;

            default:
                memberName = columnName;
                break;
            }

            ListCollectionView dataView = CollectionViewSource.GetDefaultView(lvwResults.ItemsSource) as ListCollectionView;

            dataView.SortDescriptions.Clear();
            SortDescription sd = new SortDescription(memberName, direction);

            dataView.SortDescriptions.Add(sd);
            dataView.Refresh();
        }
Ejemplo n.º 24
0
        private void InitUIList()
        {
            needAddList    = new ObservableCollection <EmployeeInfo>();
            needUpdateList = new ObservableCollection <EmployeeInfo>();
            //添加职务、部门及在职状态选择列表
            AlgorithmClass.InitEmployeeSelectionList(dataManager.AllEmployeeList, dataManager.AllPostList, dataManager.AllDepartmentList, AlgorithmClass.GetWorkStatusList());
            AllEmployeeList = AlgorithmClass.DeepClone <ObservableCollection <EmployeeInfo> >(dataManager.AllEmployeeList);
            lcv             = new ListCollectionView(AllEmployeeList);
            lcv.Filter      = Fitter_TextChanged;
            lcv.Refresh();

            SaveBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            RestoreBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });
            PrintBtn.SetBinding(Button.IsEnabledProperty, new Binding("IsEmpty")
            {
                Source = lcv, Converter = new BoolConverter()
            });

            EmployeeDataGrid.ItemsSource = lcv;
        }
Ejemplo n.º 25
0
 /// <summary>
 ///     Cancel pending edits and then execute a refresh on the collection view to prevent any exceptions thrown.
 /// </summary>
 /// <param name="collectionView">The list collection view that should be refreshed.</param>
 public static void SafeRefresh(this ListCollectionView collectionView)
 {
     if (collectionView.IsEditingItem)
     {
         collectionView.CancelEdit();
     }
     collectionView.Refresh();
 }
Ejemplo n.º 26
0
 void AddOnClick(object sender, RoutedEventArgs args)
 {
     Person person = new Person();
     people.Add(person);
     lstbox.SelectedItem = person;
     pnlPerson.Children[1].Focus();
     collview.Refresh();
 }
        private void ClearFilter(ListView lvw, DelayedTriggerTextbox txtbox)
        {
            ListCollectionView dataView = CollectionViewSource.GetDefaultView(lvw.ItemsSource) as ListCollectionView;

            dataView.Filter = null;
            dataView.Refresh();
            txtbox.Text = "";
        }
Ejemplo n.º 28
0
 protected override void OnSearch()
 {
     //foreach (Tawo item in Items)
     //{
     //item.Refresh(nameof(item.Fullname));
     //}
     Items.Refresh();
 }
        public MainViewModel(IDiagnosticsViewModel diagnosticsViewModel,
                             ITabularDataService tabularDataService,
                             IColumnsService columnsService,
                             IOverlayService overlayService,
                             IDateTimeService dateTimeService,
                             ISchedulerService schedulerService)
        {
            _tabularDataService = tabularDataService;
            _schedulerService   = schedulerService;
            _columnsService     = columnsService;
            _overlayService     = overlayService;
            _dateTimeService    = dateTimeService;
            Diagnostics         = diagnosticsViewModel;

            _dataIds        = new Dictionary <object, DynamicDataViewModel>(1000);
            _data           = new CustomTypeRangeObservableCollection <DynamicDataViewModel>();
            _collectionView = new ListCollectionView(_data)
            {
                Filter = FilterData
            };

            _updateStats = new Dictionary <long, int>();

            RefreshCommand = ReactiveCommand.Create()
                             .DisposeWith(this);

            ClearCommand = ReactiveCommand.Create()
                           .DisposeWith(this);

            ColumnPickerCommand = ReactiveCommand.Create(HasDataChanged)
                                  .DisposeWith(this);

            _dataStream = InitialiseAndProcessDataAsync()
                          .DisposeWith(this);

            RefreshCommand.Subscribe(x => Refresh())
            .DisposeWith(this);

            ClearCommand.Subscribe(x => Clear())
            .DisposeWith(this);

            ColumnPickerCommand.Subscribe(x => ShowColumnPicker())
            .DisposeWith(this);

            _suspendNotifications = new SerialDisposable()
                                    .DisposeWith(this);

            FilterChanged.Subscribe(x => _collectionView.Refresh())
            .DisposeWith(this);

            ColumnsChanged.ObserveOn(schedulerService.Dispatcher)
            .Subscribe(x => OnPropertyChanged(nameof(VisibleColumns)))
            .DisposeWith(this);

            Disposable.Create(() => Clear())
            .DisposeWith(this);
        }
Ejemplo n.º 30
0
 private void OnObservablePlaylistOnPropertyChanged(object _, PropertyChangedEventArgs __)
 {
     try
     {
         synchronization.Send(x => playlist.Refresh(), null); // Sometimes throws ugly exceptions from deep within wpf
     }
     catch (Exception e)
     { }
 }
Ejemplo n.º 31
0
        public MainPageViewModel(INavigationService navigationService, IEventAggregator eventAggregator,
                                 SettingsHelper settingsHelper, SettingsViewModel settingsViewModel,
                                 SettingsPaneViewModel settingsPaneViewModel, FilterListViewModel filterListViewModel,
                                 ListFilterViewModel listFilterViewModel, TorrentWindowViewModel torrentWindowViewModel,
                                 ErrorTracker errorTracker)
        {
            _errorTracker = errorTracker;
            _uriQueue = new List<string>();
            _torrentsQueue = new List<TorrentFileData>();

            _settingsHelper = settingsHelper;
            _eventAggregator = eventAggregator;
            _navigationService = navigationService;

            FilterList = filterListViewModel;
            ListFilter = listFilterViewModel;
            SettingsPane = settingsPaneViewModel;
            Settings = settingsViewModel;
            TorrentWindow = torrentWindowViewModel;

            backingTorrents = new ObservableCollection<TorrentViewModel>();
            Torrents = new ListCollectionView(backingTorrents);
            SelectedItems = new ObservableCollection<TorrentViewModel>();

            ChangeOrder(settingsHelper.GetSetting<bool>(SettingType.OrderByQueue));
            Torrents.Filter = ListFilter.GetFilter(Filter.All);

            ClearCommand = new DelegateCommand(() => ClearSelection());
            SelectAllCommand = new DelegateCommand(() => SelectAll());
            ForceStartCommand = new DelegateCommand(() => ChangeTorrentState(StateType.ForceStart));
            PauseCommand = new DelegateCommand(() => ChangeTorrentState(StateType.Stop));
            StartCommand = new DelegateCommand(() => ChangeTorrentState(StateType.Start));
            VerifyCommand = new DelegateCommand(() => ChangeTorrentState(StateType.Verify));
            ShowAddTorrentCommand = new DelegateCommand(() => TorrentWindow.Open(Purpose.Add, Server.DefaultDownloadLocation));
            ShowMoveTorrentsCommand = new DelegateCommand(() => TorrentWindow.Open(Purpose.Move, Server.DefaultDownloadLocation, SelectedItems));
            ShowConfirmDeleteCommand = new DelegateCommand(() => TorrentWindow.Open(Purpose.Delete, Server.DefaultDownloadLocation, SelectedItems));

            _eventAggregator.GetEvent<AddTorrent>().Subscribe(AddTorrents);
            _eventAggregator.GetEvent<DeleteTorrents>().Subscribe(Delete);
            _eventAggregator.GetEvent<MoveTorrents>().Subscribe(MoveTorrents);
            _eventAggregator.GetEvent<SearchChanged>().Subscribe(query => Torrents.Refresh());
            _eventAggregator.GetEvent<SearchCleared>().Subscribe(_ => Torrents.Refresh());
            _eventAggregator.GetEvent<PriorityChanged>().Subscribe(PriorityChanged);
            _eventAggregator.GetEvent<WantedChanged>().Subscribe(WantedChanged);
            _eventAggregator.GetEvent<FilterChanged>().Subscribe(FilterChanged);
            _eventAggregator.GetEvent<OrderByQueueSettingChanged>().Subscribe(orderByQueue => ChangeOrder(orderByQueue));
            _eventAggregator.GetEvent<FileActivated>().Subscribe(FileActivated);
            _eventAggregator.GetEvent<URIActivated>().Subscribe(URIActivated);
            _eventAggregator.GetEvent<ServerLoaded>().Subscribe(ProcessQueues);

            SelectedItems.CollectionChanged += (s, e) =>
            {
                SelectionChange();
            };
        }