public override bool FinishedLaunching(UIApplication app, NSDictionary options) { // Activate TestFlight MonoTouch.TestFlight.TestFlight.TakeOffThreadSafe(@"d8fc2051-04bd-4612-b83f-19786b749aab"); // Activate Vernacular Catalog Catalog.Implementation = new ResourceCatalog { GetResourceById = id => { var resource = NSBundle.MainBundle.LocalizedString(id, null); return(resource == id ? null : resource); }, }; // System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE"); observerSettings = NSNotificationCenter.DefaultCenter.AddObserver((NSString)"NSUserDefaultsDidChangeNotification", DefaultsChanged); DefaultsChanged(null); // Set Google Maps API Key MapServices.ProvideAPIKey(MapsApiKey); // create a new window instance based on the screen size window = new UIWindow(UIScreen.MainScreen.Bounds); // Set default color for NavigationButtons UIBarButtonItem.Appearance.TintColor = Colors.NavBarButton; // Create NavigationControlls navCartSelect = new UINavigationController(); // Set color of NavigationBar and NavigationButtons (TintColor) // OS specific details if (new Version(UIDevice.CurrentDevice.SystemVersion) >= new Version(7, 0)) { navCartSelect.NavigationBar.SetBackgroundImage(Images.BlueTop, UIBarMetrics.Default); } else { navCartSelect.NavigationBar.SetBackgroundImage(Images.Blue, UIBarMetrics.Default); } navCartSelect.NavigationBar.TintColor = Colors.NavBarButton; // Now create list for cartridges viewCartSelect = new CartridgeList(this); // Add the cartridge view to the navigation controller // (it'll be the top most screen) navCartSelect.PushViewController((UIViewController)viewCartSelect, false); // Set the root view controller on the window. The nav // controller will handle the rest // If you have defined a view, add it here: // window.AddSubview (navigationController.View); window.RootViewController = navCartSelect; // make the window visible window.MakeKeyAndVisible(); return(true); }
// Is called by other apps from "open in" dialogs public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var sourceFile = url.Path; var destFile = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), System.IO.Path.GetFileName(sourceFile)); if (!File.Exists(sourceFile)) { return(false); } var fileExists = false; if (File.Exists(destFile)) { fileExists = true; File.Delete(destFile); } File.Copy(sourceFile, destFile); Cartridge cart = new Cartridge(destFile); CartridgeLoaders.LoadMetadata(new FileStream(destFile, FileMode.Open), cart); // TODO // If there was a cartridge with the same filename, than replace if (fileExists) { } if (window.RootViewController.PresentedViewController is UINavigationController && window.RootViewController.PresentedViewController == navCartSelect) { // Now create a new list for cartridges viewCartSelect = new CartridgeList(this); // Add the cartridge view to the navigation controller // (it'll be the top most screen) navCartSelect.PopToRootViewController(true); navCartSelect.SetViewControllers(new UIViewController[] { (UIViewController)viewCartSelect }, false); // CartridgeDetail cartDetail = new CartridgeDetail(this); // ((UINavigationController)window.RootViewController.PresentedViewController).PushViewController (cartDetail,true); // cartDetail.Cartridge = cart; } return(true); }
public override bool FinishedLaunching (UIApplication app, NSDictionary options) { // Activate TestFlight MonoTouch.TestFlight.TestFlight.TakeOffThreadSafe(@"d8fc2051-04bd-4612-b83f-19786b749aab"); // Activate Vernacular Catalog Catalog.Implementation = new ResourceCatalog { GetResourceById = id => { var resource = NSBundle.MainBundle.LocalizedString(id, null); return resource == id ? null : resource; }, }; // System.Threading.Thread.CurrentThread.CurrentUICulture = new CultureInfo("de-DE"); observerSettings = NSNotificationCenter.DefaultCenter.AddObserver ((NSString)"NSUserDefaultsDidChangeNotification", DefaultsChanged); DefaultsChanged (null); // Set Google Maps API Key MapServices.ProvideAPIKey (MapsApiKey); // create a new window instance based on the screen size window = new UIWindow (UIScreen.MainScreen.Bounds); // Set default color for NavigationButtons UIBarButtonItem.Appearance.TintColor = Colors.NavBarButton; // Create NavigationControlls navCartSelect = new UINavigationController(); // Set color of NavigationBar and NavigationButtons (TintColor) // OS specific details if (new Version (UIDevice.CurrentDevice.SystemVersion) >= new Version(7,0)) navCartSelect.NavigationBar.SetBackgroundImage (Images.BlueTop, UIBarMetrics.Default); else navCartSelect.NavigationBar.SetBackgroundImage (Images.Blue, UIBarMetrics.Default); navCartSelect.NavigationBar.TintColor = Colors.NavBarButton; // Now create list for cartridges viewCartSelect = new CartridgeList(this); // Add the cartridge view to the navigation controller // (it'll be the top most screen) navCartSelect.PushViewController((UIViewController)viewCartSelect, false); // Set the root view controller on the window. The nav // controller will handle the rest // If you have defined a view, add it here: // window.AddSubview (navigationController.View); window.RootViewController = navCartSelect; // make the window visible window.MakeKeyAndVisible (); return true; }
// Is called by other apps from "open in" dialogs public override bool OpenUrl(UIApplication application, NSUrl url, string sourceApplication, NSObject annotation) { var sourceFile = url.Path; var destFile = System.IO.Path.Combine(Environment.GetFolderPath (Environment.SpecialFolder.Personal), System.IO.Path.GetFileName(sourceFile)); if (!File.Exists (sourceFile)) return false; var fileExists = false; if (File.Exists (destFile)) { fileExists = true; File.Delete (destFile); } File.Copy (sourceFile, destFile); Cartridge cart = new Cartridge(destFile); CartridgeLoaders.LoadMetadata(new FileStream(destFile, FileMode.Open), cart); // TODO // If there was a cartridge with the same filename, than replace if (fileExists) { } if (window.RootViewController.PresentedViewController is UINavigationController && window.RootViewController.PresentedViewController == navCartSelect) { // Now create a new list for cartridges viewCartSelect = new CartridgeList(this); // Add the cartridge view to the navigation controller // (it'll be the top most screen) navCartSelect.PopToRootViewController (true); navCartSelect.SetViewControllers(new UIViewController[] {(UIViewController)viewCartSelect}, false); // CartridgeDetail cartDetail = new CartridgeDetail(this); // ((UINavigationController)window.RootViewController.PresentedViewController).PushViewController (cartDetail,true); // cartDetail.Cartridge = cart; } return true; }