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


C# Cursor.GetString方法代码示例

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


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

示例1: populateFields

        private void populateFields(View v, Cursor c)
        {
            int nameCol = c.getColumnIndex(Note.TITLE);
            int modifiedCol = c.getColumnIndex(Note.MODIFIED_DATE);
            int tagCol = c.getColumnIndex(Note.TAGS);

            string title = c.GetString(nameCol);
            string tags = c.GetString(tagCol);

            //Format last modified dates to be similar to desktop Tomboy
            //TODO this is messy - must be a better way than having 3 separate date types
            Time lastModified = new Time();
            lastModified.parse3339(c.GetString(modifiedCol));
            Long lastModifiedMillis = lastModified.toMillis(false);
            Date lastModifiedDate = new Date(lastModifiedMillis);

            string strModified = this.context.GetString(Resource.String.textModified)+" ";
            //TODO this is very inefficient
            if (DateUtils.isToday(lastModifiedMillis)){
                strModified += this.context.GetString(Resource.String.textToday) +", " + localeTimeFormat.format(lastModifiedDate);
            } else {
                // Add a day to the last modified date - if the date is now today, it means the note was edited yesterday
                Time yesterdayTest = lastModified;
                yesterdayTest.monthDay += 1;
                if (DateUtils.isToday(yesterdayTest.toMillis(false))){
                    strModified += this.context.GetString(Resource.String.textYexterday) +", " + localeTimeFormat.format(lastModifiedDate);
                } else {
                    strModified += localeDateFormat.format(lastModifiedDate) + ", " + localeTimeFormat.format(lastModifiedDate);
                }
            }

            /**
             * Next set the name of the entry.
             */
            TextView note_title = (TextView) v.FindViewById(Resource.Id.note_title);
            if (note_title != null) {
                note_title.SetText(title);
                if(tags.contains("system:deleted"))
                    note_title.setPaintFlags(note_title.getPaintFlags() | Paint.STRIKE_THRU_TEXT_FLAG);
                else
                    note_title.setPaintFlags(note_title.getPaintFlags() & ~Paint.STRIKE_THRU_TEXT_FLAG);
            }
            TextView note_modified = (TextView) v.FindViewById(Resource.Id.note_date);
            if (note_modified != null) {
                note_modified.SetText(strModified);
            }
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:47,代码来源:NoteListCursorAdapter.cs


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