protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); #if __ANDROID_14__ Window.RequestFeature(WindowFeatures.ActionBar); ActionBar.SetDisplayHomeAsUpEnabled(ViewModel.CanGoBack); #endif SetContentView(Resource.Layout.identityproviderlistview); _loadingToken = ViewModel.WeakSubscribe(() => ViewModel.LoadingIdentityProviders, (sender, args) => { if (ViewModel.LoadingIdentityProviders) LoadingDialog.Show(); else LoadingDialog.Dismiss(); InvalidateOptionsMenu(); }); ViewModel.LoginError += (sender, args) => { var builder = new AlertDialog.Builder(this); builder.SetTitle("Error"); builder.SetIcon(Android.Resource.Drawable.IcDialogAlert); builder.SetMessage(args.Message); builder.SetPositiveButton("Dismiss", (s, e) => { }); builder.Create().Show(); }; }
protected override void WriteLine(string textLine, LogEvent logEvent) { if (_activity == null) return; _activity.RunOnUiThread(() => { try { var adBuilder = new AlertDialog.Builder(_activity); adBuilder.SetTitle(string.Format("LogWriter: {0}", logEvent.Logger.LoggingType.Name)); adBuilder.SetMessage(textLine); adBuilder.SetNegativeButton("OK", (s, e) => { var alertDialog = s as AlertDialog; if (alertDialog != null) { alertDialog.Dismiss(); alertDialog.Cancel(); } }); adBuilder.Create().Show(); } catch (Exception e) { // TODO detta måste fixas // something went terribly wrong } }); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); using (var db = new SQLiteConnection (dbPath)) { db.CreateTable<LogEntry> (); } // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Create our database if it does not already exist // Get our button from the layout resource, // and attach an event to it Button addFood = FindViewById<Button> (Resource.Id.AddFoodButton); addFood.Click += (object sender, EventArgs e) => { AlertDialog.Builder addFoodDialogBuilder = new AlertDialog.Builder(this); addFoodDialogBuilder.SetTitle ("I had something to eat and it was:"); addFoodDialogBuilder.SetSingleChoiceItems (choices, -1, clickFoodDialogList); addFoodDialog = addFoodDialogBuilder.Create(); // Show the alert dialog to the user and wait for response. addFoodDialog.Show(); }; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); String extra = Intent.GetStringExtra("User") ?? "Data not available"; var builder = new AlertDialog.Builder(this); builder.SetTitle("Logged in"); builder.SetMessage(extra); builder.SetPositiveButton("Ok", delegate { Finish(); }); builder.Create().Show(); // Create your application here SetContentView(Resource.Layout.Home); TextView textView = FindViewById<TextView>(Resource.Id.textView_Username); textView.Text = extra; Button goToBogdan = FindViewById<Button>(Resource.Id.button_Veres); Button goToMiki = FindViewById<Button>(Resource.Id.button_Miki); goToBogdan.Click += (sender, args) => { var bogdan = new Intent(this, typeof(Bogdan)); StartActivity(bogdan); }; goToMiki.Click += (sender, args) => { var miki = new Intent(this, typeof(Miki)); StartActivity(miki); }; }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder dialog = new AlertDialog.Builder(Activity) .SetTitle(title) .SetPositiveButton("Got it", (sender, args) => { }); LayoutInflater inflater = Activity.LayoutInflater; View view = inflater.Inflate(Resource.Layout.VideoHelpPopup, null); video = view.FindViewById<VideoView>(Resource.Id.helper_video); descriptionView = view.FindViewById<TextView>(Resource.Id.helper_explanation); descriptionView.SetText(description.ToCharArray(),0, description.Length); if (!string.IsNullOrEmpty(videoAdd)) { video.Prepared += VideoPrepared; video.SetVideoURI(Uri.Parse(videoAdd)); video.Touch += VideoTouched; video.SetZOrderOnTop(true); // Removes dimming } else { LinearLayout holder = view.FindViewById<LinearLayout>(Resource.Id.helper_videoHolder); holder.Visibility = ViewStates.Gone; } dialog.SetView(view); return dialog.Create(); }
private void ButtonOnClick(object sender, EventArgs eventArgs) { var builder = new AlertDialog.Builder(this); builder.SetMessage("This is an Alert Dialog."); var dialog = builder.Create(); dialog.Show(); }
void LoginToVk() { var auth = new OAuth2Authenticator ( clientId: "", // put your id here scope: "friends,video,groups", authorizeUrl: new Uri ("https://oauth.vk.com/authorize"), redirectUrl: new Uri ("https://oauth.vk.com/blank.html")); auth.AllowCancel = true; auth.Completed += (s, ee) => { if (!ee.IsAuthenticated) { var builder = new AlertDialog.Builder (this); builder.SetMessage ("Not Authenticated"); builder.SetPositiveButton ("Ok", (o, e) => { }); builder.Create().Show(); return; } else { token = ee.Account.Properties ["access_token"].ToString (); userId = ee.Account.Properties ["user_id"].ToString (); GetInfo(); } }; var intent = auth.GetUI (this); StartActivity (intent); }
public override bool OnOptionsItemSelected(Android.Views.IMenuItem item) { if (ViewModel.IsBusy) return base.OnOptionsItemSelected(item); switch (item.ItemId) { case Resource.Id.menu_about: var builder = new AlertDialog.Builder(this); builder .SetTitle(Resource.String.menu_about) .SetMessage(Resource.String.about) .SetPositiveButton(Resource.String.ok, delegate { }); AlertDialog alert = builder.Create(); alert.Show(); return true; case Resource.Id.menu_refresh: ViewModel.RefreshLoginCommand.Execute(null); return true; } return base.OnOptionsItemSelected(item); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Begin building a new dialog. var builder = new AlertDialog.Builder(Activity); //Get the layout inflater var inflater = Activity.LayoutInflater; populate (listData); viewdlg = SetViewDelegate; var view = inflater.Inflate(Resource.Layout.ListCustView, null); listView = view.FindViewById<ListView> (Resource.Id.CustList); if (listView != null) { adapter = new GenericListAdapter<Trader> (this.Activity, listData,Resource.Layout.ListCustDtlView, viewdlg); listView.Adapter = adapter; listView.ItemClick += ListView_Click; txtSearch= view.FindViewById<EditText > (Resource.Id.txtSearch); butSearch= view.FindViewById<Button> (Resource.Id.butCustBack); butSearch.Text = "SEARCH"; butSearch.SetCompoundDrawables (null, null, null, null); butSearch.Click+= ButSearch_Click; //txtSearch.TextChanged += TxtSearch_TextChanged; builder.SetView (view); builder.SetPositiveButton ("CANCEL", HandlePositiveButtonClick); } var dialog = builder.Create(); //Now return the constructed dialog to the calling activity return dialog; }
public bool showConfirmDialog(Context context, string info) { if (!prepareModal()) return false; // reset choice mChoice = false; AlertDialog.Builder builder = new AlertDialog.Builder(context); builder.SetMessage(info); builder.SetCancelable(false); builder.SetPositiveButton("OK", (object o, Android.Content.DialogClickEventArgs e) => { this.mQuitModal = true; this.mChoice = true; builder.Dispose(); }); builder.SetNegativeButton("Cancel", (object o, Android.Content.DialogClickEventArgs e) => { mQuitModal = true; mChoice = false; builder.Dispose(); // probably wrong }); AlertDialog alert = builder.Create(); alert.Show(); doModal(); return mChoice; }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Resource.Id.mmenu_back: BackupDatabase (); return true; case Resource.Id.mmenu_downdb: var builderd = new AlertDialog.Builder(this); builderd.SetMessage("Confirm to download database from server ? All local data will be overwritten by the downloaded data."); builderd.SetPositiveButton("OK", (s, e) => { DownlooadDb ();;}); builderd.SetNegativeButton("Cancel", (s, e) => { /* do something on Cancel click */ }); builderd.Create().Show(); return true; // case Resource.Id.mmenu_Reset: // //do something // return true; case Resource.Id.mmenu_setting: StartActivity (typeof(SettingActivity)); return true; case Resource.Id.mmenu_logoff: RunOnUiThread(() =>ExitAndLogOff()) ; return true; case Resource.Id.mmenu_downcompinfo: DownloadCompInfo (); return true; case Resource.Id.mmenu_clear: ClearPostedInv (); return true; } return base.OnOptionsItemSelected(item); }
public static void HandleException(AggregateException ex, Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.SetTitle("One or more Error(s)"); builder.SetMessage("First:" + ex.InnerExceptions.First().Message); builder.Create().Show(); }
void GetInfo() { // создаем xml-документ XmlDocument xmlDocument = new XmlDocument (); // делаем запрос на получение имени пользователя WebRequest webRequest = WebRequest.Create ("https://api.vk.com/method/users.get.xml?&access_token=" + token); WebResponse webResponse = webRequest.GetResponse (); Stream stream = webResponse.GetResponseStream (); xmlDocument.Load (stream); string name = xmlDocument.SelectSingleNode ("response/user/first_name").InnerText; // делаем запрос на проверку, webRequest = WebRequest.Create ("https://api.vk.com/method/groups.isMember.xml?group_id=20629724&access_token=" + token); webResponse = webRequest.GetResponse (); stream = webResponse.GetResponseStream (); xmlDocument.Load (stream); bool habrvk = (xmlDocument.SelectSingleNode ("response").InnerText =="1"); // выводим диалоговое окно var builder = new AlertDialog.Builder (this); // пользователь состоит в группе "хабрахабр"? if (!habrvk) { builder.SetMessage ("Привет, "+name+"!\r\n\r\nТы не состоишь в группе habrahabr.Не хочешь вступить?"); builder.SetPositiveButton ("Да", (o, e) => { // уточнив, что пользователь желает вступить, отправим запрос webRequest = WebRequest.Create ("https://api.vk.com/method/groups.join.xml?group_id=20629724&access_token=" + token); webResponse = webRequest.GetResponse (); }); builder.SetNegativeButton ("Нет", (o, e) => { }); } else { builder.SetMessage ("Привет, "+name+"!\r\n\r\nОтлично! Ты состоишь в группе habrahabr."); builder.SetPositiveButton ("Ок", (o, e) => { }); } builder.Create().Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Build Password Dialog var builder = new AlertDialog.Builder(Activity); // Get Layout Inflater var inflator = Activity.LayoutInflater; // Inflate Layout For Password Dialog var dialogView = inflator.Inflate(Resource.Layout.AddReminderDialogFragment, null); // Initialize Properties ReminderEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextReminder); // Set Positive & Negative Buttons builder.SetView(dialogView); builder.SetPositiveButton("Add Reminder", HandlePositiveButtonClick); builder.SetNegativeButton("Cancel", HandleNegativeButtonClick); // Build And Return Dialog var dialog = builder.Create(); return dialog; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.identityproviderlistview); _loadingToken = ViewModel.WeakSubscribe(() => ViewModel.LoadingIdentityProviders, (sender, args) => { if (ViewModel.LoadingIdentityProviders) LoadingDialog.Show(); else LoadingDialog.Dismiss(); InvalidateOptionsMenu(); }); ViewModel.LoginError += (sender, args) => { var builder = new AlertDialog.Builder(this); builder.SetTitle("Error"); builder.SetIcon(Android.Resource.Drawable.IcDialogAlert); builder.SetMessage(args.Message); builder.SetPositiveButton("Dismiss", (s, e) => { }); builder.Create().Show(); }; }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.Splash); new Handler ().PostDelayed (() => { //LoadActivity(); var updateManager = new UpdateManager(this,true); if (updateManager.CheckUpdate()) { var builder = new AlertDialog.Builder (this).SetTitle ("软件升级").SetMessage ("发现新版本,建议更新使用新版本").SetOnKeyListener(this).SetCancelable(false); builder.SetPositiveButton ("下载", (sender, e) => { noticeDialog.Dismiss(); //显示下载对话框,下载 updateManager.ShowDownloadDialog(); }); builder.SetNegativeButton ("以后再说", (sender, e) => { noticeDialog.Dismiss(); LoadActivity(); }); noticeDialog= builder.Create (); noticeDialog.Show(); } else { LoadActivity(); } },2000); // Create your application here }
protected override void OnCreate (Bundle bundle) { base.OnCreate (bundle); View v = new DragView (this); SetContentView (v); v.Click += (sender, args) => { AlertDialog.Builder builder = new AlertDialog.Builder(this,AlertDialog.ThemeHoloDark); AlertDialog alertDialog = builder.Create(); alertDialog.SetTitle ("Alert"); alertDialog.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon); alertDialog.SetMessage("This is View will drag."); alertDialog.SetButton("OK", (s, e) => { }); alertDialog.Show(); }; v.LongClick += (sender, args) => { AlertDialog.Builder builder = new AlertDialog.Builder(this,AlertDialog.ThemeHoloDark); AlertDialog alertDialog = builder.Create(); alertDialog.SetTitle ("Alert"); alertDialog.SetIconAttribute(Android.Resource.Attribute.AlertDialogIcon); alertDialog.SetMessage("This is View will drag."); alertDialog.SetButton("OK", (s, e) => { }); alertDialog.Show(); }; }
public void showNoticeDialog(string title, string content){ var noticeASAPTimeView = LayoutInflater.Inflate (Resource.Layout.popup_notice_layout, null); var tvTitle = noticeASAPTimeView.FindViewById<TextView> (Resource.Id.tv_title_notice_popup); var tvNotice = noticeASAPTimeView.FindViewById<TextView> (Resource.Id.tv_info_popup_notice); var btnOk = noticeASAPTimeView.FindViewById<Button> (Resource.Id.btn_ok_popup_notice); tvTitle.Text = title; tvNotice.Text = content; btnOk.Click += (sender, e) => { dialog.Dismiss (); if(noticeBeta != null){ noticeBeta.onOK(); } }; builder = new AlertDialog.Builder (_activity); builder.SetView (noticeASAPTimeView); dialog = builder.Create (); dialog.SetCanceledOnTouchOutside (false); dialog.SetCancelable (false); try { dialog.Show (); } catch(Exception e){ Console.WriteLine (e.Message); } }
public void showConfirmDialog(string title, string content, string possitiveTitle, string negativeTitle){ var confirmDeferView = LayoutInflater.Inflate (Resource.Layout.popup_confirm_layout, null); var tvTitle = confirmDeferView.FindViewById<TextView> (Resource.Id.tv_title_confirm_popup); var tvConfirm = confirmDeferView.FindViewById<TextView> (Resource.Id.tv_info_popup); var btnConfirmTalknow = confirmDeferView.FindViewById<Button> (Resource.Id.btn_confirm_tv_popup); var btnDecline = confirmDeferView.FindViewById<Button> (Resource.Id.btn_decline_tv_popup); tvTitle.Text = title; tvConfirm.Text = content; btnDecline.Text = negativeTitle; btnConfirmTalknow.Text = possitiveTitle; btnConfirmTalknow.Click += (sender, e) => { dialog.Dismiss (); actionConfirmDelegate.onOkConfirmClick (); }; btnDecline.Click += (sender, e) => { dialog.Dismiss (); }; builder = new AlertDialog.Builder (_activity); builder.SetInverseBackgroundForced (true); builder.SetView (confirmDeferView); dialog = builder.Create (); dialog.SetCanceledOnTouchOutside (false); try { dialog.Show (); } catch(Exception e){ Console.WriteLine (e.Message); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Alert); var simpleButton = FindViewById<Button>(Resource.Id.SimpleAlertButton); simpleButton.Click += (sender, args) => { Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog ad = builder.Create(); ad.SetTitle("An Alert"); ad.SetIcon(Android.Resource.Drawable.IcDialogAlert); ad.SetMessage("Alert message..."); ad.SetButton("OK", (s,e) => { Console.WriteLine("OK Button clicked, alert dismissed"); }); ad.Show(); }; var complexButton = FindViewById<Button>(Resource.Id.ComplexAlertButton); complexButton.Click += (sender, args) => { Android.App.AlertDialog.Builder builder = new AlertDialog.Builder(this); AlertDialog ad = builder.Create(); ad.SetTitle("An Alert"); ad.SetIcon(Resource.Drawable.icon); ad.SetMessage("Alert message..."); // Positive ad.SetButton("OK", (s, e) => { Console.WriteLine("OK button clicked, alert dismissed"); }); // Negative ad.SetButton2("Cancel", (s, e) => { Console.WriteLine("Cancel button clicked, alert dismissed"); }); // Neutral ad.SetButton3("Middle ground", (s, e) => { Console.WriteLine("Middle button clicked, alert dismissed"); }); ad.Show(); }; }
public static void ShowDialog(Context context, string message, string title) { var builder = new AlertDialog.Builder(context); builder.SetMessage(message); builder.SetTitle(title); builder.Create().Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Build Set Meals Dialog var builder = new AlertDialog.Builder(Activity); // Get Layout Inflater var inflator = Activity.LayoutInflater; // Inflate Layout For Password Dialog var dialogView = inflator.Inflate(Resource.Layout.SetMealsDialogFragment, null); // Initialize Properties breakfastEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextBreakfast); lunchEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextLunch); dinnerEditText = dialogView.FindViewById<EditText>(Resource.Id.editTextDinner); // Set Text To Current Meal Values breakfastEditText.Text = MealItem.Breakfast; lunchEditText.Text = MealItem.Lunch; dinnerEditText.Text = MealItem.Dinner; // Set Positive & Negative Buttons builder.SetView(dialogView); builder.SetPositiveButton("Set Meals", HandlePositiveButtonClick); // builder.SetNeutralButton("Clear Meals", HandleNeutralButtonClick); builder.SetNegativeButton("Cancel", HandleNegativeButtonClick); // Build And Return Dialog var dialog = builder.Create(); return dialog; }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { editText = new EditText (Activity); var builder = new AlertDialog.Builder (Activity); builder.SetTitle ("Add Task") .SetView (editText) .SetPositiveButton ("Go", (e, v) => { ViewModel.SelectedTask.Title = editText.Text; if (ViewModel.SelectedTask.CreateDateTime == new DateTime ()) { ViewModel.SelectedTask.CreateDateTime = DateTime.Now; } ViewModel.SelectedTask.LastModifiedDateTime = DateTime.Now; ViewModel.CommitTask (); ViewModel.StartSelectedTask (); }) .SetNeutralButton("Save", (e, v) => { ViewModel.SelectedTask.Title = editText.Text; if (ViewModel.SelectedTask.CreateDateTime == new DateTime ()) { ViewModel.SelectedTask.CreateDateTime = DateTime.Now; } ViewModel.SelectedTask.LastModifiedDateTime = DateTime.Now; ViewModel.CommitTask (); ViewModel.UnselectTask(); }) .SetNegativeButton("Cancel", (e, v) => { ViewModel.UnselectTask(); }); return builder.Create (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Main); var testNotifierButton = FindViewById<Button>(Resource.Id.TestNotifierButton); testNotifierButton.Click += delegate { Notifier.Current.Show("Test", "This is a test notification"); }; var testAppLookupButton = FindViewById<Button>(Resource.Id.TestAppLookupButton); testAppLookupButton.Click += delegate { var calApp = "com.android.calendar"; var noApp = "com.noapphasthiscrazyname"; var isCalAppInstalled = AppLookup.Current.IsInstalled(packageName: calApp); var isNoAppInstalled = AppLookup.Current.IsInstalled(packageName: noApp); var msg = "Calendar app is" + (isCalAppInstalled ? " " : " NOT ") + "installed."; var builder = new AlertDialog.Builder(this); var alert = builder.Create(); alert.SetTitle("AppLookup Test"); alert.SetMessage(msg); alert.Show(); }; }
public static void HandleException(Exception ex, Activity activity) { AlertDialog.Builder builder = new AlertDialog.Builder(activity); builder.SetTitle("Error"); builder.SetMessage(ex.Message); builder.Create().Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); var builder = new AlertDialog.Builder (Activity); var inflater = Activity.LayoutInflater; var view = inflater.Inflate (Resource.Layout.NewTournamentDialogLayout, null); if (view != null) { txtUrl = view.FindViewById<EditText> (Resource.Id.txtNewTournamentURL_Edit); txtSignup = view.FindViewById<EditText> (Resource.Id.txtNewTournamentSignup_Edit); txtSignup_Text = view.FindViewById<TextView> (Resource.Id.txtNewTournamentSignup); btnView = view.FindViewById<Button> (Resource.Id.btnNewTournament_View); txtUrl.Text = json ["tournament"] ["full_challonge_url"]; if (json ["tournament"] ["sign_up_url"] == null) { txtSignup.Visibility = ViewStates.Gone; txtSignup_Text.Visibility = ViewStates.Gone; } else txtSignup.Text = json ["tournament"] ["sign_up_url"]; btnView.Click += BtnView_Click; builder.SetTitle (json ["tournament"] ["name"].ToString ()); builder.SetView (view); } var dialog = builder.Create (); return dialog; }
public void AskForString(string message, string title, System.Action<string> returnString) { var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity> ().Activity; var builder = new AlertDialog.Builder(activity); builder.SetIcon(Resource.Drawable.ic_launcher); builder.SetTitle(title ?? string.Empty); builder.SetMessage(message); var view = View.Inflate(activity, Resource.Layout.dialog_add_member, null); builder.SetView(view); var textBoxName = view.FindViewById<EditText>(Resource.Id.name); builder.SetCancelable(true); builder.SetNegativeButton(Resource.String.cancel, delegate { });//do nothign on cancel builder.SetPositiveButton(Resource.String.ok, delegate { if (string.IsNullOrWhiteSpace(textBoxName.Text)) return; returnString(textBoxName.Text.Trim()); }); var alertDialog = builder.Create(); alertDialog.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); RequestedOrientation = global::Android.Content.PM.ScreenOrientation.Landscape; // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); SignaturePadView signature = FindViewById<SignaturePadView> (Resource.Id.signatureView); // Get our button from the layout resource, // and attach an event to it Button btnSave = FindViewById<Button> (Resource.Id.btnSave); btnSave.Click += delegate { if (signature.IsBlank) {//Display the base line for the user to sign on. AlertDialog.Builder alert = new AlertDialog.Builder (this); alert.SetMessage ("No signature to save."); alert.SetNeutralButton ("Okay", delegate { }); alert.Create ().Show (); } points = signature.Points; }; btnSave.Dispose (); Button btnLoad = FindViewById<Button> (Resource.Id.btnLoad); btnLoad.Click += delegate { if (points != null) signature.LoadPoints (points); }; btnLoad.Dispose (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); // Create the Dialog object used to display messages AlertDialog.Builder builder = new AlertDialog.Builder(this); ActivityDialog = builder.Create (); ActivityDialog.SetTitle("HelloWorld"); ActivityDialog.DismissEvent += (sender, e) => { FindViewById<TextView> (Resource.Id.textViewMessage).Text = "Alert dismissed at " + DateTime.Now.ToLongTimeString(); }; // Set our view from the "main" layout resource SetContentView (Resource.Layout.Main); // Get our button from the layout resource, // and attach an event to it Button buttonClicker = FindViewById<Button> (Resource.Id.myButton); buttonClicker.Click += delegate { buttonClicker.Text = string.Format ("{0} clicks!", count++); }; FindViewById<Button> (Resource.Id.buttonPopupMessage).Click += buttonPopupMessage_Click; }
void LoginToVk () { var auth = new OAuth2Authenticator ( clientId: "5171316", // id нашого додатку scope: "wall,photos,notes,pages", // запит прав нашого додатку authorizeUrl: new System.Uri ("https://oauth.vk.com/authorize"), redirectUrl: new System.Uri ("https://oauth.vk.com/blank.html")); auth.AllowCancel = true; auth.Completed += (s, ee) => { //провірка чи аудентифіколваний if (!ee.IsAuthenticated) { var builder = new AlertDialog.Builder (this); builder.SetMessage ("Not Authenticated"); builder.SetPositiveButton ("Ok", (o, e) => { }); builder.Create().Show(); return; } else { token = ee.Account.Properties ["access_token"].ToString (); userId = ee.Account.Properties ["user_id"].ToString (); GetInfo(); } }; var intent = auth.GetUI (this); StartActivity (intent); }