示例#1
0
        private TaskBox AddTaskBox(ITaskItem taskItem)
        {
            TaskBox taskBox = CreateTaskBox(taskItem);

            _taskBoxList.Add(taskBox);
            return(taskBox);
        }
示例#2
0
        public void Run()
        {
            TaskBox box = TaskBox.GetInstance(5);

            while (true)
            {
                string str = Console.ReadLine();
                if (str == "p")
                {
                    box.Pause();
                }
                else if (str == "r")
                {
                    box.Resume();
                }
                else if (str == "stop")
                {
                    break;
                }
                else if (str == "pa")
                {
                    Task <bool> task = box.PauseAysnc();
                    Console.WriteLine("PAUSE ASYNC");
                    bool result = task.Result;
                    Console.WriteLine("PAUSED");
                }
                else
                {
                    box.AddTask(new MyTask(Convert.ToString(i++)));
                }
            }

            return;
        }
示例#3
0
        internal static Afni.Controls.AfniLink CreateTask(string TaskName, TaskBox Group)
        {
            AfniLink task = new AfniLink();

            task.Text = TaskName;
            Group.Tasks.Add(task);
            return(task);
        }
        public async Task GetTaskBox__Brief_equals_TaskCreatedByUnitTest__OK()
        {
            string  taskBrief = "TaskCreatedByUnitTest";
            TaskBox task1     = await _taskService.GetNewTaskBoxAsync(taskBrief,
                                                                      "This is a task created by a unit test", "user1", "user1", DateTime.Today, TaskType.Task);

            TaskBox taskGetById = await _taskService.GetTaskBox(task1.ID);

            Assert.AreEqual(taskBrief, taskGetById.Brief);
        }
示例#5
0
        /// <summary>
        /// 开启服务
        /// </summary>
        public void Start(TaskBoxHandler handler, ITaskBoxStorage storage, ITaskLogProvider logProvider)
        {
            if (_isBooted == true)
            {
                throw new Exception("服务已经启动!");
            }

            if (_box == null)
            {
                if (storage == null)
                {
                    storage = new TaskBoxDbStorage();
                }

                if (logProvider == null)
                {
                    logProvider = new TaskLogProvider(storage);
                }


                _box = new TaskBox(storage, logProvider, 3);

                if (handler != null)
                {
                    handler(_box);
                }

                //if (String.IsNullOrEmpty(_server)
                //    || String.IsNullOrEmpty(_token))
                //    throw new ArgumentNullException("请使用RegistServer注册任务服务器信息!");
                //HttpSyncClient client = new HttpSyncClient(_server, _token);

                //if (client.TestConnect())
                //{
                //    //注册事件
                //    _box.OnTaskPosting += client.Post;
                //}
                //else
                //{
                //    throw new Exception("任务服务器连接失败");
                //}
            }

            _isBooted = true;
            _box.StartWork();
        }
        public async Task AssignTask__Task_is_assigned_to_other_user__OK()
        {
            string  user1 = "simon";
            string  user2 = "fred";
            TaskBox task1 = await _taskService.GetNewTaskBoxAsync("test task assignment",
                                                                  "This is a task created by a unit test", user1, user2, DateTime.Today, TaskType.Task);

            TaskBox task2 = await _taskService.GetNewTaskBoxAsync("test task assignment2",
                                                                  "This is a task created by a unit test", user2, user2, DateTime.Today, TaskType.Task);

            List <TaskBox> userTask = await _taskService.GetTaskBoxListForUser(user1);

            Assert.AreEqual(userTask.Count, 1);

            await _taskService.AssignTask(task2.ID, user1);

            //Todo: Implement event from server to clients to update tasks in client
            Assert.AreEqual(userTask.Count, 2);
        }
示例#7
0
        /// <summary>
        /// �������
        /// </summary>
        public void Start(TaskBoxHandler handler, ITaskBoxStorage storage, ITaskLogProvider logProvider)
        {
            if (_isBooted == true)
                throw new Exception("�����Ѿ����!");

            if (_box == null)
            {
                if (storage == null)
                {
                    storage = new TaskBoxDbStorage();
                }

                if (logProvider == null)
                {
                    logProvider = new TaskLogProvider(storage);
                }

                _box = new TaskBox(storage, logProvider, 3);

                if (handler != null)
                {
                    handler(_box);
                }

                //if (String.IsNullOrEmpty(_server)
                //    || String.IsNullOrEmpty(_token))
                //    throw new ArgumentNullException("��ʹ��RegistServerע�������������Ϣ!");
                //HttpSyncClient client = new HttpSyncClient(_server, _token);

                //if (client.TestConnect())
                //{
                //    //ע���¼�
                //    _box.OnTaskPosting += client.Post;
                //}
                //else
                //{
                //    throw new Exception("�������������ʧ��");
                //}
            }

            _isBooted = true;
            _box.StartWork();
        }
示例#8
0
        private void InitializeComponent()
        {
            //app
            _app.ThemeChanged += new EventHandler(this.app_ThemeChanged);

            _tbg = new TaskBoxGroup();

            //"Tasks" task box
            _tasksBox      = new TaskBox();
            _tasksBox.Text = "Tasks";
            _tbg.TaskBoxes.Add(_tasksBox);

            //"Other Views" task box
            _viewsBox      = new TaskBox();
            _viewsBox.Text = "Other Views";
            _tbg.TaskBoxes.Add(_viewsBox);

            //"Details" task box
            _detailsBox      = new TaskBox();
            _detailsBox.Text = "Details";
            _tbg.TaskBoxes.Add(_detailsBox);

            _tbg.Parent = _app.ParentForm.ExplorerPanel;
            _tbg.Dock   = DockStyle.Fill;

            //Menu item
            _app.MenuManager.AddMenuItem(this,
                                         VLoopMenus.View,
                                         null,
                                         _name,
                                         Shortcut.None,
                                         null);


            _homeLink        = new AfniLink();
            _homeLink.Icon   = VLoopIcons.VLoopHome;
            _homeLink.Text   = "VLoop Home";
            _homeLink.Click += new EventHandler(this.homeLink_Clicked);
            _viewsBox.Tasks.Add(_homeLink);
        }
 private async Task <TaskBoxViewModel> CreateTaskBoxViewModel(TaskBox taskBox)
 {
     return(new TaskBoxViewModel(taskBox));
 }
示例#10
0
文件: TestForm.cs 项目: BJFX/UWACN
        private void buttonX1_Click(object sender, EventArgs e)
        {
            try
            {
                if (OpenTestFile.ShowDialog() == DialogResult.OK)
                {
                    string       str;
                    StreamReader sr = new StreamReader(OpenTestFile.OpenFile(), Encoding.GetEncoding(936));
                    str = sr.ReadLine();  //标题
                    string[] title = str.Split('=');
                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    TaskBox.AppendText("\r\n");
                    str   = sr.ReadLine(); //说明
                    title = str.Split('=');
                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    TaskBox.AppendText("\r\n");
                    str   = sr.ReadLine();//节点
                    title = str.Split('=');
                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    linkid = int.Parse(title[1]);
                    TaskBox.AppendText("\r\n");
                    str   = sr.ReadLine();
                    title = str.Split('=', '{', '}');//测试点

                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    TaskBox.AppendText(title[2]);
                    testid = title[2].Split(' ');
                    TaskBox.AppendText("\r\n");

                    str   = sr.ReadLine();
                    title = str.Split('=', '{', '}');//测试点

                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    TaskBox.AppendText(title[2].Replace(" ", ","));
                    testip = title[2].Split(' ');
                    TaskBox.AppendText("\r\n");

                    str   = sr.ReadLine(); //
                    title = str.Split('=');
                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    command = title[1].Replace(" ", "");
                    TaskBox.AppendText("\r\n");

                    str   = sr.ReadLine(); //
                    title = str.Split('=');
                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    TaskBox.AppendText("秒");
                    interval = int.Parse(title[1]);
                    TaskBox.AppendText("\r\n");
                    str   = sr.ReadLine(); //
                    title = str.Split('=');
                    TaskBox.AppendText(title[0]);
                    TaskBox.AppendText(title[1]);
                    TaskBox.AppendText("秒");
                    timeout = int.Parse(title[1]);
                    TaskBox.AppendText("\r\n");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
示例#11
0
 public void LoadTasks()
 {
     TaskBox.Table = ConnectionForm.ConnectToDatabase.SelectQuery("select * from TaskType");
     TaskBox.FillControl(1, 0);
 }
 public TaskBoxViewModel(TaskBox taskBox)
 {
     TaskType = Enum.GetValues(typeof(TaskType)).Cast <TaskType>().ToList();
     _taskBox = taskBox;
     InitDispatcher();
 }