Beispiel #1
0
        private void ToolStripButton2_Click(object sender, EventArgs e)
        {
            FormTaskEdit file = new FormTaskEdit();

            file.ShowDialog();
            if (file.DialogResult == DialogResult.OK)
            {
                Listview(Program.Tasks);
            }
        }
        private void ToolStripButton2_Click(object sender, EventArgs e)
        {
            FormTaskEdit f = new FormTaskEdit
            {
                updateoradd = "add"
            };

            f.ShowDialog();
            if (f.DialogResult == DialogResult.OK)
            {
                Listview(TaskFile.Tasks);
            }
        }
        private void ToolStripButton8_Click(object sender, EventArgs e)
        {
            FormTaskEdit f = new FormTaskEdit();

            if (listView1.SelectedItems.Count == 1)
            {
                int a = listView1.SelectedItems[0].Index;
                TaskFile.UpdateLine = a;
                for (int i = 0; i < 13; i++)
                {
                    f.updatetask[i] = this.listView1.Items[a].SubItems[i].Text;
                }
                f.updateoradd = "update";
                f.ShowDialog();
            }
            else
            {
                MessageBox.Show("请选中一组数据");
            }
            if (f.DialogResult == DialogResult.OK)
            {
                listView1.Items[TaskFile.UpdateLine].SubItems[7].Text  = TaskFile.Tasks[TaskFile.UpdateLine].Assignee;
                listView1.Items[TaskFile.UpdateLine].SubItems[10].Text = TaskFile.Tasks[TaskFile.UpdateLine].DueTime.ToString("yy/MM/dd");
                listView1.Items[TaskFile.UpdateLine].SubItems[3].Text  = TaskFile.Tasks[TaskFile.UpdateLine].Content;
                switch (Enum.GetName(typeof(TaskPriority), TaskFile.Tasks[TaskFile.UpdateLine].Priority))
                {
                case "High":
                    listView1.Items[TaskFile.UpdateLine].ForeColor = Color.FromArgb(255, 0, 0);
                    break;

                case "Middle":
                    listView1.Items[TaskFile.UpdateLine].ForeColor = Color.FromArgb(178, 34, 34);
                    break;

                case "Normal":
                    listView1.Items[TaskFile.UpdateLine].ForeColor = Color.FromArgb(0, 0, 0);
                    break;

                case "Low":
                    listView1.Items[TaskFile.UpdateLine].ForeColor = Color.FromArgb(0, 100, 0);
                    break;
                }
            }
        }