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


C# Note.setTitle方法代码示例

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


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

示例1: createFirstNote

        public static Note createFirstNote(Activity activity)
        {
            TLog.v(TAG, "Creating first note");

            Note note = new Note();

            note.setTitle(activity.GetString(Resource.String.firstNoteTitle));
            // FIXME as soon as we can create notes, make sure GUID is unique! - we are referencing this UUID elsewhere, don't forget to check!
            note.setGuid("8f837a99-c920-4501-b303-6a39af57a714");
            note.setLastChangeDate("2010-10-09T16:50:12.219-04:00");

            // reconstitute HTML in note content

            string[] contentarray = activity.Resources.GetStringArray(Resource.Array.firstNoteContent);
            string content = TextUtils.Join("\n", contentarray);

            content = content.Replace("(?m)^=(.+)=$", "<size:large>$1</size:large>")
                    .Replace("(?m)^-(.+)$", "<list-item dir=\"ltr\">$1</list-item>")
                    .Replace("/list-item>\n<list-item", "/list-item><list-item")
                    .Replace("(<list-item.+</list-item>)", "<list>$1</list>")
                    .Replace("/list-item><list-item", "/list-item>\n<list-item");

            note.setXmlContent(content);

            return note;
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:26,代码来源:FirstNote.cs

示例2: createNewNote

        public static Note createNewNote(Context context, string title, string xmlContent)
        {
            TLog.v(TAG, "Creating new note");

            Note note = new Note();
            neverSaved = true;

            note.setTitle(title);

            UUID newid = UUID.RandomUUID();
            note.setGuid(newid.ToString());
            note.setLastChangeDate();
            note.setXmlContent(xmlContent);

            return note;
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:16,代码来源:NewNote.cs

示例3: useSendFile

        void useSendFile(File file, string contents)
        {
            Note remoteNote = new Note();

            if(file.Path.EndsWith(".note") && contents.StartsWith("<?xml")) { // xml note file

                try {
                    // Parsing
                    // XML
                    // Get a SAXParser from the SAXPArserFactory
                    SAXParserFactory spf = SAXParserFactory.newInstance();
                    SAXParser sp = spf.newSAXParser();

                    // Get the XMLReader of the SAXParser we created
                    XMLReader xr = sp.getXMLReader();

                    // Create a new ContentHandler, send it this note to fill and apply it to the XML-Reader
                    NoteHandler xmlHandler = new NoteHandler(remoteNote);
                    xr.setContentHandler(xmlHandler);

                    // Create the proper input source
                    stringReader sr = new stringReader(contents);
                    InputSource inputSource = new InputSource(sr);

                    TLog.d(TAG, "parsing note");
                    xr.parse(inputSource);

                // TODO wrap and throw a new exception here
                } catch (Exception e) {
                    e.PrintStackTrace();
                    if(e as TimeFormatException) TLog.e(TAG, "Problem parsing the note's date and time");
                    Finish();
                }
                // the note guid is not stored in the xml but in the filename
                remoteNote.setGuid(file.Name.Replace(".note", ""));
                Java.Util.Regex.Pattern note_content = Java.Util.Regex.Pattern.Compile("<note-content[^>]+>(.*)<\\/note-content>", Pattern.CASE_INSENSITIVE+Pattern.DOTALL);

                // FIXME here we are re-reading the whole note just to grab note-content out, there is probably a better way to do this (I'm talking to you xmlpull.org!)
                Matcher m = note_content.Matcher(contents);
                if (m.Find()) {
                    remoteNote.setXmlContent(NoteManager.stripTitleFromContent(m.Group(1),remoteNote.getTitle()));
                } else {
                    TLog.w(TAG, "Something went wrong trying to grab the note-content out of a note");
                    return;
                }
            }
            else { // ordinary text file
                remoteNote = NewNote.createNewNote(this, file.getName().replaceFirst("\\.[^.]+$", ""), XmlUtils.escape(contents));
            }

            remoteNote.setFileName(file.AbsolutePath);

            // check and see if the note already Exists; if so, send to conflict resolver
            Note localNote = NoteManager.getNoteByGuid(this, remoteNote.getGuid());

            if(localNote != null) {
                int compareBoth = Time.Compare(localNote.getLastChangeDate(), remoteNote.getLastChangeDate());

                TLog.v(TAG, "note conflict... showing resolution dialog TITLE:{0} GUID:{1}", localNote.getTitle(), localNote.getGuid());

                // send everything to Tomdroid so it can show Sync Dialog

                Bundle bundle = new Bundle();
                bundle.PutString("title",remoteNote.getTitle());
                bundle.PutString("file",remoteNote.getFileName());
                bundle.PutString("guid",remoteNote.getGuid());
                bundle.PutString("date",remoteNote.getLastChangeDate().Format3339(false));
                bundle.PutString("content", remoteNote.getXmlContent());
                bundle.PutString("tags", remoteNote.getTags());
                bundle.PutInt("datediff", compareBoth);
                bundle.PutBoolean("noRemote", true);

                Intent cintent = new Intent(ApplicationContext, typeof(CompareNotes));
                cintent.PutExtras(bundle);

                StartActivityForResult(cintent, 0);
                return;
            }

            // note doesn't exist, just give it a new title if necessary
            remoteNote.setTitle(NoteManager.validateNoteTitle(this, remoteNote.getTitle(), remoteNote.getGuid()));

            // add to content provider
            Android.Net.Uri uri = NoteManager.putNote(this, remoteNote);

            // view new note
            Intent i = new Intent(Intent.ActionView, uri, this, typeof(Tomdroid));
            i.PutExtra("view_note", true);
            i.AddFlags(ActivityFlags.ClearTop);
            StartActivity(i);
            Finish();
        }
开发者ID:decriptor,项目名称:tomdroid,代码行数:92,代码来源:Receive.cs


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