public Model() { // prepare model state/data m_data = new PersistentModelData (); // prepare DB // Log.Debug ("Ruly", "ext sd: " + Android.OS.Environment.ExternalStorageDirectory); // string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); string folder = Android.OS.Environment.ExternalStorageDirectory + "/ruly/ruly.db"; Util.EnsureDirectory (System.IO.Path.GetDirectoryName (folder)); m_db = new SQLiteConnection (folder); m_db.CreateTable<TaskData>(); m_db.CreateTable<TaskHistory>(); m_db.CreateTable<TaskAlarm> (); m_unknown_task = new TaskData () { Id = -1, Title = "休憩" }; // create ViewModel I/F datasets Tasks = new ObservableCollection<TaskData>(); TaskHistories = new ObservableCollection<CombinedTaskHistory> (); RawTaskHistories = new ObservableCollection<CombinedTaskHistory> (); UpdateTaskList (); // show today task at default // this result in call UpdateTaskHistoryList(); ShowDate = DateTime.Today; }
public Model() { // prepare model state/data m_data = new PersistentModelData(); // prepare DB // Log.Debug ("Ruly", "ext sd: " + Android.OS.Environment.ExternalStorageDirectory); // string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); string folder = Android.OS.Environment.ExternalStorageDirectory + "/ruly/ruly.db"; Util.EnsureDirectory(System.IO.Path.GetDirectoryName(folder)); m_db = new SQLiteConnection(folder); m_db.CreateTable <TaskData>(); m_db.CreateTable <TaskHistory>(); m_db.CreateTable <TaskAlarm> (); m_unknown_task = new TaskData() { Id = -1, Title = "休憩" }; // create ViewModel I/F datasets Tasks = new ObservableCollection <TaskData>(); TaskHistories = new ObservableCollection <CombinedTaskHistory> (); RawTaskHistories = new ObservableCollection <CombinedTaskHistory> (); UpdateTaskList(); // show today task at default // this result in call UpdateTaskHistoryList(); ShowDate = DateTime.Today; }
public void LoadState() { string folder = Android.OS.Environment.ExternalStorageDirectory + "/ruly/"; // string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine(folder, "model_data.json"); try { var sw = new StreamReader(path, Encoding.Unicode); if (sw != null) { m_data = Newtonsoft.Json.JsonConvert.DeserializeObject <PersistentModelData>(sw.ReadToEnd()); sw.Close(); } } catch (Exception e) { Log.Debug("RULY", e.Message); } }
public void LoadState() { string folder = Android.OS.Environment.ExternalStorageDirectory + "/ruly/"; // string folder = Environment.GetFolderPath (Environment.SpecialFolder.Personal); var path = System.IO.Path.Combine (folder, "model_data.json"); try { var sw = new StreamReader(path, Encoding.Unicode); if(sw != null) { m_data = Newtonsoft.Json.JsonConvert.DeserializeObject<PersistentModelData>(sw.ReadToEnd()); sw.Close(); } } catch (Exception e) { Log.Debug ("RULY", e.Message); } }