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


C# Bundle.Get方法代码示例

本文整理汇总了C#中Bundle.Get方法的典型用法代码示例。如果您正苦于以下问题:C# Bundle.Get方法的具体用法?C# Bundle.Get怎么用?C# Bundle.Get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Bundle的用法示例。


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

示例1: Quest

 public Quest(Bundle b)
     : this()
 {
     ID = (int)b.Get ("id");
     Name = (string)b.Get ("name");
     Description = (string)b.Get ("description");
     XP = (int)b.Get ("xp");
     Joules = (int)b.Get ("joules");
 }
开发者ID:nicklytle,项目名称:GDRGEnergyGame,代码行数:9,代码来源:Quest.cs

示例2: OnMessageReceived

        public override void OnMessageReceived(string from, Bundle data)
        {
            var notificationBundle = data.Get("notification") as Bundle;

            if (notificationBundle != null)
            {
                var message = notificationBundle.Get("body").ToString();

                var pushService = DependencyService.Get<IPushService>();
                var dict = new Dictionary<string, string>();
                dict.Add("notification", message);
                pushService.ProcessPushNotification(dict);

                SendNotification(message);
            }
        }
开发者ID:Pleio,项目名称:pleioapp,代码行数:16,代码来源:GCMListener.cs

示例3: GetResponseCodeFromBundle

		/// <summary>
		/// Workaround to bug where sometimes response codes come as Long instead of Integer
		/// </summary>
		/// <param name="b"></param>
		/// <returns></returns>
		public static int GetResponseCodeFromBundle(Bundle b)
		{
			var o = b.Get(Consts.RESPONSE_CODE);
			if (o == null)
			{
				LogDebug("Bundle with null response code, assuming OK (known issue)");
				return Consts.BILLING_RESPONSE_RESULT_OK;
			}
			else if (o is Integer)
				return (int)o;
			else if (o is Long)
				return (int)o;
			else
			{
				LogError("Unexpected type for bundle response code.");
				LogError(o.GetType().Name);
				throw new RuntimeException("Unexpected type for bundle response code: " + o.GetType().Name);
			}
		}
开发者ID:JohanOtto,项目名称:play.billing.v3,代码行数:24,代码来源:Utils.cs

示例4: OnMessageReceived

        /// <summary>
        /// Called when message is received.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="extras"></param>
        public override void OnMessageReceived(string from,Bundle extras)
        {
            if (extras != null && !extras.IsEmpty)
            {

                    System.Diagnostics.Debug.WriteLine(string.Format("{0} - GCM Listener - Push Received", PushNotificationKey.DomainName));

                    var parameters = new Dictionary<string, object>();

                    foreach (var key in extras.KeySet())
                    {

                        parameters.Add(key, extras.Get(key));

                        System.Diagnostics.Debug.WriteLine(string.Format("{0} - GCM Listener - Push Params {1} : {2}", PushNotificationKey.DomainName, key, extras.Get(key)));

                    }

                    Context context = Android.App.Application.Context;

                    if (CrossPushNotification.IsInitialized)
                    {
                        CrossPushNotification.PushNotificationListener.OnMessage(parameters, DeviceType.Android);
                    }
                    else
                    {
                        throw CrossPushNotification.NewPushNotificationNotInitializedException();
                    }

                    try
                    {
                        int notifyId = 0;
                        string title = context.ApplicationInfo.LoadLabel(context.PackageManager);
                        string message = "";
                        string tag = "";

                        if (!string.IsNullOrEmpty(CrossPushNotification.NotificationContentTextKey) && parameters.ContainsKey(CrossPushNotification.NotificationContentTextKey))
                        {
                            message = parameters[CrossPushNotification.NotificationContentTextKey].ToString();
                        }
                        else if (parameters.ContainsKey(PushNotificationKey.Message))
                        {
                            message = parameters[PushNotificationKey.Message].ToString();
                        }
                        else if (parameters.ContainsKey(PushNotificationKey.Subtitle))
                        {
                            message = parameters[PushNotificationKey.Subtitle].ToString();
                        }
                        else if (parameters.ContainsKey(PushNotificationKey.Text))
                        {
                            message = parameters[PushNotificationKey.Text].ToString();
                        }

                        if (!string.IsNullOrEmpty(CrossPushNotification.NotificationContentTitleKey) && parameters.ContainsKey(CrossPushNotification.NotificationContentTitleKey))
                        {
                            title = parameters[CrossPushNotification.NotificationContentTitleKey].ToString();

                        }
                        else if (parameters.ContainsKey(PushNotificationKey.Title))
                        {

                            if (!string.IsNullOrEmpty(message))
                            {
                                title = parameters[PushNotificationKey.Title].ToString();
                            }
                            else
                            {
                                message = parameters[PushNotificationKey.Title].ToString();
                            }
                        }
                        if (parameters.ContainsKey(PushNotificationKey.Id))
                        {
                            var str = parameters[PushNotificationKey.Id].ToString();
                            try
                            {
                                notifyId = Convert.ToInt32(str);
                            }
                            catch (System.Exception)
                            {
                                // Keep the default value of zero for the notify_id, but log the conversion problem.
                                System.Diagnostics.Debug.WriteLine("Failed to convert {0} to an integer", str);
                            }
                        }
                        if (parameters.ContainsKey(PushNotificationKey.Tag))
                        {
                            tag = parameters[PushNotificationKey.Tag].ToString();
                        }

                        if (!parameters.ContainsKey(PushNotificationKey.Silent) || !System.Boolean.Parse(parameters[PushNotificationKey.Silent].ToString()))
                        {
                            if (CrossPushNotification.PushNotificationListener.ShouldShowNotification())
                            {
                                CreateNotification(title, message, notifyId, tag);
                            }
                        }
//.........这里部分代码省略.........
开发者ID:perumalsamya,项目名称:xamarin-plugins,代码行数:101,代码来源:PushNotificationGcmListener.cs

示例5: GetResponseCodeFromBundle

		int GetResponseCodeFromBundle (Bundle bunble)
		{
			object response = bunble.Get (Response.Code);
			if (response == null) {
				//Bundle with null response code, assuming OK (known issue)
				return BillingResult.OK;
			}

			if (response is Java.Lang.Number) {
				return ((Java.Lang.Number)response).IntValue ();
			}

			return BillingResult.Error;
		}
开发者ID:foxanna,项目名称:SimpleLocationAlarm,代码行数:14,代码来源:InAppBillingHelper.cs


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