public void changeAccount(String id) { curinfo = DataMgr.getAccountById(id); if (curinfo.provider != "") { blog = BlogFactory.createBlogger(curinfo.provider); blog.authenticate(curinfo.username, curinfo.password); titlelabel.Text = curinfo.blogname; } else MessageBox.Show("切换账户出错!\r\n"); }
public void fetchBlogThread() { //开始获取blog数据 String key="0"; //= catagorylist.FocusedItem.Name; catagorylist.Invoke( (MethodInvoker)delegate { key = catagorylist.FocusedItem.Name; } ); int idx = int.Parse(key.Trim()); blog = BlogFactory.createBlogger(infolist[idx].provider); blog.authenticate(infolist[idx].username, infolist[idx].password); posts = blog.getPost(20); //contentlist.Clear(); contentlist.Invoke( (MethodInvoker)delegate { contentlist.Clear(); } ); if (posts != null && posts.Count() != 0) { for (int i = 0; i <= posts.Count() - 1; i++) { JoeBlogs.Post p = posts.ElementAt(i); contentlist.Invoke( (MethodInvoker)delegate { contentlist.Items.Add(i + "", p.Title + " " + p.DateCreated.ToString(), 0); } ); // contentlist.Items.Add(i + "", p.title + " " + p.dateCreated.ToString(), 0); } } freeWizard1.Invoke( (MethodInvoker)delegate { freeWizard1.SelectedIndex = 0; } ); // freeWizard1.SelectedIndex = 0; }
private void nextbtn_Click(object sender, EventArgs e) { if (this.SelectedIndex < this.freeWizard1.TabCount - 1) this.SelectedIndex = this.SelectedIndex + 1; else if (this.SelectedIndex == this.freeWizard1.TabCount - 1) { try { blog = BlogFactory.createBlogger(blogbox.Text); auth = blog.authenticate(usernamebox.Text, passwdbox.Text); } catch (Exception ex) { MessageBox.Show("博客连接失败 在继续之前请先处理下面的异常\r\n"+ex.Message); auth = false; } if (auth) { this.DialogResult = DialogResult.OK; this.Close(); } } }