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); }
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); }
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(); }
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()); } }
// Запуск демонстрационного примера 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(); }
private void CreateTask() { try { TaskForm frm = new TaskForm(); frm.ShowDialog(); frm.Dispose(); MemoryHelper.ReduceMemory(); } catch (Exception ex) { ErrorHandler.Show(ex); } }
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; }
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; }
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(); //激活显示 } }
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); } } }
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(); } } }
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++; } }
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(); }); }
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); }
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); } }
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); } }
public void Post(TaskForm form) { if (ModelState.IsValid) { } }
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; } }
/// <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);
/// <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);
public Ret VouMostrarIssoPraCininha(TaskForm taskForm, Task[] tasks) { return(Ret.OK()); }
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; } }
public void Edit(TaskForm changes, Task task) { }
protected void CardFrom_CardClick(object sender, CardEventArgs e) { TaskForm tf = new TaskForm(e.card); tf.Show(); }
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(); }