public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { nuint row = (nuint)indexPath.Row; Control ctrl = Controller.Controls.GetItem <Control>(row); string sampleListPathString = NSBundle.MainBundle.BundlePath + "/plist/SampleList.plist"; NSDictionary sampleDict = new NSDictionary(); sampleDict = NSDictionary.FromFile(sampleListPathString); NSMutableArray dictArray = sampleDict.ValueForKey(new NSString(ctrl.Name)) as NSMutableArray; NSMutableArray collections = new NSMutableArray(); Control contrl = Controller.Controls.GetItem <Control>((nuint)indexPath.Row); for (nuint i = 0; i < dictArray.Count; i++) { NSDictionary dict = dictArray.GetItem <NSDictionary>(i); Control control = new Control { ControlName = ctrl.Name, Name = (NSString)dict.ValueForKey(new NSString("SampleName")), Description = (NSString)dict.ValueForKey(new NSString("Description")) }; NSString imageToLoad = (NSString)dict.ValueForKey(new NSString("Image")); if (imageToLoad != null) { control.Image = UIImage.FromBundle(imageToLoad); } if (dict.ValueForKey(new NSString("IsNew")) != null && dict.ValueForKey(new NSString("IsNew")).ToString().ToUpper() == "YES") { control.Tag = new NSString("NEW"); } else if (dict.ValueForKey(new NSString("IsUpdated")) != null && dict.ValueForKey(new NSString("IsUpdated")).ToString().ToUpper() == "YES") { control.Tag = new NSString("UPDATED"); } else if (dict.ValueForKey(new NSString("IsPreview")) != null && dict.ValueForKey(new NSString("IsPreview")).ToString().ToUpper() == "YES") { control.Tag = new NSString("PREVIEW"); } else { control.Tag = new NSString(string.Empty); } if (dict.ValueForKey(new NSString("DisplayName")) != null) { control.DisplayName = dict.ValueForKey(new NSString("DisplayName")) as NSString; } else { control.DisplayName = new NSString(string.Empty); } collections.Add(control); } this.Controller.NavigationItem.BackBarButtonItem = new UIBarButtonItem("Back", UIBarButtonItemStyle.Plain, null); if (ctrl.Name == "Chart") { ChartSamplesViewController sampleController = new ChartSamplesViewController { FeaturesCollections = collections, ControlName = contrl.Name, Types = contrl.Type1, Features = contrl.Type2 }; Controller.NavigationController.PushViewController(sampleController, true); } else { indexPath = NSIndexPath.FromRowSection(0, 0); SampleViewController controller = new SampleViewController(indexPath) { SamplesCollection = collections, ControlName = contrl.Name }; Controller.NavigationController.PushViewController(controller, true); } }
public override NSDictionary RegistrationDictionaryForGrowl() { string path = NSBundle.MainBundle.PathForResource("Growl", "plist"); return(NSDictionary.FromFile(path)); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { NSUserDefaults.StandardUserDefaults.RegisterDefaults(NSDictionary.FromFile("Info.plist")); return(true); }
static PlatformInfo GetHostPlatformInfo() { string name; string version; #if __MACCATALYST__ name = "MacCatalyst"; version = UIDevice.CurrentDevice.SystemVersion; #elif __TVOS__ || __IOS__ name = UIDevice.CurrentDevice.SystemName; version = UIDevice.CurrentDevice.SystemVersion; #elif __WATCHOS__ name = WatchKit.WKInterfaceDevice.CurrentDevice.SystemName; version = WatchKit.WKInterfaceDevice.CurrentDevice.SystemVersion; #elif MONOMAC || __MACOS__ using (var plist = NSDictionary.FromFile("/System/Library/CoreServices/SystemVersion.plist")) { name = (NSString)plist ["ProductName"]; version = (NSString)plist ["ProductVersion"]; } #else #error Unknown platform #endif name = name?.Replace(" ", String.Empty)?.ToLowerInvariant(); if (name == null) { throw new FormatException("Product name is `null`"); } var platformInfo = new PlatformInfo(); if (name.StartsWith("maccatalyst", StringComparison.Ordinal)) { platformInfo.Name = PlatformName.MacCatalyst; } else if (name.StartsWith("mac", StringComparison.Ordinal)) { platformInfo.Name = PlatformName.MacOSX; } else if (name.StartsWith("ios", StringComparison.Ordinal) || name.StartsWith("iphoneos", StringComparison.Ordinal)) { platformInfo.Name = PlatformName.iOS; } else if (name.StartsWith("tvos", StringComparison.Ordinal)) { platformInfo.Name = PlatformName.TvOS; } else if (name.StartsWith("watchos", StringComparison.Ordinal)) { platformInfo.Name = PlatformName.WatchOS; } else { throw new FormatException($"Unknown product name: {name}"); } platformInfo.Version = Version.Parse(version); if (IntPtr.Size == 4) { platformInfo.Architecture = PlatformArchitecture.Arch32; } else if (IntPtr.Size == 8) { platformInfo.Architecture = PlatformArchitecture.Arch64; } return(platformInfo); }
static iOSAuthSSOClient() { var googleServiceDictionary = NSDictionary.FromFile("GoogleService-Info.plist"); Google.SignIn.SignIn.SharedInstance.ClientID = googleServiceDictionary["CLIENT_ID"].ToString(); }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { XfxControls.Init(); ButtonCircle.FormsPlugin.iOS.ButtonCircleRenderer.Init(); UINavigationBar.Appearance.TintColor = Color.White.ToUIColor(); global::Xamarin.Forms.Forms.Init(); Firebase.Core.App.Configure(); KeyboardOverlapRenderer.Init(); DependencyService.Register <ToastNotification>(); // Register your dependency ToastNotification.Init(); FFImageLoading.Forms.Touch.CachedImageRenderer.Init(); var ignore = new CircleTransformation(); //CarouselViewRenderer.Init(); DependencyService.Register <IGoogleManager, GoogleManager>(); DependencyService.Register <IFacebookManager, FacebookManager>(); var googleServiceDictionary = NSDictionary.FromFile("GoogleService-Info.plist"); SignIn.SharedInstance.ClientID = googleServiceDictionary["CLIENT_ID"].ToString(); FormsMaps.Init(); Rg.Plugins.Popup.Popup.Init(); LoadApplication(new App()); //var statusBar = UIApplication.SharedApplication.ValueForKey(new NSString("statusBar")) as UIView; //if (statusBar.RespondsToSelector(new ObjCRuntime.Selector("setBackgroundColor:"))) //{ // statusBar.BackgroundColor = UIColor.White; // statusBar.TintColor = UIColor.White; //} ImageCircle.Forms.Plugin.iOS.ImageCircleRenderer.Init(); //FirebasePushNotificationManager.Initialize(options, new NotificationUserCategory[] //{ // new NotificationUserCategory("message",new List<NotificationUserAction> { // new NotificationUserAction("Reply","Reply",NotificationActionType.Foreground) // }), // new NotificationUserCategory("request",new List<NotificationUserAction> { // new NotificationUserAction("Accept","Accept"), // new NotificationUserAction("Reject","Reject",NotificationActionType.Destructive) // }) //}); // Register your app for remote notifications. if (UIDevice.CurrentDevice.CheckSystemVersion(10, 0)) { // iOS 10 or later var authOptions = UNAuthorizationOptions.Alert | UNAuthorizationOptions.Badge | UNAuthorizationOptions.Sound; UNUserNotificationCenter.Current.RequestAuthorization(authOptions, (granted, error) => { Console.WriteLine(granted); }); // For iOS 10 display notification (sent via APNS) UNUserNotificationCenter.Current.Delegate = this; // For iOS 10 data message (sent via FCM) Messaging.SharedInstance.RemoteMessageDelegate = this; } else { // iOS 9 or before var allNotificationTypes = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound; var settings = UIUserNotificationSettings.GetSettingsForTypes(allNotificationTypes, null); UIApplication.SharedApplication.RegisterUserNotificationSettings(settings); } UIApplication.SharedApplication.RegisterForRemoteNotifications(); return(base.FinishedLaunching(app, options)); }
/// <summary> /// Load Plist Fro,m Bundle /// </summary> /// <param name="plistName"></param> /// <returns></returns> private NSDictionary LoadPlistFromBundle(string plistName) { var path = NSBundle.MainBundle.PathForResource(plistName, "plist"); return(NSDictionary.FromFile(path)); }
static void Init() { SetInvalid(); DeveloperRoot = Environment.GetEnvironmentVariable("MD_APPLE_SDK_ROOT"); if (DeveloperRoot.IsNullOrEmpty) { DeveloperRoot = GetConfiguredSdkLocation(); } bool foundSdk = false; FilePath xcode, vplist, devroot; if (DeveloperRoot.IsNullOrEmpty) { foreach (var v in DefaultRoots) { if (ValidateSdkLocation(v, out xcode, out vplist, out devroot)) { foundSdk = true; break; } else { LoggingService.LogDebug("Apple iOS SDK not found at '{0}'", v); } } } else { foundSdk = ValidateSdkLocation(DeveloperRoot, out xcode, out vplist, out devroot); } if (foundSdk) { XcodePath = xcode; DeveloperRoot = devroot; DeveloperRootVersionPlist = vplist; } else { SetInvalid(); return; } try { var plist = XcodePath.Combine("Contents", "Info.plist"); if (!File.Exists(plist)) { return; } lastWritten = File.GetLastWriteTime(plist); XcodeVersion = new Version(3, 2, 6); XcodeRevision = 0; // DTXCode was introduced after xcode 3.2.6 so it may not exist using (var pool = new NSAutoreleasePool()) { var dict = NSDictionary.FromFile(plist); NSObject value; if (dict.TryGetValue((NSString)"DTXcode", out value)) { DTXcode = ((NSString)value).ToString(); } if (dict.TryGetValue((NSString)"CFBundleShortVersionString", out value)) { XcodeVersion = Version.Parse(((NSString)value).ToString()); } if (dict.TryGetValue((NSString)"CFBundleVersion", out value)) { XcodeRevision = int.Parse(((NSString)value).ToString()); } } IsXcode4 = !string.IsNullOrEmpty(DTXcode) && int.Parse(DTXcode) >= 0400; IsValid = true; } catch (Exception ex) { LoggingService.LogError("Error loading Xcode information for prefix '" + DeveloperRoot + "'", ex); SetInvalid(); } }
//======================================================================== //======================================================================== /// <summary> /// Recursive version of LoadDefautSetings /// </summary> private static void LoadSettingsFile(NSDictionary settings) { //---- declare vars bool foundTypeKey; bool foundDefaultValue; string prefKeyName; NSObject prefDefaultValue; NSObject key; //---- get the preference specifiers node NSArray prefs = settings.ObjectForKey(new NSString("PreferenceSpecifiers")) as NSArray; //---- loop through the settings for (uint i = 0; i < prefs.Count; i++) { //---- reset for each setting foundTypeKey = false; foundDefaultValue = false; prefKeyName = string.Empty; prefDefaultValue = new NSObject(); //---- NSDictionary pref = new NSDictionary(prefs.ValueAt(i)); #if DEBUG Console.WriteLine("============="); #endif //---- loop through the dictionary of any particular setting for (uint keyCount = 0; keyCount < pref.Keys.Length; keyCount++) { //---- shortcut reference key = pref.Keys[keyCount]; //---- get the key name and default value if (key.ToString() == "Key") { foundTypeKey = true; prefKeyName = pref[key].ToString(); } else if (key.ToString() == "DefaultValue") { foundDefaultValue = true; prefDefaultValue = pref[key]; } else if (key.ToString() == "File") { #if DEBUG Console.WriteLine("calling recursively"); Console.WriteLine("<nested>"); #endif NSDictionary nestedSettings = NSDictionary.FromFile( NSBundle.MainBundle.BundlePath + "/Settings.bundle/" + pref[key].ToString() + ".plist"); LoadSettingsFile(nestedSettings); #if DEBUG Console.WriteLine("</nested>"); #endif } //---- if we've found both, set it in our user preferences if (foundTypeKey && foundDefaultValue) { NSUserDefaults.StandardUserDefaults[prefKeyName] = prefDefaultValue; } #if DEBUG //---- write to the console, our values WriteKeyAndValueToOutput(pref, key); #endif } } }
public override void ItemSelected(UICollectionView collectionView, NSIndexPath indexPath) { nuint row = (nuint)indexPath.Row; Control ctrl = controller.controls.GetItem <Control>(row); string sampleListPathString = NSBundle.MainBundle.BundlePath + "/plist/SampleList.plist"; NSDictionary sampleDict = new NSDictionary(); sampleDict = NSDictionary.FromFile(sampleListPathString); //NSMutableArray samplesArray = new NSMutableArray(); NSMutableArray dictArray = sampleDict.ValueForKey(new NSString(ctrl.name)) as NSMutableArray; NSMutableArray collections = new NSMutableArray(); Control contrl = controller.controls.GetItem <Control>((nuint)indexPath.Row); for (nuint i = 0; i < dictArray.Count; i++) { NSDictionary dict = dictArray.GetItem <NSDictionary>(i); //samplesArray.Add(dict.ValueForKey(new NSString("SampleName"))); Control control = new Control(); control.ControlName = ctrl.name; control.name = (NSString)dict.ValueForKey(new NSString("SampleName")); control.description = (NSString)dict.ValueForKey(new NSString("Description")); NSString imageToLoad = (NSString)dict.ValueForKey(new NSString("Image")); if (imageToLoad != null) { control.image = UIImage.FromBundle(imageToLoad); } if (dict.ValueForKey(new NSString("IsNew")) != null && dict.ValueForKey(new NSString("IsNew")).ToString() == "YES") { control.tag = new NSString("NEW"); } else if (dict.ValueForKey(new NSString("IsUpdated")) != null && dict.ValueForKey(new NSString("IsUpdated")).ToString() == "YES") { control.tag = new NSString("UPDATED"); } else if (dict.ValueForKey(new NSString("IsPreview")) != null && dict.ValueForKey(new NSString("IsPreview")).ToString() == "YES") { control.tag = new NSString("PREVIEW"); } else { control.tag = new NSString(""); } if (dict.ValueForKey(new NSString("DisplayName")) != null) { control.dispName = dict.ValueForKey(new NSString("DisplayName")) as NSString; } else { control.dispName = new NSString(""); } collections.Add(control); } if (ctrl.name == "Chart") { ChartSamplesViewController sampleController = new ChartSamplesViewController(); sampleController.FeaturesCollections = collections; sampleController.ControlName = contrl.name; sampleController.Types = contrl.Type1; sampleController.Features = contrl.Type2; controller.NavigationController.PushViewController(sampleController, true); } //Go directly to sample page for controls having sample less than or equat to 4 else { indexPath = NSIndexPath.FromRowSection(0, 0); SampleViewController _controller = new SampleViewController(indexPath); _controller.SamplesCollection = collections; _controller.ControlName = contrl.name; //_controller.DisplayNameCollection = dispNames; controller.NavigationController.PushViewController(_controller, true); } }
public DataSource() { var dataPath = NSBundle.MainBundle.PathForResource("Data", "plist"); data = NSDictionary.FromFile(dataPath); }
public override void ViewDidLoad() { base.ViewDidLoad(); String plist_path = NSBundle.MainBundle.PathForResource("Info.plist", null); NSDictionary dict = NSDictionary.FromFile(plist_path); NSDate buildDate = NSFileManager.DefaultManager.GetAttributes(plist_path).CreationDate; NSDateComponents components = NSCalendar.CurrentCalendar.Components(NSCalendarUnit.Year, buildDate); int bulidYear = (int)components.Year; string version = NSBundle.MainBundle.ObjectForInfoDictionary("CFBundleShortVersionString").ToString(); string html = String.Format( @"<!DOCTYPE html> <html> <head> <style> *{{ overflow:hidden; }} body{{ line-height:1; text-align:center; font-family: sans-serif; }} div{{ background-color:rgb(235,235,235); //height:100% !important; padding:0.3em; border-radius:1em; -webkit-border-radius:1em; }} p{{ margin-top:0.8em !important; margin-bottom:0 !important; }} </style> </head> <body> <div> <p>Pixelnetica Document Scanning SDK <p>Version {0} <p>For more information, visit <p><a target=""_blank"" href=""http://www.pixelnetica.com/products/document-scanning-sdk/mobile-document-capture-sdk.html"">Document Scanning SDK page</a> <p>© Pixelnetica {1} <p> </div> </body> </html>", version, bulidYear ); UIWebView webView = this.WebView; webView.Delegate = webDelegate; webView.LoadHtmlString(html, null); }
public override void ViewWillAppear(bool animated) { base.ViewWillAppear(animated); this.NavigationController.NavigationBar.BarTintColor = Utility.ThemeColor; this.View.BackgroundColor = UIColor.White; menuButton = new UIBarButtonItem { Image = UIImage.FromBundle("Images/Changefile"), Style = UIBarButtonItemStyle.Plain, Target = this }; menuButton.Clicked += OpenMenu; fadeOutView = new UIView(this.View.Bounds) { BackgroundColor = UIColor.FromRGBA(0.537f, 0.537f, 0.537f, 0.3f) }; UITapGestureRecognizer singleFingerTap = new UITapGestureRecognizer(); singleFingerTap.AddTarget(() => HandleSingleTap(singleFingerTap)); fadeOutView.AddGestureRecognizer(singleFingerTap); string controlListPathString = NSBundle.MainBundle.BundlePath + "/plist/SourceList.plist"; NSDictionary controlDict = new NSDictionary(); controlDict = NSDictionary.FromFile(controlListPathString); NSString controlDictKey = new NSString(ControlName); string sample = GetFileName(SampleName); NSDictionary controlDictArray = controlDict.ValueForKey(controlDictKey) as NSDictionary; if (controlDictArray != null) { NSString sampleDictKey = new NSString(sample); SampleDictionaryArray = controlDictArray.ValueForKey(sampleDictKey) as NSArray; if (SampleDictionaryArray != null) { sample = (string)SampleDictionaryArray.GetItem <NSString>(0); this.NavigationItem.SetRightBarButtonItem(menuButton, true); menuVisible = false; nfloat height = this.View.Bounds.Height - 64; nfloat left = this.View.Bounds.Width - 260; MenuView = new UIView(new CGRect(left, 64, 260, height)); MenuTable = new UITableView(new CGRect(0, 0, 260, height)); MenuTable.Layer.BorderWidth = 0.5f; MenuTable.Layer.BorderColor = UIColor.FromRGBA(0.537f, 0.537f, 0.537f, 0.5f).CGColor; MenuTable.BackgroundColor = UIColor.White; MenuTable.Source = new SampleDataSource(this); NSIndexPath indexPath = NSIndexPath.FromRowSection(0, 0); MenuTable.SelectRow(indexPath, false, UITableViewScrollPosition.Top); MenuView.AddSubview(MenuTable); } } viewer = new UILabel { Font = UIFont.SystemFontOfSize(12.0f), Lines = 0, LineBreakMode = UILineBreakMode.WordWrap }; viewer.SizeToFit(); scrollview = new UIScrollView(); scrollview.AddSubview(viewer); this.View.AddSubview(scrollview); this.LoadSample((string)sample); }