Ejemplo n.º 1
0
 public TodoFileWatcher(TodoFile todoFile)
 {
     string path = Path.GetDirectoryName(Settings.Default.FileLocation);
     string filename = Path.GetFileName(Settings.Default.FileLocation);
     fileSystemWatcher = new FileSystemWatcher(path, filename);
     fileSystemWatcher.EnableRaisingEvents = true;
     fileSystemWatcher.Changed += delegate(object sender, FileSystemEventArgs e) { todoFile.Dirty = true; };
     fileSystemWatcher.Deleted += delegate(object sender, FileSystemEventArgs e) { todoFile.Dirty = true; };
 }
Ejemplo n.º 2
0
        private void InitializeTodoText()
        {
            todoFile = new TodoFile();
            todoText.Font = Settings.Default.Font;
            todoText.Text = todoFile.GetFileContents();
            dirtyTextBox = false;
            todoText.Select(todoText.TextLength, 0);

            todoFileWatcher = new TodoFileWatcher(todoFile);

            fileTimer.Enabled = true;
            if (TodoTextInitialized != null)
                TodoTextInitialized();
        }