本文整理汇总了C#中ICursor.GetColumnIndexOrThrow方法的典型用法代码示例。如果您正苦于以下问题:C# ICursor.GetColumnIndexOrThrow方法的具体用法?C# ICursor.GetColumnIndexOrThrow怎么用?C# ICursor.GetColumnIndexOrThrow使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICursor
的用法示例。
在下文中一共展示了ICursor.GetColumnIndexOrThrow方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EditNote
/// <summary>
/// Create an intent to start the WikiNoteEditor using the current title
/// and body information (if any).
/// </summary>
public void EditNote(string mNoteName, ICursor cursor)
{
// This intent could use the android.intent.action.EDIT for a wiki note
// to invoke, but instead I wanted to demonstrate the mechanism for invoking
// an intent on a known class within the same application directly. Note
// also that the title and body of the note to edit are passed in using the extras bundle.
Intent i = new Intent(_context, typeof(WikiNoteEditor));
i.PutExtra(WikiNote.Notes.TITLE, mNoteName);
String body;
if (cursor != null)
{
body = cursor.GetString(cursor.GetColumnIndexOrThrow(WikiNote.Notes.BODY));
}
else
{
body = string.Empty;
}
i.PutExtra(WikiNote.Notes.BODY, body);
_context.StartActivityForResult(i, ACTIVITY_EDIT);
}
示例2: prepareSyncableNotes
// syncing based on updated local notes only
protected void prepareSyncableNotes(ICursor localGuids)
{
remoteGuids = new List<string>();
pushableNotes = new List<Note>();
pullableNotes = new List<Note>();
comparableNotes = new List<Note[]>();
deleteableNotes = new List<Note>();
conflictingNotes = new List<Note[]>();
localGuids.MoveToFirst();
do {
Note note = NoteManager.getNoteByGuid(activity, localGuids.GetString(localGuids.GetColumnIndexOrThrow(Note.GUID)));
if(!note.getTags().Contains("system:template")) // don't push templates TODO: find out what's wrong with this, if anything
pushableNotes.Add(note);
} while (localGuids.MoveToNext());
if(cancelled) {
doCancel();
return;
}
doSyncNotes();
}
示例3: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);
this._noteView = FindViewById<TextView>(Resource.Id.noteview);
AndroidUri localUri = Intent.Data;
if ((localUri == null) && (bundle != null))
{
localUri = AndroidUri.Parse(bundle.GetString(KEY_URL));
}
if ((localUri == null) || (localUri.PathSegments.Count < 2))
{
localUri = AndroidUri.WithAppendedPath(WikiNote.Notes.ALL_NOTES_URI, Resources.GetString(Resource.String.start_page));
}
ICursor localCursor = ManagedQuery(localUri, WikiNote.WIKI_NOTES_PROJECTION, null, null, null);
bool newNote = false;
if ((localCursor == null) || (localCursor.Count == 0))
{
try
{
// no matching wikinote, so create it
localUri = ContentResolver.Insert(localUri, null);
if (localUri == null)
{
Log.Error("WikiNotes", "Failed to insert new wikinote into " + Intent.Data);
Finish();
return;
}
// make sure that the new note was created successfully, and
// select it
localCursor = ManagedQuery(localUri, WikiNote.WIKI_NOTES_PROJECTION, null, null, null);
if ((localCursor == null) || (localCursor.Count == 0))
{
Log.Error("WikiNotes", "Failed to open new wikinote: " + Intent.Data);
Finish();
return;
}
newNote = true;
}
catch (Exception ex)
{
Log.Error(WikiNote.LOG_TAG, ex.Message);
}
}
_uri = localUri;
_cursor = localCursor;
localCursor.MoveToFirst();
_helper = new WikiActivityHelper(this);
// get the note name
String noteName = _cursor.GetString(_cursor
.GetColumnIndexOrThrow(WikiNote.Notes.TITLE));
_noteName = noteName;
// set the title to the name of the page
Title = Resources.GetString(Resource.String.wiki_title, noteName);
// If a new note was created, jump straight into editing it
if (newNote)
{
_helper.EditNote(noteName, null);
}
// Set the menu shortcut keys to be default keys for the activity as well
SetDefaultKeyMode(DefaultKey.Shortcut);
}
示例4: getNoteTitle
private string getNoteTitle(ICursor item)
{
return item.GetString(item.GetColumnIndexOrThrow(Note.TITLE));
}
示例5: getNoteId
private int getNoteId(ICursor item)
{
return item.GetInt(item.GetColumnIndexOrThrow(Note.ID));
}
示例6: PopulateFrom
public void PopulateFrom(ICursor c)
{
var nameColumn = c.GetColumnIndexOrThrow(VehicleTable.Columns.VEHICLE);
_textView.Text = c.GetString(nameColumn);
}