Dialog() публичный Метод

各種ダイアログを表示する.結果はGetResultメソッドで取得する. コルーチンとして実行する.
public Dialog ( string action, string>.Dictionary param ) : IEnumerator
action string
param string>.Dictionary
Результат IEnumerator
Пример #1
0
        void RequestsToMany()
        {
            var gift = new JsonObject();

            gift.Add("social_karma", new JsonPrimitive(5));
            gift.Add("badge_of_awesomeness", new JsonPrimitive(1));

            var parameters = NSMutableDictionary.FromObjectsAndKeys(
                new object [] { "Learn how to make your iOS apps social", "Check this out", gift.ToString() },
                new object [] { "message", "notification_text", "data" });

            facebook.Dialog("apprequests", parameters, DialogCallback(RequestsCallback));
        }
Пример #2
0
		/** 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;
		}
Пример #3
0
        /** 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;
        }