/// <summary> /// Loads the best sessions.json it can find - first look in SpecialFolder /// (if not there, load the one that was included in the app download) /// </summary> public override bool FinishedLaunching(UIApplication app, NSDictionary options) { AppDelegate.current = this; documentsPath = Environment.GetFolderPath (Environment.SpecialFolder.Personal); // Documents folder libraryPath = Path.Combine (documentsPath, "..", "Library"); // Library folder var builtInJsonPath = Path.Combine (System.Environment.CurrentDirectory, ConferenceManager.JsonDataFilename); jsonPath = Path.Combine (libraryPath, ConferenceManager.JsonDataFilename); // UserData = new UserDatabase(Path.Combine (libraryPath, SqliteDataFilename)); Conference = new ConferenceManager(); Conference.OnDownloadSucceeded += (jsonString) => { File.WriteAllText (jsonPath, jsonString); NSUserDefaults.StandardUserDefaults.SetString(ConferenceManager.LastUpdatedDisplay, "LastUpdated"); Console.WriteLine("Local json file updated " + jsonPath); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; Conference.OnDownloadFailed += (error) => { Console.WriteLine("OnDownloadFailed:" + error); UIApplication.SharedApplication.NetworkActivityIndicatorVisible = false; }; #region Get session data from json into memory... var json = ""; if (!File.Exists(jsonPath)) { //jsonPath = builtInJsonPath; // use the bundled file NSUserDefaults.StandardUserDefaults.SetString("2013-05-28 15:15:15", "LastUpdated"); File.Copy (builtInJsonPath, jsonPath); // so it is there for loading } json = File.ReadAllText(jsonPath); MonkeySpace.Core.ConferenceManager.LoadFromString (json); #endregion #region APPEARANCE //#d4563e UINavigationBar.Appearance.TintColor = new UIColor(212/255f, 86/255f, 62/255f, 1f); UILabel.Appearance.Font = UIFont.FromName (FontLightName, 14f); // Avenir-Heavy, Avenir-Black, Avenir-Medium, ...Oblique UINavigationBar.Appearance.SetTitleTextAttributes (FontTitleTextAttributes); UIBarButtonItem.Appearance.SetTitleTextAttributes (FontBackTextAttributes, UIControlState.Normal); #endregion FlyoutNavigation = new CustomFlyoutNavigationController (); window = new UIWindow (UIScreen.MainScreen.Bounds); window.RootViewController = FlyoutNavigation; window.MakeKeyAndVisible (); return true; }