public Form1() { InitializeComponent(); // Constants todoListFilter = "TodoList files (*.tdl)|*.tdl|All files (*.*)|*.*"; todoList = new TodoList(); }
public TodoApplication() { _todoList = new TodoList(); _itemTemplate = jQuery.Select("#itemTemplate").Plugin<jQueryTemplateObject>(); _newItem = jQuery.Select("#new-todo"); _list = jQuery.Select("#todo-list"); _activeCount = jQuery.Select("#todo-count"); _clearButton = jQuery.Select("#clear-completed"); _newItem.On("keyup", OnNewItemKeyUp); _list.On("change", ".toggle", OnItemToggle); _list.On("click", ".destroy", OnItemDelete); _list.On("dblclick", "label", OnItemEditBegin); _list.On("keypress", "input", OnItemEdit); _list.On("blur", "input", OnItemEditComplete); _clearButton.On("click", OnClearCompletedClick); UpdateRendering(); }
public TodoApplication() { _todoList = new TodoList(); _itemTemplate = jQuery.Select("#itemTemplate").Plugin <jQueryTemplateObject>(); _newItem = jQuery.Select("#new-todo"); _list = jQuery.Select("#todo-list"); _activeCount = jQuery.Select("#todo-count"); _clearButton = jQuery.Select("#clear-completed"); _newItem.On("keyup", OnNewItemKeyUp); _list.On("change", ".toggle", OnItemToggle); _list.On("click", ".destroy", OnItemDelete); _list.On("dblclick", "label", OnItemEditBegin); _list.On("keypress", "input", OnItemEdit); _list.On("blur", "input", OnItemEditComplete); _clearButton.On("click", OnClearCompletedClick); UpdateRendering(); }
// TodoList opening/saving methods private void openTodoList() { string filename = selectFile(new OpenFileDialog(), todoListFilter); if (!filename.Equals(String.Empty)) { //string temp = createTempDir("todolist\\"); //ZipTools.unzip(filename, temp); //string[] files = Directory.GetFiles(filename); todoList = new TodoList(); todoList = ListTools.readTodoList(filename); //for (int i = 0; i < files.Length; i++) //{ // //} // remove temp dir //removeTempDir(temp); } }
// Menu items private void newToolStripMenuItem_Click(object sender, EventArgs e) { todoList = new TodoList(); populateSubjectPanel(); }
private void saveTodoList() { string filename = selectFile(new SaveFileDialog(), todoListFilter); Task t = new Task(); t.ID = 9; t.dateTime = DateTime.Now; t.bCompleted = false; t.desc = new List<string>(); t.desc.Add("the description"); t.subjectID = 8765; Subject tt = new Subject(); tt.ID = 8765; tt.title = "the subject title"; tt.date = DateTime.Now; tt.tasks = new List<Task>(); tt.tasks.Add(t); TodoList ttt = new TodoList(); ttt.ID = 4321; ttt.savePath = filename; ttt.lastSaved = DateTime.Now; ttt.subjects = new List<Subject>(); ttt.subjects.Add(tt); if (!filename.Equals(String.Empty)) { ListTools.writeTodoList(filename, ttt); } }
internal static void writeTodoList(string filename, TodoList todoList) { }
internal static TodoList readTodoList(string location) { //string line = FileTools.readLine(location); string line = Regex.Replace(FileTools.readLine(location), "===", "\\r\\n"); string[] lines = Regex.Split(line, "\\|\\|\\|"); for(int ii = 0; ii < lines.Length; ii++) { string d = lines[ii]; string dd = d; } List<string> matches = RegexTools.match(headerPattern, lines[0], RegexOptions.Multiline); TodoList tdl = new TodoList() { ID = Int32.Parse(matches[0]), savePath = matches[1], lastSaved = DateTime.FromBinary(Int64.Parse(matches[2])), subjects = new List<Subject>() }; Subject subject = null; Task task = null; int i = 1; while(true)//i < lines.Count - 1) { matches = RegexTools.match(subjectPattern, lines[i], RegexOptions.Multiline); subject = new Subject() { ID = Int32.Parse(matches[0]), title = matches[1], date = DateTime.FromBinary(Int64.Parse(matches[2])), tasks = new List<Task>() }; i++; if (RegexTools.beginsWith("task\\(", lines[i])) { matches = RegexTools.match(taskPattern, lines[i], RegexOptions.Multiline); task = new Task() { ID = Int32.Parse(matches[0]), dateTime = DateTime.FromBinary(Int64.Parse(matches[1])), bCompleted = Boolean.Parse(matches[2]), desc = new List<string>() }; bool done = false; if (i != 0)//lines.Count - 1) { i++; while (!RegexTools.beginsWith("subject\\(", lines[i]) && !RegexTools.beginsWith("task(", lines[i]) && !done) { task.desc.Add(lines[i]); if (i != 0)//lines.Count - 1) { i++; } else { done = true; } } } } } return tdl; }