public DataGridViewModel(ITaskListGroup taskListGroup, int currentTaskList) { Log.Instance.LogInfo("Creating DataGridViewModel"); PropertyTasks.CollectionChanged += OnViewChanged; TaskListGroup = taskListGroup; CurrentTaskList = currentTaskList; UpdateView(); RaisePropertyChanged("ContextMenuItems"); }
public void Save(ITaskListGroup tlg) { if (FilePath != null) { Log.Instance.LogFineDebug(string.Format("FilePersister.Save {0}", FilePath)); Stream s = File.Create(FilePath); BinaryFormatter serializer = new BinaryFormatter(); serializer.Serialize(s, tlg); s.Close(); } }
public ITaskListGroup Load() { Log.Instance.LogFineDebug(string.Format("FilePersister.Load {0}", FilePath)); ITaskListGroup result = null; try { Stream s = File.OpenRead(FilePath); BinaryFormatter deserializer = new BinaryFormatter(); result = (TaskListGroup)deserializer.Deserialize(s); s.Close(); } catch (System.IO.FileNotFoundException) { Log.Instance.LogError(string.Format("FilePersister.Load file not found")); } return(result); }