예제 #1
0
        private void tbx_taskEntry_KeyPress(object sender, KeyPressEventArgs e)
        {
            // Checks if the enter key is pressed
            if (e.KeyChar == Convert.ToChar(13))
            {
                TDLItem newTDLItem = new TDLItem(tbx_taskEntry.Text);
                taskList[taskList.GetFirstEmpty()] = newTDLItem;

                // The following removes the ... character if it is present
                if (listView_tasks.Groups[1].Items.Count == 1)
                {
                    ListViewItem toDelete;
                    if ((toDelete = listView_tasks.Groups[1].Items[0]).Text == "Empty")
                    {
                        listView_tasks.Items.Remove(toDelete);
                    }
                }

                // We add this newly created task to the listView
                ListViewItem newlyAdded = listView_tasks.Items.Add(new ListViewItem
                                                                       (new[] { newTDLItem.TaskTitle, newTDLItem.Deadline, newTDLItem.Priority.ToString() },
                                                                       listView_tasks.Groups[1]));

                // We then save the taskList
                taskList.SaveTaskList(listView_tasks.Items, folderBrowserDialog.SelectedPath);

                tbx_taskEntry.Clear();
                listView_tasks.Select();
                listView_tasks.SelectedIndices.Clear();
                listView_tasks.Items[newlyAdded.Index].Selected = true;
            }
        }
예제 #2
0
 private void tbx_taskEntry_KeyPress(object sender, KeyPressEventArgs e)
 {
     // Checks if the enter key is pressed
     if (e.KeyChar == Convert.ToChar(13))
     {
         //MessageBox.Show(tbx_taskEntry.Text);
         TDLItem tdlItem = new TDLItem(tbx_taskEntry.Text);
         //MessageBox.Show("The input is " + tdlItem.ToBeParsed);
     }
 }