public static void loadAll(string folder, Wall wall) { if(folder == null || folder == string.Empty) { return; } var files = Directory.EnumerateFiles(folder, "*.txt", SearchOption.TopDirectoryOnly).ToArray(); foreach(var file in files) { var lines = File.ReadAllLines(file); if(lines.Length >= 5) { var note = new StickyNote(folder, wall); note.id = Guid.Parse(lines[0].Trim()); note.textBoxTitle.Text = lines[1].Trim(); if(lines[2].Trim() == "Color 1") { note.textBoxNote.BackColor = Color.LightGray; } else if(lines[2].Trim() == "Color 2") { note.textBoxNote.BackColor = Color.Bisque; } else if(lines[2].Trim() == "Color 3") { note.textBoxNote.BackColor = Color.Gold; } else if(lines[2].Trim() == "Color 4") { note.textBoxNote.BackColor = Color.DarkKhaki; } note.Location = new Point(int.Parse(lines[3].Trim()), int.Parse(lines[4].Trim())); note.textBoxNote.Lines = lines.Skip(5).ToArray(); wall.addStikyNote(note); } } }
public void closeStickyNote(StickyNote note) { this.panelCanvas.Controls.Remove(note); }
public void addStikyNote(StickyNote note) { this.panelCanvas.Controls.Add(note); }