Esempio n. 1
0
 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> >();
         }
     });
 }
Esempio n. 2
0
        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();
            });
        }
Esempio n. 3
0
 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);
         });
     }
 }
Esempio n. 4
0
        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();
                    }
                });
            }
        }
Esempio n. 5
0
 private void MetroWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     AriaUtil.JsonRequestAsync("aria2.shutdown", null, (ent) => {
     });
 }