当前位置: 首页>>代码示例>>C#>>正文


C# ICursor.GetString方法代码示例

本文整理汇总了C#中ICursor.GetString方法的典型用法代码示例。如果您正苦于以下问题:C# ICursor.GetString方法的具体用法?C# ICursor.GetString怎么用?C# ICursor.GetString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ICursor的用法示例。


在下文中一共展示了ICursor.GetString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: mapNote

 private Note mapNote(ICursor cursor)
 {
     return new Note
     {
         Id = cursor.GetInt(0),
         Title = cursor.GetString(1),
         Contents = cursor.GetString(2)
     };
 }
开发者ID:jorik041,项目名称:Sample-Projects,代码行数:9,代码来源:StandardNoteRepository.cs

示例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;
 }
开发者ID:Ezekoka,项目名称:MonoGame-StarterKits,代码行数:10,代码来源:BillingDB.cs

示例3: BindView

            public override void BindView(View view, Context context, ICursor cursor)
            {
                string type = cursor.GetString(BlocksQuery.BLOCK_TYPE);
                string blockId = cursor.GetString(BlocksQuery.BLOCK_ID);
                string blockTitle = cursor.GetString(BlocksQuery.BLOCK_TITLE);
                long blockStart = cursor.GetLong(BlocksQuery.BLOCK_START);
                long blockEnd = cursor.GetLong(BlocksQuery.BLOCK_END);
                string blockMeta = cursor.GetString(BlocksQuery.BLOCK_META);

                //TODO: Fix it
                //String blockTimeString = UIUtils.FormatBlockTimeString(blockStart, blockEnd,
                //    context);
            }
开发者ID:prashantvc,项目名称:XamarinIO,代码行数:13,代码来源:MyScheduleFragment.cs

示例4: BindView

        public override void BindView(View view, Context context, ICursor cursor)
        {
            Uri contactUri = ContactsContract.Contacts.GetLookupUri(
                cursor.GetLong(SampleContactsActivity.ContactsQuery.Id),
                cursor.GetString(SampleContactsActivity.ContactsQuery.LookupKey));

            ViewHolder holder = (ViewHolder)view.Tag;
            holder.text1.Text = cursor.GetString(SampleContactsActivity.ContactsQuery.DisplayName);
            holder.icon.AssignContactUri(contactUri);

            Picasso.With(context)
                   .Load(contactUri)
                   .Placeholder(Resource.Drawable.contact_picture_placeholder)
                   .Tag(context)
                   .Into(holder.icon);
        }
开发者ID:fitzhex,项目名称:testrepo,代码行数:16,代码来源:SampleContactsAdapter.cs

示例5: ConvertToStringFormatted

		public override ICharSequence ConvertToStringFormatted (ICursor cursor)
		{
			var convertMe = new string[1];
			convertMe [0] = cursor.GetString (COLUMN_DISPLAY_NAME);

			var converted = CharSequence.ArrayFromStringArray (convertMe);
			return converted [0];
		}
开发者ID:89sos98,项目名称:monodroid-samples,代码行数:8,代码来源:AutoComplete4.cs

示例6: Create_Database

        public void Create_Database()
        {
            HashSet<String> tableNameHashSet = new HashSet<String> ();
            tableNameHashSet.Add (WeatherContractOpen.LocationEntryOpen.TABLE_NAME);
            tableNameHashSet.Add (WeatherContractOpen.WeatherEntryOpen.TABLE_NAME);

            context.DeleteDatabase (WeatherDbOpenHelper.DATABASE_NAME);
            SQLiteDatabase db = new WeatherDbOpenHelper (
                                    this.context).WritableDatabase;
            Assert.AreEqual (true, db.IsOpen);

            // have we created the tables we want?
            c = db.RawQuery ("SELECT name FROM sqlite_master WHERE type='table'", null);

            Assert.IsTrue (c.MoveToFirst (), "Error: This means that the database has not been created correctly");

            // verify that the tables have been created
            do {
                tableNameHashSet.Remove (c.GetString (0));
            } while(c.MoveToNext ());

            // if this fails, it means that your database doesn't contain both the location entry
            // and weather entry tables
            Assert.IsTrue (tableNameHashSet.Count == 0, "Error: Your database was created without both the location entry and weather entry tables");

            // now, do our tables contain the correct columns?
            c = db.RawQuery ("PRAGMA table_info(" + WeatherContractOpen.LocationEntryOpen.TABLE_NAME + ")",
                null);

            Assert.IsTrue (c.MoveToFirst (), "Error: This means that we were unable to query the database for table information.");

            // Build a HashSet of all of the column names we want to look for
            HashSet<String> locationColumnHashSet = new HashSet<String> ();
            locationColumnHashSet.Add (WeatherContractOpen.LocationEntryOpen._ID);
            locationColumnHashSet.Add (WeatherContractOpen.LocationEntryOpen.COLUMN_CITY_NAME);
            locationColumnHashSet.Add (WeatherContractOpen.LocationEntryOpen.COLUMN_COORD_LAT);
            locationColumnHashSet.Add (WeatherContractOpen.LocationEntryOpen.COLUMN_COORD_LONG);
            locationColumnHashSet.Add (WeatherContractOpen.LocationEntryOpen.COLUMN_LOCATION_SETTING);

            int columnNameIndex = c.GetColumnIndex ("name");
            do {
                String columnName = c.GetString (columnNameIndex);
                locationColumnHashSet.Remove (columnName);
            } while(c.MoveToNext ());

            // if this fails, it means that your database doesn't contain all of the required location
            // entry columns
            Assert.IsTrue (locationColumnHashSet.Count == 0, "Error: The database doesn't contain all of the required location entry columns");
            db.Close ();
        }
开发者ID:Screech129,项目名称:WeatherApp,代码行数:50,代码来源:TestDbOpen.cs

示例7: 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);
 }
开发者ID:CBSAdvisor,项目名称:cbs-quantum,代码行数:24,代码来源:WikiActivityHelper.cs

示例8: GetContacts

		internal static IEnumerable<Contact> GetContacts (ICursor cursor, bool rawContacts, ContentResolver content, Resources resources, int batchSize)
		{
			if (cursor == null)
				yield break;

			string column = (rawContacts)
								? ContactsContract.RawContactsColumns.ContactId
								: ContactsContract.ContactsColumns.LookupKey;

			string[] ids = new string[batchSize];
			int columnIndex = cursor.GetColumnIndex (column);

			HashSet<string> uniques = new HashSet<string>();

			int i = 0;
			while (cursor.MoveToNext())
			{
				if (i == batchSize)
				{
					i = 0;
					foreach (Contact c in GetContacts (rawContacts, content, resources, ids))
						yield return c;
				}

				string id = cursor.GetString (columnIndex);
				if (uniques.Contains (id))
					continue;

				uniques.Add (id);
				ids[i++] = id;
			}

			if (i > 0)
			{
				foreach (Contact c in GetContacts (rawContacts, content, resources, ids.Take(i).ToArray()))
					yield return c;
			}
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:38,代码来源:ContactHelper.cs

示例9: 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;
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:13,代码来源:ContactHelper.cs

示例10: 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;
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:27,代码来源:ContactHelper.cs

示例11: GetPhone

		internal static Phone GetPhone (ICursor c, Resources resources)
		{
			Phone p = new Phone();
			p.Number = GetString (c, ContactsContract.CommonDataKinds.Phone.Number);

			PhoneDataKind pkind = (PhoneDataKind) c.GetInt (c.GetColumnIndex (CommonColumns.Type));
			p.Type = pkind.ToPhoneType();
			p.Label = (pkind != PhoneDataKind.Custom)
						? ContactsContract.CommonDataKinds.Phone.GetTypeLabel (resources, pkind, String.Empty)
						: c.GetString (CommonColumns.Label);

			return p;
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:13,代码来源:ContactHelper.cs

示例12: GetRelationship

		internal static Relationship GetRelationship (ICursor c, Resources resources)
		{
			Relationship r = new Relationship { Name = c.GetString (Relation.Name) };

			RelationDataKind rtype = (RelationDataKind)c.GetInt (c.GetColumnIndex (CommonColumns.Type));
			switch (rtype)
			{
				case RelationDataKind.DomesticPartner:
				case RelationDataKind.Spouse:
				case RelationDataKind.Friend:
					r.Type = RelationshipType.SignificantOther;
					break;

				case RelationDataKind.Child:
					r.Type = RelationshipType.Child;
					break;

				default:
					r.Type = RelationshipType.Other;
					break;
			}

			return r;
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:24,代码来源:ContactHelper.cs

示例13: GetImAccount

		internal static InstantMessagingAccount GetImAccount (ICursor c, Resources resources)
		{
			InstantMessagingAccount ima = new InstantMessagingAccount();
			ima.Account = c.GetString (CommonColumns.Data);

			//IMTypeDataKind imKind = (IMTypeDataKind) c.GetInt (c.GetColumnIndex (CommonColumns.Type));
			//ima.Type = imKind.ToInstantMessagingType();
			//ima.Label = InstantMessaging.GetTypeLabel (resources, imKind, c.GetString (CommonColumns.Label));

			IMProtocolDataKind serviceKind = (IMProtocolDataKind) c.GetInt (c.GetColumnIndex (InstantMessaging.Protocol));
			ima.Service = serviceKind.ToInstantMessagingService();
			ima.ServiceLabel = (serviceKind != IMProtocolDataKind.Custom)
								? InstantMessaging.GetProtocolLabel (resources, serviceKind, String.Empty)
								: c.GetString (InstantMessaging.CustomProtocol);

			return ima;
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:17,代码来源:ContactHelper.cs

示例14: 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();
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:25,代码来源:SyncService.cs

示例15: FillContactWithRow

		private static void FillContactWithRow (Resources resources, Contact contact, ICursor c)
		{
			string dataType = c.GetString (c.GetColumnIndex (ContactsContract.DataColumns.Mimetype));
			switch (dataType)
			{
				case ContactsContract.CommonDataKinds.Nickname.ContentItemType:
					contact.Nickname = c.GetString (c.GetColumnIndex (ContactsContract.CommonDataKinds.Nickname.Name));
					break;

				case StructuredName.ContentItemType:
					contact.Prefix = c.GetString (StructuredName.Prefix);
					contact.FirstName = c.GetString (StructuredName.GivenName);
					contact.MiddleName = c.GetString (StructuredName.MiddleName);
					contact.LastName = c.GetString (StructuredName.FamilyName);
					contact.Suffix = c.GetString (StructuredName.Suffix);
					break;

				case ContactsContract.CommonDataKinds.Phone.ContentItemType:
					contact.phones.Add (GetPhone (c, resources));
					break;

				case ContactsContract.CommonDataKinds.Email.ContentItemType:
					contact.emails.Add (GetEmail (c, resources));
					break;

				case ContactsContract.CommonDataKinds.Note.ContentItemType:
					contact.notes.Add (GetNote (c, resources));
					break;

				case ContactsContract.CommonDataKinds.Organization.ContentItemType:
					contact.organizations.Add (GetOrganization (c, resources));
					break;

				case StructuredPostal.ContentItemType:
					contact.addresses.Add (GetAddress (c, resources));
					break;

				case InstantMessaging.ContentItemType:
					contact.instantMessagingAccounts.Add (GetImAccount (c, resources));
					break;

				case WebsiteData.ContentItemType:
					contact.websites.Add (GetWebsite (c, resources));
					break;

				case Relation.ContentItemType:
					contact.relationships.Add (GetRelationship (c, resources));
					break;
			}
		}
开发者ID:rampyodm,项目名称:Xamarin.Mobile,代码行数:50,代码来源:ContactHelper.cs


注:本文中的ICursor.GetString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。