public void CheckPurchases() { #if WINDOWS_PHONE try { // if (InstalledProductKind == ProductKind.unknown) return; #if !DEBUG if (InstalledProductKind == ProductKind.Trial) { var licenseInfo = new Microsoft.Phone.Marketplace.LicenseInformation(); if (!licenseInfo.IsTrial()) { SessionLog.RecordMilestone("Converted from Trial to Paid", SessionId.ToString()); InstalledProductKind = ProductKind.Paid; Save(); } } #endif if (InstalledProductKind == ProductKind.Free && AdShows) { var productLicenses = CurrentApp.LicenseInformation.ProductLicenses; foreach (var license in productLicenses.Values) { if (license.IsActive && license.ProductId == RemoveAdsProduct) { SessionLog.RecordMilestone("RemoveAdsProduct Purchased", AppStats.Current.SessionId.ToString()); InstalledProductKind = ProductKind.Paid; AdShows = false; Save(); } if (license.IsActive && license.ProductId.StartsWith(PremiumProduct)) { SessionLog.RecordMilestone(license.ProductId + " Purchased", AppStats.Current.SessionId.ToString()); InstalledProductKind = ProductKind.Paid; AdShows = false; MultiMealHidden = false; Save(); } } } } catch (Exception ex) { LittleWatson.ReportException(ex); } #endif }
public static void MessageBox(string message) { #if WINDOWS_PHONE System.Windows.MessageBox.Show(message); #else try{ new AlertDialog.Builder(Navigate.dialogContext) .SetMessage(message) .SetPositiveButton("Ok", (sender, args) => { }) .SetTitle("") .Create() .Show(); } catch (Exception ex) { LittleWatson.ReportException(ex); } #endif }
private static void SaveDay(DateTime date) { try { var d = new Serializer("Date", date.ToStorageStringDate()); List <Entry>[] PeriodEntries = Cache.GetEntryCache(date); foreach (Period period in PeriodList.All) { if (Cache.ShouldSavePeriod(date, period)) { var p = d.Add("Period", period.ToString()); p.Write("LastChanged", DateTime.Now.ToStorageStringFull()); p.Write("Note", Cache.GetPeriodNote(date, period)); p.Write("Time", Cache.GetPeriodTime(date, period)); foreach (Entry entry in PeriodEntries[(int)period]) { FoodItem item = entry.Item; #if DEBUG if (item.ServingSizes.GetEquivalent(entry.AmountSelectedDB).ToStorageString() == "") { System.Diagnostics.Debugger.Break(); } #endif p.Add("Entry", entry.Text) .Write("Amount", entry.AmountSelectedDB) .Write("AmountScale", entry.AmountScaleDB.ToStorageString()) .Write("Grams", item.ServingSizes.GetEquivalent(entry.AmountSelectedDB).ToStorageString()) .Write("Properties", item.NutritionDB); } } } string Xml = d.GetXML(); // Store in LocalDB string Container = date.ToStorageStringMonth(); string DocumentID = date.ToStorageStringDate(); LocalDB.WriteAsync(Container, "Day", DocumentID, Xml); } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public Property NextProperty() { try { List <Property> sel = UserSettings.Current.SelectedProperties; for (int i = 0; i < sel.Count - 1; i++) { if (sel[i] == selectedProperty) { return(sel[i + 1]); } } return(sel[0]); } catch (Exception ex) { LittleWatson.ReportException(ex); } return(StandardProperty.Calories); }
private static void RemoveBackEntry() { try { #if WINDOWS_PHONE navigationService.RemoveBackEntry(); #else //Android.App. //ActivityManager am = (ActivityManager) navigationContext.GetSystemService(Context.ActivityService); //am. #endif } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public void AssertChanges(int count) { try { var cs = this.GetChangeSet(); if (cs.Deletes.Count == 0 && cs.Inserts.Count == 0 && cs.Updates.Count == count) { return; } #if DEBUG Debugger.Break(); #endif SessionLog.ReportException(new Exception("The Database is Dirty when expected Clean"), "AssertChanges"); } catch (Exception ex) { LittleWatson.ReportException(ex); } }
private void InitializeLanguage() { try { #if DEBUG try { if (!String.IsNullOrWhiteSpace(AppStats.appForceCulture)) { Thread.CurrentThread.CurrentCulture = new CultureInfo(AppStats.appForceCulture); Thread.CurrentThread.CurrentUICulture = new CultureInfo(AppStats.appForceCulture); } } catch (Exception ex) { LittleWatson.ReportException(ex); } #endif AppStats.CultureComma = Thread.CurrentThread.CurrentCulture.NumberFormat.NumberDecimalSeparator; AppStats.CultureCommaNotADot = AppStats.CultureComma != "."; RootFrame.Language = XmlLanguage.GetLanguage(AppResources.ResourceLanguage); FlowDirection flow = (FlowDirection)Enum.Parse(typeof(FlowDirection), AppResources.ResourceFlowDirection, true); #if DEBUG if (String.IsNullOrWhiteSpace(AppStats.appForceCulture) == false) { flow = AppStats.appForceFlow; } #endif RootFrame.FlowDirection = flow; } catch { // If an exception is caught here it is most likely due to either // ResourceLangauge not being correctly set to a supported language // code or ResourceFlowDirection is set to a value other than LeftToRight // or RightToLeft. if (Debugger.IsAttached) { Debugger.Break(); } throw; } }
internal override void RunQueryS(string Query, List <SearchResultVM> results) { DateTime start = DateTime.Now; string url = "https://api.nutritionix.com:443/v1_1/search/" + Query + "?results=0%3A20&fields=*&appId=54c51034&appKey=c72005c34b95b456fe067e129e4be11e"; WebClient wc = new WebClient(); wc.DownloadStringCompleted += (e, a) => { try { if (a.Error != null) { LittleWatson.ReportException(a.Error); return; } JObject o = (JObject)Newtonsoft.Json.JsonConvert.DeserializeObject(a.Result); foreach (var x in o["hits"]) { try { string text = x["fields"]["item_name"].ToString() + " (" + x["fields"]["brand_name"].ToString() + ")"; //if (this.IsMatch(text)) //int HitCount = searchVM.(terms, text); //ResultVM result = new NutritionIxResultVM(text, x["fields"], HitCount); results.Add(new SearchResultNutritionIxVM(text, x["fields"])); } catch (Exception ex) { LittleWatson.ReportException(ex); } } MessageQueue.Push(new ServiceSearchMessage("NutritionIX", Query, results.Count, (int)DateTime.Now.Subtract(start).TotalMilliseconds, results, a.Result)); this.IsDone = true; ReportProgress(results); } catch (Exception ex) { if (ex.Message != "The remote server returned an error: NotFound.") { LittleWatson.ReportException(ex); } } }; wc.DownloadStringAsync(new Uri(url)); }
public PropertyBinding(DataContext <T> set, int ResourceId, MemberExpression expression, string propertyName, Convert.Call convertFrom, Convert.Call convertTo) { try { this.Set = set; this.View = set.view.FindViewById(ResourceId); this.VMProperty = (PropertyInfo)expression.Member; this.Name = VMProperty.Name; Type t = View.GetType(); targetProperty = t.GetProperty(propertyName); this.convertFrom = convertFrom; this.convertTo = convertTo; string EventName = propertyName == "Checked" ? "CheckedChange" : propertyName + "Changed"; //if (EventName== "TextChanged") EventName = "FocusChange"; EventInfo e = t.GetEvent(EventName); if (e != null) { MethodInfo mi = this.GetType().GetMethod("EventHandler", BindingFlags.Public | BindingFlags.Instance); Delegate del = Delegate.CreateDelegate(e.EventHandlerType, this, mi); //e.AddEventHandler (View, del); //Delegate del = new EventHandler(this.EventHandler); e.AddEventHandler(View, del); //e.AddEventHandler (View, this.EventHandler); } if (EventName == "TextChanged") { e = t.GetEvent("FocusChange"); if (e != null) { MethodInfo mi = this.GetType().GetMethod("OnFocusChanged", BindingFlags.Public | BindingFlags.Instance); Delegate del = Delegate.CreateDelegate(e.EventHandlerType, this, mi); e.AddEventHandler(View, del); } } } catch (Exception ex) { LittleWatson.ReportException(ex); } }
// Code to execute on Unhandled Exceptions private void Application_UnhandledException(object sender, ApplicationUnhandledExceptionEventArgs e) { if (e != null) { Exception exception = e.ExceptionObject; if ((exception is XmlException || exception is NullReferenceException) && exception.ToString().ToUpper().Contains("INNERACTIVE")) { Debug.WriteLine("Handled Inneractive exception {0}", exception); e.Handled = true; return; } if (exception is NullReferenceException && exception.ToString().ToUpper().Contains("SOMA")) { Debug.WriteLine("Handled Smaato null reference exception {0}", exception); e.Handled = true; return; } if ((exception is System.IO.IOException || exception is NullReferenceException) && exception.ToString().ToUpper().Contains("GOOGLE")) { Debug.WriteLine("Handled Google exception {0}", exception); e.Handled = true; return; } if (exception is ObjectDisposedException && exception.ToString().ToUpper().Contains("MOBFOX")) { Debug.WriteLine("Handled Mobfox exception {0}", exception); e.Handled = true; return; } if ((exception is NullReferenceException) && exception.ToString().ToUpper().Contains("MICROSOFT.ADVERTISING")) { Debug.WriteLine("Handled Microsoft.Advertising exception {0}", exception); e.Handled = true; return; } } LittleWatson.SaveExceptionForReporting(e.ExceptionObject); if (Debugger.IsAttached) { // An unhandled exception has occurred; break into the debugger Debugger.Break(); } }
override public void OnReceive(Context context, Intent intent) { try { Reminder r = Reminder.FromIntent(intent); Intent resultIntent = new Intent(context, typeof(Splash)); PendingIntent resultPendingIntent = PendingIntent.GetActivity(context, 0, resultIntent, PendingIntentFlags.UpdateCurrent); // //resultIntent.PutExtras(valuesForActivity); // Pass some values to SecondActivity. // TaskStackBuilder stackBuilder = TaskStackBuilder.Create(this); // stackBuilder.AddParentStack(Class.FromType(typeof(Splash))); // stackBuilder.AddNextIntent(resultIntent); // // PendingIntent resultPendingIntent = stackBuilder.GetPendingIntent(0, (int)PendingIntentFlags.UpdateCurrent); // PendingIntent pi = PendingIntent.GetBroadcast (this, 0, i, PendingIntentFlags.UpdateCurrent); // // Build the notification NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .SetAutoCancel(true) // dismiss the notification from the notification area when the user clicks on it .SetContentIntent(resultPendingIntent) // start up this activity when the user clicks the intent. .SetContentTitle(r.Title) // Set the title .SetDefaults((int)(NotificationDefaults.Vibrate | NotificationDefaults.Sound)) // .SetSound(Android.Net.Uri.Parse (GetRingtone ())) // .SetLargeIcon(Android.Graphics.Bitmap. Resource.Drawable.ic_launcher) //.SetLargeIcon (Resource.Drawable.ic_icon) // This is the icon to display .SetSmallIcon(Resource.Drawable.ic_icon) // This is the icon to display .SetContentText(r.Content); // the message to display. // Notification n = new Notification (Resource.Drawable.ic_launcher, r.Title, Java.Lang.JavaSystem.CurrentTimeMillis ()); // PendingIntent pi = PendingIntent.GetActivity (context, 0, new Intent(context, typeof(Splash)), 0); // // n.SetLatestEventInfo (context, r.Title, r.Content, pi); // // TODO check user preferences // n.Defaults |= NotificationDefaults.Vibrate; // n.Sound = Android.Net.Uri.Parse (GetRingtone ()); // // n.defaults |= Notification.DEFAULT_SOUND; // n.Flags |= NotificationFlags.AutoCancel; NotificationManager nm = (NotificationManager) context.GetSystemService(Context.NotificationService); int id = 0; nm.Notify((int)id, builder.Build()); } catch (Exception ex) { LittleWatson.ReportException(ex); } }
// Threadsafe reading of entire document contents public static string Read(string Container, string DocumentType, string DocumentID) { try { ThreadSync.WaitOne(); // Wait till we have a sync signal, and clear the signal SessionLog.StartPerformance("Read"); return(ReadDocument(Container, DocumentType, DocumentID)); } catch (Exception ex) { LittleWatson.ReportException(ex); } finally { SessionLog.EndPerformance("Read"); ThreadSync.Set(); // Set the signal for the next thread to go if it comes to it } return(null); }
public static void ReplaceWith(String Xml) { try { if (Xml == null) { return; } current = (UserSettings)DataContractSerialization.Deserialize(Xml, typeof(UserSettings)); current.VerifyDefaults(); current.DoneLoading = true; current.Save(); current.UpdateAgent(); current.UpdateReminders(); }catch (Exception ex) { LittleWatson.ReportException(ex); } }
public override bool OnCreateOptionsMenu(IMenu menu) { try{ // Inflate the menu; this adds items to the action bar if it is present. if (!EditMode) { MenuInflater.Inflate(Resource.Menu.menu_add_item, menu); } Menu = menu; if (addInputDialog.Text.Length == 0) { menu.FindItem(Resource.Id.action_done).SetVisible(false); } } catch (Exception ex) { LittleWatson.ReportException(ex); } return(true); }
public EntryUpdatedMessage(Entry entry) { try { Date = entry.Date; Period = entry.Period; TotalAmount = entry.TotalAmount.ToStorageString(); Nutrition = entry.NutritionSummary; ItemText = entry.Item.Text; ItemSource = entry.Item.SourceID; ItemDescription = entry.Item.Description; ItemPropertyValues = entry.Item.Values.ToString(); ItemServingSizes = entry.Item.ServingSizes.ToString(); ItemLastModifed = entry.Item.LastChanged; } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public static void BackAfterSubmit() { try { #if WINDOWS_PHONE navigationService.RemoveBackEntry(); // Search screen navigationService.GoBack(); // -> Day Pivot #else BackFromEntryDetail(); // BackFromSearch(); //navigate (PGDayPivot); #endif } catch (Exception ex) { LittleWatson.ReportException(ex); } }
private void ItemTap(object sender, System.Windows.Input.GestureEventArgs e) { try { var sr = (sender as Grid).DataContext as SearchResultVM; if (sr == null) { return; } var vm = sr.Listener; if (vm == null) { return; } vm.OnItemTap(sr); } catch (Exception ex) { LittleWatson.ReportException(ex); } }
private void UpdateReminders() { if (!DoneLoading) { return; } try { foreach (var item in Reminders) { var reminderPeriod = item.Time.Period(); if (reminderPeriod == Period.Breakfast) { _BreakfastReminder = item.Checked; _BreakfastReminderTime = item.Time; UpdateReminder(_BreakfastReminder, "BreakfastReminder", _BreakfastReminderTime, AppResources.ReminderTitle, AppResources.ReminderContent, "/Views/Splash.xaml?Period=Breakfast"); } else if (reminderPeriod == Period.Lunch) { _LunchReminder = item.Checked; _LunchReminderTime = item.Time; UpdateReminder(_LunchReminder, "LunchReminder", _LunchReminderTime, AppResources.ReminderTitle, AppResources.ReminderContent, "/Views/Splash.xaml?Period=Lunch"); } else if (reminderPeriod == Period.Dinner) { _DinnerReminder = item.Checked; _DinnerReminderTime = item.Time; UpdateReminder(_DinnerReminder, "DinnerReminder", _DinnerReminderTime, AppResources.ReminderTitle, AppResources.ReminderContent, "/Views/Splash.xaml?Period=Dinner"); } else if (reminderPeriod == Period.Dinner) { _SnackReminder = item.Checked; _SnackReminderTime = item.Time; UpdateReminder(_SnackReminder, "SnackReminder", _SnackReminderTime, AppResources.ReminderTitle, AppResources.ReminderContent, "/Views/Splash.xaml?Period=Snack"); } else { UpdateReminder(item.Checked, "Reminder", item.Time, AppResources.ReminderTitle, AppResources.ReminderContent, "/Views/Splash.xaml?Period=Snack"); } } } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public void StartRequery() { SessionLog.Debug(string.Format("*** StartRequery: {0}", period)); //App.PeriodVM = this; Navigate.selectedDate = date; #if WINDOWS_PHONE Navigate.selectedPeriod = period; #endif var syncID = new System.Random().NextDouble().ToString(); querySyncID = syncID; try { SyncPeriod(); if (NewStyleWithoutItems) { return; } Requery(syncID, false); } catch (Exception ex) { LittleWatson.ReportException(ex); } var bw = new System.ComponentModel.BackgroundWorker(); bw.DoWork += (s, a) => { System.Threading.Thread.Sleep(300); try { if (querySyncID == syncID) { #if DEBUG && WINDOWS_PHONE FoodJournal.WinPhone.App.SetThreadCulture(); // only needed for screenshots #endif Requery(syncID, true); } } catch (Exception ex) { LittleWatson.ReportException(ex); } }; bw.RunWorkerAsync(); }
public static void LoadDay(DateTime date) { SessionLog.StartPerformance("LoadDay"); try { string Container = date.ToStorageStringMonth(); string DocumentID = date.ToStorageStringDate(); string Xml = LocalDB.Read(Container, "Day", DocumentID); LoadDay(date, Xml); //FoodJournalBackup.Log("Load Day",date.ToStorageStringFull(),null); //FoodJournalBackup.VerifyDate(date); } catch (Exception ex) { LittleWatson.ReportException(ex); } SessionLog.EndPerformance("LoadDay"); }
private void PinToStart_Tap(object sender, System.Windows.Input.GestureEventArgs e) { try { SessionLog.RecordMilestone("Pin To Start", AppStats.Current.SessionId.ToString()); string tileId = new Random().Next().ToString(); Uri mp = new Uri(@"/Views/Splash.xaml?" + "tileid=" + tileId, UriKind.Relative); IconicTileData tileData = new IconicTileData(); tileData.Title = "@AppResLib.dll,-200"; tileData.IconImage = new Uri(@"/Resources/IconTransparent.png", UriKind.Relative); tileData.SmallIconImage = new Uri(@"/Resources/IconTransparent.png", UriKind.Relative); ShellTile.Create(mp, tileData, false); (sender as Button).Visibility = System.Windows.Visibility.Collapsed; } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public static void StartEmailTask() { try { SessionLog.RecordMilestone("Email", AppStats.Current.SessionId.ToString()); var to = AppStats.email; var subject = AppResources.FeedbackSubject; #if AMAZON try { subject += " (z" + AppStats.Current.AppInstance.ToString().Substring(0, 6) + ")"; } #else #if V16 try { subject += " (v" + AppStats.Current.AppInstance.ToString().Substring(0, 6) + ")"; } #else try { subject += " (" + AppStats.Current.AppInstance.ToString().Substring(0, 6) + ")"; } #endif #endif catch (Exception ex) { LittleWatson.ReportException(ex); } #if WINDOWS_PHONE var task = new EmailComposeTask(); task.To = to; task.Subject = subject; task.Show(); #else //Intent emailIntent = new Intent(Intent.ActionSendto, Android.Net.Uri.FromParts("mailto",to, null)); Intent emailIntent = new Intent(Intent.ActionSendto); emailIntent.AddFlags(ActivityFlags.NewTask); Android.Net.Uri Uri = Android.Net.Uri.Parse("mailto:" + to + "?subject=" + subject); emailIntent.SetData(Uri); //emailIntent.SetType("text/plain"); //emailIntent.PutExtra(Intent.ExtraEmail, new string[]{to}); //emailIntent.PutExtra(Intent.ExtraSubject, subject); //emailIntent.PutExtra(Intent.ExtraText, AppResources.Feedback_EmailText); navigationContext.StartActivity(Intent.CreateChooser(emailIntent, AppResources.Feedback_Email)); #endif } catch (Exception ex) { LittleWatson.ReportException(ex); } Navigate.BackFromFeedback(); }
public void UnRegisterPurchase() { try { // SessionLog.RecordMilestone (productid + " Purchased", AppStats.Current.SessionId.ToString ()); InstalledProductKind = ProductKind.Free; AdShows = true; MultiMealHidden = true; Save(); //foreach (var a in FoodJournal.Android15.Adapters.PeriodListAdapter.AllAds) // try { // a.Visibility = Android.Views.ViewStates.Visible; //} catch (Exception ex) { // LittleWatson.ReportException (ex); //} } catch (Exception ex) { LittleWatson.ReportException(ex); } }
private void BuyProduct(string product) { try { SessionLog.RecordMilestone("Buying " + product, AppStats.Current.SessionId.ToString()); if (_serviceConnection != null) { #if DEBUG _serviceConnection.BillingHandler.BuyProduct("android.test.purchased", "inapp", ""); #else _serviceConnection.BillingHandler.BuyProduct(product, "inapp", ""); #endif } } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { try { ContactViewHolder contactViewHolder = (ContactViewHolder)holder; /*CardModel ci = cardList.get(i); * contactViewHolder.title.setText(ci.test);*/ Entry t = cardList[position]; contactViewHolder.entry = t; contactViewHolder.title.SetText(t.Text, TextView.BufferType.Normal); contactViewHolder.size.SetText(t.TotalAmountText, TextView.BufferType.Normal); contactViewHolder.fab.Visibility = (periodDeleteVM.IsSelected(t)) ? ViewStates.Visible : ViewStates.Gone; var text = MakeColoredText(t); contactViewHolder.calories.SetText(text, TextView.BufferType.Spannable); contactViewHolder.calories.Visibility = (text.Length() == 0) ? ViewStates.Gone : ViewStates.Visible; } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public void RefreshPeriod(Values.Period period, bool FocusNote) { try{ foreach (var fragment in mFragments) { if (fragment is TodayFragment) { if ((fragment as TodayFragment).Period == period) { (fragment as TodayFragment).Refresh(); if (FocusNote) { (fragment as TodayFragment).FocusNote(); } } } } } catch (Exception ex) { LittleWatson.ReportException(ex); } }
public static T LoadOrNew(string name) { T result = default(T); try { // Prefer LocalDB result = (T)LocalDB.ReadDataContract("Settings", typeof(T).Name, "All", typeof(T)); if (result == null) { // Fall back to IsolatedStorageSettings if (IsolatedStorageSettings.ApplicationSettings.TryGetValue(name, out result)) { return(result); } else { return(new T()); } } #if DEBUG // in debug, compare LocalDB and IsolatedStorageSettings based retrieval (to validate the LocalDB) T fromAS = default(T); if (IsolatedStorageSettings.ApplicationSettings.Contains(name)) { IsolatedStorageSettings.ApplicationSettings.TryGetValue(name, out fromAS); } if (fromAS != null) { if (!DataContractSerialization.IsObjectTreeIdentical(result, fromAS)) { System.Diagnostics.Debugger.Break(); } } #endif } catch (Exception ex) { LittleWatson.ReportException(ex); } return(result); }
public void ToVM() { if (locked) { return; } try { if (!(View is UISwitch) && (View is UITextView)) { if (View != lastSource) { if (!(View as UITextView).Focused) { return; } } } locked = true; object value = targetProperty.GetValue(View); if (convertTo != null) { value = convertTo(value); } lastSource = View; //SessionLog.Debug(string.Format("ToVM: {0} ({1})", Name, value)); VMProperty.SetValue(Set.VM, value, null); } catch (Exception ex) { LittleWatson.ReportException(ex); } locked = false; }
public static Amount ParseEquivalent(string text) { try{ if (string.IsNullOrEmpty(text)) { return(Amount.Zero); } if (text.EndsWith("g") || text.EndsWith("ml")) { return(Parse(text)); } if (char.IsNumber(text, text.Length - 1)) { return(FromGram(Floats.ParseStorage(text))); } } catch (Exception ex) { LittleWatson.ReportException(ex, text); } return(Parse(text)); }
public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { base.OnCreateView(inflater, container, savedInstanceState); Instance = this; Title = Title ?? GetString(Resource.String.Today); var view = inflater.Inflate(Resource.Layout.fragment_pager, container, false); tabLayout = Activity.FindViewById <TabLayout>(Resource.Id.tabs); viewPager = view.FindViewById <ViewPager>(Resource.Id.viewpager); tabLayout.Visibility = ViewStates.Visible; Task.Run(() => { Task.Delay(100).Wait(); Platform.RunSafeOnUIThread("TodayViewFragment.OnCreateView", () => { periodDeleteVM = new PeriodDeleteVM(); periodDeleteVM.DeleteModeChanged += DeleteModeChanged; setupViewPager(DefaultPeriod); SessionLog.EndPerformance("Navigate"); }); }); FloatingActionButton fab = Activity.FindViewById <FloatingActionButton>(Resource.Id.fab_list); fab.SetRippleColor(Resource.Color.ripple_material_dark); fab.Visibility = ViewStates.Visible; fab.Click += (object sender, EventArgs ea) => { try { periodDeleteVM.InDeleteMode = false; actionMode = ((AppCompatActivity)Activity).StartSupportActionMode(this); actionMode.Finish(); // periodDeleteVM.InDeleteMode = false; //GrabAdIntertitials(); ShowNewDialog(); } catch (Exception ex) { LittleWatson.ReportException(ex); } }; return(view); }