示例#1
0
        public IActionResult Login([FromBody] JObject jObject)
        {
            bool result = QBittorrentHelper.TryLogin(jObject["Host"].Value <string>(),
                                                     jObject["Username"].Value <string>(),
                                                     jObject["Password"].Value <string>(),
                                                     out string cookieValue);

            return(new JsonResult(new
            {
                IsSuccess = result,
                LoginCookie = cookieValue
            }));
        }
示例#2
0
        public MainWindow()
        {
            List <string> categoryList = ConfigurationManager.AppSettings["CategoryList"].Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries).ToList();

            categoryList.ForEach(this.CategoryList.Add);

            this.Command_SetCategory = new CustomCommand {
                CustomCanExecuteFunc = (obj) => true,
                CustomExecutAction   = (obj) => { this.Category = obj.ToString(); },
            };

            this.Command_AddTorrent = new CustomCommand {
                CustomCanExecuteFunc = (obj) => !string.IsNullOrEmpty(this.Category) && !string.IsNullOrEmpty(((App)Application.Current).FullPath),
                CustomExecutAction   = async(obj) => {
                    await QBittorrentHelper.AddTorrent(((App)Application.Current).FullPath, this.Category);

                    Application.Current.Shutdown();
                },
            };

            this.InitializeComponent();
        }