/// <summary> /// 重置数据库,界面的所有信息 /// </summary> public void RefreshFormInfo() { Config.Instance = null; ZikuState.Text = "当前使用的数据库名称是:" + Config.Instance.name; CategoryListBox.Items.Clear(); SubCategoryListBox.Items.Clear(); itemListView.Items.Clear(); //刷新父分类 foreach (string pID in Config.Instance.pCsort.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries)) { Category ca = Category.getInstance(pID); if (ca != null) { SkinListBoxItem eff = new SkinListBoxItem(ca.name); eff.Tag = pID; CategoryListBox.Items.Add(eff); } } if (CategoryListBox.Items.Count != 0) { CategoryListBox.SelectedIndex = 0; } ReUIinfo(); }
/// <summary> /// 添加单个文件到列表中 /// </summary> /// <param name="file"></param> public void AddFile(Files file) { SkinListBoxItem item = new SkinListBoxItem(file.CFullName); item.Tag = file; this.Items.Add(item); }
private void button1_Click(object sender, EventArgs e) { listBox1.Items.Clear(); Result.Clear(); WebClient web = new WebClient(); string webSite = "http://mobilecdn.kugou.com/api/v3/search/song?format=json&keyword=" + textBox1.Text + "&page=1&pagesize=30"; byte[] buffer = web.DownloadData(webSite); string html = Encoding.UTF8.GetString(buffer); JObject kugou = JObject.Parse(html); List <JToken> all = kugou["data"]["info"].Children().ToList(); all.ForEach(x => { KugouResult kg = JsonConvert.DeserializeObject <KugouResult>(x.ToString()); //kg.hash = x["320hash"].ToString(); if (kg.sqhash != "") { SkinListBoxItem sl = new SkinListBoxItem(kg.filename); listBox1.Items.Add(sl); kg.key = GetMD5(kg.sqhash + "kgcloud"); webSite = "http://trackercdn.kugou.com/i/?cmd=4&hash=" + kg.sqhash + "&key=" + kg.key + "&pid=1&forceDown=0&vip=1"; buffer = web.DownloadData(webSite); html = Encoding.UTF8.GetString(buffer); JObject flac = JObject.Parse(html); Result.Add(flac["url"].ToString().Replace("\\", "")); } }); }
private void Set传输设置() { try { Options.输设置 info = JsonConvert.DeserializeObject <Options.输设置>(Settings1.Default.输设置); 输设置_cb_下载完毕后自动打开文件.Checked = info.载完毕后自动打开文件; 输设置_cb_屏蔽所有文件消息.Checked = info.屏蔽所有文件消息; 输设置_lb_SavePath.Text = info.保存路径; 输设置_nup_大于numMB则屏.Value = info.文件接收大小最大上限; this.输设置_ExtListBox.Items.Clear(); if (info.屏蔽的后缀名 != null) { foreach (var text in info.屏蔽的后缀名) { SkinListBoxItem item = new SkinListBoxItem(" " + text); item.Image = DSAPI.图形图像.获取扩展名关联图标(text, false); this.输设置_ExtListBox.Items.Add(item); } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
private void GetTXT_Load(object sender, EventArgs e) { string blist = WTS.getWebData(bookmlurl); // TextBox.Text = blist; if (blist != "") { getbooklist(blist); //bookmllist_tj foreach (string bn in bookmllist_tj) { SkinListBoxItem lbei = new SkinListBoxItem(); lbei.Text = " " + bn; Image image = Resource.book; lbei.Image = image; tjlistbox.Items.Add(lbei); } foreach (string bn in bookmllist_jp) { SkinListBoxItem lbei = new SkinListBoxItem(); lbei.Text = " " + bn; Image image = Resource.book; lbei.Image = image; jplistbox.Items.Add(lbei); } } else { this.Close(); } }
private void AddTXT(string str) { this.BeginInvoke((MethodInvoker) delegate { SkinListBoxItem slbi = new SkinListBoxItem(str); skinListBox1.Items.Add(slbi); }); }
/// <summary> /// 根据文件列表,显示文件 /// </summary> /// <param name="files"></param> public void SetList(List <Files> files) { foreach (Files f in files) { SkinListBoxItem item = new SkinListBoxItem(f.CFullName); item.Tag = f; this.Items.Add(item); } }
private void BtnBrowse_Click(object sender, EventArgs e) //打开"浏览文件夹"对话框,将选定文件夹中的图片文件添加到列表框中 { string TempStr; //临时变量:用于保存文件名 Boolean BeenAdded; //临时变量:判断当前文件是否已经加入列表框中 TempStr = ""; FolderBrowserForPicture.ShowDialog(); if (FolderBrowserForPicture.SelectedPath != "")//选择了文件夹 { TempStr = FileSystem.Dir(FolderBrowserForPicture.SelectedPath + "\\*.*", Microsoft.VisualBasic.FileAttribute.Directory); while (TempStr != null)//该文件夹有文件 { var dd = TempStr.Substring(TempStr.LastIndexOf(".")).ToUpper(); if (((TempStr.Substring(TempStr.LastIndexOf(".")).ToUpper()) == ".BMP") || ((TempStr.Substring(TempStr.LastIndexOf(".")).ToUpper()) == ".GIF") || ((TempStr.Substring(TempStr.LastIndexOf(".")).ToUpper()) == ".JPG") || ((TempStr.Substring(TempStr.LastIndexOf(".")).ToUpper()) == ".JPEG")) //如果为常见的图像文件 { //下面判断该文件是否已经在列表框中 BeenAdded = false; if (listBoxPictureFile.Items.Count >= 1)//列表框中有文件名 { for (int j = 1; j <= listBoxPictureFile.Items.Count; j++) { if (listBoxPictureFile.Items[j - 1].ToString() == FolderBrowserForPicture.SelectedPath + @"\" + TempStr) { BeenAdded = true;//已经在列表框中 break; } } } if (!BeenAdded)//还没有加入列表框中 { SkinListBoxItem item = new SkinListBoxItem(FolderBrowserForPicture.SelectedPath + @"\" + TempStr); listBoxPictureFile.Items.Add(item);//将其加入列表框中 } } TempStr = Microsoft.VisualBasic.FileSystem.Dir();//继续查找下一个文件 } } }
/// <summary> /// 字段添加 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnAddField_Click(object sender, EventArgs e) { if (txtField.Text.IsNullOrEmpty() && txtFieldSql.Text.IsNullOrEmpty()) { return; } SkinListBoxItem item = new SkinListBoxItem { Text = txtField.Text }; listField.Items.Add(item); item = new SkinListBoxItem { Text = txtFieldSql.Text }; listFieldSql.Items.Add(item); txtField.Text = txtFieldSql.Text = ""; }
private void refreshSubCategoryListBox(string pID) { SubCategoryListBox.Items.Clear(); DataTable d = SQLite.ExecuteDataTable("SELECT * FROM Category WHERE id = " + pID + ";", Config.Instance.Path, null, false); if (d.Rows.Count > 0) { foreach (string subID in Tools.SplitString(d.Rows[0]["C_ID"].ToString())) { DataTable subDT = SQLite.ExecuteDataTable("SELECT * FROM Category WHERE id =" + subID, Config.Instance.Path); if (subDT.Rows.Count > 0) { SkinListBoxItem eff = new SkinListBoxItem(subDT.Rows[0]["name"].ToString()); eff.Tag = subDT.Rows[0]["id"].ToString(); SubCategoryListBox.Items.Add(eff); } } } }
private void 输设置_BtAdd_Click(object sender, EventArgs e) { string pattern = "\\.\\w{2,5}"; string input = this.输设置_ExtTxb.Text; if (!Regex.IsMatch(input, pattern)) { MessageBox.Show("后缀名格式不合法", "格式错误", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ListBoxHasItem(input)) { MessageBox.Show("列表中已包含该项!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); return; } SkinListBoxItem item = new SkinListBoxItem(" " + input); item.Image = DSAPI.图形图像.获取扩展名关联图标(input, false); this.输设置_ExtListBox.Items.Add(item); }
private void skinListBox1_DoubleClick(object sender, EventArgs e) { if (skinListBox1.SelectedItem != null) { SkinListBoxItem item = skinListBox1.SelectedItem as SkinListBoxItem; string hostname = EncryptsHelper.Encrypt(item.Tag.ToString()); ShadowsocksR ssR = ShadowsocksR.Find(ShadowsocksR._.HostName == hostname); if (ssR != null) { MainFrm.shadowsocksR = ssR; DialogResult = DialogResult.OK; Close(); } else { CCWin.MessageBoxEx.Show("节点选择异常,请稍后重试!", "提示"); Close(); } } }
private void ChooseLine_Load(object sender, EventArgs e) { ssList = new Dictionary <string, string>();//字典需要初始化才能赋值 var listAll = ShadowsocksR.FindAll(Shadowsocks._.State, "启用"); foreach (var list in listAll) { ssList.Add(EncryptsHelper.Decrypt(list.HostName), list.Remark); } if (ssList.Count > 0) { for (int i = 0; i < ssList.Count; i++) { SkinListBoxItem item = new SkinListBoxItem(ssList.ElementAt(i).Value); item.Tag = ssList.ElementAt(i).Key; skinListBox1.Items.Add(item); } } TestIP(); timer1.Enabled = true; }
public void AddItem(object html) { if (this.skinListBox1.InvokeRequired)//等待异步 { FlushClient fc = new FlushClient(AddItem); this.Invoke(fc, new object[1] { html }); //通过代理调用刷新方法 } else { XmlDocument xml = new XmlDocument(); xml.LoadXml(html.ToString()); XmlNodeList list = xml.SelectSingleNode("Document").ChildNodes; foreach (XmlNode node in list[0].ChildNodes[3].ChildNodes) { XmlElement xe = (XmlElement)node; XmlNodeList firList = xe.ChildNodes; string name = firList[0].InnerText; XmlNodeList singers = firList[4].ChildNodes; string[] artist = new string[singers.Count]; for (int i = 0; i < artist.Length; i++) { artist[i] = singers[i].ChildNodes[1].InnerText; } string ar = string.Join("/", artist); string al = firList[13].ChildNodes[1].InnerText; string l = firList[17].ChildNodes[0].InnerText; string m = "", h = ""; h = firList[15].HasChildNodes ? firList[15].ChildNodes[0].InnerText : l; m = firList[16].HasChildNodes ? firList[16].ChildNodes[0].InnerText : l; DownList dl = new DownList(firList[1].InnerText, h, m, l); IDlist.Add(dl); SkinListBoxItem lb = new SkinListBoxItem(ar + " - " + name); skinListBox1.Items.Add(lb); } } }
private void gxlistload(string gxtext) { blog_gx.Clear(); bookmllist_gx.Clear(); gxlistbox.Items.Clear(); int gxul = gxtext.IndexOf("</ul>"); if (gxul > 0) { gxtext = gxtext.Substring(0, gxul); //TextBox.Text = gxtext; } List <string> gxlist = gxtext.Split(new string[] { "\r\n" }, StringSplitOptions.None).ToList(); foreach (string gx in gxlist) { int p = gx.IndexOf("http://www.xiaoqiangxs.org"); if (p <= 0) { continue; } List <string> hl = gx.Split(new[] { "href=\"", "\" target=\"_blank\">", "</a>" }, StringSplitOptions.None).ToList(); booklog gxt = new booklog(); gxt.name = hl[2]; gxt.url = hl[1]; bookmllist_gx.Add(hl[2]); blog_gx.Add(gxt); } foreach (string bn in bookmllist_gx) { SkinListBoxItem lbei = new SkinListBoxItem(); lbei.Text = " " + bn; Image image = Resource.book; lbei.Image = image; gxlistbox.Items.Add(lbei); } }