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


C# Bundle.PutByteArray方法代码示例

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


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

示例1: OpenColorSelector

 private void OpenColorSelector(object sender, EventArgs e)
 {
     var intent = new Intent(this, typeof(ColorSelectActivity));
     Bundle b = new Bundle();
     b.PutByteArray("color", new byte[] { color.R, color.G, color.B });
     intent.PutExtra("color", b);
     StartActivity(intent);
 }
开发者ID:evelinemart,项目名称:App1,代码行数:8,代码来源:MainActivity.cs

示例2: BackToMain

 private void BackToMain(object sender, EventArgs e)
 {
     Intent.Extras.Remove("color");
     Bundle bun = new Bundle();
     bun.PutByteArray("newColor", new byte[] { color.R, color.G, color.B });
     var intent = new Intent(this, typeof(MainActivity));
     intent.PutExtra("newColor", bun);
     StartActivity(intent);
 }
开发者ID:evelinemart,项目名称:App1,代码行数:9,代码来源:ColorSelectActivity.cs

示例3: SaveToBundle

        public static void SaveToBundle(this IStateBundle state, Bundle 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;

                        bundle.PutByteArray(kv.Key, stream.ToArray());
                    }
                }
            }
        }
开发者ID:sgmunn,项目名称:Mobile.Utils,代码行数:20,代码来源:StateBundleExtensions.cs

示例4: OnCreate

		/** Called when the activity is first created. */
		protected override void OnCreate (Bundle savedInstanceState)
		{
			base.OnCreate (savedInstanceState);

			if (APP_ID == null) {
				Util.ShowAlert (this, "Warning", "Facebook Applicaton ID must be " +
					"specified before running this example: see Example.java");
			}

			SetContentView (Resource.Layout.main);
			mLoginButton = (LoginButton)FindViewById (Resource.Id.login);
			mText = (TextView)FindViewById (Resource.Id.txt);
			mRequestButton = (Button)FindViewById (Resource.Id.requestButton);
			mPostButton = (Button)FindViewById (Resource.Id.postButton);
			mDeleteButton = (Button)FindViewById (Resource.Id.deletePostButton);
			mUploadButton = (Button)FindViewById (Resource.Id.uploadButton);

			mFacebook = new Facebook (APP_ID);
			mAsyncRunner = new AsyncFacebookRunner (mFacebook);

			SessionStore.Restore (mFacebook, this);
			SessionEvents.AddAuthListener (new SampleAuthListener (this));
			SessionEvents.AddLogoutListener (new SampleLogoutListener (this));
			mLoginButton.Init (this, mFacebook);

			mRequestButton.Click += delegate {
				mAsyncRunner.Request ("me", new SampleRequestListener (this));
			};
			mRequestButton.Visibility = mFacebook.IsSessionValid ?
                ViewStates.Visible :
                ViewStates.Invisible;

			mUploadButton.Click += async delegate {
				Bundle parameters = new Bundle ();
				parameters.PutString ("method", "photos.upload");

				URL uploadFileUrl = null;
				try {
					uploadFileUrl = new URL (
						"http://www.facebook.com/images/devsite/iphone_connect_btn.jpg");
				} catch (MalformedURLException e) {
					e.PrintStackTrace ();
				}
				try {
					HttpURLConnection conn = (HttpURLConnection)uploadFileUrl.OpenConnection ();
					conn.DoInput = true;
					await conn.ConnectAsync ();
					int length = conn.ContentLength;

					byte[] imgData = new byte[length];
					var ins = conn.InputStream;
					await ins.ReadAsync (imgData, 0, imgData.Length);
					parameters.PutByteArray ("picture", imgData);

				} catch (IOException e) {
					e.PrintStackTrace ();
				}

				mAsyncRunner.Request (null, parameters, "POST",
				                      new SampleUploadListener (this), null);
			};
			mUploadButton.Visibility = mFacebook.IsSessionValid ?
                ViewStates.Visible :
                ViewStates.Invisible;

			mPostButton.Click += delegate {
				mFacebook.Dialog (this, "feed",
				                  new SampleDialogListener (this));
			};
			mPostButton.Visibility = mFacebook.IsSessionValid ?
                ViewStates.Visible :
                ViewStates.Invisible;
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:74,代码来源:Example.cs

示例5: OnCreate

        protected override void OnCreate(Bundle bundle)
        {
            sInstance = this;

            base.OnCreate(bundle);

            Game1.Activity = this;
            mGame = new Game1();
            SetContentView(mGame.Window);

            using (var ignore = new TV.Ouya.Sdk.OuyaInputView(this))
            {
                // do nothing
            }

            View content = FindViewById (Android.Resource.Id.Content);
            if (null != content) {
                content.KeepScreenOn = true;
            }
            mGame.Run();

            Bundle developerInfo = new Bundle();

            developerInfo.PutString(OuyaFacade.OUYA_DEVELOPER_ID, "310a8f51-4d6e-4ae5-bda0-b93878e5f5d0");

            byte[] applicationKey = null;

            // load the application key from assets
            try {
                AssetManager assetManager = ApplicationContext.Assets;
                AssetFileDescriptor afd = assetManager.OpenFd(SIGNING_KEY);
                int size = 0;
                if (null != afd) {
                    size = (int)afd.Length;
                    afd.Close();
                    using (Stream inputStream = assetManager.Open(SIGNING_KEY, Access.Buffer))
                    {
                        applicationKey = new byte[size];
                        inputStream.Read(applicationKey, 0, size);
                        inputStream.Close();
                    }
                }
            } catch (Exception e) {
                Log.Error (TAG, string.Format("Failed to read application key exception={0}", e));
            }

            if (null != applicationKey) {
                Log.Debug (TAG, "Read signing key");
                developerInfo.PutByteArray (OuyaFacade.OUYA_DEVELOPER_PUBLIC_KEY, applicationKey);
            } else {
                Log.Error (TAG, "Failed to authorize with signing key");
                Finish ();
                return;
            }

            developerInfo.PutString(OuyaFacade.XIAOMI_APPLICATION_ID, "0000000000000");
            developerInfo.PutString(OuyaFacade.XIAOMI_APPLICATION_KEY, "000000000000000000");

            developerInfo.PutStringArray(OuyaFacade.OUYA_PRODUCT_ID_LIST, Game1.PURCHASABLES);

            _ouyaFacade = OuyaFacade.Instance;
            _ouyaFacade.Init(this, developerInfo);
        }
开发者ID:wister01,项目名称:ouya-sdk-examples,代码行数:63,代码来源:Activity1.cs


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