コード例 #1
0
 protected void Button10_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao,this.AccessToken);
     var note = noteApi.GetNote("/8F970E0A60B743408C9F4B85B2FC081E/CC13776676444A3AA7416465266AE6BE");
     var noteBookApi = new YDNoteBookAPI(youDao, this.AccessToken);
     var books = noteBookApi.GetAllNoteBooks();
     this.lbl.Text = noteApi.MoveNote(note, books[0]).path;
 }
コード例 #2
0
 protected void Button11_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var bookApi = new YDNoteBookAPI(youDao, this.AccessToken);
     var books = bookApi.GetAllNoteBooks();
     var notes = bookApi.GetNotesInBook(books[0].path);
     var noteApi = new YDNoteAPI(youDao, this.AccessToken);
     noteApi.DeleteNote(notes[0]);
 }
コード例 #3
0
        protected void Button13_Click(object sender, EventArgs e)
        {
            if (FileUpload1.PostedFile.ContentLength > 0)
            {
                var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
                var resourceApi = new YDResourceAPI(youDao, this.AccessToken);

                var resource = resourceApi.Upload(Path.GetFileName(FileUpload1.PostedFile.FileName),
                   FileUpload1.PostedFile.ContentType, FileUpload1.PostedFile.InputStream);

                if (resource!=null)
                {
                    Button13.Text = resource.url;
                }
            }
        }
コード例 #4
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var api = new YDUserAPI(youDao,this.AccessToken);
     var ydUser = api.GetUserInfo();
     this.lbl.Text = "user:" + ydUser.user;
 }
コード例 #5
0
 protected void Button9_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao, this.AccessToken);
     this.lbl.Text = noteApi.MoveNote("/6E45D26BEB6943C4BF4CAF420AD03022/CC13776676444A3AA7416465266AE6BE", "/8F970E0A60B743408C9F4B85B2FC081E").modify_time.ToString();
 }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);

                var accessTokenResponse = youDao.ProcessUserAuthorization();
                if (accessTokenResponse != null)
                {
                    this.AccessToken = accessTokenResponse.AccessToken;
                    this.lbl.Text = "Token:" + this.AccessToken + " Screct:" + this.TokenManager.GetTokenSecret(this.AccessToken);
                }
                else if (this.AccessToken == null)
                {
                    // If we don't yet have access, immediately request it.
                    YDWebConsumer.RequestAuthorization(youDao);
                }
            }
        }
コード例 #7
0
 protected void Button7_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao,this.AccessToken);
     string path = "/6E45D26BEB6943C4BF4CAF420AD03022/CC13776676444A3AA7416465266AE6BE";
     var newNote = noteApi.GetNote(path);
     this.lbl.Text = newNote.content;
 }
コード例 #8
0
 protected void Button8_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao,this.AccessToken);
     string path = "/6E45D26BEB6943C4BF4CAF420AD03022/CC13776676444A3AA7416465266AE6BE";
     var newNote = noteApi.GetNote(path);
     newNote.content = "<html><body>去你妈的</body></html>";
     newNote.title = "test";
     noteApi.UpdateNote(newNote);
 }
コード例 #9
0
 protected void Button6_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var noteApi = new YDNoteAPI(youDao, this.AccessToken);
     var note = new YDNote()
                    {
                       source="",author = "kklldog",
                       content = "<content>内容</content><br/><finishtime>ttt</finishtime>",
                       notebook ="",title = "testNote1"
                    };
     var newNote = noteApi.CreateNote(note);
     this.lbl.Text = newNote.content + newNote.create_time;
 }
コード例 #10
0
 protected void Button5_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var api = new YDNoteBookAPI(youDao, this.AccessToken);
     var books = api.GetAllNoteBooks();
     api.DeleteNoteBook(books[1].path);
     this.lbl.Text = "DELETE SUCCESS";
 }
コード例 #11
0
 protected void Button4_Click(object sender, EventArgs e)
 {
     var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
     var api = new YDNoteBookAPI(youDao, this.AccessToken);
     var newBook = api.CreateNoteBook(DateTime.Now.ToString());
     this.lbl.Text = newBook.name;
 }
コード例 #12
0
        protected void Button3_Click(object sender, EventArgs e)
        {
            var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
            var api = new YDNoteBookAPI(youDao, this.AccessToken);
            var noteBooks = api.GetAllNoteBooks();
            var noteBook = noteBooks[1];

            var notes = api.GetNotesInBook(noteBook.path);
            var note = notes[0];
            this.lbl.Text = note.content;
        }
コード例 #13
0
        protected void Button2_Click(object sender, EventArgs e)
        {
            var youDao = new YDWebConsumer(YDAuthBaseInfo.ServiceDescription, this.TokenManager);
            var api = new YDNoteBookAPI(youDao,this.AccessToken);
            var books = api.GetAllNoteBooks();

            foreach (var ydNoteBook in books)
            {
                this.lbl.Text += ydNoteBook.path+"<\br>";
            }
        }