Example #1
0
 public override ModuleServiceResponse Handle(ModuleServiceRequest req, ApiClient client)
 {
     if (client == null || client.Display == null || !Directory.Exists(client.LatipiumDir))
     {
         throw new ClientException("Client is not authenticated");
     }
     if (client.LoadedModules.ContainsKey(req.ModuleId))
     {
         ApiClient  moduleClient = Server.GetClient(client.LoadedModules[req.ModuleId]);
         Guid       workId       = Guid.NewGuid();
         ModuleTask task         = moduleClient.ToDoList[workId] = new ModuleTask()
         {
             Request = req
         };
         Thread thread = Thread.CurrentThread;
         string result = null;
         task.Result += res => {
             result = res;
             thread.Interrupt();
         };
         try {
             Thread.Sleep(RequestTimeout);
             throw new ModuleException("Request timed out");
         } catch (ThreadInterruptedException) {
         }
         return(new ModuleServiceResponse()
         {
             ModuleResult = result
         });
     }
     else
     {
         throw new ClientException("Module is not loaded");
     }
 }
        private void btnAddNew_Click(object sender, EventArgs e)
        {
            AddStep      ads = new AddStep();
            DialogResult dr  = ads.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ModuleTask mt = new ModuleTask();
                mt.Description  = ads._Description;
                mt.Title        = ads._Titel;
                mt.Completeness = 0;
                int moduleindex = GetSelectedModuleAt(cbProjectsTodolist.SelectedIndex);
                Log.System(string.Format("Adding task to module with index : {0}", moduleindex));
                _ProjectManager.AddTaskToModule(moduleindex, mt);
                BuildMainToduList();
            }
        }
        private void btnTaskEdit_Click(object sender, EventArgs e)
        {
            if (clbMainTaskList.SelectedItem == null)
            {
                return;
            }
            AddStep      ads = new AddStep(clbMainTaskList.SelectedItem.Title, clbMainTaskList.SelectedItem.Description);
            DialogResult dr  = ads.ShowDialog();

            if (dr == DialogResult.OK)
            {
                ModuleTask mt = new ModuleTask();
                mt.Description = ads._Description;
                mt.Title       = ads._Titel;
                int moduleindex = GetSelectedModuleAt(cbProjectsTodolist.SelectedIndex);
                mt.Completeness = clbMainTaskList.SelectedItem.Completeness;
                int taskid   = clbMainTaskList.IndexOf(clbMainTaskList.SelectedItem);
                int moduleid = GetSelectedModuleAt(cbProjectsTodolist.SelectedIndex);
                _ProjectManager.ChangeTaskInModule(moduleid, taskid, mt);
                Log.System("Done Changing Task");
                BuildMainToduList();
            }
        }
Example #4
0
 public override ResponseObject Handle(ModuleResults req, ApiClient client)
 {
     if (client == null || client.Display == null || !Directory.Exists(client.LatipiumDir))
     {
         throw new ClientException("Client is not authenticated");
     }
     if (client.Type != ClientType.Module)
     {
         throw new ClientException("Invalid client type");
     }
     foreach (KeyValuePair <Guid, string> result in req.Results)
     {
         ModuleTask task = client.ToDoList.Where(p => p.Key == result.Key).Select(p => p.Value).FirstOrDefault();
         if (task == null)
         {
             throw new ModuleException("Unknown task");
         }
         else
         {
             task.OnResult(result.Value);
         }
     }
     return(new ResponseObject());
 }
 internal void ChangeTaskInModule(int moduleIndex, int taskId, ModuleTask newTask)
 {
     _Project.ChangeTaskInModule(moduleIndex, taskId, newTask);
 }
 internal void AddTaskToModule(int index, ModuleTask task)
 {
     _Project.AddTaskToModule(index, task);
 }
 internal void ChangeTaskInModule(int moduleId, int taskId, ModuleTask newTask)
 {
     _ModuleManeger.ChangeTaskInModule(moduleId, taskId, newTask);
 }
 internal void AddTaskToModule(int index, ModuleTask task)
 {
     _ModuleManeger.AddTaskToModule(index, task);
 }