Exemple #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
#if DEBUG
            LanguageEngine.SaveDummy();
#endif
            NotifyIcon.Icon = new System.Drawing.Icon("Assets/icon-16.ico");
            this.Icon       = new BitmapImage(new Uri("Assets/icon-allsizes.ico", UriKind.Relative));
            this.Icon.Freeze();

            var cts = new CancellationTokenSource();

            state = new State
            {
                uiContext = uiContext,
                MainTaskCancellationTokenSource = cts
            };

            Task.Run(() => Update(cts.Token), cts.Token);

            this.DataContext          = new NiceDataContext <MainWindow>(this);
            this.mainlist.ItemsSource = this.state.Torrents;

            itemselector = ShowAll;

            graph = new GraphDrawer(graph_canvas);

            foreach (string str in App.to_add)
            {
                if (Utility.IsMagnetLink(str))
                {
                    state.AddTorrentByMagnet(str);
                }
                else
                {
                    state.AddTorrentByPath(str);
                }
            }

            feeds_tree_item.ItemsSource = FeedsManager.EntriesList;

            if (!App.Settings.ImportedTorrents)
            {
                ImportTorrents();
            }
            Utility.ReloadTheme(App.Settings.Theme);


            if (App.Settings.CheckForUpdates)
            {
                StartAutoUpdater();
            }
        }
Exemple #2
0
        private void Window_Drop(object sender, DragEventArgs e)
        {
            var data = ((DataObject)e.Data);

            if (data.ContainsText())
            {
                string text = (string)data.GetData(typeof(string));
                if (!string.IsNullOrWhiteSpace(text))
                {
                    if (Utility.IsMagnetLink(text))
                    {
                        state.AddTorrentByMagnet(text);
                    }
                }
            }
            else
            {
                string toppest = (string)data.GetFileDropList()[0];
                state.AddTorrentByPath(toppest);
            }
        }
Exemple #3
0
 public void AddTorrentByMagnet(string magnet)
 {
     State.AddTorrentByMagnet(magnet);
 }