private void timer1_Tick(object sender, EventArgs e) { //save the files ProjectListManager.WriteFile(Active); ProjectListManager.WriteFile(Waiting); ProjectListManager.WriteFile(Archive); }
public static void WriteFile(ProjectListManager manager) { StreamWriter sw = null; string fullpath = manager.GetProjectFileFullPath(); try { if (File.Exists(fullpath)) { File.Delete(fullpath); } FileInfo fi = new FileInfo(fullpath); sw = new StreamWriter(fi.OpenWrite()); foreach (Project p in manager.projectList) { sw.Write(p.ToString()); sw.WriteLine("||END||"); } } catch {} finally { if (sw != null) { sw.Close(); } } }
private void LoadDataViewGrid(DataGridView dgv, ProjectListManager manager) { if (dgv == null || manager == null) { return; } string target = ""; if (dgv.SelectedRows.Count > 0) { target = dgv.SelectedRows[0].Cells[0].Value.ToString(); } dgv.Rows.Clear(); foreach (Project p in manager.ProjectList) { dgv.Rows.Add(new object[] { p.Name, p.GetLastNote() }); } if (target.CompareTo("") != 0) { foreach (DataGridViewRow row in dgv.Rows) { if (row.Cells[0].Value.ToString().CompareTo(target) == 0) { row.Selected = true; } } } }
private void MoveProject(string ProjectName, DataGridView fromdgv, ProjectListManager from, DataGridView todgv, ProjectListManager to) { Project mover = from.Find(ProjectName); from.Remove(mover); to.Add(mover); LoadDataViewGrid(fromdgv, from); LoadDataViewGrid(todgv, to); }
private void biMMExportToExcel_Click(object sender, EventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.DefaultExt = ".txt"; save.Filter = "Text (tab-delimited) | *.txt"; save.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (save.ShowDialog() == DialogResult.OK) { ProjectListManager[] managers = new ProjectListManager[3]; TXTExport.SaveToTXT(save.FileName, Active, Waiting, Archive); } }
private void biMMExportToXML_Click(object sender, EventArgs e) { SaveFileDialog save = new SaveFileDialog(); save.DefaultExt = ".xml"; save.Filter = "XML | *.xml"; save.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments); if (save.ShowDialog() == DialogResult.OK) { ProjectListManager[] managers = new ProjectListManager[3]; XMLExport.SaveToXML(save.FileName, Active, Waiting, Archive); } }
private void NewProject(DataGridView dgv, ProjectListManager manager) { NewProjectForm frm = new NewProjectForm(); if (frm.ShowDialog() == DialogResult.OK) { Project p = new Project(frm.ProjectName); p.Notes.Add(new Note("Created", DateTime.Now)); manager.Add(p); LoadDataViewGrid(dgv, manager); SelectRow(dgv, p.Name); } }
private void frmMain_Load(object sender, EventArgs e) { Active = new ProjectListManager("Active", ActiveFile); Waiting = new ProjectListManager("Waiting", WaitingFile); Archive = new ProjectListManager("Archive", ArchiveFile); dgv2plm = new Dictionary <DataGridView, ProjectListManager>(); dgv2plm.Add(dgvActive, Active); dgv2plm.Add(dgvWaiting, Waiting); dgv2plm.Add(dgvArchive, Archive); LoadDataViewGrid(dgvActive, Active); LoadDataViewGrid(dgvWaiting, Waiting); LoadDataViewGrid(dgvArchive, Archive); this.Text += " (v" + Application.ProductVersion + ")"; }
public string GetProjectFileFullPath() { return(System.IO.Path.Combine(ProjectListManager.GetProjectDirectory(), this.filename)); }