public void OnTimerSendCancelDefer(Guid bookingId, DeferInfo deferInfo, int iTotalTime){ _bookingId = bookingId; _deferInfo = deferInfo; timer = new System.Timers.Timer(); timer.Interval = 1000; timer.Elapsed += OnTimedEvent; timer.Enabled = true; iTotalSeconds = iTotalTime; }
public void showPopupDefer(BookingInfo bookingInfo, DeferInfo deferInfo){ var confirmDeferView = LayoutInflater.Inflate (Resource.Layout.popup_confirm_layout, null); var tvTitle = confirmDeferView.FindViewById<TextView> (Resource.Id.tv_title_confirm_popup); var tvConfirm = confirmDeferView.FindViewById<TextView> (Resource.Id.tv_info_popup); var btnConfirmDefer = confirmDeferView.FindViewById<Button> (Resource.Id.btn_confirm_tv_popup); var btnDecline = confirmDeferView.FindViewById<Button> (Resource.Id.btn_decline_tv_popup); tvConfirm.Gravity = global::Android.Views.GravityFlags.Left; tvTitle.SetText (Android.Resource.String.delayed_title); btnConfirmDefer.Text = "Accept"; btnDecline.Text = "Decline"; if (deferInfo.IsDefer) { string strMinute = ((double)bookingInfo.Deferral).ToString ("C0", new CultureInfo ("en-us")).Substring (1) + " minutes."; tvConfirm.TextFormatted = Html.FromHtml (String.Format (_activity.GetString (Resource.String.delay_minute_info), bookingInfo.SpecialistName, strMinute)); } else { int iHours = (int)(bookingInfo.Deferral / 60); tvConfirm.TextFormatted = Html.FromHtml (String.Format (_activity.GetString (Resource.String.delay_day_info), bookingInfo.SpecialistName, iHours)); } OnTimerSendCancelDefer (bookingInfo.Id, deferInfo, 0); btnConfirmDefer.Click += (sender, e) => { dialog.Dismiss(); sendDeferTalkNow(bookingInfo, deferInfo); if(timer != null) { timer.Stop(); timer = null; } }; btnDecline.Click += (sender, e) => { dialog.Dismiss(); sendCancelDeferTalkNow(bookingInfo.Id, deferInfo); if(timer != null) { timer.Stop(); timer = null; } }; builder = new AlertDialog.Builder (_activity); builder.SetInverseBackgroundForced (true); builder.SetView (confirmDeferView); dialog = builder.Create (); dialog.SetCanceledOnTouchOutside(false); dialog.Show (); }
public DeferDTO (BookingInfo BookingInfo, DeferInfo DeferInfo) { this.bookingInfo = BookingInfo; this.deferInfo = DeferInfo; }
public void showAlertDefer (object pDeferInfo) { this.InvokeOnMainThread (delegate { DeferInfo deferInfo = (DeferInfo)pDeferInfo; this.deferInfo = deferInfo; this.timer = NSTimer.CreateScheduledTimer(60, this, new Selector("sendRequestDeferCancel"), null, false); TCBookingHelper bookingHelper = new TCBookingHelper (this); bookingHelper.Delegate = this; bookingHelper.getBookingInfo (deferInfo.BookingId); }); }
public void sendCancelDeferTalkNow(Guid bookingId, DeferInfo deferInfo){ actionDeferDelegate.onDeferSending (); Action<String> successful = (response => { _activity.RunOnUiThread (() => { DeferTalkNow deferTalkNowInfo = ParseDataHelper.parseDataDeferTalknow(response); if(deferTalkNowInfo != null) { actionDeferDelegate.onDeferSuccess(deferTalkNowInfo, true); } else { actionDeferDelegate.onDeferFail(_activity.GetString(Resource.String.cancel_defer_title), _activity.GetString(Resource.String.request_fail)); } }); }); Action<String> failure = (response => { _activity.RunOnUiThread (() => { actionDeferDelegate.onDeferFail(_activity.GetString(Resource.String.title_notice), _activity.GetString(Resource.String.connection_fail)); }); }); DataHelperRequest.getInstance ().sendCancelTalkNowDeferRequest(bookingId, deferInfo.IsDefer, successful, failure); }