Exemplo n.º 1
0
        void btnMoveRight_Click(object sender, RoutedEventArgs e)
        {
            if (lbUnselectedTorrentSources.SelectedItem == null)
            {
                return;
            }

            TorrentSourceVM ts = lbUnselectedTorrentSources.SelectedItem as TorrentSourceVM;

            UserSettingsVM.Instance.AddTorrentSource(ts.TorrentSource);
        }
Exemplo n.º 2
0
        void btnMoveUp_Click(object sender, RoutedEventArgs e)
        {
            if (lbSelectedTorrentSources.SelectedItem == null)
            {
                return;
            }

            TorrentSourceVM ts = lbSelectedTorrentSources.SelectedItem as TorrentSourceVM;

            int newPos = UserSettingsVM.Instance.MoveUpTorrentSource(ts.TorrentSource);

            if (newPos >= 0)
            {
                lbSelectedTorrentSources.SelectedIndex = newPos;
                lbSelectedTorrentSources.Focus();
            }
        }
        private void CommandBinding_BrowseTorrents(object sender, ExecutedRoutedEventArgs e)
        {
            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

            this.Cursor = Cursors.Wait;

            try
            {
                Window parentWindow = Window.GetWindow(this);
                this.IsEnabled = false;

                if (obj.GetType() == typeof(TorrentSourceVM))
                {
                    TorrentSourceVM tor = obj as TorrentSourceVM;

                    TorrentLinks.Clear();
                    ViewTorrentLinks.Refresh();

                    List <TorrentLinkVM> links = tor.BrowseTorrents();
                    TorrentCount = links.Count;

                    foreach (TorrentLinkVM link in links)
                    {
                        TorrentLinks.Add(link);
                    }

                    ViewTorrentLinks.Refresh();
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
            finally
            {
                this.Cursor    = Cursors.Arrow;
                this.IsEnabled = true;
            }
        }
Exemplo n.º 4
0
        private void CommandBinding_ToggleSource(object sender, ExecutedRoutedEventArgs e)
        {
            //object obj = lbGroupsSeries.SelectedItem;
            object obj = e.Parameter;

            if (obj == null)
            {
                return;
            }

            try
            {
                if (obj.GetType() == typeof(TorrentSourceVM))
                {
                    TorrentSourceVM src = (TorrentSourceVM)obj;
                    src.IsEnabled = !src.IsEnabled;
                }
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }