本文整理汇总了C#中ICursor.GetInt方法的典型用法代码示例。如果您正苦于以下问题:C# ICursor.GetInt方法的具体用法?C# ICursor.GetInt怎么用?C# ICursor.GetInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ICursor
的用法示例。
在下文中一共展示了ICursor.GetInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: mapNote
private Note mapNote(ICursor cursor)
{
return new Note
{
Id = cursor.GetInt(0),
Title = cursor.GetString(1),
Contents = cursor.GetString(2)
};
}
示例2: createTransaction
public static Transaction createTransaction(ICursor cursor)
{
Transaction purchase = new Transaction();
purchase.orderId = cursor.GetString(0);
purchase.productId = cursor.GetString(1);
purchase.purchaseState = (PurchaseState)Enum.Parse(typeof(PurchaseState), cursor.GetInt(2).ToString());
purchase.purchaseTime = cursor.GetLong(3);
purchase.developerPayload = cursor.GetString(4);
return purchase;
}
示例3: DeleteNote
public void DeleteNote(ICursor cursor)
{
new AlertDialog.Builder(_context)
.SetTitle(_context.Resources.GetString(Resource.String.delete_title))
.SetMessage(Resource.String.delete_message)
.SetPositiveButton(Resource.String.yes_button, (object sender, DialogClickEventArgs e) =>
{
Uri noteUri = ContentUris.WithAppendedId(WikiNote.Notes.ALL_NOTES_URI,
cursor.GetInt(0));
_context.ContentResolver.Delete(noteUri, null, null);
_context.SetResult(Result.Ok);
_context.Finish();
})
.SetNegativeButton(Resource.String.no_button, delegate { }).Show();
}
示例4: BindView
public override void BindView(View view, Context context, ICursor cursor)
{
int image_column_index = cursor.GetColumnIndex(MediaStore.Images.Media.InterfaceConsts.Id);
var imageView = (ImageView)view;
int id = cursor.GetInt(image_column_index);
Bitmap bm = MediaStore.Images.Thumbnails.GetThumbnail(context.ContentResolver, id, ThumbnailKind.MicroKind, null);
BitmapDrawable drawable = imageView.Drawable as BitmapDrawable;
if (drawable != null && drawable.Bitmap != null)
{
drawable.Bitmap.Recycle();
}
imageView.SetImageBitmap(bm);
}
示例5: OnTrackQueryComplete
/**
* Handle {@link TracksQuery} {@link Cursor}.
*/
private void OnTrackQueryComplete (ICursor cursor)
{
try {
if (!cursor.MoveToFirst ()) {
return;
}
// Use found track to build title-bar
ActivityHelper activityHelper = ((BaseActivity)Activity).ActivityHelper;
String trackName = cursor.GetString (TracksQuery.TRACK_NAME);
activityHelper.SetActionBarTitle (new Java.Lang.String (trackName));
activityHelper.SetActionBarColor (new Color (cursor.GetInt (TracksQuery.TRACK_COLOR)));
//AnalyticsUtils.getInstance(getActivity()).trackPageView("/Tracks/" + trackName);
} finally {
cursor.Close ();
}
}
示例6: BindView
/*
This is where we fill-in the views with the contents of the cursor.
*/
public override void BindView(View view, Context context, ICursor cursor)
{
// Read weather icon ID from cursor
int weatherId = cursor.GetInt (ForecastFragment.COL_WEATHER_CONDITION_ID);
// Use placeholder image for now
if (GetItemViewType (cursor.Position) == 0) {
MainViewHolder.iconView.SetImageResource (getArtResourceForWeatherCondition (weatherId));
} else {
MainViewHolder.iconView.SetImageResource (getIconResourceForWeatherCondition (weatherId));
}
// TODO Read date from cursor
long date = cursor.GetLong (ForecastFragment.COL_WEATHER_DATE);
MainViewHolder.dateView.Text = Utility.getFriendlyDayString (context, date);
// TODO Read weather forecast from cursor
string forecast = cursor.GetString (ForecastFragment.COL_WEATHER_DESC);
MainViewHolder.descriptionView.Text = forecast;
// Read user preference for metric or imperial temperature units
bool isMetric = Utility.isMetric (context);
// Read high temperature from cursor
double high = cursor.GetDouble (ForecastFragment.COL_WEATHER_MAX_TEMP);
MainViewHolder.highTempView.Text = Utility.formatTemperature (context, high, isMetric);
// TODO Read low temperature from cursor
double low = cursor.GetDouble (ForecastFragment.COL_WEATHER_MIN_TEMP);
MainViewHolder.lowTempView.Text = Utility.formatTemperature (context, low, isMetric);
}
示例7: GetCalendar
private static Calendar GetCalendar(ICursor cursor)
{
var accessLevel = cursor.GetInt(CalendarContract.Calendars.InterfaceConsts.CalendarAccessLevel);
var accountType = cursor.GetString(CalendarContract.Calendars.InterfaceConsts.AccountType);
var colorInt = cursor.GetInt(CalendarContract.Calendars.InterfaceConsts.CalendarColor);
var colorString = string.Format("#{0:x8}", colorInt);
return new Calendar
{
Name = cursor.GetString(CalendarContract.Calendars.InterfaceConsts.CalendarDisplayName),
ExternalID = cursor.GetString(CalendarContract.Calendars.InterfaceConsts.Id),
CanEditCalendar = accountType == CalendarContract.AccountTypeLocal,
CanEditEvents = IsCalendarWriteable(accessLevel),
Color = colorString
};
}
示例8: OnQueryComplete
/**
* {@inheritDoc}
*/
public void OnQueryComplete (int token, Java.Lang.Object cookie, ICursor cursor)
{
if (Activity == null) {
return;
}
try {
if (!cursor.MoveToFirst ()) {
return;
}
mNameString = cursor.GetString (VendorsQuery.NAME);
mName.Text = mNameString;
// Unregister around setting checked state to avoid triggering
// listener since change isn't user generated.
mStarred.CheckedChange += null;
mStarred.Checked = cursor.GetInt (VendorsQuery.STARRED) != 0;
mStarred.CheckedChange += HandleCheckedChange;
// Start background fetch to load vendor logo
String logoUrl = cursor.GetString (VendorsQuery.LOGO_URL);
if (!TextUtils.IsEmpty (logoUrl)) {
BitmapUtils.FetchImage (Activity, new Java.Lang.String (logoUrl), null, null, (result) => {
Activity.RunOnUiThread (() => {
if (result == null) {
mLogo.Visibility = ViewStates.Gone;
} else {
mLogo.Visibility = ViewStates.Visible;
mLogo.SetImageBitmap (result);
}
});
});
}
mUrl.Text = cursor.GetString (VendorsQuery.URL);
mDesc.Text = cursor.GetString (VendorsQuery.DESC);
mProductDesc.Text = cursor.GetString (VendorsQuery.PRODUCT_DESC);
mTrackId = cursor.GetString (VendorsQuery.TRACK_ID);
// Assign track details when found
// TODO: handle vendors not attached to track
ActivityHelper activityHelper = ((BaseActivity)Activity).ActivityHelper;
activityHelper.SetActionBarTitle (new Java.Lang.String (cursor.GetString (VendorsQuery.TRACK_NAME)));
activityHelper.SetActionBarColor (new Color (cursor.GetInt (VendorsQuery.TRACK_COLOR)));
//AnalyticsUtils.getInstance(getActivity()).trackPageView("/Sandbox/Vendors/" + mNameString);
} finally {
cursor.Close ();
}
}
示例9: LoadTrack
public void LoadTrack (ICursor cursor, bool loadTargetFragment)
{
String trackId;
Color trackColor;
var res = Resources;
if (cursor != null) {
trackColor = new Color (cursor.GetInt (TracksAdapter.TracksQuery.TRACK_COLOR));
trackId = cursor.GetString (TracksAdapter.TracksQuery.TRACK_ID);
mTitle.Text = (cursor.GetString (TracksAdapter.TracksQuery.TRACK_NAME));
mAbstract.Text = (cursor.GetString (TracksAdapter.TracksQuery.TRACK_ABSTRACT));
} else {
trackColor = res.GetColor (Resource.Color.all_track_color);
trackId = ScheduleContract.Tracks.ALL_TRACK_ID;
mTitle.SetText (TracksFragment.NEXT_TYPE_SESSIONS.Equals (mNextType)
? Resource.String.all_sessions_title
: Resource.String.all_sandbox_title);
mAbstract.SetText (TracksFragment.NEXT_TYPE_SESSIONS.Equals (mNextType)
? Resource.String.all_sessions_subtitle
: Resource.String.all_sandbox_subtitle);
}
bool isDark = UIUtils.IsColorDark (trackColor);
mRootView.SetBackgroundColor (trackColor);
if (isDark) {
mTitle.SetTextColor (res.GetColor (Resource.Color.body_text_1_inverse));
mAbstract.SetTextColor (res.GetColor (Resource.Color.body_text_2_inverse));
mRootView.FindViewById (Resource.Id.track_dropdown_arrow).SetBackgroundResource (Resource.Drawable.track_dropdown_arrow_light);
} else {
mTitle.SetTextColor (res.GetColor (Resource.Color.body_text_1));
mAbstract.SetTextColor (res.GetColor (Resource.Color.body_text_2));
mRootView.FindViewById (Resource.Id.track_dropdown_arrow).SetBackgroundResource (Resource.Drawable.track_dropdown_arrow_dark);
}
if (loadTargetFragment) {
Intent intent = new Intent (Intent.ActionView);
Uri trackUri = ScheduleContract.Tracks.BuildTrackUri (trackId);
intent.PutExtra (SessionDetailFragment.EXTRA_TRACK, trackUri);
if (NEXT_TYPE_SESSIONS.Equals (mNextType)) {
if (cursor == null) {
intent.SetData (ScheduleContract.Sessions.CONTENT_URI);
} else {
intent.SetData (ScheduleContract.Tracks.BuildSessionsUri (trackId));
}
} else if (NEXT_TYPE_VENDORS.Equals (mNextType)) {
if (cursor == null) {
intent.SetData (ScheduleContract.Vendors.CONTENT_URI);
} else {
intent.SetData (ScheduleContract.Tracks.BuildVendorsUri (trackId));
}
}
((BaseActivity)Activity).OpenActivityOrFragment (intent);
}
}
示例10: BindView
public override void BindView (Android.Views.View view, Context context, ICursor cursor)
{
TextView titleView = view.FindViewById<TextView> (Resource.Id.session_title);
TextView subtitleView = view.FindViewById<TextView> (Resource.Id.session_subtitle);
titleView.Text = cursor.GetString (SessionsQuery.TITLE);
// Format time block this session occupies
long blockStart = cursor.GetLong (SessionsQuery.BLOCK_START);
long blockEnd = cursor.GetLong (SessionsQuery.BLOCK_END);
string roomName = cursor.GetString (SessionsQuery.ROOM_NAME);
string subtitle = UIUtils.FormatSessionSubtitle (blockStart, blockEnd, roomName, context);
subtitleView.Text = subtitle;
bool starred = cursor.GetInt (SessionsQuery.STARRED) != 0;
view.FindViewById (Resource.Id.star_button).Visibility = starred ? ViewStates.Visible : ViewStates.Invisible;
// Possibly indicate that the session has occurred in the past.
UIUtils.SetSessionTitleColor (blockStart, blockEnd, titleView, subtitleView);
}
示例11: GetAddress
internal static Address GetAddress (ICursor c, Resources resources)
{
Address a = new Address();
a.Country = c.GetString (StructuredPostal.Country);
a.Region = c.GetString (StructuredPostal.Region);
a.City = c.GetString (StructuredPostal.City);
a.PostalCode = c.GetString (StructuredPostal.Postcode);
AddressDataKind kind = (AddressDataKind) c.GetInt (c.GetColumnIndex (CommonColumns.Type));
a.Type = kind.ToAddressType();
a.Label = (kind != AddressDataKind.Custom)
? StructuredPostal.GetTypeLabel (resources, kind, String.Empty)
: c.GetString (CommonColumns.Label);
string street = c.GetString (StructuredPostal.Street);
string pobox = c.GetString (StructuredPostal.Pobox);
if (street != null)
a.StreetAddress = street;
if (pobox != null)
{
if (street != null)
a.StreetAddress += Environment.NewLine;
a.StreetAddress += pobox;
}
return a;
}
示例12: GetEmail
internal static Email GetEmail (ICursor c, Resources resources)
{
Email e = new Email();
e.Address = c.GetString (ContactsContract.DataColumns.Data1);
EmailDataKind ekind = (EmailDataKind) c.GetInt (c.GetColumnIndex (CommonColumns.Type));
e.Type = ekind.ToEmailType();
e.Label = (ekind != EmailDataKind.Custom)
? ContactsContract.CommonDataKinds.Email.GetTypeLabel (resources, ekind, String.Empty)
: c.GetString (CommonColumns.Label);
return e;
}
示例13: getNoteId
private int getNoteId(ICursor item)
{
return item.GetInt(item.GetColumnIndexOrThrow(Note.ID));
}
示例14: SetViewValue
public bool SetViewValue (View view, ICursor cursor, int columnIndex)
{
//Let the adapter handle the binding if the column is not TYPE
if (columnIndex != COLUMN_TYPE) {
return false;
}
int type = cursor.GetInt (COLUMN_TYPE);
string label = null;
//Custom type? Then get the custom label
if (type == ContactsContract.CommonDataKinds.Phone.InterfaceConsts.TypeCustom) {
label = cursor.GetString (COLUMN_LABEL);
}
//Get the readable string
string text = (String) ContactsContract.CommonDataKinds.Phone.GetTypeLabel (self.Resources, (PhoneDataKind)type, label);
//Set text
((TextView) view).Text = text;
return true;
}
示例15: cursorToSubscription
/// <summary>
/// Cursors to subscription.
/// </summary>
/// <returns>The to subscription.</returns>
/// <param name='cursor'>Cursor.</param>
private Subscription cursorToSubscription(ICursor cursor)
{
Subscription subscription = new Subscription();
subscription.Description = cursor.GetString(cursor.GetColumnIndex(Subscription.COL_DESCRIPTION));
subscription.LogoUrl = stringToUrl(cursor.GetString(cursor.GetColumnIndex(Subscription.COL_LOGO_URL)));
subscription.MygpoLink = stringToUrl(cursor.GetString(cursor.GetColumnIndex(Subscription.COL_MYGPO_LINK)));
subscription.PositionLastWeek = cursor.GetInt(cursor.GetColumnIndex(Subscription.COL_POSITION_LAST_WEEK));
subscription.ScaledLogoUrl = stringToUrl(cursor.GetString(cursor.GetColumnIndex(Subscription.COL_SCALED_LOGO_URL)));
subscription.Subscribers = cursor.GetInt(cursor.GetColumnIndex(Subscription.COL_SUBSCRIBERS));
subscription.SubscribersLastWeek = cursor.GetInt(cursor.GetColumnIndex(Subscription.COL_SUBSRIBERS_LAST_WEEK));
subscription.Title = cursor.GetString(cursor.GetColumnIndex(Subscription.COL_TITLE));
subscription.Url = stringToUrl(cursor.GetString(cursor.GetColumnIndex(Subscription.COL_URL)));
subscription.Website = stringToUrl(cursor.GetString(cursor.GetColumnIndex(Subscription.COL_WEBSITE)));
return subscription;
}