示例#1
0
        private void btnOK_Click(object sender, EventArgs e)
        {
            Workers.Tasky tasky = new Workers.Tasky();
            tasky.SubTaskName = subTaskName.Text;
            tasky.Priority    = comboBoxPriority.Text;

            Tasky = tasky;

            //_subTask = subTaskName.Text;
            //Priority = comboBoxPriority.Text;
            this.Close();
        }
示例#2
0
        //Loads existing task to the program on startup
        public Dictionary <string, List <Tasky> > LoadTasks(TabControl tabControl, List <FileInfo> files, ref List <string[]> completedRows)
        {
            //_contextMenu2.ItemClicked += ToolStripMenu2_ItemClicked;
            Dictionary <string, List <Tasky> > loadInfo = new Dictionary <string, List <Tasky> >();

            for (int i = 0; i < files.Count; i++)
            {
                List <Tasky> taskyies = new List <Tasky>();

                string tabPageName = Path.GetFileNameWithoutExtension(files[i].Name);
                tabControl.TabPages.Add(Path.GetFileNameWithoutExtension(files[i].Name));

                var grid = MakeGrid();
                grid.MouseDown += DataGridView_MouseDownClick;

                tabControl.TabPages[i].Controls.Add(grid);

                //Load subtask to grid from path
                var lines = File.ReadAllLines(files[i].FullName);
                foreach (var line in lines)
                {
                    var rowInfo = line.Split(';');

                    Workers.Tasky restoreTasky = new Tasky(rowInfo);
                    taskyies.Add(restoreTasky);

                    string[] row = new string[3] {
                        restoreTasky.SubTaskName, restoreTasky.Priority, restoreTasky.Status == true ? "In progres" : "Done"
                    };
                    #region Odl
                    //row.Cells[0].Value = restoreTasky.SubTaskName;
                    //row.Cells[1].Value = new DataGridViewComboBoxCell().Value = restoreTasky.Priority;
                    //row.Cells[2].Value = new DataGridViewComboBoxCell().Value = restoreTasky.Status == true ? "In progres" : "Done";

                    //grid.Rows[rowIndex].Cells[0].Value = restoreTasky.SubTaskName;
                    //grid.Rows[rowIndex].Cells[1].Value = new DataGridViewComboBoxCell().Value = restoreTasky.Priority;
                    //grid.Rows[rowIndex].Cells[2].Value = new DataGridViewComboBoxCell().Value = restoreTasky.Status == true ? "In progres" : "Done";
                    #endregion

                    if (Convert.ToBoolean(restoreTasky.Status))
                    {
                        grid.Rows.Add(row);
                    }
                    else
                    {
                        completedRows.Add(row);
                    }

                    foreach (DataGridViewRow dgvRow in grid.Rows)
                    {
                        dgvRow.ContextMenuStrip = _contextMenu2;
                    }
                }

                grid.ClearSelection();

                if (loadInfo.Keys.Contains(tabPageName) == false)
                {
                    loadInfo.Add(tabPageName, taskyies);
                }
            }

            return(loadInfo);
        }