コード例 #1
0
        /// <summary>
        /// Pushes new upload data task into the task list
        /// </summary>
        private void UploadData(IJson data)
        {
            string role = _role == MultiplayerRole.Host ? "host" : "opponent";

            _uploadTask?.AddTask(Task.Run(() =>
            {
                if (_cancelToken.IsCancellationRequested)
                {
                    return(false);
                }

                var task = Firebase.Put(data.ToJsonString(), GetLink(role));
                return(task.Wait(Constants.TIMEOUT) && task.Result);
            }, _cancelToken));
        }
コード例 #2
0
 //新增任务
 private void button1_Click(object sender, EventArgs e)
 {
     task.Name        = txt_Name.Text;
     task.Application = txt_App.Text;
     task.Url         = txt_Param.Text;
     if (string.IsNullOrEmpty(task.Name.Trim()) || string.IsNullOrEmpty(task.Url.Trim()) || string.IsNullOrEmpty(task.Application.Trim()))
     {
         MessageBox.Show("参数不能为空,请重试!");
         return;
     }
     else
     {
         TaskAction.AddTask(task);
         MessageBox.Show("新增任务成功!");
     }
 }