public void RecordingCompleted(string path, string title) { try { TellMyself tell = new TellMyself(); tell.TellType = ConstantsAndTypes.TELL_TYPE.Audio; tell.TellText = path.Trim(); tell.TellTitle = title.Trim(); Globals dbHelp = new Globals(); dbHelp.OpenDatabase(); var sqlDatabase = dbHelp.GetSQLiteDatabase(); tell.Save(sqlDatabase); dbHelp.CloseDatabase(); GlobalData.TellMyselfItemsList.Add(tell); Log.Info(TAG, "RecordingCompleted: Added recording " + title.Trim() + ", ID '" + tell.ID.ToString() + "'"); UpdateAdapter(); Toast.MakeText(this, GetString(Resource.String.RecordedAudioToast) + " '" + title + "'", ToastLength.Short).Show(); } catch (Exception e) { Log.Error(TAG, "RecordingCompleted: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorCompletingTellMyselfAudio), "TellMyselfActivity.RecordingCompleted"); } } }
//Required callback for generic text dialog entry public void ConfirmText(string textEntered, int genericTextID) { try { if (textEntered.Trim() == "") { return; } TellMyself tell = new TellMyself(); if (genericTextID != -1) { tell.IsNew = false; tell.IsDirty = true; tell.ID = genericTextID; } else { tell.IsDirty = false; tell.IsNew = true; } tell.TellType = ConstantsAndTypes.TELL_TYPE.Textual; tell.TellText = textEntered.Trim(); tell.TellTitle = ""; Globals dbHelp = new Globals(); dbHelp.OpenDatabase(); var sqlDatabase = dbHelp.GetSQLiteDatabase(); tell.Save(sqlDatabase); dbHelp.CloseDatabase(); if (genericTextID == -1) { GlobalData.TellMyselfItemsList.Add(tell); Log.Info(TAG, "ConfirmText: Added text " + textEntered.Trim() + ", ID '" + tell.ID.ToString() + "'"); } else { var index = GlobalData.TellMyselfItemsList.IndexOf(GlobalData.TellMyselfItemsList.Find(gen => gen.ID == genericTextID)); GlobalData.TellMyselfItemsList[index] = tell; Log.Info(TAG, "ConfirmText: Updated text " + textEntered.Trim() + ", ID '" + tell.ID.ToString() + "'"); } UpdateAdapter(); Toast.MakeText(this, GetString(Resource.String.TellMyselfAddedToast) + " '" + textEntered + "'", ToastLength.Short).Show(); } catch (Exception e) { Log.Error(TAG, "ConfirmText: Exception - " + e.Message); if (GlobalData.ShowErrorDialog) { ErrorDisplay.ShowErrorAlert(this, e, GetString(Resource.String.ErrorTellMyselfAddText), "TellMyselfActivity.ConfirmText"); } } }