// Transsfer items from AddButton (AddTaskForm.xaml) to listTaskForm // and add it to the panel private void AddButton_Response(object sender, EventArgs e) { if (InputValidation()) { m_listForm = new ListTaskForm(); m_listForm.EditButton_StatusUpdate += new EventHandler <ListTaskForm>(EditButton_Response); m_listForm.ProgressValue_StatusUpdate += new EventHandler <double>(ChangeProgressValueState); m_listForm.ProgressMaximum_StatusUpdate += new Action <bool, double>(ChangeProgressMaximumState); m_listForm.m_task.Text = m_addForm.m_taskName.Text; m_listForm.m_progress.Maximum = Int32.Parse(m_addForm.m_progressSize.Text); m_listForm.m_progress.Minimum = 0; m_listForm.m_progress.Value = 0; m_todoPanel.Children.Remove(m_addForm); m_todoPanel.Children.Add(m_listForm); m_todoPanel.Children.Add(m_newButton); m_listSize++; } else { String errorMsgBoxName = Application.Current.Resources["ATF_Error"] as String; String errorMsgBoxText = Application.Current.Resources["ATF_ErrorMsg"] as String; MessageBoxResult result = MessageBox.Show(errorMsgBoxText, errorMsgBoxName); } }
// Take ListTaskForm (this) from the edit button selected // then send its values to AddTaskForm private void EditButton_Response(object sender, ListTaskForm e) { m_todoPanel.Children.Remove(m_newButton); m_todoPanel.Children.Remove(e); m_addForm.ResetTexts(); m_addForm.m_taskName.Text = e.m_task.Text; m_addForm.m_progressSize.Text = e.m_progress.Maximum.ToString(); m_todoPanel.Children.Add(m_addForm); }