private void fabClicked(object sender, EventArgs args) { AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); var inflater = this.LayoutInflater; var childLayout = inflater.Inflate(Resource.Layout.dialog_main, null); alertDialog.SetView(childLayout) //set event to null so alertdialog won't be destroyd on button click .SetPositiveButton(Resource.String.ok, (EventHandler <DialogClickEventArgs>)null) .SetNegativeButton(Resource.String.cancel, (EventHandler <DialogClickEventArgs>)null); var dialog = alertDialog.Create(); dialog.Show(); var positiveButton = dialog.GetButton((int)DialogButtonType.Positive); positiveButton.Click += delegate { var groupName = childLayout.FindViewById <EditText>(Resource.Id.dialog_group).Text; var playersText = childLayout.FindViewById <EditText>(Resource.Id.dialog_players).Text; if (mainPresenter.FabOkClicked(groupName, playersText)) { dialog.Dismiss(); } }; }
private void CreateOrdersData() { try { ordersList = new List <Order>(); JsonSerializer serializer = new JsonSerializer(); serializer.NullValueHandling = NullValueHandling.Ignore; var json = new WebClient().DownloadString("http://192.168.1.33/CMOS/CMOSS/GetTableNoClothingOrderApi"); JObject googleSearch = JObject.Parse(json); IList <JToken> results = googleSearch["data"].Children().ToList(); foreach (JToken result in results) { Order searchResult = result.ToObject <Order>(); searchResult.PositionName = searchResult.PositionName; searchResult.PercentComplited += "%"; searchResult.Id = "Заказ №: " + searchResult.Id; searchResult.NumberTN = "ПТМЦ №: " + searchResult.NumberTN; ordersList.Add(searchResult); } isEdit = false; } catch (Exception ex) { RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Сервер не отвечает"); alert.SetMessage("Обратитесь к администратору" + ex.Message); alert.Show(); return; }); } }
//Alert handler to improve code cleanliness public AlertDialog CreateAlert(AlertType type, string alertMessage, string alertTitle) { if (type == AlertType.Error) { AlertDialog.Builder dialogConnection = new AlertDialog.Builder(this); dialog = dialogConnection.Create(); dialog.SetTitle(alertTitle); dialog.SetMessage(alertMessage); } else if (type == AlertType.Load) { dialog = new EDMTDialogBuilder() .SetContext(this) .SetMessage(alertMessage) .Build(); } else if (type == AlertType.Info) { AlertDialog.Builder dialogConnection = new AlertDialog.Builder(this); var btnOk = Resources.GetText(Resource.String.btnOk); dialogConnection.SetPositiveButton(btnOk, (senderAlert, args) => { dialogConnection.Dispose(); }); dialog = dialogConnection.Create(); dialog.SetTitle(alertTitle); dialog.SetMessage(alertMessage); dialog.SetCanceledOnTouchOutside(true); } dialog.Show(); return(dialog); }
protected override void OnStart() { base.OnStart(); active = true; var connectivityManager = (ConnectivityManager)GetSystemService(ConnectivityService); var activeConnection = connectivityManager.ActiveNetworkInfo; if ((activeConnection == null) || !activeConnection.IsConnected) { // brak połączenia z siecią AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Błąd:"); alert.SetMessage("Brak połączenia z internetem!"); alert.SetPositiveButton("Ok", (senderAlert, args) => { // }); alert.Create().Show(); } else { if (viewSwitcher.CurrentView != progressLayout) { viewSwitcher.ShowNext(); } GetData(); } }
private void ShowModeConfigurationDialog(int joystickId) { // Build and display the mode configuration dialog AlertDialog modeConfigurationDialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle); builder.SetSingleChoiceItems(Resource.Array.JoystickModes, (int)GetRelatedJoystickConfiguration(joystickId).JoystickMode, delegate(object sender, DialogClickEventArgs args) { ConfigureJoystickAxis((JoystickConfiguration.JoystickModes)args.Which, joystickId); // ReSharper disable once AccessToModifiedClosure modeConfigurationDialog?.Dismiss(); }); builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogPositive, delegate { // ReSharper disable once AccessToModifiedClosure modeConfigurationDialog?.Dismiss(); }); builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickModeDialogTitle); builder.SetCancelable(false); modeConfigurationDialog = builder.Create(); modeConfigurationDialog.Show(); }
private void ShowRetryDialog() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetCancelable(false); builder.SetTitle("메시지 분류에 실패했습니다."); builder.SetMessage("다시 시도하시겠습니까?"); builder.SetPositiveButton("예", (senderAlert, args) => { Categorize(); }); builder.SetNegativeButton("아니오", (senderAlert, args) => { AlertDialog.Builder builder2 = new AlertDialog.Builder(this); builder2.SetTitle("메시지를 나중에 분류할 수 있습니다."); builder2.SetMessage("메시지 분류를 미루시겠습니까?"); builder2.SetPositiveButton("예", (senderAlert2, args2) => { MoveToNextScreen(); }); builder2.SetNegativeButton("아니오", (senderAlert2, args2) => { RunOnUiThread(() => { _NextBtn.Clickable = true; }); //버튼 누를 수 있게 풀어줘야 됨. }); RunOnUiThread(() => { Dialog dialog2 = builder2.Create(); dialog2.Show(); }); }); RunOnUiThread(() => { Dialog dialog = builder.Create(); dialog.Show(); }); }
void schedule_ScheduleCellTapped(object sender, CellTappedEventArgs args) { var appointment = args.ScheduleAppointment; if (appointment != null) { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Confirm delete"); alert.SetMessage(appointment.Subject); alert.SetPositiveButton("Delete", async(senderAlert, arg) => { await apiClient.DeleteWorkplaceOrderAsync((int)appointment.RecurrenceId); Toast.MakeText(this, "Deleted!", ToastLength.Short).Show(); Orders.Remove(appointment); schedule.ItemsSource = Orders; SetContentView(schedule); }); alert.SetNegativeButton("Cancel", (senderAlert, arg) => { Toast.MakeText(this, "Cancelled!", ToastLength.Short).Show(); }); Dialog dialog = alert.Create(); dialog.Show(); } }
public override bool OnOptionsItemSelected(IMenuItem item) { switch (item.ItemId) { case Android.Resource.Id.Home: startBack(); return(true); case Resource.Id.action_invisible: //Menu de contexto confirmacao AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle(GetString(Resource.String.confirmTitle)); alert.SetMessage(GetString(Resource.String.confirmMSG)); alert.SetPositiveButton(GetString(Resource.String.confirmOk), (senderAlert, args) => { appPreferences.clearPreferences(); SingOutApp(); startBackLogin(); }); alert.SetNegativeButton(GetString(Resource.String.confirmNOk), (senderAlert, args) => { }); Dialog dialog = alert.Create(); dialog.Show(); return(true); default: return(base.OnOptionsItemSelected(item)); } }
public static async Task <int> ShowSingleChoiseDlg(Context context, string title, IListAdapter items, bool bAllowAbort = true) { if (context == null) { return(-1); } tcsScDlg = new TaskCompletionSource <int>(); MainThread.BeginInvokeOnMainThread(() => { try { var builder = new AlertDialog.Builder(context).SetTitle(title); if (bAllowAbort) { builder = builder.SetNegativeButton(context.Resources.GetString(context.Resources.GetIdentifier("action_abort", "string", "me.ichrono.droid")), (s, e) => { tcsScDlg.TrySetResult(-1); }); } builder = builder.SetSingleChoiceItems(items, -1, new SingleChoiceClickListener(tcsScDlg)); builder = builder.SetOnCancelListener(new myDialogCancelListener <int>(tcsScDlg)); var dlg = builder.Create(); dlg.Show(); } catch { tcsScDlg.TrySetResult(-1); } }); await tskScDlg; return(tskScDlg.Result); }
void OnActionSheetRequested(Page sender, ActionSheetArguments arguments) { var builder = new AlertDialog.Builder(this); builder.SetTitle(arguments.Title); string[] items = arguments.Buttons.ToArray(); builder.SetItems(items, (o, args) => arguments.Result.TrySetResult(items[args.Which])); if (arguments.Cancel != null) { builder.SetPositiveButton(arguments.Cancel, (o, args) => arguments.Result.TrySetResult(arguments.Cancel)); } if (arguments.Destruction != null) { builder.SetNegativeButton(arguments.Destruction, (o, args) => arguments.Result.TrySetResult(arguments.Destruction)); } AlertDialog dialog = builder.Create(); builder.Dispose(); //to match current functionality of renderer we set cancelable on outside //and return null dialog.SetCanceledOnTouchOutside(true); dialog.CancelEvent += (o, e) => arguments.SetResult(null); dialog.Show(); }
/// <summary> /// ShowMessage /// </summary> /// <param name="message"></param> /// <param name="title"></param> /// <param name="firstButtonContent"></param> /// <param name="nextButtonContent"></param> /// <param name="lastButtonContent"></param> /// <returns></returns> public async Task <ButtonDialog> ShowMessage(string title, string message, string firstButtonContent, string nextButtonContent, string lastButtonContent) { var tcs = new TaskCompletionSource <ButtonDialog>(); var builder = new AlertDialog.Builder(CrossCurrentActivity.Current.Activity, Resource.Style.AppCompatAlertDialogStyle); builder.SetTitle(title) .SetMessage(message) .SetCancelable(false) .SetPositiveButton(firstButtonContent, (s, args) => { tcs.TrySetResult(ButtonDialog.Primary); }) .SetNeutralButton(lastButtonContent, (s, args) => { tcs.TrySetResult(ButtonDialog.Close); }) .SetNegativeButton(nextButtonContent, (s, args) => { tcs.TrySetResult(ButtonDialog.Secondary); }); var alert = builder.Create(); alert.Show(); var btnPositive = alert.GetButton((int)DialogButtonType.Positive); var btnNegative = alert.GetButton((int)DialogButtonType.Negative); var btnNeutral = alert.GetButton((int)DialogButtonType.Neutral); var layoutParams = (LinearLayout.LayoutParams)btnPositive.LayoutParameters; layoutParams.Gravity = GravityFlags.Center; btnPositive.LayoutParameters = layoutParams; btnNegative.LayoutParameters = layoutParams; btnNeutral.LayoutParameters = layoutParams; return(await tcs.Task); }
private void TxtWidth_FocusChange(object sender, View.FocusChangeEventArgs e) { var txt = (EditText)sender; if (txt.Text != string.Empty) { var resp = Validartxt(txt); if (resp == false) { alert.Builder adb = new alert.Builder(this); adb.SetTitle("Advertencia?"); adb.SetMessage("Verifique el datos ingresado " + txt.Text + " y corregir!!!"); adb.SetNeutralButton("Mantener Dato", (senderAlert, args) => { }); adb.SetPositiveButton("Borrar Dato Ingresado", (senderAlert, args) => { txt.Text = ""; txt.RequestFocus(); }); alert dialog = adb.Create(); dialog.Show(); } else { txt.Focusable = true; } } }
private void SetDeleteMark() { AlertDialog.Builder quitDialog = new AlertDialog.Builder(this); quitDialog.SetTitle("Вы уверены?"); quitDialog.SetPositiveButton("Да", (senderAlert, args) => { var item = mAdapterDataList.GetItemAtPosition(mSelectedItemPosition); Dictionary <long, ElementData> mCommands = new Dictionary <long, ElementData>(); mCommands.Add(0, new ElementData() { Name = "delete", Data = "delete" }); string output = JsonConvert.SerializeObject(mCommands); DataSetWS dataSetWS = new DataSetWS(); dataSetWS.SetDataCompleted += DataSetWS_SetDataCompleted; dataSetWS.SetDataAsync(mRef, item.Ref, output, AppVariable.Variable.getSessionParametersJSON()); mCommands.Remove(0); }); quitDialog.SetNegativeButton("Нет", (senderAlert, args) => { }); Dialog dialog = quitDialog.Create(); dialog.Show(); }
public override bool OnOptionsItemSelected(IMenuItem item) { int id = item.ItemId; switch (id) { case Resource.Id.action_exit: timer.Stop(); AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Confirm EXIT"); alert.SetMessage("Do you want to Exit?"); alert.SetPositiveButton("Yes", (senderAlert, args) => { StartActivity(new Intent(Application.Context, typeof(ScoreviewActivity))); Finish(); }); alert.SetNegativeButton("Cancel", (senderAlert, args) => { timer.Start(); }); Dialog dialog = alert.Create(); dialog.Show(); break; default: break; } return(base.OnOptionsItemSelected(item)); }
/// <summary> /// Shows an alert dialog with two buttons. /// </summary> /// <param name="title"></param> /// <param name="message"></param> /// <param name="okButtonText"></param> /// <param name="cancelButtonText"></param> /// <param name="okCallback"></param> /// <param name="cancelCallback"></param> public void ShowPopup(string title, string message, string okButtonText, string cancelButtonText, Action okCallback, Action cancelCallback, bool dismissable = false, Action dismissCallback = null) { var top = Mvx.Resolve <IMvxAndroidCurrentTopActivity>(); if (top == null) { // may occur if in middle of transition return; } AlertDialog.Builder builder = new AlertDialog.Builder(top.Activity); builder.SetMessage(message); builder.SetTitle(title); builder.SetNegativeButton(cancelButtonText, (o, args) => { cancelCallback?.Invoke(); }); builder.SetPositiveButton(okButtonText, (o, args) => { okCallback?.Invoke(); }); builder.SetCancelable(dismissable); var dialog = builder.Create(); // set the dismiss callback, note that this is not the same as tapping cancel dialog.CancelEvent += (sender, args) => dismissCallback?.Invoke(); top.Activity.RunOnUiThread(() => { dialog.Show(); }); }
public override void OnBackPressed() { if (_isEdited) { var alert = new AlertDialog.Builder(this); alert.SetTitle("Avertisment"); alert.SetMessage("Esti pe cale sa renunti la modificarile facute. Renuntati?"); alert.SetPositiveButton("Da", (senderAlert, args) => { base.OnBackPressed(); }); alert.SetNegativeButton("Nu", (senderAlert, args) => { }); Dialog dialog = alert.Create(); dialog.Show(); } else { //base.OnBackPressed(); var intent = new Intent(this, typeof(MedicineBaseActivity)); intent.AddFlags(ActivityFlags.ClearTop); intent.PutExtra("FromMedicine", true); StartActivity(intent); } }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.ActivityDataList); mRef = Intent.GetStringExtra("ref"); mName = Intent.GetStringExtra("name"); mIsSelectedForm = Intent.GetBooleanExtra("selected", false); mRead = Intent.GetBooleanExtra("read", false); mEdit = Intent.GetBooleanExtra("edit", false); mDelete = Intent.GetBooleanExtra("delete", false); mContainer = FindViewById <LinearLayout>(Resource.Id.Container); mSwipeRefreshLayout = FindViewById <SwipeRefreshLayout>(Resource.Id.swipeLayoutDataList); mSwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight); mSwipeRefreshLayout.Refresh += mSwipeRefreshLayout_Refresh; mDataList = FindViewById <ListView>(Resource.Id.ListView); if (mRead || mIsSelectedForm) { mDataList.ItemClick += MDataList_ItemClick; } if (mDelete) { mDataList.ItemLongClick += MDataList_ItemLongClick; } mFloatingActionButton = FindViewById <FloatingActionButton>(Resource.Id.Fab); mFloatingActionButton.Visibility = mEdit ? ViewStates.Visible : ViewStates.Invisible; mFloatingActionButton.Click += Fab_Click; mEemptyList = FindViewById <TextView>(Resource.Id.ViewEmpty); mToolbar = FindViewById <SupportToolbar>(Resource.Id.Toolbar); mToolbar.Title = mName; SetSupportActionBar(mToolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetDisplayShowHomeEnabled(true); mSearchLinearLayout = FindViewById <LinearLayout>(Resource.Id.Search); mSearchEditText = FindViewById <EditText>(Resource.Id.etSearch); mSearchButton = FindViewById <Button>(Resource.Id.btnSearch); mSearchButton.Click += MSearchButton_Click; mSearchEditText.EditorAction += MSearchEditText_EditorAction;; mSearchLinearLayout.Alpha = 0; mContainer.BringToFront(); mListDataSet = new List <string>(); mListDataSet.Add("Установить/снять пометку на удаление"); ArrayAdapter <string> mListAdapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleListItem1, mListDataSet); AlertDialog.Builder mAlertDialog = new AlertDialog.Builder(this) .SetTitle("Выберите действие:") .SetAdapter(mListAdapter, OnSelectAction); mDialog = mAlertDialog.Create(); UpdateList(); }
/// <summary> /// Dialog for editing phone number /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void EditPhone_Click(object sender, EventArgs e) { LayoutInflater inflater = LayoutInflater.From(this); View view = inflater.Inflate(Resource.Layout.dialog_profile_phone, null); AlertDialog.Builder alertBuilder = new AlertDialog.Builder(this); alertBuilder.SetView(view); var editPhone = view.FindViewById <EditText>(Resource.Id.dialog_edit_phone); // editPhone.Text = phone.Text; alertBuilder.SetTitle("Edit Phone") .SetPositiveButton("Submit", delegate { Toast.MakeText(this, "You clicked Submit!", ToastLength.Short).Show(); }) .SetNegativeButton("Cancel", delegate { alertBuilder.Dispose(); }); AlertDialog alertDialog = alertBuilder.Create(); alertDialog.Show(); }
private void CreatePositionsData(int id) { try { positionsList = new List <Position>(); JsonSerializer serializer = new JsonSerializer(); serializer.NullValueHandling = NullValueHandling.Ignore; var json = new WebClient().DownloadString("http://192.168.1.33/CMOS/CMOSS/GetPositionsPreorderApi/" + id.ToString()); JObject googleSearch = JObject.Parse(json); IList <JToken> results = googleSearch["data"].Children().ToList(); foreach (JToken result in results) { Position searchResult = result.ToObject <Position>(); positionsList.Add(searchResult); } positionsList.Add(new Position { Code = "", Color = "", Loading = "", Name = "", Norm = 0, Order = "", ShortName = "" }); isEdit = false; } catch (Exception ex) { RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Сервер не отвечает"); alert.SetMessage("Обратитесь к администратору" + ex.Message); alert.Show(); return; }); } }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup)inflater.Inflate(Resource.Layout.FragmentMessages, null); mContext = (Activity)container.Context; RecyclerView.LayoutManager mLayoutManager = new LinearLayoutManager(mContext); mRecyclerView = root.FindViewById <RecyclerView>(Resource.Id.recyclerView); mRecyclerView.SetLayoutManager(mLayoutManager); mSwipeRefreshLayout = root.FindViewById <SwipeRefreshLayout>(Resource.Id.swipeLayout); mSwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueDark, Android.Resource.Color.HoloGreenLight, Android.Resource.Color.HoloRedLight); mSwipeRefreshLayout.Refresh += (s, e) => UpdateList(); FloatingActionButton mFloatingActionButton = root.FindViewById <FloatingActionButton>(Resource.Id.Fab); mFloatingActionButton.Click += MFloatingActionButton_Click; mEemptyList = root.FindViewById <TextView>(Resource.Id.ViewEmpty); mListDataSet = new List <string>(); mListDataSet.Add("ќтветить"); mListDataSet.Add("ѕереслать"); mListDataSet.Add("”далить"); ArrayAdapter <string> mListAdapter = new ArrayAdapter <string>(mContext, Android.Resource.Layout.SimpleListItem1, mListDataSet); AlertDialog.Builder mAlertDialog = new AlertDialog.Builder(mContext) .SetTitle("¬ыберите действие:") .SetAdapter(mListAdapter, OnSelectAction); mDialog = mAlertDialog.Create(); return(root); }
public void ShowDeleteListAlert() { AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetMessage(Resource.String.areYouSure); builder.SetPositiveButton(Resource.String.yes, (sender, args) => { _presenter.DeleteList(); }); builder.SetNegativeButton(Resource.String.no, (sender, args) => { }); builder.Create().Show(); }
private void OpenRemarksButton_Click(object sender, EventArgs e) { _builder = new AlertDialog.Builder(this); _builder .SetTitle(Resource.String.aboutme_remark_title) .SetMessage(Resource.String.aboutme_remark_text) .SetNeutralButton(Resource.String.aboutme_remark_ok, delegate { }); _builder.Create().Show(); }
void ShowCopyright() { AlertDialog.Builder dialogBuilder = new AlertDialog.Builder(this); dialogBuilder .SetTitle(GetString(Resource.String.cnhspotlight_copyright_title)) .SetMessage(GetString(Resource.String.cnhspotlight_copyright_content)) .SetPositiveButton("Ok", (o, e) => { }); dialogBuilder.Create().Show(); }
private void ShowMotorConfigurationDialog(int joystickId, int joystickAxis) { // Build and display the motor configuration dialog AlertDialog motorConfigurationDialog = null; AlertDialog.Builder builder = new AlertDialog.Builder(Activity, Resource.Style.AlertDialogStyle); builder.SetSingleChoiceItems(GetMotorList(), GetRelatedJoystickConfiguration(joystickId).MotorIndexes[joystickAxis], delegate(object sender, DialogClickEventArgs args) { // When one motor was clicked we set it and display the next dialog SetMotorIndex(joystickId, args.Which, joystickAxis); // ReSharper disable once AccessToModifiedClosure motorConfigurationDialog?.Dismiss(); // If configured the first joystick axis we have to configure the second. // This can be done better but it works :) if (joystickAxis == 0) { ShowMotorConfigurationDialog(joystickId, ++joystickAxis); } }); builder.SetPositiveButton(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogPositive, delegate { // ReSharper disable once AccessToModifiedClosure motorConfigurationDialog?.Dismiss(); // If configured the first joystick axis we have to configure the second. if (joystickAxis == 0) { ShowMotorConfigurationDialog(joystickId, ++joystickAxis); } }); if (joystickAxis == 0) { builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor1DialogTitle); } else if (joystickAxis == 1) { builder.SetTitle(Resource.String.ControlInterfaceActivity_configureJoystickMotor2DialogTitle); } builder.SetCancelable(false); motorConfigurationDialog = builder.Create(); motorConfigurationDialog.Show(); }
public void showRegisteredDialog() { AlertDialog.Builder alert = new AlertDialog.Builder(context); alert.SetTitle("Success!"); alert.SetMessage("Registration completed"); alert.SetPositiveButton("Ok!", (sender, args) => { }); Dialog dialog = alert.Create(); dialog.Show(); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var loc = ServiceLocator.Current.GetInstance <ILocalizedStringProvider>(); var builder = new AlertDialog.Builder(Activity); builder.SetTitle(loc.GetLocalizedString(Localized.ChangeLanguage_Label)); builder.SetAdapter(new LanguageAdapter(Activity), this); return(builder.Create()); }
private void btnGeoWithAddress_Click(object sender, EventArgs e) { search_view = base.LayoutInflater.Inflate(Resource.Layout.search_alert_layout, null); AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.SetView(search_view); builder.SetTitle("Search Location"); builder.SetNegativeButton("Cancel", (send, arg) => { builder.Dispose(); }); search_view.FindViewById <Button>(Resource.Id.btnSearch).Click += btnSearchClicked; alert = builder.Create(); alert.Show(); }
private void MapOnInfoWindowClick(object sender, GoogleMap.InfoWindowClickEventArgs e) { Marker myMarker = e.Marker; ISharedPreferences prefs = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor = prefs.Edit(); KeyValuePair <Building, List <Workplace> > buildingInstance = CompositeMarkers[myMarker.Id]; TextView markerMenu = FindViewById <TextView>(Resource.Id.marker_menu); PopupMenu menu = new PopupMenu(this, markerMenu); foreach (Workplace workplace in buildingInstance.Value) { FindedWorkplace finded = findedWorkplaces.FirstOrDefault(x => x.WorkplaceId == workplace.Id); menu.Menu.Add("Workplace number:" + workplace.Id.ToString() + ",\nWorkplace cost: " + workplace.Cost.ToString() + ",\nAppropriation: " + finded.AppropriationPercentage.ToString() + ",\nCost approp: " + finded.CostColor + ", Address: " + buildingInstance.Key.Country + ", " + buildingInstance.Key.City + ", " + buildingInstance.Key.Street + ", " + buildingInstance.Key.House.ToString() + ", " + buildingInstance.Key.Flat.ToString()); } menu.MenuItemClick += (s1, arg1) => { AlertDialog.Builder alert = new AlertDialog.Builder(this); alert.SetTitle("Workplace"); alert.SetMessage(arg1.Item.TitleFormatted.ToString()); alert.SetPositiveButton("Visit", async(senderAlert, arg) => { ISharedPreferences prefs1 = PreferenceManager.GetDefaultSharedPreferences(Android.App.Application.Context); ISharedPreferencesEditor editor1 = prefs1.Edit(); string workplId = arg1.Item.TitleFormatted.ToString().Split(':', ',')[1]; editor1.PutString("workplaceId", workplId); editor1.Apply(); var intent = new Intent(this, typeof(WorkplaceActivity)); StartActivity(intent); }); alert.SetNegativeButton("Cancel", (senderAlert, arg) => { Toast.MakeText(this, "Cancelled!", ToastLength.Short).Show(); }); Dialog dialog = alert.Create(); dialog.Show(); }; menu.DismissEvent += (s2, arg2) => { Console.WriteLine("menu dismissed"); }; menu.Show(); //editor.PutString("restaurant", Markers[myMarker.Id].ToString()); //editor.Apply(); //var intent = new Intent(this, typeof(RestaurantActivity)); //StartActivity(intent); }
private void SavePosData() { try { if (pos != null) { int quentity = Int32.Parse(quentityInput.Text); if (quentity > pos.Norm) { quentity = pos.Norm; } pos.Rate = quentity; if (pos.Weight != Double.Parse(weightInput.Text.Replace(".", ","))) { pos.IsWeight = true; } pos.Weight = Double.Parse(weightInput.Text.Replace(".", ",")); positionItem = positionsList.FindIndex(a => a.Id == pos.Id); foreach (var t in positionsList) { if (t.Code == pos.Code) { t.Weight = pos.Weight; } } RunOnUiThread(() => codeInput.Text = pos.Code); RunOnUiThread(() => quentityInput.Text = pos.Rate.ToString()); RunOnUiThread(() => weightInput.Text = pos.Weight.ToString()); MainThread.BeginInvokeOnMainThread(() => { adapterPosition = new PositionsAdapter(positionsList); adapterPosition.ItemClick += OnPositionClick; ordersRecyclerView.SetAdapter(adapterPosition); ordersRecyclerView.ScrollToPosition(positionItem); }); codeInput.ClearFocus(); quentityInput.ClearFocus(); weightInput.ClearFocus(); isEdit = true; } } catch (Exception ex) { RunOnUiThread(() => { AlertDialog.Builder dialog = new AlertDialog.Builder(this); AlertDialog alert = dialog.Create(); alert.SetTitle("Ошибка сохранения"); alert.SetMessage("Ошибка: " + ex.Message); alert.Show(); return; }); } }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var loc = ServiceLocator.Current.GetInstance <ILocalizedStringProvider>(); var builder = new AlertDialog.Builder(Activity); builder.SetTitle(loc.GetLocalizedString(Localized.Sessions_Label)); builder.SetAdapter(App.Locator.CourseViewModel.Course.Sessions.GetAdapter(GetSessionTemplate), this); return(builder.Create()); }
private void InitializeRecyclerView () { RecyclerView recyclerView = FindViewById<RecyclerView> (Resource.Id.HomeLayoutRecyclerView); TodoAdapter adapter = new TodoAdapter (Todos); recyclerView.SetAdapter (adapter); adapter.ItemClickEvent += (object sender, int position) => { var builder = new AlertDialog.Builder(this); builder.SetTitle(Todos[position].Name) .SetMessage(Todos[position].Description) .SetPositiveButton("Got it", delegate {}); builder.Create().Show(); }; recyclerView.SetLayoutManager (new LinearLayoutManager(this, LinearLayoutManager.Vertical, false)); }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.Home); InitializeToolbar (); Todos = TodoFactory.GetTodos (); InitializeRecyclerView (); FloatingActionButton fab = FindViewById<FloatingActionButton> (Resource.Id.fab); fab.Click += (object sender, EventArgs e) => { var builder = new AlertDialog.Builder(this); builder.SetTitle("Notification") .SetMessage("You clicked the Action Button!") .SetPositiveButton("OK", delegate {}); builder.Create().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); if (true) { // Customization activated View root = FindViewById<View> (Resource.Id.rootView); // Activate this to internally use a bitmap to store the strokes // (good for frequent-redraw situations, bad for memory footprint) // signature.UseBitmapBuffer = true; signature.Caption.Text = "Authorization Signature"; signature.Caption.SetTypeface (Typeface.Serif, TypefaceStyle.BoldItalic); signature.Caption.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 16f); signature.SignaturePrompt.Text = ">>"; signature.SignaturePrompt.SetTypeface (Typeface.SansSerif, TypefaceStyle.Normal); signature.SignaturePrompt.SetTextSize (global::Android.Util.ComplexUnitType.Sp, 32f); signature.BackgroundColor = Color.Rgb (255, 255, 200); // a light yellow. signature.StrokeColor = Color.Black; signature.BackgroundImageView.SetImageResource (Resource.Drawable.logo_galaxy_black_64); signature.BackgroundImageView.SetAlpha (16); signature.BackgroundImageView.SetAdjustViewBounds (true); var layout = new RelativeLayout.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent); layout.AddRule (LayoutRules.CenterInParent); layout.SetMargins (20, 20, 20, 20); signature.BackgroundImageView.LayoutParameters = layout; // You can change paddings for positioning... var caption = signature.Caption; caption.SetPadding (caption.PaddingLeft, 1, caption.PaddingRight, 25); } // 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 (); }
public override void Prompt(PromptConfig config) { Utils.RequestMainThread(() => { var activity = this.getTopActivity(); var txt = new EditText(activity) { Hint = config.Placeholder }; if (config.Text != null) txt.Text = config.Text; this.SetInputType(txt, config.InputType); var builder = new AlertDialog .Builder(activity) .SetCancelable(false) .SetMessage(config.Message) .SetTitle(config.Title) .SetView(txt) .SetPositiveButton(config.OkText, (o, e) => config.OnResult(new PromptResult { Ok = true, Text = txt.Text }) ); if (config.IsCancellable) { builder.SetNegativeButton(config.CancelText, (o, e) => config.OnResult(new PromptResult { Ok = false, Text = txt.Text }) ); } var dialog = builder.Create(); dialog.Window.SetSoftInputMode(SoftInput.StateVisible); dialog.Show(); }); }
public override Dialog OnCreateDialog(Bundle savedInstanceState) { var adb = new AlertDialog.Builder(Activity); adb.SetTitle(Title).SetMessage(Message).SetPositiveButton(Resource.String.ok, delegate{meListener.OnDialogPositiveClick();}); return adb.Create(); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.weld_count_fragment, container, false); var refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.srl); if (refresher != null) { refresher.Refresh += delegate { Refresh(forced: true); refresher.Refreshing = false; }; } listView = view.FindViewById<ListView>(Resource.Id.listView); listView.Adapter = adapter; listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var builder = new AlertDialog.Builder(Context); builder.SetItems(Resource.Array.select_dialog_items, (object sender1, DialogClickEventArgs e1) => { var items = Resources.GetStringArray(Resource.Array.select_dialog_items); var item = items[(int)e1.Which]; if (e1.Which == 0) { ListView_Click(e.Position); } else if (e1.Which == 1) { Pref.TextViewDialog(Context, null, adapter.GetItem(e.Position).RowText()); } }); builder.Create().Show(); }; listView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) => { ListView_Click(e.Position); }; return view; }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { view = inflater.Inflate(Resource.Layout.file_list_fragment, container, false); var refresher = view.FindViewById<SwipeRefreshLayout>(Resource.Id.srl); if (refresher != null) { refresher.Refresh += delegate { RefreshFilesList(DirPath); refresher.Refreshing = false; }; } listView = view.FindViewById<ListView>(Resource.Id.listView); listView.Adapter = adapter; listView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) => { var fileSystemInfo = adapter.GetItem(e.Position); if (e.Position == 0) { RefreshFilesList(Path.GetDirectoryName(fileSystemInfo.FullName)); } else if (fileSystemInfo.IsDirectory()) { RefreshFilesList(fileSystemInfo.FullName); } else { Pref.TextViewDialog(Context, fileSystemInfo.FullName); } }; listView.ItemLongClick += (object sender, AdapterView.ItemLongClickEventArgs e) => { if (e.Position == 0) return; var fileSystemInfo = adapter.GetItem(e.Position); var actionName = fileSystemInfo.IsDirectory() ? "폴더 삭제" : "파일 삭제"; var fileType = fileSystemInfo.IsDirectory() ? "이 폴더를 " : "이 파일을 "; var msg = fileType + "완전히 삭제 하시겠습니까?\n\n" + fileSystemInfo.Name + "\n\n수정한 날짜: " + fileSystemInfo.LastWriteTime.ToString(); var builder = new AlertDialog.Builder(Context); builder.SetTitle(actionName) .SetMessage(msg) .SetNegativeButton("취소", delegate { RefreshFilesList(DirPath); Show("삭제가 취소 되었습니다"); }) .SetPositiveButton("삭제", delegate { try { Directory.Delete(fileSystemInfo.FullName, true); RefreshFilesList(DirPath); } catch { Show("삭제할 수 없습니다"); } }); builder.Create().Show(); }; return view; }