private async void DeleteButton_Click(object sender, RoutedEventArgs e) { selectedTorrentIndex = TorrentsDataGrid.SelectedIndex; if (selectedTorrentIndex > -1 && selectedTorrentIndex < torrentClient.GetCurrentTorrentsCount()) { await torrentClient.Pause(selectedTorrentIndex); var deleteTorrentWindow = new DeleteTorrentWindow(); deleteTorrentWindow.Owner = this; deleteTorrentWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner; deleteTorrentWindow.TorrentsFolderPath = torrentClient.pathsManager.TorrentsPath; deleteTorrentWindow.DownloadFolderPath = torrentClient.pathsManager.DownloadsPath; deleteTorrentWindow.DeletedTorrentManager = torrentClient.GetTorrentManager(selectedTorrentIndex); deleteTorrentWindow.ShowDialog(); if (deleteTorrentWindow.IsNoChangingExit == false) { torrentClient.DeleteTorrentManager(selectedTorrentIndex); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.DeleteTorrentWindow1 = ((Torrent.DeleteTorrentWindow)(target)); return; case 2: this.DeleteFromTorrentsFolderCheckBox = ((System.Windows.Controls.CheckBox)(target)); return; case 3: this.DeleteFromDownloadsFolderCheckBox = ((System.Windows.Controls.CheckBox)(target)); return; case 4: this.DeleteButton = ((System.Windows.Controls.Button)(target)); #line 13 "..\..\..\DeleteTorrentWindow.xaml" this.DeleteButton.Click += new System.Windows.RoutedEventHandler(this.DeleteButton_Click); #line default #line hidden return; case 5: this.DeleteButton_Copy = ((System.Windows.Controls.Button)(target)); #line 18 "..\..\..\DeleteTorrentWindow.xaml" this.DeleteButton_Copy.Click += new System.Windows.RoutedEventHandler(this.DeleteButton_Copy_Click); #line default #line hidden return; } this._contentLoaded = true; }