Ejemplo n.º 1
0
        private void LoadTasks()
        {
            TaskManager.ClearGroups();
            LoadControl lc = new LoadControl(
                () =>
                {
                    TaskManager.ClearGroups();
                    var rj = FileHelper.ReadJosn<List<CustomTasks>>();
                    if (rj != null)
                    {
                        TaskManager.LoadGroup(rj.ToList<ITaskGroup>());
                    }
                },
                () =>
                {
                    foreach (var taskgroup in TaskManager.GetTaskGroups())
                    {
                        MetroFramework.Controls.MetroTabPage tabPage = new MetroFramework.Controls.MetroTabPage();
                        tabPage.Name = taskgroup.GroupId;
                        tabPage.Tag = taskgroup;
                        tabPage.Text = taskgroup.GroupName;
                        tabPage.VerticalScrollbarSize = 4;
                        tabPage.HorizontalScrollbar = false;
                        tabPage.HorizontalScroll.Enabled = false;
                        tabPage.HorizontalScrollbarHighlightOnWheel = false;
                        tabPage.VerticalScrollbar = true;
                        tabPage.AutoScroll = true;
                        tabPage.Theme = this.metroStyleManager1.Theme;

                        tabPage.PagePanelDock<TaskForm>(list =>
                        {
                            List<DailyTask> dtl = new List<DailyTask>();
                            foreach (var ctl in list)
                            {
                                dtl.Add(ctl.DailyTask);
                            }
                            TaskManager.GetTaskGroup(tabPage.Name).DailyTasks = dtl;
                        });

                        metroTabControl1.TabPages.Add(tabPage);

                        foreach (var task in taskgroup.DailyTasks)
                        {
                            TaskForm form = new TaskForm(this, task);
                            form.Theme = this.metroStyleManager1.Theme;
                            form.Show();
                            tabPage.Controls.Add(form);
                            form.FormClosed += form_FormClosed;
                        }
                    }
                });
            lc.Parent = this;
            lc.Dock = DockStyle.Fill;
            this.Controls.Add(lc);
            this.Controls.SetChildIndex(lc, 0);
        }
Ejemplo n.º 2
0
            public Ret Edit(TaskForm form, Task[] tasks)
            {
                var currentTasks = DB.Tasks.Where(task => tasks.Any(x => x.Id == task.Id));

                if (form.Name != null)
                {
                    currentTasks.ForEach(x => x.Name = form.Name);
                }

                return(true);
            }
Ejemplo n.º 3
0
        private void Goto(MyTask label)
        {
            //Hashtable h = new Hashtable();
            //h.Add("Id", label.Id);
            //h.Add("Task", label);
            //NavigateTo("Tasks", h);
            TaskForm frm = new TaskForm(label);

            frm.CheckSecurityForView();
            frm.ShowDialog();
        }
Ejemplo n.º 4
0
 void form_FormClosed(object sender, FormClosedEventArgs e)
 {
     var form = sender as TaskForm;
     if (TaskManager.MoveToFinishGroup(form.DailyTask))
     {
         TaskForm taskform = new TaskForm(this, form.DailyTask);
         taskform.Show();
         this.metroTabControl1.TabPages[form.DailyTask.GroupId].Controls.Add(taskform);
         taskform.FormClosed += form_FormClosed;
         FileHelper.SaveJosn(TaskManager.ConvertJson());
     }
 }
Ejemplo n.º 5
0
        // Запуск демонстрационного примера
        private void bDemonstrationExample_Click(object sender, EventArgs e)
        {
            var gsForm = new GraphSelectorForm(graphsStorage.GraphsCount);

            // Открываем форму и ждём выбора. Отмена - всё, выходим
            if (gsForm.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            var dExampleForm = new TaskForm(graphsStorage[gsForm.SelectedGraphIndex]);

            dExampleForm.ShowDialog();
        }
Ejemplo n.º 6
0
 private void CreateTask()
 {
     try
     {
         TaskForm frm = new TaskForm();
         frm.ShowDialog();
         frm.Dispose();
         MemoryHelper.ReduceMemory();
     }
     catch (Exception ex)
     {
         ErrorHandler.Show(ex);
     }
 }
Ejemplo n.º 7
0
        private void add_task_form(Todo task)
        {
            var      item     = Settings.taskList[Settings.taskList.Count - 1];
            TaskForm taskForm = new TaskForm();

            taskForm.Init_task(item);

            taskForm.Location    = new Point(Settings.poz_x_task - 3, listPanel.AutoScrollPosition.Y + Settings.poz_y_task);
            taskForm.AutoScroll  = true;
            taskForm.ParentForm  = this;
            Settings.poz_y_task += taskForm.Height + 10;

            listPanel.Controls.Add(taskForm);
            notaskLb.Visible = false;
        }
Ejemplo n.º 8
0
        private void add_task_form(Todo task)
        {
            var      item     = todo_list[todo_list.Count - 1];
            TaskForm taskForm = new TaskForm();

            taskForm.Init_task(item);

            taskForm.Location   = new Point(poz_x - 3, listPanel.AutoScrollPosition.Y + poz_y);
            taskForm.AutoScroll = true;
            taskForm.Type("group");
            //taskForm.ParentForm = this;
            poz_y += taskForm.Height + 10;

            listPanel.Controls.Add(taskForm);
            notaskLb.Visible = false;
        }
Ejemplo n.º 9
0
 private void toolStripButton1_Click(object sender, EventArgs e)
 {
     if (taskForm.IsDisposed != true)
     {
         taskForm.TopLevel = false;
         taskForm.Parent   = splitContainer3.Panel1;
         taskForm.Show();  //弹出这个窗口
         taskForm.Focus(); //激活显示
     }
     else
     {
         taskForm = new TaskForm();
         taskForm.Show();  //弹出这个窗口
         taskForm.Focus(); //激活显示
     }
 }
Ejemplo n.º 10
0
 private void task_listView_MouseDoubleClick(object sender, MouseEventArgs e)
 {
     if (task_listView.SelectedItems.Count != 0)
     {
         TaskInfo ta = (TaskInfo)task_listView.SelectedItems[0].Tag;
         if (ta.IspId.ToString() == m_Cfg.UserID && ta.Status != 2)
         {
             TaskForm        taskAction = new TaskForm();
             List <object[]> res        = DataBase.SelectQuery("select * from users;", m_Cfg.DbConnectionString);
             if (res.Count > 0)
             {
                 List <UserInfo> usr_lst = new List <UserInfo>();
                 for (int i = 0; i < res.Count; i++)
                 {
                     usr_lst.Add(new UserInfo((int)res[i][0], (string)res[i][1]));
                 }
                 taskAction.UserList = usr_lst;
                 taskAction.Task     = ta;
                 DialogResult dr = taskAction.ShowDialog();
                 if (dr == DialogResult.OK)
                 {
                     DataBase.UpdateTaskQuery(taskAction.Task, m_Cfg.DbConnectionString);
                     refresh_btn_Click(null, null);
                 }
             }
         }
         if (ta.SoglId.ToString() == m_Cfg.UserID && ta.SoglStatus == 0 && ta.Status == 2)
         {
             DialogResult dr = MessageBox.Show("Согласовать перенос срока на " + ta.DatePerenos.ToString("dd.MM.yyyy"), "Согласование переноса", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
             if (dr == DialogResult.Yes)
             {
                 //   ta.DateEnd = ta.DatePerenos;
                 // ta.DatePerenos = TaskInfo.NULLDATE;
                 // ta.Status = 0;
                 ta.SoglStatus = 1;
                 DataBase.UpdateTaskQuery(ta, m_Cfg.DbConnectionString);
             }
             else if (dr == DialogResult.No)
             {
                 // ta.Status = 0;
                 ta.SoglStatus = 0;
                 DataBase.UpdateTaskQuery(ta, m_Cfg.DbConnectionString);
             }
             refresh_btn_Click(null, null);
         }
     }
 }
Ejemplo n.º 11
0
        private void LargeHeader_Submited(object sender, TappedRoutedEventArgs e)
        {
            var form = new TaskForm()
            {
                Id          = id,
                Name        = nameTb.Text,
                Description = descTb.Text,
                EveryTime   = Convert.ToInt32(timeTb.Text)
            };

            if (string.IsNullOrWhiteSpace(form.Name))
            {
                _ = new MessageDialog(Constants.GetString("task_name.PlaceholderText")).ShowAsync();
                return;
            }
            _ = save(form);
        }
        private void createTask(enTaskType type)
        {
            saveCaretPosition();
            string selectedLineText = getSelectedLineText();

            System.Text.RegularExpressions.Match match = FindActionItemPatternInText(selectedLineText);
            if (match.Captures.Count > 0)
            {
                MessageBox.Show(string.Format("This line is already attached with Action Item: '{0}'", match.ToString()), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }


            StartOfLineCommand startOfLineCommand = new StartOfLineCommand(richEditControl1);

            startOfLineCommand.Execute();
            DocumentPosition beginOfLine = richEditControl1.Document.CaretPosition;

            if (_parentForm.isTaskListDirty())
            {
                _parentForm.save(false);
            }

            //create task
            TaskForm newTaskForm = new TaskForm(_parentForm, new Tasks()
            {
                taskName = selectedLineText.Substring(0, Math.Min(128, selectedLineText.Length)), remarks = selectedLineText, updateRequester = false, projectID = Guid.Parse("00000000-0000-0000-0000-000000000000"), requesterID = Guid.Parse("00000000-0000-0000-0000-000000000000")
            }, formMode.add, type);

            _parentForm.openTaskForm(newTaskForm);

            if (newTaskForm.DialogResult == DialogResult.OK)
            {
                using (new Splash(this.Parent as Form))
                {
                    using (var model = new DocumentModel())
                    {
                        string aiCaption = addActionItemText(beginOfLine, newTaskForm._task.ID, newTaskForm._task.getUserName(), newTaskForm._task.dueDate);
                        startOfLineCommand.Execute();     //Go back to begining of line and make the inserted text as hyperlink
                        ChangeTextToHyperlink(aiCaption, newTaskForm._task.ID);
                        SaveMeetingRTF();
                    }
                    syncActionItems();
                }
            }
        }
Ejemplo n.º 13
0
        private void AddTaskButtonClick(object sender, EventArgs e)
        {
            TaskForm TaskFormObject = new TaskForm();

            TaskFormObject.ShowDialog();
            if (TaskFormObject.TaskObject != null)
            {
                TaskCollectionObject.TaskList.Add(TaskFormObject.TaskObject);
                PopulateTasksWithoutThread(TaskFormObject.TaskObject);
                TotalTasksLabel.Text = "Total Tasks : " + TaskCollectionObject.TaskList.Count;
                if (TaskCollectionObject.TaskList.Count > 0)
                {
                    SortByChangeEnabled(true);
                }
                Options.LastTaskID++;
            }
        }
Ejemplo n.º 14
0
        private async Task save(TaskForm form)
        {
            App.ViewModel.IsLoading = true;
            var dispatcherQueue = Windows.System.DispatcherQueue.GetForCurrentThread();
            var data            = await App.Repository.Task.SaveTaskAsync(form, async res => {
                await dispatcherQueue.EnqueueAsync(() =>
                {
                    _ = new MessageDialog(res.Message).ShowAsync();
                });
            });

            await dispatcherQueue.EnqueueAsync(() =>
            {
                App.ViewModel.IsLoading = false;
                _ = new MessageDialog(Constants.GetString("task_save_success")).ShowAsync();
                Frame.GoBack();
            });
        }
Ejemplo n.º 15
0
        private void btnNewTask_Click(object sender, EventArgs e)
        {
            //Add some Space
            Label space = new Label();

            space.AutoSize = false;
            space.Size     = new Size(490, 6);
            space.Dock     = DockStyle.Top;
            panNewTasks.Controls.Add(space);

            //Add a new Task
            TaskForm task = new TaskForm("Test");

            task.TopLevel = false;
            //task.Dock = DockStyle.Top;
            //panNewTasks.Controls.Add(task);
            this.Controls.Add(task);
            task.Show();
            ControlExtension.Draggable(task, true);
        }
Ejemplo n.º 16
0
 private void commandBar1_NewCommandPressed(object sender, EventArgs e)
 {
     try
     {
         //Hashtable h = new Hashtable();
         //h.Add("Id", _current.Id);
         //h.Add("Customer", _current);
         //base.NavigateTo("Tasks", h);
         try
         {
             TaskForm frm = new TaskForm(_current);
             if (frm.ShowDialog() == DialogResult.OK)
             {
                 if (frm.CurrentTask != null)
                 {
                     IBindingList g = gridView1.DataSource as IBindingList;
                     g.Add(frm.CurrentTask);
                 }
             }
         }
         catch (AccessDeniedException)
         {
             XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         catch (Exception ex)
         {
             ErrorHandler.Show(ex);
         }
     }
     catch (AccessDeniedException)
     {
         XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex)
     {
         ErrorHandler.Show(ex);
     }
 }
Ejemplo n.º 17
0
 private void barButtonItem1_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     try
     {
         TaskForm frm = new TaskForm();
         if (frm.ShowDialog() == DialogResult.OK)
         {
             if (frm.CurrentTask != null)
             {
                 IBindingList g = gridView1.DataSource as IBindingList;
                 g.Add(frm.CurrentTask);
             }
         }
     }
     catch (AccessDeniedException)
     {
         XtraMessageBox.Show("Impossibile accedere alla funzionalità richiesta. Accesso negato", "Errore", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (Exception ex)
     {
         ErrorHandler.Show(ex);
     }
 }
Ejemplo n.º 18
0
 public void Post(TaskForm form)
 {
     if (ModelState.IsValid)
     {
     }
 }
Ejemplo n.º 19
0
        private void TaskNewChild()
        {
            try {

                // Create a new Task with selected parent
                Task new_task = new Task();
                Task parent_task = (Task)treeTasks.GetSelectedObject();
                new_task.CategoryId = parent_task.CategoryId;
                new_task.ParentId = parent_task.Id;

                // Edit the new task in a Task form.
                TaskForm form = new TaskForm(Lang, Settings, new_task);
                if (!this.Visible) { // From tray...
                    form.MinimizeBox = true;
                    form.ShowInTaskbar = true;
                    form.StartPosition = FormStartPosition.CenterScreen; }
                DialogResult res = form.ShowDialog();

                // If the task has been modified, save it to the DB.
                if (res != DialogResult.OK) return;
                new_task.Update(); // Save task in DB
                CountTasks();

                // Save pending notes
                ArrayList pending_notes = new_task.GetUnsavedNotes();
                foreach (Note note in pending_notes) { note.TaskId = new_task.Id; note.Save(); }
                if (pending_notes.Count > 0) { new_task.Reload(); new_task.ClearUnsavedNotes(); }

                // If the task is in the selected category, update the tree
                if (SelectedCategory != null) if (new_task.CategoryId != SelectedCategory.Id) return;
                Todomoo.Tasks.Add(new_task); // Add to tasks
                if (flatView) { /* Flat view? Add task and select it */
                    treeTasks.AddObject(new_task);
                    treeTasks.SelectedObject = new_task;
                } else { /* Tree view, update and expand parent */
                    treeTasks.RefreshObject(Todomoo.GetParent(new_task)); // Refresh parent task  (this will add the created child), thanks to Dege
                    treeTasks.Expand(parent_task); /* Expand parent task to view new task */ }
                treeTasks.RefreshItem(treeTasks.GetItem(0)); // Refresh first item. Bug?
                treeTasks.RefreshItem(treeTasks.GetItem(treeTasks.GetItemCount() - 1)); // Refresh last item. Bug?

            } catch {
                Utils.MsgDialog.Error(Lang.Get("task_save_error"), Lang.Get("error")); return;
            }
        }
Ejemplo n.º 20
0
 /// <summary>
 /// 保存任务
 /// </summary>
 /// <param name="item"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public async Task <TaskItem> SaveTaskAsync(TaskForm item, Action <HttpException> action = null)
 => await http.PostAsync <TaskForm, TaskItem>("task/home/save", item, action);
Ejemplo n.º 21
0
 /// <summary>
 /// 快速添加任务
 /// </summary>
 /// <param name="item"></param>
 /// <param name="action"></param>
 /// <returns></returns>
 public async Task <TaskDay> FastCreateAsync(TaskForm item, Action <HttpException> action = null)
 => await http.PostAsync <TaskForm, TaskDay>("task/home/fast_create", item, action);
Ejemplo n.º 22
0
 public Ret VouMostrarIssoPraCininha(TaskForm taskForm, Task[] tasks)
 {
     return(Ret.OK());
 }
Ejemplo n.º 23
0
        private void TaskNoteAdd()
        {
            try {

                // Edit the selected task in a Task form, showing notes.
                Task edit_task = (Task)treeTasks.GetSelectedObject();
                TaskForm form = new TaskForm(Lang, Settings, edit_task, TaskForm.StartingTab.Notes);
                form.AddNewNoteAccordionItem(); // Add a new note
                form.giveFocusToNewNote = true;
                DialogResult res = form.ShowDialog();

                // If the task has been modified, save it to the DB.
                if (res != DialogResult.OK) return;
                edit_task.Update(); // Save task in DB

                // Save pending notes
                ArrayList current_notes = edit_task.GetNotes();
                ArrayList pending_notes = edit_task.GetUnsavedNotes();
                foreach (Note note in current_notes) { bool d = true; foreach (Note p in pending_notes) if (note.Id == p.Id) d = false; if (d) Todomoo.RemoveNote(note); }
                foreach (Note note in pending_notes) { note.TaskId = edit_task.Id; note.Save(); }
                if ((pending_notes.Count > 0) || (current_notes.Count > 0)) { edit_task.Reload(); edit_task.ClearUnsavedNotes(); }

                // If the task is in the selected category, update the tree
                if (SelectedCategory != null) if (edit_task.CategoryId != SelectedCategory.Id) return;
                if (flatView) treeTasks.RefreshObject(edit_task);
                else treeTasks.RefreshObject(Todomoo.GetRoot(edit_task)); // Refresh root task (whis will refresh the editid child or itself)
                treeTasks.RefreshItem(treeTasks.GetItem(0)); // Refresh first item. Bug?
                treeTasks.RefreshItem(treeTasks.GetItem(treeTasks.GetItemCount() - 1)); // Refresh last item. Bug?

            } catch {
                Utils.MsgDialog.Error(Lang.Get("task_edit_error"), Lang.Get("error")); return;
            }
        }
Ejemplo n.º 24
0
 public void Edit(TaskForm changes, Task task)
 {
 }
Ejemplo n.º 25
0
        protected void CardFrom_CardClick(object sender, CardEventArgs e)
        {
            TaskForm tf = new TaskForm(e.card);

            tf.Show();
        }
Ejemplo n.º 26
0
        private void TaskNewRoot()
        {
            try {

                // Create a new Task in this category
                Task new_task = new Task();
                new_task.CategoryId = (SelectedCategory == null) ? 0 : SelectedCategory.Id;

                // Edit the new task in a Task form.
                TaskForm form = new TaskForm(Lang, Settings, new_task);
                if (!this.Visible) { // From tray...
                    form.MinimizeBox = true;
                    form.ShowInTaskbar = true;
                    form.StartPosition = FormStartPosition.CenterScreen; }
                DialogResult res = form.ShowDialog();

                // If the task has been modified, save it to the DB.
                if (res != DialogResult.OK) return;
                new_task.Update(); // Save task in DB
                CountTasks();

                // Save pending notes
                ArrayList pending_notes = new_task.GetUnsavedNotes();
                foreach (Note note in pending_notes) { note.TaskId = new_task.Id; note.Save(); }
                if (pending_notes.Count > 0) { new_task.Reload(); new_task.ClearUnsavedNotes(); }

                // If the task is in the selected category, update the tree
                if (SelectedCategory != null) if (new_task.CategoryId != SelectedCategory.Id) return;
                Todomoo.Tasks.Add(new_task); // Add to tasks
                treeTasks.AddObject(new_task); // Add to tree (this is always a root task)
                treeTasks.RefreshItem(treeTasks.GetItem(0)); // Refresh first item. Bug?
                treeTasks.RefreshItem(treeTasks.GetItem(treeTasks.GetItemCount() - 1)); // Refresh last item. Bug?

                // Select created task
                treeTasks.SelectedObject = new_task;

            } catch {
                Utils.MsgDialog.Error(Lang.Get("task_save_error"), Lang.Get("error")); return;
            }
        }
        private void BtnTask_Click(object sender, EventArgs e)
        {
            TaskForm taskForm = new TaskForm();

            taskForm.ShowDialog();
        }