当前位置: 首页>>代码示例>>C#>>正文


C# NSMutableDictionary类代码示例

本文整理汇总了C#中NSMutableDictionary的典型用法代码示例。如果您正苦于以下问题:C# NSMutableDictionary类的具体用法?C# NSMutableDictionary怎么用?C# NSMutableDictionary使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


NSMutableDictionary类属于命名空间,在下文中一共展示了NSMutableDictionary类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: CMMemoryPool

		public CMMemoryPool (TimeSpan ageOutPeriod)
		{
			using (var dict = new NSMutableDictionary ()) {
				dict.LowlevelSetObject (AgeOutPeriodSelector, new NSNumber (ageOutPeriod.TotalSeconds).Handle);
				handle = CMMemoryPoolCreate (dict.Handle);
			}
		}
开发者ID:Anomalous-Software,项目名称:maccore,代码行数:7,代码来源:CMMemoryPool.cs

示例2: CreateKeyPair

        /// <inheritdoc/>
        public ICryptographicKey CreateKeyPair(int keySize)
        {
            Requires.Range(keySize > 0, "keySize");

            string keyIdentifier = Guid.NewGuid().ToString();
            string publicKeyIdentifier = RsaCryptographicKey.GetPublicKeyIdentifierWithTag(keyIdentifier);
            string privateKeyIdentifier = RsaCryptographicKey.GetPrivateKeyIdentifierWithTag(keyIdentifier);

            // Configure parameters for the joint keypair.
            var keyPairAttr = new NSMutableDictionary();
            keyPairAttr[KSec.AttrKeyType] = KSec.AttrKeyTypeRSA;
            keyPairAttr[KSec.AttrKeySizeInBits] = NSNumber.FromInt32(keySize);

            // Configure parameters for the private key
            var privateKeyAttr = new NSMutableDictionary();
            privateKeyAttr[KSec.AttrIsPermanent] = NSNumber.FromBoolean(true);
            privateKeyAttr[KSec.AttrApplicationTag] = NSData.FromString(privateKeyIdentifier, NSStringEncoding.UTF8);

            // Configure parameters for the public key
            var publicKeyAttr = new NSMutableDictionary();
            publicKeyAttr[KSec.AttrIsPermanent] = NSNumber.FromBoolean(true);
            publicKeyAttr[KSec.AttrApplicationTag] = NSData.FromString(publicKeyIdentifier, NSStringEncoding.UTF8);

            // Parent the individual key parameters to the keypair one.
            keyPairAttr[KSec.PublicKeyAttrs] = publicKeyAttr;
            keyPairAttr[KSec.PrivateKeyAttrs] = privateKeyAttr;

            // Generate the RSA key.
            SecKey publicKey, privateKey;
            SecStatusCode code = SecKey.GenerateKeyPair(keyPairAttr, out publicKey, out privateKey);
            Verify.Operation(code == SecStatusCode.Success, "status was " + code);

            return new RsaCryptographicKey(publicKey, privateKey, keyIdentifier, this.algorithm);
        }
开发者ID:tofutim,项目名称:PCLCrypto,代码行数:35,代码来源:RsaAsymmetricKeyAlgorithmProvider.cs

示例3: AddBeerToIndex

        public void AddBeerToIndex(Beer beer)
        {
            var activity = new NSUserActivity("com.micjames.beerdrinkin.beerdetails");

            if (!string.IsNullOrEmpty(beer.Description))
            {
                var info = new NSMutableDictionary();
                info.Add(new NSString("name"), new NSString(beer.Name));
                info.Add(new NSString("description"), new NSString(beer.Description));

                if (beer?.Image?.MediumUrl != null)
                {
                    info.Add(new NSString("imageUrl"), new NSString(beer.Image.LargeUrl));
                }

                var attributes = new CSSearchableItemAttributeSet();
                attributes.DisplayName = beer.Name;
                attributes.ContentDescription = beer.Description;

                var keywords = new NSString[] { new NSString(beer.Name), new NSString("beerName") };
                activity.Keywords = new NSSet<NSString>(keywords);
                activity.ContentAttributeSet = attributes;

                activity.Title = beer.Name;
                activity.UserInfo = info;

                activity.EligibleForSearch = true;
                activity.EligibleForPublicIndexing = true;
                activity.BecomeCurrent();
            }

        }
开发者ID:MikeCodesDotNet,项目名称:Beer-Drinkin,代码行数:32,代码来源:SpotlightService.cs

示例4: logEvent

 public void logEvent (string eventName, object[] args) {
   if (args.Length == 0) {
     try {
       FA.Flurry.LogEvent(eventName);
     } catch (Exception e) {
       PlayN.log().warn("Failed to log event to Flurry [event=" + eventName + "]", e);
     }
   } else {
     var dict = new NSMutableDictionary();
     for (int ii = 0; ii < args.Length; ii += 2) {
       var key = (string)args[ii];
       var value = args[ii+1];
       if (value is string) {
         dict.Add(new NSString(key), new NSString((string)value));
       } else if (value is java.lang.Boolean) {
         dict.Add(new NSString(key), new NSNumber(((java.lang.Boolean)value).booleanValue()));
       } else if (value is java.lang.Integer) {
         dict.Add(new NSString(key), new NSNumber(((java.lang.Integer)value).intValue()));
       } else {
         var vclass = (value == null) ? "null" : value.GetType().ToString();
         PlayN.log().warn("Got unknown Flurry event parameter type [key=" + key +
                          ", value=" + value + ", vclass=" + vclass + "]");
       }
     }
     try {
       FA.Flurry.LogEvent(eventName, dict);
     } catch (Exception e) {
       PlayN.log().warn("Failed to log event to Flurry [event=" + eventName +
                        ", argCount=" + args.Length + "]", e);
     }
   }
 }
开发者ID:livingblast,项目名称:playn-samples,代码行数:32,代码来源:Main.cs

示例5: NavigateToURL

		/// <summary>
		/// Navigates the Webview to the given URL string.
		/// </summary>
		/// <param name="url">URL.</param>
		private void NavigateToURL(string url) {

			// Properly formatted?
			if (!url.StartsWith ("http://")) {
				// Add web
				url = "http://" + url;
			}

			// Display the give webpage
			WebView.LoadRequest(new NSUrlRequest(NSUrl.FromString(url)));

			// Invalidate existing Activity
			if (UserActivity != null) {
				UserActivity.Invalidate();
				UserActivity = null;
			}

			// Create a new user Activity to support this tab
			UserActivity = new NSUserActivity (ThisApp.UserActivityTab4);
			UserActivity.Title = "Coffee Break Tab";

			// Update the activity when the tab's URL changes
			var userInfo = new NSMutableDictionary ();
			userInfo.Add (new NSString ("Url"), new NSString (url));
			UserActivity.AddUserInfoEntries (userInfo);

			// Inform Activity that it has been updated
			UserActivity.BecomeCurrent ();

			// Log User Activity
			Console.WriteLine ("Creating User Activity: {0} - {1}", UserActivity.Title, url);
		}
开发者ID:CBrauer,项目名称:monotouch-samples,代码行数:36,代码来源:FourthViewController.cs

示例6: SetupLiveCameraStream

        public void SetupLiveCameraStream()
        {
            captureSession = new AVCaptureSession();

            var viewLayer = liveCameraStream.Layer;

            Console.WriteLine(viewLayer.Frame.Width);

            var videoPreviewLayer = new AVCaptureVideoPreviewLayer(captureSession)
            {
                Frame = liveCameraStream.Bounds
            };
            liveCameraStream.Layer.AddSublayer(videoPreviewLayer);

            Console.WriteLine(liveCameraStream.Layer.Frame.Width);

            var captureDevice = AVCaptureDevice.DefaultDeviceWithMediaType(AVMediaType.Video);
            ConfigureCameraForDevice(captureDevice);
            captureDeviceInput = AVCaptureDeviceInput.FromDevice(captureDevice);

            var dictionary = new NSMutableDictionary();
            dictionary[AVVideo.CodecKey] = new NSNumber((int)AVVideoCodec.JPEG);
            stillImageOutput = new AVCaptureStillImageOutput()
            {
                OutputSettings = new NSDictionary()
            };

            captureSession.AddOutput(stillImageOutput);
            captureSession.AddInput(captureDeviceInput);
            captureSession.StartRunning();

            ViewWillLayoutSubviews();
        }
开发者ID:xmendoza,项目名称:BeerDrinkin,代码行数:33,代码来源:CameraViewController.cs

示例7: TwitterRequest

			public TwitterRequest (string method, Uri url, IDictionary<string, string> paramters, Account account)
				: base (method, url, paramters, account)
			{
				var ps = new NSMutableDictionary ();
				if (paramters != null) {
					foreach (var p in paramters) {
						ps.SetValueForKey (new NSString (p.Value), new NSString (p.Key));
					}
				}

				var m = TWRequestMethod.Get;
				switch (method.ToLowerInvariant()) {
				case "get":
					m = TWRequestMethod.Get;
					break;
				case "post":
					m = TWRequestMethod.Post;
					break;
				case "delete":
					m = TWRequestMethod.Delete;
					break;
				default:
					throw new NotSupportedException ("Twitter does not support the HTTP method '" + method + "'");
				}

				request = new TWRequest (new NSUrl (url.AbsoluteUri), ps, m);

				Account = account;
			}
开发者ID:Willseph,项目名称:Xamarin.Social,代码行数:29,代码来源:Twitter5Service.cs

示例8: ConvertToDictionary

        public static Dictionary<String, Object> ConvertToDictionary(NSMutableDictionary dictionary)
        {
            Dictionary<String,Object> prunedDictionary = new Dictionary<String,Object>();
            foreach (NSString key in dictionary.Keys) {
                NSObject dicValue = dictionary.ObjectForKey(key);

                if (dicValue is NSDictionary) {
                    prunedDictionary.Add (key.ToString(), ConvertToDictionary(new NSMutableDictionary(dicValue as NSDictionary)));
                } else {
                    //SystemLogger.Log(SystemLogger.Module.PLATFORM, "***** key["+key.ToString ()+"] is instance of: " + dicValue.GetType().FullName);
                    if ( ! (dicValue is NSNull)) {
                        if(dicValue is NSString) {
                            prunedDictionary.Add (key.ToString(), ((NSString)dicValue).Description);
                        } else if(dicValue is NSNumber) {
                            prunedDictionary.Add (key.ToString(), ((NSNumber)dicValue).Int16Value);
                        } else if(dicValue is NSArray) {
                            prunedDictionary.Add (key.ToString(), ConvertToArray((NSArray)dicValue));
                        } else {
                            prunedDictionary.Add (key.ToString(), dicValue);
                        }
                    }
                }
            }
            return prunedDictionary;
        }
开发者ID:lsp1357,项目名称:appverse-mobile,代码行数:25,代码来源:PushNotificationsUtils.cs

示例9: ToDictionary

        internal NSDictionary ToDictionary()
        {
            int n = 0;
            if (Enhance.HasValue && Enhance.Value == false)
                n++;
            if (RedEye.HasValue && RedEye.Value == false)
                n++;
            if (ImageOrientation.HasValue)
                n++;
            if (Features != null && Features.Length != 0)
                n++;
            if (n == 0)
                return null;

            NSMutableDictionary dict = new NSMutableDictionary ();

            if (Enhance.HasValue && Enhance.Value == false){
                dict.LowlevelSetObject (CFBoolean.False.Handle, CIImage.AutoAdjustEnhanceKey.Handle);
            }
            if (RedEye.HasValue && RedEye.Value == false){
                dict.LowlevelSetObject (CFBoolean.False.Handle, CIImage.AutoAdjustRedEyeKey.Handle);
            }
            if (Features != null && Features.Length != 0){
                dict.LowlevelSetObject (NSArray.FromObjects (Features), CIImage.AutoAdjustFeaturesKey.Handle);
            }
            if (ImageOrientation.HasValue){
                dict.LowlevelSetObject (new NSNumber ((int)ImageOrientation.Value), CIImage.ImagePropertyOrientation.Handle);
            }
            #if false
            for (i = 0; i < n; i++){
                Console.WriteLine ("{0} {1}-{2}", i, keys [i], values [i]);
            }
            #endif
            return dict;
        }
开发者ID:roblillack,项目名称:maccore,代码行数:35,代码来源:CIImage.cs

示例10: SetOptions

        /// <summary>Sets custom options</summary>
        /// <param name="options">Option mask containing the options you want to set. Available 
        /// options are described 
        /// below at Options enum</param>
        public static void SetOptions(Options options, bool bValue = true)
        {
            var optionsDict = new NSMutableDictionary();
            var strValue = bValue ? new NSString("YES") : new NSString("NO");

            if ((options & Options.DisableAutoDeviceIdentifying) == 0 && isFirstTime) {
                TestFlight.SetDeviceIdentifier(UIDevice.CurrentDevice.UniqueIdentifier);
                isFirstTime = false;
            }

            if ((options & Options.AttachBacktraceToFeedback) != 0) {
                optionsDict.Add (strValue, OptionKeys.AttachBacktraceToFeedback);
            }
            if ((options & Options.DisableInAppUpdates) != 0) {
                optionsDict.Add (strValue, OptionKeys.DisableInAppUpdates);
            }
            if ((options & Options.LogToConsole) != 0) {
                optionsDict.Add (strValue, OptionKeys.LogToSTDERR);
            }
            if ((options & Options.LogToSTDERR) != 0) {
                optionsDict.Add (strValue, OptionKeys.ReinstallCrashHandlers);
            }
            if ((options & Options.SendLogOnlyOnCrash) != 0) {
                optionsDict.Add (strValue, OptionKeys.SendLogOnlyOnCrash);
            }

            TestFlight.SetOptionsRaw(optionsDict);
        }
开发者ID:stelapps,项目名称:monotouch-bindings,代码行数:32,代码来源:extras.cs

示例11: SaveToDictionary

        public static void SaveToDictionary(this IStateBundle state, NSMutableDictionary bundle)
        {
            var formatter = new BinaryFormatter();

            foreach (var kv in state.Data.Where(x => x.Value != null))
            {
                var value = kv.Value;

                if (value.GetType().IsSerializable)
                {
                    using (var stream = new MemoryStream())
                    {
                        formatter.Serialize(stream, value);
                        stream.Position = 0;
                        var bytes = stream.ToArray();
                        var array = new NSMutableArray();
                        foreach (var b in bytes)
                        {
                            array.Add(NSNumber.FromByte(b));
                        }

                        bundle.Add(new NSString(kv.Key), array);
                    }
                }
            }
        }
开发者ID:sgmunn,项目名称:Mobile.Utils,代码行数:26,代码来源:StateBundleExtensions.cs

示例12: GetCrmTasks

		public override async void HandleWatchKitExtensionRequest
	   (UIApplication application, NSDictionary userInfo, Action<NSDictionary> reply)
		{
			if (userInfo.Values[0].ToString() == "gettasks")
			{
				string userId = NSUserDefaults.StandardUserDefaults.StringForKey("UserId");

				List<CrmTask> tasks = await GetCrmTasks(userId);

				var nativeDict = new NSMutableDictionary();
				foreach (CrmTask task in tasks)
				{
					nativeDict.Add((NSString)task.TaskId, (NSString)task.Subject);
				}

				reply(new NSDictionary(
					"count", NSNumber.FromInt32(tasks.Count),
					"tasks", nativeDict
					));
			}
			else if (userInfo.Values[0].ToString() == "closetask")
			{
				string taskId = userInfo.Values[1].ToString();
				CloseTask(taskId);

				reply(new NSDictionary(
					"count", 0,
					"something", 0
					));
			}
		}
开发者ID:jlattimer,项目名称:CrmWatchKit,代码行数:31,代码来源:AppDelegate.cs

示例13: RegisterDefaultSettings

		public static void RegisterDefaultSettings ()
		{
			var path = Path.Combine(NSBundle.MainBundle.PathForResource("Settings", "bundle"), "Root.plist");

			using (NSString keyString = new NSString ("Key"), defaultString = new NSString ("DefaultValue"), preferenceSpecifiers = new NSString ("PreferenceSpecifiers"))
			using (var settings = NSDictionary.FromFile(path))
			using (var preferences = (NSArray)settings.ValueForKey(preferenceSpecifiers))
			using (var registrationDictionary = new NSMutableDictionary ()) {
				for (nuint i = 0; i < preferences.Count; i++)
					using (var prefSpecification = preferences.GetItem<NSDictionary>(i))
					using (var key = (NSString)prefSpecification.ValueForKey(keyString))
						if (key != null)
							using (var def = prefSpecification.ValueForKey(defaultString))
								if (def != null)
									registrationDictionary.SetValueForKey(def, key);

				NSUserDefaults.StandardUserDefaults.RegisterDefaults(registrationDictionary);

				#if DEBUG
				SetSetting(SettingsKeys.UserReferenceKey, debugReferenceKey);
				#else
				SetSetting(SettingsKeys.UserReferenceKey, UIDevice.CurrentDevice.IdentifierForVendor.AsString());
				#endif

				Synchronize();
			}
		}
开发者ID:colbylwilliams,项目名称:Nomads,代码行数:27,代码来源:Settings.cs

示例14: ToDictionary

		internal NSDictionary ToDictionary ()
		{
			var ret = new NSMutableDictionary ();

			if (AffineMatrix.HasValue){
				var a = AffineMatrix.Value;
				var affine = new NSNumber [6];
				affine [0] = NSNumber.FromFloat (a.xx);
				affine [1] = NSNumber.FromFloat (a.yx);
				affine [2] = NSNumber.FromFloat (a.xy);
				affine [3] = NSNumber.FromFloat (a.yy);
				affine [4] = NSNumber.FromFloat (a.x0);
				affine [5] = NSNumber.FromFloat (a.y0);
				ret.SetObject (NSArray.FromNSObjects (affine), CISampler.AffineMatrix);
			}
			if (WrapMode.HasValue){
				var k = WrapMode.Value == CIWrapMode.Black ? CISampler.WrapBlack : CISampler.FilterNearest;
				ret.SetObject (k, CISampler.WrapMode);
			}
			if (FilterMode.HasValue){
				var k = FilterMode.Value == CIFilterMode.Nearest ? CISampler.FilterNearest : CISampler.FilterLinear;
				ret.SetObject (k, CISampler.FilterMode);
			}
			return ret;
		}
开发者ID:kangaroo,项目名称:monomac,代码行数:25,代码来源:CISampler.cs

示例15: WarningWindow

        public WarningWindow()
        {
            // Interface Builder won't allow us to create a window with no title bar
            // so we have to create it manually. But we could use IB if we display
            // the window with a sheet...
            NSRect rect = new NSRect(0, 0, 460, 105);
            m_window = NSWindow.Alloc().initWithContentRect_styleMask_backing_defer(rect, 0, Enums.NSBackingStoreBuffered, false);

            m_window.setHasShadow(false);

            // Initialize the text attributes.
            var dict = NSMutableDictionary.Create();

            NSFont font = NSFont.fontWithName_size(NSString.Create("Georgia"), 64.0f);
            dict.setObject_forKey(font, Externs.NSFontAttributeName);

            NSMutableParagraphStyle style = NSMutableParagraphStyle.Create();
            style.setAlignment(Enums.NSCenterTextAlignment);
            dict.setObject_forKey(style, Externs.NSParagraphStyleAttributeName);

            m_attrs = dict.Retain();

            // Initialize the background bezier.
            m_background = NSBezierPath.Create().Retain();
            m_background.appendBezierPathWithRoundedRect_xRadius_yRadius(m_window.contentView().bounds(), 20.0f, 20.0f);

            m_color = NSColor.colorWithDeviceRed_green_blue_alpha(250/255.0f, 128/255.0f, 114/255.0f, 1.0f).Retain();

            ActiveObjects.Add(this);
        }
开发者ID:andyhebear,项目名称:Continuum,代码行数:30,代码来源:WarningWindow.cs


注:本文中的NSMutableDictionary类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。