public async Task ShowShortResultAsync(bool result) { Toast toast = new Toast(activity); ImageView imgView = new ImageView(activity); toast.View = imgView; if(result) imgView.SetImageResource(Resource.Drawable.ic_thumb_up_black); else imgView.SetImageResource(Resource.Drawable.ic_thumb_down_black); toast.Show(); await Task.Delay(RESULT_DISPLAYED_TIME); try { toast.Cancel(); } catch(Exception ex) { Log.Error("HarmNumb", ex.ToString()); } }
public void Show(string msg) { var vibrator = (Vibrator)Xamarin.Forms.Forms.Context.GetSystemService(Context.VibratorService); vibrator.Vibrate(100); //XHUD.HUD.ShowToast(msg, true, 60000); this.toast = Toast.MakeText(Forms.Context, msg, ToastLength.Long); this.toast.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.Toast); var shortButton = FindViewById<Button>(Resource.Id.ShortToastButton); shortButton.Click += (sender, args) => { Toast.MakeText(this, "Short toast message", ToastLength.Short).Show(); }; var longButton = FindViewById<Button>(Resource.Id.LongToastButton); longButton.Click += (sender, args) => { Toast.MakeText(this, "Longer toast duration because you need extra time if there's more to read", ToastLength.Long).Show(); }; var topButton = FindViewById<Button>(Resource.Id.TopToastButton); topButton.Click += (sender, args) => { var t = Toast.MakeText(this, "Wow this toast appears near the top", ToastLength.Short); t.SetGravity(GravityFlags.Top, 0, 200); t.Show(); }; var customButton = FindViewById<Button>(Resource.Id.CustomToastButton); customButton.Click += (sender, args) => { var toastView = LayoutInflater.Inflate(Resource.Layout.ToastCustom, FindViewById<ViewGroup>(Resource.Id.ToastLayout)); toastView.FindViewById<TextView>(Resource.Id.ToastText).Text = "REALLY OBVIOUS TOAST @ " + DateTime.Now.ToShortTimeString(); var t = new Toast(this); t.SetGravity(GravityFlags.Center, 0, 0); t.View = toastView; t.Show(); }; }
public void Show(string header, string body, Action activated, Action<Exception> failed = null) { var toast = new Toast(header, body); toast.Activated += (sender, args) => activated(); if (failed != null) toast.ToastFailed += (sender, args) => failed(args.ErrorCode); toast.Show(); }
public void ShowToast(string msg, int delay = 1000) { var vibrator = (Vibrator)Xamarin.Forms.Forms.Context.GetSystemService(Context.VibratorService); vibrator.Vibrate(100); //java.lang.NullPointerException: Attempt to invoke virtual method 'android.content.res.Resources$Theme android.content.Context.getTheme()' on a null object reference //XHUD.HUD.ShowToast(msg, timeoutMs: delay); this.toast = Toast.MakeText(Forms.Context, msg, ToastLength.Short); this.toast.Show(); }
public StreamManager(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; StreamStatusToast = Toast.MakeText(context, string.Empty, ToastLength.Long); app = ((GlobalApp)context.ApplicationContext); }
void OneShotClick(object sender, EventArgs e) { var intent = new Intent (this, typeof (OneShotAlarm)); var source = PendingIntent.GetBroadcast (this, 0, intent, 0); var am = (AlarmManager) GetSystemService (AlarmService); am.Set (AlarmType.ElapsedRealtime, SystemClock.ElapsedRealtime () + 30*1000, source); if (repeating != null) repeating.Cancel (); repeating = Toast.MakeText (this, Resource.String.one_shot_scheduled, ToastLength.Long); repeating.Show (); }
public void OnHeaderClick(AdapterView parent, Android.Views.View view, long id) { string text = "Header " + ((TextView)view.FindViewById(Android.Resource.Id.Text1)).Text + " was tapped."; if (toast == null) { toast = Toast.MakeText(Activity, text, ToastLength.Short); } else { toast.SetText(text); } toast.Show(); }
void StopRepeatingClick(object sender, EventArgs e) { var intent = new Intent (this, typeof (RepeatingAlarm)); var source = PendingIntent.GetBroadcast (this, 0, intent, 0); var am = (AlarmManager) GetSystemService (AlarmService); am.Cancel (source); if (repeating != null) repeating.Cancel (); repeating = Toast.MakeText (this, Resource.String.repeating_unscheduled, ToastLength.Long); repeating.Show (); }
private TapjoyManager(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; TapjoyToast = Toast.MakeText(context, string.Empty, ToastLength.Short); app = ((GlobalApp)context.ApplicationContext); StreamPrice = context.Resources.GetInteger(Resource.Integer.tapjoy_stream_price); connectListener = new ConnectListener(); streamSpentListener = new CurrencySpentListener(); streamPlacementListener = new PlacementListener(); earnedListener = new CurrencyEarnedListener(); videoListener = new VideoListener(); }
public MainEventHandlers(Context context) { if (context == null) throw new ArgumentNullException("context"); this.context = context; app = ((GlobalApp)context.ApplicationContext); ConnectStatusToast = Toast.MakeText(context, string.Empty, ToastLength.Long); TapjoyManager.Initialize(context); TapjoyManager.Connect(delegate { if (SetMenuVisibility != null) SetMenuVisibility.Invoke(); }); }
private void ShowError(string message) { var inflater = LayoutInflater.FromContext(_applicationContext); View layoutView = inflater.Inflate(Resource.Layout.ToastLayout_Error, null); var text1 = layoutView.FindViewById<TextView>(Resource.Id.ErrorText1); text1.Text = "Sorry!"; var text2 = layoutView.FindViewById<TextView>(Resource.Id.ErrorText2); text2.Text = message; var toast = new Toast(_applicationContext); toast.SetGravity(GravityFlags.CenterVertical, 0, 0); toast.Duration = ToastLength.Long; toast.View = layoutView; toast.Show(); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.AllTotems); //if else that prevents crash when app is killed if (_appController.CurrentProfiel == null) { var i = new Intent(this, typeof(MainActivity)); StartActivity(i); Finish(); } else { //Action bar InitializeActionBar(SupportActionBar); title = ActionBarTitle; close = ActionBarClose; back = ActionBarBack; delete = ActionBarDelete; //single toast for entire activity mToast = Toast.MakeText(this, "", ToastLength.Short); profile = _appController.CurrentProfiel; totemList = _appController.GetTotemsFromProfiel(profile.name); totemAdapter = new TotemAdapter(this, totemList); allTotemListView = FindViewById<ListView>(Resource.Id.all_totem_list); allTotemListView.Adapter = totemAdapter; allTotemListView.ItemClick += ShowDetail; allTotemListView.ItemLongClick += DeleteTotem; title.Text = "Totems voor " + profile.name; noTotems = FindViewById<TextView>(Resource.Id.empty_totem); close.Click += HideDeleteTotems; delete.Click += ShowDeleteTotems; if (totemList.Count == 0) { noTotems.Visibility = ViewStates.Visible; delete.Visibility = ViewStates.Gone; } else { delete.Visibility = ViewStates.Visible; } } }
private void ShowError(string message) { var activity = Mvx.Resolve<IMvxAndroidCurrentTopActivity>().Activity as IMvxBindingContextOwner; // note that we're not using Binding in this Inflation - but the overhead is minimal - so use it anyway! View layoutView = activity.BindingInflate(Resource.Layout.ToastLayout_Error, null); var text1 = layoutView.FindViewById<TextView>(Resource.Id.ErrorText1); text1.Text = "Sorry!"; var text2 = layoutView.FindViewById<TextView>(Resource.Id.ErrorText2); text2.Text = message; var toast = new Toast(_applicationContext); toast.SetGravity(GravityFlags.CenterVertical, 0, 0); toast.Duration = ToastLength.Long; toast.View = layoutView; toast.Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate (savedInstanceState); SetContentView (Resource.Layout.Profielen); //Action bar InitializeActionBar (SupportActionBar); title = ActionBarTitle; close = ActionBarClose; back = ActionBarBack; add = ActionBarAdd; delete = ActionBarDelete; //single toast for entire activity mToast = Toast.MakeText (this, "", ToastLength.Short); profielen = _appController.DistinctProfielen; profielAdapter = new ProfielAdapter (this, profielen); profielenListView = FindViewById<ListView> (Resource.Id.profielen_list); profielenListView.Adapter = profielAdapter; profielenListView.ItemClick += ShowTotems; profielenListView.ItemLongClick += DeleteProfile; noProfiles = FindViewById<TextView> (Resource.Id.empty_profiel); title.Text = "Profielen"; add.Visibility = ViewStates.Visible; add.Click += (sender, e) => AddProfile (); delete.Click += ShowDeleteProfiles; close.Click += HideDeleteProfiles; if (profielen.Count == 0) { noProfiles.Visibility = ViewStates.Visible; delete.Visibility = ViewStates.Gone; } else { delete.Visibility = ViewStates.Visible; } }
void OneShotClick (object sender, EventArgs e) { // When the alarm goes off, we want to broadcast an Intent to our // BroadcastReceiver. Here we make an Intent with an explicit class // name to have our own receiver (which has been published in // AndroidManifest.xml) instantiated and called, and then create an // IntentSender to have the intent executed as a broadcast. var intent = new Intent (this, typeof (OneShotAlarm)); var source = PendingIntent.GetBroadcast (this, 0, intent, 0); // Schedule the alarm for 30 seconds from now! var am = (AlarmManager) GetSystemService (AlarmService); am.Set (AlarmType.ElapsedRealtime, SystemClock.ElapsedRealtime () + 30*1000, source); // Tell the user about what we did. if (repeating != null) repeating.Cancel (); repeating = Toast.MakeText (this, Resource.String.one_shot_scheduled, ToastLength.Long); repeating.Show (); }
public override Android.Views.View GetSampleContent (Android.Content.Context context) { Toast currentToast=new Toast(context); LinearLayout layout= new LinearLayout(context); layout.Orientation = Orientation.Vertical; TextView textView= new TextView(context); textView.TextSize = 20; textView.SetPadding(10,20,0,0); textView.SetHeight(70); textView.Text ="Primary Agricultural Data of USA"; layout.AddView(textView); textView.Gravity = Android.Views.GravityFlags.Top; maps = new SfMaps (context); ShapeFileLayer layer = new ShapeFileLayer(); layer.ShapeSelected += (object sender, ShapeFileLayer.ShapeSelectedEventArgs e) => { JSONObject data = (JSONObject)e.P0; if (data != null) { if (currentToast != null) { currentToast.Cancel (); } currentToast = Toast.MakeText (context, data.Get ("Name") + "\n" + data.Get ("Type"), ToastLength.Short); currentToast.Show (); } }; layer.EnableSelection = true; layer.Uri ="usa_state.shp"; layer.ShapeIdTableField ="STATE_NAME"; layer.ShapeIdPath ="Name"; layer.DataSource = GetDataSource (); layer.ShapeSettings.ShapeStrokeThickess = 2; SetColorMapping(layer.ShapeSettings); layer.ShapeSettings.ShapeColorValuePath ="Type"; maps.Layers.Add (layer); maps.SetY(-20); layout.AddView (maps); return layout; }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // 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 button = FindViewById<Button>(Resource.Id.MyButton); EditText phoneEditText = FindViewById<EditText>(Resource.Id.PhoneNumberText); button.Click += delegate { var phoneNumber = phoneEditText.Text; var activity = new Intent(this, typeof(ResultActivity)); activity.PutExtra("PhoneNumber", phoneNumber); transitionToast = Toast.MakeText(this, "Loading...", ToastLength.Long); transitionToast.Show(); StartActivity(activity); }; }
protected override void OnCreate (Bundle savedInstanceState) { base.OnCreate (savedInstanceState); this.AddPreferencesFromResource (Resource.Xml.preferences_general); var reset = this.FindPreference ("reset_high_score"); reset.PreferenceClick += (sender, e) => { if(toast != null && leftToClick > 0) toast.Cancel(); leftToClick--; if(leftToClick ==0) { Helpers.Settings.HighScore = Helpers.Settings.HighScoreDefault; Helpers.Settings.HighScoreDay = DateTime.Today; toast = Toast.MakeText(this, Resource.String.has_been_reset, ToastLength.Long); toast.Show(); } else if(leftToClick > 0) { var text = Resources.GetString(Resource.String.reset_count); toast = Toast.MakeText(this, string.Format(text, leftToClick), ToastLength.Short); toast.Show(); } }; }
public void Show(Toast toast, float duration, ToastPosition position) { Should.NotBeNull(toast, nameof(toast)); _toast = toast; switch (position) { case ToastPosition.Bottom: _toast.SetGravity(GravityFlags.Bottom | GravityFlags.CenterHorizontal, toast.XOffset, toast.YOffset); break; case ToastPosition.Center: _toast.SetGravity(GravityFlags.Center, toast.XOffset, toast.YOffset); break; case ToastPosition.Top: _toast.SetGravity(GravityFlags.Top | GravityFlags.CenterHorizontal, toast.XOffset, toast.YOffset); break; default: throw new ArgumentOutOfRangeException(nameof(position)); } _toast.Duration = ToastLength.Short; _toast.Show(); _delayTimer = new Timer(DelayTimerCallback, this, (uint)duration, int.MaxValue); if (duration > 2000) _showTimer = new Timer(ShowTimerCallback, this, TimerInterval, TimerInterval); }
public void alertano(object sender, EventArgs e) { Toast.MakeText(this, "Operacion cancelada", ToastLength.Short).Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.menusincronizacion); /////////////////////////////Mappings////////////////////////// botonabrirqr = FindViewById <ImageView>(Resource.Id.imageView1); nombreservidor = FindViewById <TextView>(Resource.Id.textView2); playpause = FindViewById <ImageView>(Resource.Id.imageView3); homeb = FindViewById <ImageView>(Resource.Id.imageView2); ll = FindViewById <LinearLayout>(Resource.Id.linearLayout1); tvnombrecancion = FindViewById <TextView>(Resource.Id.textView3); root = FindViewById <LinearLayout>(Resource.Id.rooteeooo); //////////////////////////////////////////////////////////////// ll.SetBackgroundColor(Android.Graphics.Color.Black); // root.SetBackgroundColor(Android.Graphics.Color.DarkGray); cliente = new TcpClient(); cliente2 = new TcpClient(); clientelocal = new TcpClient(); clientelocal.Client.Connect(Intent.GetStringExtra("ipadre"), 1024); // ll.SetBackgroundColor(Android.Graphics.Color.Black); // animar2(ll); UiHelper.SetBackgroundAndRefresh(this); // ll.SetBackgroundColor(Android.Graphics.Color.ParseColor("#2b2e30")); servidor = new TcpListener(IPAddress.Any, 1060); botonabrirqr.SetBackgroundResource(Resource.Drawable.synchalf); vero = new Thread(new ThreadStart(cojerstreamlocal)); vero.IsBackground = true; vero.Start(); tvnombrecancion.Selected = true; homeb.Click += delegate { this.Finish(); }; playpause.Click += delegate { animar(playpause); clientelocal.Client.Send(Encoding.UTF8.GetBytes("playpause()")); }; botonabrirqr.Click += async(ss, sss) => { if (conectado == false) { animar(botonabrirqr); ZXing.Mobile.MobileBarcodeScanner.Initialize(Application); var scanner = new ZXing.Mobile.MobileBarcodeScanner(); var resultado = await scanner.Scan(); string captured = resultado.Text.Trim(); ipadres = captured.Split(';')[0]; puerto = int.Parse(captured.Split(';')[1]); cliente.Client.Connect(ipadres, puerto); // botonabrirqr.Visibility = ViewStates.Invisible; Toast.MakeText(this, "conectado..", ToastLength.Long).Show(); conocerset = new Thread(new ThreadStart(conocerse)); conocerset.IsBackground = true; conocerset.Start(); cojert = new Thread(new ThreadStart(cojerstream)); cojert.IsBackground = true; cojert.Start(); conectado = true; } else { AlertDialog.Builder ad = new AlertDialog.Builder(this); ad.SetCancelable(false); ad.SetMessage("Desea desconectarse??"); ad.SetTitle("Advertencia"); ad.SetIcon(Resource.Drawable.warningsignonatriangularbackground); ad.SetPositiveButton("Si", alertaok); ad.SetNegativeButton("No", alertano); ad.Create(); ad.Show(); } }; }
public async Task SignOut(Toast toast = default(Toast)) { await httpClientService.Get("api/user/SignOut", toast); await authenticationStateProvider.MarkUserAsSignedOut(); }
private void ShowEasterEgg(object sender, Android.Views.View.LongClickEventArgs e) { mToast = new Toast(this); mToast.Duration = ToastLength.Short; mToast.SetGravity(GravityFlags.Center | GravityFlags.Bottom, 0, ConvertDPToPixels(10)); toastView.Visibility = ViewStates.Visible; mToast.View = toastView; mToast.Show(); }
protected override void OnResume() { base.OnResume(); Toast.MakeText(this, "Click on the map to update your marker", ToastLength.Long).Show(); }
void StopRepeatingClick (object sender, EventArgs e) { // Create the same intent, and thus a matching IntentSender, for // the one that was scheduled. var intent = new Intent (this, typeof (RepeatingAlarm)); var source = PendingIntent.GetBroadcast (this, 0, intent, 0); // And cancel the alarm. var am = (AlarmManager) GetSystemService (AlarmService); am.Cancel (source); // Tell the user about what we did. if (repeating != null) repeating.Cancel (); repeating = Toast.MakeText (this, Resource.String.repeating_unscheduled, ToastLength.Long); repeating.Show (); }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.TotemDetail); //if else that prevents crash when app is killed if (_appController.CurrentTotem == null) { var i = new Intent(this, typeof(MainActivity)); StartActivity(i); Finish(); } else { //Action bar InitializeActionBar(SupportActionBar); title = ActionBarTitle; back = ActionBarBack; search = ActionBarSearch; //single toast for entire activity mToast = Toast.MakeText(this, "", ToastLength.Short); number = FindViewById<TextView>(Resource.Id.number); title_synonyms = FindViewById<TextView>(Resource.Id.title_synonyms); body = FindViewById<TextView>(Resource.Id.body); _gestureDetector = new GestureDetector(this); title.Text = "Beschrijving"; if (!_appController.ShowAdd) { action = ActionBarDelete; action.Click += (sender, e) => RemoveFromProfile(_appController.CurrentProfiel.name); } else { action = ActionBarAdd; action.Click += (sender, e) => ProfilePopup(); } action.Visibility = ViewStates.Visible; search.Visibility = ViewStates.Visible; search.SetImageResource(Resource.Drawable.ic_visibility_off_white_24dp); search.Click += (sender, e) => ToggleHidden(); _appController.NavigationController.GotoProfileListEvent += StartProfielenActivity; SetInfo(); } }
public void Shorttime(string message) { Toast.MakeText(Android.App.Application.Context, message, ToastLength.Short).Show(); }
private View RenderForm(FormParameter formParameter, string submitAction) { var scroll = new NestedScrollView(Application.Context); var linearLayout = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; if (formParameter != null) { InvokeForm.Response result = null; var inputsManager = new List <FormInputManager>(); var resultLayout = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical, LayoutParameters = linearLayout.MatchParentWrapContent() }; if (formParameter.Form.InputFields.Count > 0) { var inputsLayout = new LinearLayout(Application.Context) { Orientation = Orientation.Vertical }; this.RenderInputs(inputsLayout, formParameter, inputsManager); if (formParameter.Form.InputFields.Count(a => !a.Hidden) > 0) { this.ManagersCollection.StyleRegister.ApplyStyle("FormLayout", inputsLayout); var submitLabel = "Submit"; var submitbuttonlabel = formParameter.Form.CustomProperties?.GetCustomProperty <string>("submitButtonLabel"); if (!string.IsNullOrEmpty(submitbuttonlabel)) { submitLabel = submitbuttonlabel; } var btn = new Button(Application.Context) { Text = submitLabel, LayoutParameters = inputsLayout.MatchParentWrapContent() }; this.ManagersCollection.StyleRegister.ApplyStyle("Button SubmitButton", btn); inputsLayout.AddView(btn); btn.Click += async(sender, args) => { try { result = await this.SubmitFormAsync(resultLayout, formParameter.Form, inputsManager); if (submitAction == FormLinkActions.OpenModal && result != null) { this.FormWrapper.CloseForm(); } else { this.RenderOutput(resultLayout, result, formParameter.Form, inputsManager); } } catch (Exception ex) { Toast.MakeText(Application.Context, ex.Message, ToastLength.Long).Show(); } }; } linearLayout.AddView(inputsLayout); } // run on response handled events EventsManager.OnFormLoadedEvent(formParameter); if (formParameter.Form.PostOnLoad || submitAction == FormLinkActions.Run) { try { var taskToRun = Task.Run(() => this.SubmitFormAsync(resultLayout, formParameter.Form, inputsManager, formParameter.Form.PostOnLoadValidation)); result = taskToRun.Result; } catch (AggregateException ex) { ex.ThrowInnerException(); } if (submitAction == FormLinkActions.Run) { this.FormWrapper.CloseForm(); return(null); } this.RenderOutput(resultLayout, result, formParameter.Form, inputsManager); } this.ManagersCollection.StyleRegister.ApplyStyle("ResultsLayout", resultLayout); linearLayout.AddView(resultLayout); scroll.AddView(linearLayout, scroll.MatchParentWrapContent()); } return(scroll); }
private void BtnSend_Click(object sender, EventArgs e) { try { try { foreach (var i in AssignJobP3Activity.WorkerList) { var parts = SmsManager.Default.DivideMessage(txtMsg.Text); SmsManager.Default.SendMultipartTextMessage(i.empMobile, null, parts, null, null); } } catch (Exception ex) { Toast.MakeText(this, "A message failed to send\n" + ex, ToastLength.Long).Show(); } Toast.MakeText(this, "Messages sent", ToastLength.Long).Show(); btnSend.Enabled = false; JobInstructions = txtMsg.Text.Split(new string[] { "Note:" }, StringSplitOptions.None).Last(); //NEEDSTEST JobsAssigned job = new JobsAssigned(); foreach (var worker in AssignJobP3Activity.WorkerList) { EmployeeJob emp1 = new EmployeeJob(); emp1.EmpNAME = worker.empNAME; job.EmployeeJobs.Add(emp1); } startTime = JobDate + "T" + JobTime; job.AssignJOBNUM = JobNumber.ToString(); job.AssignCLIENT = JobClient; job.AssignWORK = JobName; job.AssignAREA = JobArea; job.AssignINSTRUCTIONS = JobInstructions; job.AssignTRUCK = JobTruckNo; job.TextSENT = DateTime.Now.ToString("yyyy-MM-dd" + "T" + "HH:mm:ss"); job.AssignSTARTTIME = startTime; try { objJOBS.ExecutePostRequest(job); } catch (Exception ex) { Toast.MakeText(this, "Something went wrong:" + ex.Message, ToastLength.Long).Show(); } AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); alertDialog.SetMessage("Message sent and saved."); alertDialog.SetPositiveButton("New Message", delegate { StartActivity(typeof(AssignJobP2Activity)); alertDialog.Dispose(); }); alertDialog.SetNegativeButton("Menu", delegate { StartActivity(typeof(MainActivity)); alertDialog.Dispose(); }); alertDialog.Show(); } catch (Exception ex) { Toast.MakeText(this, "Something went wrong:" + ex.Message, ToastLength.Long).Show(); } }
private void ApplyButter(Toast toast) { Console.WriteLine("Putting butter on the toast"); }
private void ApplyJam(Toast toast) { Console.WriteLine("Putting jam on the toast"); }
public override void OnDestroy() { base.OnDestroy(); Toast.MakeText(this, "The Battery Service has been stopped", ToastLength.Long).Show(); }
public void onRegistrationFail(string msg) { Toast.MakeText(Android.App.Application.Context, msg, ToastLength.Short).Show(); }
public void SumbitClick(object o, EventArgs e) { //Sumbit report here Toast.MakeText(this, "Report sumbited", ToastLength.Short).Show(); }
private void SubscribeChannelButtonClick(object sender, EventArgs e) { try { if (Methods.CheckConnectivity()) { if (UserDetails.IsLogin) { if (!string.IsNullOrEmpty(UserData.SubscriberPrice) && UserData.SubscriberPrice != "0") { if (SubscribeChannelButton.Tag.ToString() == "PaidSubscribe") { DialogType = "PaidSubscribe"; //This channel is paid, You must pay to subscribe var dialog = new MaterialDialog.Builder(Context).Theme(AppSettings.SetTabDarkTheme ? AFollestad.MaterialDialogs.Theme.Dark : AFollestad.MaterialDialogs.Theme.Light); dialog.Title(Resource.String.Lbl_Warning); dialog.Content(GetText(Resource.String.Lbl_ChannelIsPaid)); dialog.PositiveText(GetText(Resource.String.Lbl_Ok)).OnPositive(this); dialog.NegativeText(GetText(Resource.String.Lbl_Cancel)).OnNegative(this); dialog.AlwaysCallSingleChoiceCallback(); dialog.Build().Show(); } else { SubscribeChannelButton.Tag = "Subscribe"; SubscribeChannelButton.Text = GetText(Resource.String.Btn_Subscribe); //Color SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef")); //icon Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribeButton); icon.Bounds = new Rect(10, 10, 10, 7); SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); //Remove The Video to Subscribed Videos Database var sqlEntity = new SqLiteDatabase(); sqlEntity.RemoveSubscriptionsChannel(IdChannel); sqlEntity.Dispose(); //Send API Request here for UnSubscribed PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Add_Subscribe_To_Channel_Http(UserData.Id) }); // Toast.MakeText(this, this.GetText(Resource.String.Lbl_Channel_Removed_successfully, ToastLength.Short).Show(); } } else { if (SubscribeChannelButton.Tag.ToString() == "Subscribe") { SubscribeChannelButton.Tag = "Subscribed"; SubscribeChannelButton.Text = GetText(Resource.String.Btn_Subscribed); //Color SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef")); //icon Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribedButton); icon.Bounds = new Rect(10, 10, 10, 7); SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); //Add The Video to Subcribed Videos Database Events_Insert_SubscriptionsChannel(); //Send API Request here for Subcribe PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Add_Subscribe_To_Channel_Http(UserData.Id) }); Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_Subscribed_successfully), ToastLength.Short).Show(); } else { SubscribeChannelButton.Tag = "Subscribe"; SubscribeChannelButton.Text = GetText(Resource.String.Btn_Subscribe); //Color SubscribeChannelButton.SetTextColor(Color.ParseColor("#efefef")); //icon Drawable icon = Activity.GetDrawable(Resource.Drawable.SubcribeButton); icon.Bounds = new Rect(10, 10, 10, 7); SubscribeChannelButton.SetCompoundDrawablesWithIntrinsicBounds(icon, null, null, null); //Remove The Video to Subcribed Videos Database var sqlEntity = new SqLiteDatabase(); sqlEntity.RemoveSubscriptionsChannel(IdChannel); sqlEntity.Dispose(); //Send API Request here for UnSubcribe PollyController.RunRetryPolicyFunction(new List <Func <Task> > { () => RequestsAsync.Global.Add_Subscribe_To_Channel_Http(UserData.Id) }); // Toast.MakeText(this, this.GetText(Resource.String.Lbl_Channel_Removed_successfully, ToastLength.Short).Show(); } } } else { PopupDialogController dialog = new PopupDialogController(Activity, null, "Login"); dialog.ShowNormalDialog(GetText(Resource.String.Lbl_Warning), GetText(Resource.String.Lbl_Please_sign_in_Subcribed), GetText(Resource.String.Lbl_Yes), GetText(Resource.String.Lbl_No)); } } else { Toast.MakeText(Activity, Activity.GetText(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } } catch (Exception exception) { Console.WriteLine(exception); } }
void Awake() { enabled = false; if (instance == null) { Application.targetFrameRate = 300; instance = this; setBounds(); enemyMask = LayerMask.GetMask("Enemy"); #if UNITY_ANDROID activity = new AndroidJavaClass("com.unity3d.player.UnityPlayer").GetStatic<AndroidJavaObject>("currentActivity"); toast = new Toast(); prefs = new SecurePreferences(activity, "resonance.spaceincharge"); #else prefs = new SecurePreferences(); #endif points = prefs.readInt(PREF_POINTS, PREF_POINTS_DEFAULT); setLevels(); setFeatures(); DontDestroyOnLoad(gameObject); } else { instance.mainCamera = Camera.main; instance.cameraShake = instance.mainCamera.GetComponent<CameraShake>(); DestroyImmediate(gameObject); } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); CurrentPlatform.Init(); // Set our view from the "main" layout resource base.SetContentView(PlanYourJourney.Resource.Layout.Arrangement_layout); var toolbar = FindViewById <Toolbar>(PlanYourJourney.Resource.Id.toolbar); //Toolbar will now take on default actionbar characteristics SetSupportActionBar(toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); SupportActionBar.Title = "Loading..."; _flag = false; _id = Intent.GetStringExtra("Id"); try { if (_id != "") { _argArrangement = await((MainApplication)this.Application).arrangementTable.LookupAsync(_id); _flag = true; } else { throw new ArgumentException(); } } catch (Exception e) { Toast.MakeText(this, "Error: not exist", ToastLength.Short).Show(); _argArrangement = new Arrangement { Id = "", Title = "Not exist", Date = DateTime.MinValue, Location = "", ImageResourcePath = null, Contents = "", Author = "" }; toolbar.Clickable = false; _flag = false; } _title = FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_name); _title_2 = FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_name_2); _content = FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_notes); _location = FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_place); _author = FindViewById <TextView>(PlanYourJourney.Resource.Id.arrangement_author); _date = FindViewById <TextView>(PlanYourJourney.Resource.Id.date); _imageView = FindViewById <ImageView>(PlanYourJourney.Resource.Id.arrangement_picture); _title.Text = _argArrangement.Title; _title_2.Text = _argArrangement.Title; _location.Text = _argArrangement.Location; _content.Text = _argArrangement.Contents; _author.Text = _argArrangement.Author; _date.Text = _argArrangement.Date.ToString("dd-MM-yyy"); SetImage(_argArrangement.ImageResourcePath); SupportActionBar.Title = _argArrangement.Title; }
public void OnFailure(Java.Lang.Exception e) { Toast.MakeText(this, e.Message, ToastLength.Short).Show(); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.Wykres); chartView = FindViewById <ChartView>(Resource.Id.wykres); string typWykresu = Intent.GetStringExtra("typ wykresu"); switch (typWykresu) { case "bar": chart = new BarChart(); break; case "point": chart = new PointChart(); break; case "line": chart = new LineChart(); break; case "radial gauge": chart = new RadialGaugeChart(); break; case "donut": chart = new DonutChart(); break; case "radar": chart = new RadarChart(); break; } List <Entry> entries = new List <Entry>(); string dane = Intent.GetStringExtra("dane"); try { switch (dane) { case "ceny złota": foreach (var item in ZwrocWartosci <CenaZlota>("http://api.nbp.pl/api/cenyzlota/last/5")) { entries.Add(new Entry((float)item.cena) { Label = item.data, ValueLabel = item.cena.ToString(), Color = SKColor.Parse(ZwrocKolor()) }); } break; case "kurs GBP": foreach (var item in ZwrocExchangeRatesTable("http://api.nbp.pl/api/exchangerates/rates/a/gbp/last/5")) { entries.Add(new Entry((float)item.mid) { Label = item.effectiveDate, ValueLabel = item.mid.ToString(), Color = SKColor.Parse(ZwrocKolor()) }); } break; case "kurs USD": foreach (var item in ZwrocWalute("http://api.nbp.pl/api/exchangerates/rates/c/usd/last/5")) { entries.Add(new Entry((float)item.bid) { Label = item.effectiveDate, ValueLabel = item.bid.ToString(), Color = SKColor.Parse(ZwrocKolor()) }); } break; case "kurs EUR": foreach (var item in ZwrocWalute("http://api.nbp.pl/api/exchangerates/rates/c/eur/last/5")) { entries.Add(new Entry((float)item.bid) { Label = item.effectiveDate, ValueLabel = item.bid.ToString(), Color = SKColor.Parse(ZwrocKolor()) }); } break; case "kurs CHF": foreach (var item in ZwrocWalute("http://api.nbp.pl/api/exchangerates/rates/c/chf/last/5")) { entries.Add(new Entry((float)item.bid) { Label = item.effectiveDate, ValueLabel = item.bid.ToString(), Color = SKColor.Parse(ZwrocKolor()) }); } break; case "kurs JPY": foreach (var item in ZwrocWalute("http://api.nbp.pl/api/exchangerates/rates/c/jpy/last/5")) { entries.Add(new Entry((float)item.bid) { Label = item.effectiveDate, ValueLabel = item.bid.ToString(), Color = SKColor.Parse(ZwrocKolor()) }); } break; } } catch (WebException we) { Toast.MakeText(this, we.Message, ToastLength.Long).Show(); } chart.Entries = entries; chartView.Chart = chart; }
private void SubmitButton_Click(object sender, EventArgs e) { HashMap postMap = new HashMap(); postMap.Put("author", AppDataHelper.GetFullname()); postMap.Put("owner_id", AppDataHelper.GetFirebaseAuth().CurrentUser.Uid); postMap.Put("post_date", DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss tt")); postMap.Put("post_body", postEditText.Text); //this will return an instance of our firestore //this will also generate an id DocumentReference newPostRef = AppDataHelper.GetFirestore().Collection("posts").Document(); //retrieve the document ID created string postKey = newPostRef.Id; postMap.Put("image_id", postKey); ShowProgressDialogue("Posting.."); // Save post image to firebase storage StorageReference storageReference = null; //check if the filebytes is not null if (fileBytes != null) { //This is the location where our images will be uploaded in the Firebase Storage //"postImages/" + "photo" is the location + imagename storageReference = FirebaseStorage.Instance.GetReference("postImages/" + postKey); //this code will save our image file to firebase storage storageReference.PutBytes(fileBytes) .AddOnSuccessListener(taskCompletionListeners) .AddOnFailureListener(taskCompletionListeners); } taskCompletionListeners.Success += (obj, EventArgs args) => { //check if storageReference is null if (storageReference != null) { storageReference.DownloadUrl.AddOnSuccessListener(downloadUrlListener); } //to get hold of the URL downloadUrlListener.Success += (obj, args) => { string downloadUrl = args.Result.ToString(); postMap.Put("download_url", downloadUrl); //Save post to Firebase Firestore newPostRef.Set(postMap); CloseProgressDialogue(); Finish(); }; }; taskCompletionListeners.Failure += (obj, args) => { Toast.MakeText(this, "Upload failed!", ToastLength.Short).Show(); CloseProgressDialogue(); }; }
/// <summary> /// Отображение сообщения /// </summary> /// <param name="text"> Текст для отображения </param> private void ShowMessage(string text) => Toast.MakeText(this, text, ToastLength.Long).Show();
public void ShowMessage(string content) { Toast.MakeText(CurrentContext, content, ToastLength.Short).Show(); }
public void Initialize(NearByAdapterViewHolder holder, Get_Nearby_Users_Object.Nearby_Users users) { try { if (holder.Image.Tag?.ToString() != "loaded") { var AvatarSplit = users.avatar.Split('/').Last(); var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit); if (getImage_Avatar != "File Dont Exists") { ImageServiceLoader.Load_Image(holder.Image, "no_profile_image.png", getImage_Avatar, 1); holder.Image.Tag = "loaded"; } else { IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, users.avatar); ImageServiceLoader.Load_Image(holder.Image, "no_profile_image.png", users.avatar, 1); } holder.Image.Tag = "loaded"; } //Online Or offline if (users.lastseen_status == "on") { //Online if (holder.ImageOnline.Tag?.ToString() != "true") { holder.ImageOnline.Tag = "true"; holder.ImageOnline.SetImageResource(Resource.Drawable.Green_Color); } if (holder.LastTimeOnline.Tag?.ToString() != "true") { holder.LastTimeOnline.Tag = "true"; holder.LastTimeOnline.Text = Activity_Context.GetString(Resource.String.Lbl_Online); } } else { if (holder.ImageOnline.Tag?.ToString() != "true") { holder.ImageOnline.Tag = "true"; holder.ImageOnline.SetImageResource(Resource.Drawable.Grey_Offline); } if (holder.LastTimeOnline.Tag?.ToString() != "true") { holder.LastTimeOnline.Tag = "true"; holder.LastTimeOnline.Text = IMethods.ITime.TimeAgo(int.Parse(users.lastseen_unix_time)); } } if (holder.Name.Tag?.ToString() != "true") { holder.Name.Tag = "true"; string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(users.name)); holder.Name.Text = IMethods.Fun_String.SubStringCutOf(name, 14); } if (users.is_following == "yes" || users.is_following == "Yes") // My Friend { if (holder.Button.Tag?.ToString() != "friends") { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); holder.Button.SetTextColor(Color.ParseColor("#ffffff")); if (Settings.ConnectivitySystem == "1") // Following { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following); } else // Friend { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Friends); } holder.Button.Tag = "friends"; } } else //Not Friend { if (holder.Button.Tag?.ToString() != "false") { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); holder.Button.SetTextColor(Color.ParseColor(Settings.MainColor)); if (Settings.ConnectivitySystem == "1") // Following { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Follow); } else // Friend { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_AddFriends); } holder.Button.Tag = "false"; } } if (!holder.Button.HasOnClickListeners) { holder.Button.Click += (sender, args) => { try { if (!IMethods.CheckConnectivity()) { Toast.MakeText(Activity_Context, Activity_Context.GetString(Resource.String.Lbl_CheckYourInternetConnection), ToastLength.Short).Show(); } else { if (holder.Button.Tag.ToString() == "false") { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends_pressed); holder.Button.SetTextColor(Color.ParseColor("#ffffff")); if (Settings.ConnectivitySystem == "1") // Following { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Following); holder.Button.Tag = "true"; } else // Request Friend { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); holder.Button.SetTextColor(Color.ParseColor("#444444")); holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Request); holder.Button.Tag = "Request"; } } else { holder.Button.SetBackgroundResource(Resource.Drawable.follow_button_profile_friends); holder.Button.SetTextColor(Color.ParseColor(Settings.MainColor)); if (Settings.ConnectivitySystem == "1") // Following { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_Follow); } else // Friend { holder.Button.Text = Activity_Context.GetText(Resource.String.Lbl_AddFriends); } holder.Button.Tag = "false"; var dbDatabase = new SqLiteDatabase(); dbDatabase.Delete_UsersContact(users.user_id); dbDatabase.Dispose(); } var result = Client.Global.Follow_User(users.user_id).ConfigureAwait(false); } } catch (Exception e) { Crashes.TrackError(e); } } } ; } catch (Exception e) { Crashes.TrackError(e); } }
/** * Generates all the lists of prefabs needed by the game * * For now directory paths are hard coded */ private void GeneratePrefabLists() { buildings = Resources.LoadAll("Prefabs/Buildings", typeof(Building)).Cast<Building>().ToArray(); resourceBuildings = Resources.LoadAll("Prefabs/Buildings/Resource Buildings", typeof(ResourceBuilding)).Cast<ResourceBuilding>().ToArray(); decorativeBuildings = Resources.LoadAll("Prefabs/Buildings/Decorative Buildings", typeof(DecorativeBuilding)).Cast<DecorativeBuilding>().ToArray(); headQuarterBuildings = Resources.LoadAll ("Prefabs/Buildings/Headquarters", typeof(HeadQuarterBuilding)).Cast<HeadQuarterBuilding> ().ToArray (); tiles = Resources.LoadAll("Prefabs/Grid/Tile", typeof(Tile)).Cast<Tile>().ToArray(); borders = Resources.LoadAll("Prefabs/Grid/border", typeof(GameObject)).Cast<GameObject>().ToArray(); npcs = Resources.LoadAll("Prefabs/NPCs", typeof(NPC)).Cast<NPC>().ToArray(); panels = Resources.LoadAll("Prefabs/UI/Panels", typeof(CanvasRenderer)).Cast<CanvasRenderer>().ToArray(); canvas = (Canvas)Resources.Load("Prefabs/UI/Canvas", typeof(Canvas)); buildingOptionCanvas = (Canvas)Resources.Load ("Prefabs/UI/local Panels/Building Option Canvas", typeof(Canvas)); buildingInfo = (Image)Resources.Load("Prefabs/UI/local Panels/Building Info", typeof(Image)); toast = (Toast)Resources.Load("Prefabs/UI/Panels/Toast", typeof(Toast)); }
private void spinner_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { Time = DateTime.UtcNow; TimeLowBorder = GetDateLimits(e.Position, Time); Toast.MakeText(this, TimeLowBorder.ToString(), ToastLength.Long).Show(); }
public void cojerstream() { while (parador) { NetworkStream strum = cliente.GetStream(); byte[] bitesaresibir = new byte[120000]; int o = 0; try { while ((o = strum.Read(bitesaresibir, 0, bitesaresibir.Length)) != 0 && cliente.Client.Connected == true) { string capturado = Encoding.Default.GetString(bitesaresibir, 0, o); string tipo = capturado.Split('$')[0]; if (tipo == "minombre") { nombreserver = capturado.Split('$')[1]; RunOnUiThread(() => Toast.MakeText(this, "Conexion establecida con " + nombreserver, ToastLength.Short).Show()); RunOnUiThread(() => botonabrirqr.SetBackgroundResource(Resource.Drawable.syncfull)); RunOnUiThread(() => nombreservidor.Text = "Conectado con: " + nombreserver); capturado = ""; } else if (tipo == "gettearelementos") { string sr = File.ReadAllText(listasreprod[Convert.ToInt32(capturado.Split('$')[1])]); int nolista = sr.Split('$')[0].Split(';').Length; cliente.Client.Send(Encoding.Default.GetBytes("Elementos$" + nolista)); capturado = ""; } else if (tipo == "desconectarse") { RunOnUiThread(() => this.Finish()); } else if (tipo == "conectarservidor") { try { cliente2.Client.Connect(capturado.Split('$')[1].Split(';')[1], Convert.ToInt32(capturado.Split('$')[1].Split(';')[0])); Thread prooo = new Thread(new ThreadStart(cojerarchivo)); prooo.IsBackground = true; prooo.Start(); capturado = ""; } catch (Exception) { } } else if (tipo == "recibirlista") { string str = File.ReadAllText(listasreprod[Convert.ToInt32(capturado.Split('$')[1])]); cliente2.Client.Send(Encoding.UTF8.GetBytes(str)); capturado = ""; } else if (tipo == "nombrelista") { nombrelistaarecibir = capturado.Split('$')[1]; capturado = ""; } else if (tipo == "listareprodactual") { string str = ""; string str2 = ""; if (listanombres.Count > 0 && listalinks.Count > 0) { foreach (string prr2 in listanombres) { str += prr2 + ";"; } str = str.Replace('$', ' '); str = str.Remove(str.Length - 1, 1); foreach (string prr in listalinks) { str2 += prr + ";"; } str2 = str2.Remove(str2.Length - 1, 1); cliente.Client.Send(Encoding.UTF8.GetBytes("listaactual$" + str + "$" + str2)); } } } } catch (Exception) { } } }
private async Task LoadDataPostAsync(string offset = "0") { if (LikeTab != null && LikeTab.MainScrollEvent.IsLoading) { return; } if (LoveTab != null && LoveTab.MainScrollEvent.IsLoading) { return; } if (WowTab != null && WowTab.MainScrollEvent.IsLoading) { return; } if (HahaTab != null && HahaTab.MainScrollEvent.IsLoading) { return; } if (SadTab != null && SadTab.MainScrollEvent.IsLoading) { return; } if (AngryTab != null && AngryTab.MainScrollEvent.IsLoading) { return; } if (LikeTab != null) { LikeTab.MainScrollEvent.IsLoading = true; } if (LoveTab != null) { LoveTab.MainScrollEvent.IsLoading = true; } if (WowTab != null) { WowTab.MainScrollEvent.IsLoading = true; } if (HahaTab != null) { HahaTab.MainScrollEvent.IsLoading = true; } if (SadTab != null) { SadTab.MainScrollEvent.IsLoading = true; } if (AngryTab != null) { AngryTab.MainScrollEvent.IsLoading = true; } var(apiStatus, respond) = await RequestsAsync.Comment.GetCommentReactionsAsync(Id, TypeClass.ToLower(), "10", TypeReaction, offset); switch (apiStatus) { case 200: { switch (respond) { case PostReactionsObject result: { if (LikeTab != null) { int countLikeUserList = LikeTab?.MAdapter?.UserList?.Count ?? 0; //Like var respondListLike = result.Data.Like.Count; switch (respondListLike) { case > 0: { var dataTab = Adapter.FragmentNames.FirstOrDefault(a => a.Contains(GetText(Resource.String.Btn_Likes))); if (string.IsNullOrEmpty(dataTab)) { Adapter.AddFragment(LikeTab, GetText(Resource.String.Btn_Likes)); } switch (countLikeUserList) { case > 0: { foreach (var item in from item in result.Data.Like let check = LikeTab.MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item) { LikeTab.MAdapter.UserList.Add(item); } RunOnUiThread(() => { LikeTab.MAdapter.NotifyItemRangeInserted(countLikeUserList - 1, LikeTab.MAdapter.UserList.Count - countLikeUserList); }); break; } default: LikeTab.MAdapter.UserList = new ObservableCollection <UserDataObject>(result.Data.Like); RunOnUiThread(() => { LikeTab.MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (LikeTab.MAdapter.UserList.Count) { case > 10 when !LikeTab.MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_No_more_users), ToastLength.Short)?.Show(); break; } break; } } } if (LoveTab != null) { int countLoveUserList = LoveTab?.MAdapter?.UserList?.Count ?? 0; //Love var respondListLove = result.Data.Love.Count; switch (respondListLove) { case > 0: { var dataTab = Adapter.FragmentNames.FirstOrDefault(a => a.Contains(GetText(Resource.String.Btn_Love))); if (string.IsNullOrEmpty(dataTab)) { Adapter.AddFragment(LoveTab, GetText(Resource.String.Btn_Love)); } switch (countLoveUserList) { case > 0: { foreach (var item in from item in result.Data.Love let check = LoveTab.MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item) { LoveTab.MAdapter.UserList.Add(item); } RunOnUiThread(() => { LoveTab.MAdapter.NotifyItemRangeInserted(countLoveUserList - 1, LoveTab.MAdapter.UserList.Count - countLoveUserList); }); break; } default: LoveTab.MAdapter.UserList = new ObservableCollection <UserDataObject>(result.Data.Love); RunOnUiThread(() => { LoveTab.MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (LoveTab.MAdapter.UserList.Count) { case > 10 when !LoveTab.MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_No_more_users), ToastLength.Short)?.Show(); break; } break; } } } if (WowTab != null) { int countWowUserList = WowTab?.MAdapter?.UserList?.Count ?? 0; //Wow var respondListWow = result.Data.Wow.Count; switch (respondListWow) { case > 0: { var dataTab = Adapter.FragmentNames.FirstOrDefault(a => a.Contains(GetText(Resource.String.Btn_Wow))); if (string.IsNullOrEmpty(dataTab)) { Adapter.AddFragment(WowTab, GetText(Resource.String.Btn_Wow)); } switch (countWowUserList) { case > 0: { foreach (var item in from item in result.Data.Wow let check = WowTab.MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item) { WowTab.MAdapter.UserList.Add(item); } RunOnUiThread(() => { WowTab.MAdapter.NotifyItemRangeInserted(countWowUserList - 1, WowTab.MAdapter.UserList.Count - countWowUserList); }); break; } default: WowTab.MAdapter.UserList = new ObservableCollection <UserDataObject>(result.Data.Wow); RunOnUiThread(() => { WowTab.MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (WowTab.MAdapter.UserList.Count) { case > 10 when !WowTab.MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_No_more_users), ToastLength.Short)?.Show(); break; } break; } } } if (HahaTab != null) { int countHahaUserList = HahaTab?.MAdapter?.UserList?.Count ?? 0; //Haha var respondListHaha = result.Data.Haha.Count; switch (respondListHaha) { case > 0: { var dataTab = Adapter.FragmentNames.FirstOrDefault(a => a.Contains(GetText(Resource.String.Btn_Haha))); if (string.IsNullOrEmpty(dataTab)) { Adapter.AddFragment(HahaTab, GetText(Resource.String.Btn_Haha)); } switch (countHahaUserList) { case > 0: { foreach (var item in from item in result.Data.Haha let check = HahaTab.MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item) { HahaTab.MAdapter.UserList.Add(item); } RunOnUiThread(() => { HahaTab.MAdapter.NotifyItemRangeInserted(countHahaUserList - 1, HahaTab.MAdapter.UserList.Count - countHahaUserList); }); break; } default: HahaTab.MAdapter.UserList = new ObservableCollection <UserDataObject>(result.Data.Haha); RunOnUiThread(() => { HahaTab.MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (HahaTab.MAdapter.UserList.Count) { case > 10 when !HahaTab.MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_No_more_users), ToastLength.Short)?.Show(); break; } break; } } } if (SadTab != null) { int countSadUserList = SadTab?.MAdapter?.UserList?.Count ?? 0; //Sad var respondListSad = result.Data.Sad.Count; switch (respondListSad) { case > 0: { var dataTab = Adapter.FragmentNames.FirstOrDefault(a => a.Contains(GetText(Resource.String.Btn_Sad))); if (string.IsNullOrEmpty(dataTab)) { Adapter.AddFragment(SadTab, GetText(Resource.String.Btn_Sad)); } switch (countSadUserList) { case > 0: { foreach (var item in from item in result.Data.Sad let check = SadTab.MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item) { SadTab.MAdapter.UserList.Add(item); } RunOnUiThread(() => { SadTab.MAdapter.NotifyItemRangeInserted(countSadUserList - 1, SadTab.MAdapter.UserList.Count - countSadUserList); }); break; } default: SadTab.MAdapter.UserList = new ObservableCollection <UserDataObject>(result.Data.Sad); RunOnUiThread(() => { SadTab.MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (SadTab.MAdapter.UserList.Count) { case > 10 when !SadTab.MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_No_more_users), ToastLength.Short)?.Show(); break; } break; } } } if (AngryTab != null) { int countAngryUserList = AngryTab?.MAdapter?.UserList?.Count ?? 0; //Angry var respondListAngry = result.Data.Angry.Count; switch (respondListAngry) { case > 0: { string dataTab = Adapter.FragmentNames.FirstOrDefault(a => a.Contains(GetText(Resource.String.Btn_Angry))); if (string.IsNullOrEmpty(dataTab)) { Adapter.AddFragment(AngryTab, GetText(Resource.String.Btn_Angry)); } switch (countAngryUserList) { case > 0: { foreach (var item in from item in result.Data.Angry let check = AngryTab.MAdapter.UserList.FirstOrDefault(a => a.UserId == item.UserId) where check == null select item) { AngryTab.MAdapter.UserList.Add(item); } RunOnUiThread(() => { AngryTab.MAdapter.NotifyItemRangeInserted(countAngryUserList - 1, AngryTab.MAdapter.UserList.Count - countAngryUserList); }); break; } default: AngryTab.MAdapter.UserList = new ObservableCollection <UserDataObject>(result.Data.Angry); RunOnUiThread(() => { AngryTab.MAdapter.NotifyDataSetChanged(); }); break; } break; } default: { switch (AngryTab.MAdapter.UserList.Count) { case > 10 when !AngryTab.MRecycler.CanScrollVertically(1): Toast.MakeText(this, GetText(Resource.String.Lbl_No_more_users), ToastLength.Short)?.Show(); break; } break; } } } break; } } break; } default: Methods.DisplayReportResult(this, respond); break; } RunOnUiThread(ShowEmptyPage); if (LikeTab != null) { LikeTab.MainScrollEvent.IsLoading = false; } if (LoveTab != null) { LoveTab.MainScrollEvent.IsLoading = false; } if (WowTab != null) { WowTab.MainScrollEvent.IsLoading = false; } if (HahaTab != null) { HahaTab.MainScrollEvent.IsLoading = false; } if (SadTab != null) { SadTab.MainScrollEvent.IsLoading = false; } if (AngryTab != null) { AngryTab.MainScrollEvent.IsLoading = false; } }
protected override void OnCreate(Bundle bundle) { base.OnCreate (bundle); SetContentView (Resource.Layout.AllEigenschappen); //Action bar InitializeActionBar (SupportActionBar); title = ActionBarTitle; query = ActionBarQuery; search = ActionBarSearch; back = ActionBarBack; mToastShort = Toast.MakeText (this, "", ToastLength.Short); mToastLong = Toast.MakeText (this, "", ToastLength.Long); currProfiel = _appController.CurrentProfiel; IsProfileNull = (currProfiel == null); eigenschappenList = _appController.Eigenschappen; //listener to pass to EigenschapAdapter containing context mListener = new MyOnCheckBoxClickListener (this); eigenschapAdapter = new EigenschapAdapter (this, _appController.Eigenschappen, mListener); allEigenschappenListView = FindViewById<ListView> (Resource.Id.all_eigenschappen_list); allEigenschappenListView.Adapter = eigenschapAdapter; title.Text = IsProfileNull ? "Eigenschappen" : "Selectie"; query.Hint = "Zoek eigenschap"; //hide keyboard when scrolling through list allEigenschappenListView.SetOnTouchListener(new MyOnTouchListener(this, query)); //initialize progress dialog used when calculating totemlist progress = new ProgressDialog(this); progress.SetMessage("Totems zoeken..."); progress.SetProgressStyle(ProgressDialogStyle.Spinner); progress.SetCancelable(false); LiveSearch (); sharedPrefs = GetSharedPreferences("data", FileCreationMode.Private); var vind = FindViewById<LinearLayout> (Resource.Id.vind); vind.Click += VindTotem; bottomBar = FindViewById<RelativeLayout> (Resource.Id.bottomBar); search.Visibility = ViewStates.Visible; search.Click += (sender, e) => ToggleSearch (); //hide keyboard when enter is pressed query.EditorAction += (sender, e) => { if (e.ActionId == ImeAction.Search) KeyboardHelper.HideKeyboard(this); else e.Handled = false; }; }
private void OpenIntentAsync(Intent intent) { new Thread(() => { // wait for service helper to be initialized, since this method might be called before the service starts up // and initializes the service helper. int timeToWaitMS = 60000; int waitIntervalMS = 1000; while (SensusServiceHelper.Get() == null && timeToWaitMS > 0) { Thread.Sleep(waitIntervalMS); timeToWaitMS -= waitIntervalMS; } if (SensusServiceHelper.Get() == null) { // don't use SensusServiceHelper.Get().FlashNotificationAsync because service helper is null RunOnUiThread(() => { Toast.MakeText(this, "Failed to get service helper. Cannot open Intent.", ToastLength.Long); }); return; } // open page to view protocol if a protocol was passed to us if (intent.Data != null) { global::Android.Net.Uri dataURI = intent.Data; try { if (intent.Scheme == "http" || intent.Scheme == "https") { Protocol.DeserializeAsync(new Uri(dataURI.ToString()), Protocol.DisplayAndStartAsync); } else if (intent.Scheme == "content" || intent.Scheme == "file") { byte[] bytes = null; try { MemoryStream memoryStream = new MemoryStream(); Stream inputStream = ContentResolver.OpenInputStream(dataURI); inputStream.CopyTo(memoryStream); inputStream.Close(); bytes = memoryStream.ToArray(); } catch (Exception ex) { SensusServiceHelper.Get().Logger.Log("Failed to read bytes from local file URI \"" + dataURI + "\": " + ex.Message, LoggingLevel.Normal, GetType()); } if (bytes != null) { Protocol.DeserializeAsync(bytes, Protocol.DisplayAndStartAsync); } } else { SensusServiceHelper.Get().Logger.Log("Sensus didn't know what to do with URI \"" + dataURI + "\".", LoggingLevel.Normal, GetType()); } } catch (Exception ex) { SensusContext.Current.MainThreadSynchronizer.ExecuteThreadSafe(() => { new AlertDialog.Builder(this).SetTitle("Failed to get protocol").SetMessage(ex.Message).Show(); }); } } }).Start(); }
private void displayToast(View v, int resId) { if (mToast == null) { mToast = Toast.makeText(v.Context, resId, Toast.LENGTH_SHORT); } else { mToast.Duration = Toast.LENGTH_SHORT; mToast.Text = resId; } mToast.show(); }
protected override void OnCreate(Bundle savedInstanceState) { Console.Error.WriteLine("--------------------------- Creating activity ---------------------------"); base.OnCreate(savedInstanceState); _activityResultWait = new ManualResetEvent(false); _facebookCallbackManager = CallbackManagerFactory.Create(); _serviceBindWait = new ManualResetEvent(false); Window.AddFlags(global::Android.Views.WindowManagerFlags.DismissKeyguard); Window.AddFlags(global::Android.Views.WindowManagerFlags.ShowWhenLocked); Window.AddFlags(global::Android.Views.WindowManagerFlags.TurnScreenOn); Forms.Init(this, savedInstanceState); FormsMaps.Init(this, savedInstanceState); ZXing.Net.Mobile.Forms.Android.Platform.Init(); CrossCurrentActivity.Current.Activity = this; #if UI_TESTING Forms.ViewInitialized += (sender, e) => { if (!string.IsNullOrWhiteSpace(e.View.StyleId)) { e.NativeView.ContentDescription = e.View.StyleId; } }; #endif _app = new App(); LoadApplication(_app); _serviceConnection = new AndroidSensusServiceConnection(); _serviceConnection.ServiceConnected += (o, e) => { // it's happened that the service is created / started after the service helper is disposed: https://insights.xamarin.com/app/Sensus-Production/issues/46 // binding to the service in such a situation can result in a null service helper within the binder. if the service helper was disposed, then the goal is // to close down sensus. so finish the activity. if (e.Binder.SensusServiceHelper == null) { Finish(); return; } // tell the service to finish this activity when it is stopped e.Binder.ServiceStopAction = Finish; // signal the activity that the service has been bound _serviceBindWait.Set(); // if we're UI testing, try to load and run the UI testing protocol from the embedded assets #if UI_TESTING using (Stream protocolFile = Assets.Open("UiTestingProtocol.json")) { Protocol.RunUiTestingProtocol(protocolFile); } #endif }; // the following is fired if the process hosting the service crashes or is killed. _serviceConnection.ServiceDisconnected += (o, e) => { Toast.MakeText(this, "The Sensus service has crashed.", ToastLength.Long); DisconnectFromService(); Finish(); }; OpenIntentAsync(Intent); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = (View) inflater.Inflate(Resource.Layout.SheZhiLayout,container, false); mVersion = view.FindViewById<TextView> (Resource.Id.sheZhiversion); mSwitch = view.FindViewById<SwitchCompat> (Resource.Id.toggleButton1); mSwitchVib = view.FindViewById<SwitchCompat> (Resource.Id.toggleButton2); mUpdateLayout = view.FindViewById<LinearLayout> (Resource.Id.BanBenGengXinLayout); mZhuXiaoLayout = view.FindViewById<LinearLayout> (Resource.Id.zhuxiaodenglu); mLiuLiangTongJi = view.FindViewById<LinearLayout> (Resource.Id.liuLiangShiYong); mProgressbar = view.FindViewById<ProgressBar> (Resource.Id.progressBar); mProgressbar.Visibility = ViewStates.Invisible; mVersion.Text = Application.Context.PackageManager.GetPackageInfo (Application.Context.PackageName, 0).VersionName; try{ var prefs = Application.Context.GetSharedPreferences("MySwitchState", FileCreationMode.Private); somePref = prefs.GetString("PrefName", null); }catch{ } switch (somePref) { case "False": mSwitch.Checked = false; break; case "True": mSwitch.Checked = true; break; default: mSwitch.Checked = true; break; } mSwitch.Click += delegate { if (mSwitch.Checked) { var prefs1 = Application.Context.GetSharedPreferences("MySwitchState", FileCreationMode.Private); var prefEditor = prefs1.Edit(); prefEditor.PutString("PrefName", "True"); prefEditor.Commit(); } else { var prefs2 = Application.Context.GetSharedPreferences("MySwitchState", FileCreationMode.Private); var prefEditor = prefs2.Edit(); prefEditor.PutString("PrefName", "False"); prefEditor.Commit(); } }; try{ var prefs2 = Application.Context.GetSharedPreferences("MySwitchState2", FileCreationMode.Private); vibPref = prefs2.GetString("vibState", null); }catch{ } switch (vibPref) { case "False": mSwitchVib.Checked = false; break; case "True": mSwitchVib.Checked = true; break; default: mSwitchVib.Checked = true; break; } mSwitchVib.Click += delegate { if (mSwitchVib.Checked) { var prefs1 = Application.Context.GetSharedPreferences("MySwitchState2", FileCreationMode.Private); var prefEditor = prefs1.Edit(); prefEditor.PutString("vibState", "True"); prefEditor.Commit(); } else { var prefs2 = Application.Context.GetSharedPreferences("MySwitchState2", FileCreationMode.Private); var prefEditor = prefs2.Edit(); prefEditor.PutString("vibState", "False"); prefEditor.Commit(); } }; mLiuLiangTongJi.Click += delegate { // long datausage= TrafficStats.GetUidTxBytes(Android.OS.Process.MyUid())/(1024*1024); // // string msg=String.Format(datausage.ToString()+"MB"); // // Toast mToast = Toast.MakeText (Application.Context, msg, ToastLength.Long); // mToast.Show (); // float dataRX= (float)TrafficStats.GetUidRxBytes(Android.OS.Process.MyUid())/(float)(1024*1024); float dataTX= (float)TrafficStats.GetUidTxBytes(Android.OS.Process.MyUid())/(float)(1024*1024); View customToastroot =inflater.Inflate(Resource.Layout.myCustomToast, null); Toast customtoast=new Toast(Application.Context); TextView mdataRX=customToastroot.FindViewById<TextView>(Resource.Id.customToastText1); TextView mdataTX=customToastroot.FindViewById<TextView>(Resource.Id.customToastText2); mdataRX.Text=String.Format(" 下载使用流量总计: "+dataRX.ToString("0.00")+"MB"); mdataTX.Text=String.Format(" 上传使用流量总计: "+dataTX.ToString("0.00")+"MB"); customtoast.View=customToastroot; customtoast.SetGravity(GravityFlags.CenterHorizontal | GravityFlags.Bottom ,0, 80); customtoast.Duration=ToastLength.Long; customtoast.Show(); }; mUpdateLayout.Click += delegate { mProgressbar.Visibility = ViewStates.Visible; mWorker=new BackgroundWorker(); mWorker.DoWork +=delegate { checkVersion(); Thread.Sleep(1500); }; mWorker.RunWorkerCompleted += delegate { mProgressbar.Visibility = ViewStates.Gone; onWorkCompleted(); }; mWorker.RunWorkerAsync(); }; mZhuXiaoLayout.Click += delegate { var callDialog = new AlertDialog.Builder(Activity); callDialog.SetMessage(string.Format("您确定注销登录吗?")); callDialog.SetNeutralButton("确定", delegate { Intent service = new Intent (Application.Context, typeof(UpdateServices)); Activity.StopService (service); Intent i = new Intent(Activity, typeof(LogInPage)); // set the new task and clear flags i.SetFlags(ActivityFlags.NewTask | ActivityFlags.ClearTask); Activity.StartActivity(i); Activity.OverridePendingTransition(Resource.Animation.slide_in_bottom, Resource.Animation.slide_out_top); }); callDialog.SetNegativeButton("取消", delegate { }); // Show the alert dialog to the user and wait for response. callDialog.Show(); }; return view; }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); ActionBar.Hide(); mActivity = this; SetContentView(Resource.Layout.Main); adType = FindViewById <Spinner>(Resource.Id.adType); String[] adTypes = { "Banner", "Banner Top", "Banner Bottom", "Banner View", "Native", "Interstitial", "Rewarded Video" }; var adapter = ArrayAdapter.CreateFromResource(this, Resource.Array.adtypes_array, Android.Resource.Layout.SimpleSpinnerItem); adType.Adapter = adapter; CheckBox logging = FindViewById <CheckBox>(Resource.Id.logging); CheckBox testing = FindViewById <CheckBox>(Resource.Id.testing); CheckBox autocache = FindViewById <CheckBox>(Resource.Id.autocache); CheckBox disableSmartBanners = FindViewById <CheckBox>(Resource.Id.disable_smart_banners); CheckBox disableBannerAnimation = FindViewById <CheckBox>(Resource.Id.disable_banner_animation); CheckBox disable728x90Banners = FindViewById <CheckBox>(Resource.Id.disable_728x90_banners); CheckBox enableTriggerOnLoadedTwice = FindViewById <CheckBox>(Resource.Id.enable_trigger_on_loaded_on_precache); CheckBox disableLocationPermissionCheck = FindViewById <CheckBox>(Resource.Id.disable_location_permission_check); CheckBox disableWriteExternalStorageCheck = FindViewById <CheckBox>(Resource.Id.disable_write_external_storage_check); Button initialize = FindViewById <Button> (Resource.Id.initialize); initialize.Click += delegate { if (logging.Checked) { Appodeal.LogLevel = Com.Appodeal.Ads.Utils.Log.LogLevel.Verbose; } else { Appodeal.LogLevel = Com.Appodeal.Ads.Utils.Log.LogLevel.None; } Appodeal.SetTesting(testing.Checked); Appodeal.SetAutoCache(GetSelectedAdType(), autocache.Checked); Appodeal.SetSmartBanners(!disableSmartBanners.Checked); Appodeal.SetBannerAnimation(!disableBannerAnimation.Checked); Appodeal.Set728x90Banners(!disable728x90Banners.Checked); Appodeal.SetTriggerOnLoadedOnPrecache(GetSelectedAdType(), enableTriggerOnLoadedTwice.Checked); if (disableLocationPermissionCheck.Checked) { Appodeal.DisableLocationPermissionCheck(); } if (disableWriteExternalStorageCheck.Checked) { Appodeal.DisableWriteExternalStoragePermissionCheck(); } Appodeal.GetUserSettings(this) .SetAge(25) .SetGender(UserSettings.Gender.MALE); Appodeal.SetCustomRule("name", 10); Appodeal.SetCustomRule("name", 100.5); Appodeal.SetCustomRule("name", true); Appodeal.SetCustomRule("name", "value"); Appodeal.SetTesting(false); Appodeal.SetAutoCacheNativeIcons(false); Appodeal.SetAutoCacheNativeMedia(false); Appodeal.SetInterstitialCallbacks(this); Appodeal.SetBannerCallbacks(this); Appodeal.SetNativeCallbacks(this); Appodeal.Initialize(this, "fee50c333ff3825fd6ad6d38cff78154de3025546d47a84f", GetSelectedAdType()); Appodeal.SetBannerViewId(Resource.Id.appodealBannerView); }; Button cache = FindViewById <Button> (Resource.Id.cache); cache.Click += delegate { Appodeal.Cache(this, GetSelectedAdType()); }; Button isLoaded = FindViewById <Button>(Resource.Id.is_loaded); isLoaded.Click += delegate { Toast.MakeText(this, "is loaded: " + Appodeal.IsLoaded(GetSelectedAdType()), ToastLength.Short).Show(); }; Button isPrecache = FindViewById <Button>(Resource.Id.is_precache); isPrecache.Click += delegate { Toast.MakeText(this, "is precache: " + Appodeal.IsPrecache(GetSelectedAdType()), ToastLength.Short).Show(); }; Button show = FindViewById <Button>(Resource.Id.show); show.Click += delegate { Appodeal.Show(this, GetSelectedAdType()); }; Button showWithPlacement = FindViewById <Button> (Resource.Id.show_with_placement); showWithPlacement.Click += delegate { Appodeal.Show(this, GetSelectedAdType(), "main_menu"); }; Button hide = FindViewById <Button> (Resource.Id.hide); hide.Click += delegate { Appodeal.Hide(this, GetSelectedAdType()); }; }
// Log |msg| and Toast about it. private void logAndToast(string msg) { Log.Debug(TAG, msg); if (logToast != null) { logToast.Cancel(); } logToast = Toast.MakeText(this, msg, ToastLength.Short); logToast.Show(); }
public void ShowToast(string msg) { Toast.MakeText(this.Activity, msg, ToastLength.Short).Show(); }
/// <summary>shortcut back to the main screen</summary> void ShowUnsupported () { if (unsupportedToast != null) { unsupportedToast.Cancel (); unsupportedToast.Dispose (); } unsupportedToast = Toast.MakeText (this, "Your device does not support this feature", ToastLength.Long); unsupportedToast.Show (); }
bool OpenWriter(string message) { var now = DateTime.Now; // let the application provide it's own TextWriter to ease automation with AutoStart property if (writer == null) { if (RunnerOptions.Current.ShowUseNetworkLogger) { Console.WriteLine("[{0}] Sending '{1}' results to {2}:{3}", now, message, RunnerOptions.Current.HostName, RunnerOptions.Current.HostPort); try { writer = new TcpTextWriter(RunnerOptions.Current.HostName, RunnerOptions.Current.HostPort); } catch (SocketException) { var msg = $"Cannot connect to {RunnerOptions.Current.HostName}:{RunnerOptions.Current.HostPort}. Start network service or disable network option"; Toast.MakeText(Application.Context, msg, ToastLength.Long) .Show(); return(false); } } } if (writer == null) { writer = Console.Out; } writer.WriteLine("[Runner executing:\t{0}]", message); // FIXME writer.WriteLine("[M4A Version:\t{0}]", "???"); writer.WriteLine("[Board:\t\t{0}]", Build.Board); writer.WriteLine("[Bootloader:\t{0}]", Build.Bootloader); writer.WriteLine("[Brand:\t\t{0}]", Build.Brand); writer.WriteLine("[CpuAbi:\t{0} {1}]", Build.CpuAbi, Build.CpuAbi2); writer.WriteLine("[Device:\t{0}]", Build.Device); writer.WriteLine("[Display:\t{0}]", Build.Display); writer.WriteLine("[Fingerprint:\t{0}]", Build.Fingerprint); writer.WriteLine("[Hardware:\t{0}]", Build.Hardware); writer.WriteLine("[Host:\t\t{0}]", Build.Host); writer.WriteLine("[Id:\t\t{0}]", Build.Id); writer.WriteLine("[Manufacturer:\t{0}]", Build.Manufacturer); writer.WriteLine("[Model:\t\t{0}]", Build.Model); writer.WriteLine("[Product:\t{0}]", Build.Product); writer.WriteLine("[Radio:\t\t{0}]", Build.Radio); writer.WriteLine("[Tags:\t\t{0}]", Build.Tags); writer.WriteLine("[Time:\t\t{0}]", Build.Time); writer.WriteLine("[Type:\t\t{0}]", Build.Type); writer.WriteLine("[User:\t\t{0}]", Build.User); writer.WriteLine("[VERSION.Codename:\t{0}]", Build.VERSION.Codename); writer.WriteLine("[VERSION.Incremental:\t{0}]", Build.VERSION.Incremental); writer.WriteLine("[VERSION.Release:\t{0}]", Build.VERSION.Release); writer.WriteLine("[VERSION.Sdk:\t\t{0}]", Build.VERSION.Sdk); writer.WriteLine("[VERSION.SdkInt:\t{0}]", Build.VERSION.SdkInt); writer.WriteLine("[Device Date/Time:\t{0}]", now); // to match earlier C.WL output // FIXME: add data about how the app was compiled (e.g. ARMvX, LLVM, Linker options) return(true); }
private async void QuerySublayers_Click(object sender, EventArgs e) { // Clear selected features from the graphics overlay. _selectedFeaturesOverlay.Graphics.Clear(); // If the population value entered is not numeric, warn the user and exit. double populationNumber = 0.0; if (!double.TryParse(_populationValueInput.Text.Trim(), out populationNumber)) { Toast messageToast = Toast.MakeText(this.ApplicationContext, "Population value must be numeric.", ToastLength.Short); messageToast.Show(); return; } // Get the USA map image layer (the first and only operational layer in the map). ArcGISMapImageLayer usaMapImageLayer = (ArcGISMapImageLayer)_myMapView.Map.OperationalLayers[0]; try { // Use a utility method on the map image layer to load all the sublayers and tables. await usaMapImageLayer.LoadTablesAndLayersAsync(); // Get the sublayers of interest (skip 'Highways' since it doesn't have the POP2000 field). ArcGISMapImageSublayer citiesSublayer = (ArcGISMapImageSublayer)usaMapImageLayer.Sublayers[0]; ArcGISMapImageSublayer statesSublayer = (ArcGISMapImageSublayer)usaMapImageLayer.Sublayers[2]; ArcGISMapImageSublayer countiesSublayer = (ArcGISMapImageSublayer)usaMapImageLayer.Sublayers[3]; // Get the service feature table for each of the sublayers. ServiceFeatureTable citiesTable = citiesSublayer.Table; ServiceFeatureTable statesTable = statesSublayer.Table; ServiceFeatureTable countiesTable = countiesSublayer.Table; // Create the query parameters that will find features in the current extent with a population greater than the value entered. QueryParameters populationQuery = new QueryParameters { WhereClause = "POP2000 > " + _populationValueInput.Text, Geometry = _myMapView.GetCurrentViewpoint(ViewpointType.BoundingGeometry).TargetGeometry }; // Query each of the sublayers with the query parameters. FeatureQueryResult citiesQueryResult = await citiesTable.QueryFeaturesAsync(populationQuery); FeatureQueryResult statesQueryResult = await statesTable.QueryFeaturesAsync(populationQuery); FeatureQueryResult countiesQueryResult = await countiesTable.QueryFeaturesAsync(populationQuery); // Display the selected cities in the graphics overlay. SimpleMarkerSymbol citySymbol = new SimpleMarkerSymbol(SimpleMarkerSymbolStyle.Circle, Color.Red, 16); foreach (Feature city in citiesQueryResult) { Graphic cityGraphic = new Graphic(city.Geometry, citySymbol); _selectedFeaturesOverlay.Graphics.Add(cityGraphic); } // Display the selected counties in the graphics overlay. SimpleLineSymbol countyLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Dash, Color.Cyan, 2); SimpleFillSymbol countySymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.DiagonalCross, Color.Cyan, countyLineSymbol); foreach (Feature county in countiesQueryResult) { Graphic countyGraphic = new Graphic(county.Geometry, countySymbol); _selectedFeaturesOverlay.Graphics.Add(countyGraphic); } // Display the selected states in the graphics overlay. SimpleLineSymbol stateLineSymbol = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, Color.DarkCyan, 6); SimpleFillSymbol stateSymbol = new SimpleFillSymbol(SimpleFillSymbolStyle.Null, Color.Cyan, stateLineSymbol); foreach (Feature state in statesQueryResult) { Graphic stateGraphic = new Graphic(state.Geometry, stateSymbol); _selectedFeaturesOverlay.Graphics.Add(stateGraphic); } } catch (Exception ex) { new AlertDialog.Builder(this).SetMessage(ex.ToString()).SetTitle("Error").Show(); } }
private void ShowDuplicateItemToast() { Toast.MakeText(Context, Resource.String.duplicate_tag_warning, ToastLength.Short).Show(); }