private void reloadList() { AriaUtil.JsonRequestAsync("aria2.tellActive", null, (ent) => { if (ent.Result != null) { MissionList = ent.Result.ToObject <ObservableCollection <MissionItem> >(); reloadListSource(); } }); AriaUtil.JsonRequestAsync("aria2.tellStopped", JToken.FromObject(new List <int> { 0, 9999 }), (ent) => { if (ent.Result != null) { PausedMissionList = ent.Result.ToObject <ObservableCollection <MissionItem> >(); } }); AriaUtil.JsonRequestAsync("aria2.tellWaiting", JToken.FromObject(new List <int> { 0, 9999 }), (ent) => { if (ent.Result != null) { WaittingMissionList = ent.Result.ToObject <ObservableCollection <MissionItem> >(); } }); }
private void Button_Click_3(object sender, RoutedEventArgs e) { Button btn = sender as Button; string gid = btn.Tag as string; AriaUtil.JsonRequestAsync("aria2.unpause", JToken.FromObject(new List <string> { gid }), (ent) => { reloadList(); }); }
private void MenuItem_Click(object sender, RoutedEventArgs e) { if (urlListBox.SelectedItems.Count > 0) { List <string> uri = new List <string>(); foreach (string item in urlListBox.SelectedItems) { uri.Add(item); } AriaUtil.AddURI(uri, (ent) => { Debug.WriteLine(ent); }); } }
private void Button_Click_5(object sender, RoutedEventArgs e) { System.Windows.Forms.OpenFileDialog ofd = new System.Windows.Forms.OpenFileDialog(); ofd.Filter = "*.torrent|*.torrent"; if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { byte[] fileBuffer = File.ReadAllBytes(ofd.FileName); string base64Str = Convert.ToBase64String(fileBuffer); AriaUtil.JsonRequestAsync("aria2.addTorrent", JToken.FromObject(new List <string> { base64Str }), (ent) => { //Debug.WriteLine(ent); }); } }
private void MetroWindow_Loaded(object sender, RoutedEventArgs e) { if (!AriaUtil.IsRunning()) { AriaUtil.Start(); } else { reloadList(); } timer = new System.Timers.Timer(); timer.Enabled = true; timer.Interval = 1000; timer.Elapsed += Timer_Elapsed; timer.Start(); }
private async void Button_Click(object sender, RoutedEventArgs e) { var input = await this.ShowInputAsync("WinAria", Settings.GetLanguage(Resources)["EnterURLOrMagnet"].ToString()); if (input != null) { List <List <string> > files = new List <List <string> > { new List <string> { input } }; AriaUtil.JsonRequestAsync("aria2.addUri", JToken.FromObject(files), (ent) => { if (ent.Result != null) { reloadList(); } }); } }
private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { AriaUtil.JsonRequestAsync("aria2.shutdown", null, (ent) => { }); }