Example #1
0
        private void buttonChange_Click(object sender, EventArgs e)
        {
            Match m = urlPattern.Match(TextboxUrl.Text);

            if (m != Match.Empty)
            {
                string noteName = m.Groups[1].ToString();
                string pageId = m.Groups[2].ToString();

                try
                {
                    Note note = new Note(noteName, setting.GetConsumer());

                    Page page = note.FindPage(pageId);
                    DialogResult ret = MessageBox.Show("제목이 \"" + page.Title + "\"인 페이지가 맞습니까?", "ClipNote", MessageBoxButtons.YesNo);
                    if (ret == DialogResult.Yes)
                    {
                        setting.pageUrl = TextboxUrl.Text;
                        setting.pageId = pageId;
                        setting.noteName = noteName;
                        setting.Save();
                    }
                }
                catch (System.Net.WebException)
                {
                    MessageBox.Show("페이지를 읽을 수 없습니다. 잘못된 주소가 분명합니다.");
                }
            }
        }
Example #2
0
        public static Page Find(Note note, string pageId)
        {
            string resp = note.GetConsumer().Get(BuildPageUrl(pageId, note.GetDefaultParamerers()));

            XmlDocument xml = new XmlDocument();
            xml.LoadXml(resp);

            Page page = (Page)Deserialize(typeof(Page), xml.InnerXml);
            page.note = note;
            return page;
        }