void obikona_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { string cesta; int cislo; if (tbikona.Text == "") { cesta = tbprogram.Text.Replace("\"", ""); cislo = 0; } else { cesta = tbikona.Text; cislo = ynt(tbindex.Text); } if (tbindex.Text == "") { cislo = 0; } Ikony ik = new Ikony(cesta, cislo); if (ik.ShowDialog() == true) { tbikona.Text = ik.cesta; tbindex.Text = ik.cislo; } }
//nacte ikonu do prvku "obrazek" public void nactiIkonu(string program, string ikona, int index) { if (ikona == "") { try { obrazek.ImageSource = Ikony.Otevrit(program, 0, 1); } catch { obrazek.ImageSource = null; } } else { try { obrazek.ImageSource = Ikony.Otevrit(ikona, index, 1); } catch { obrazek.ImageSource = null; } } }
public void seznampripon() { listView1.Items.Clear(); tobnovit.IsEnabled = true; zatrhnout = false; chb_listview.IsChecked = false; tZmenaLV.Content = "Obnovit"; Task ukol = new Task(() => { foreach (string klic in Registry.ClassesRoot.GetSubKeyNames()) { if (klic.Substring(0, 1) == ".") { string pripona = klic.Replace(".", ""); string cesta; int index; var info = ASC.Nacti(pripona); if (SPP && info.typ == "" && info.program == "" && info.ikona == "") { continue; } if (ZUP) { if (!(info.nazev.Length >= 5 && info.nazev.Substring(0, ASC.nazevPr.Length) == ASC.nazevPr)) { continue; } } if (info.ikona == "") { cesta = info.program.Replace("\"", ""); index = 0; } else { cesta = info.ikona; index = info.poradi; } string cesta_ikona = ""; ImageSource obraz; if (info.ikona != "") { cesta_ikona = info.ikona + "," + info.poradi; obraz = Ikony.Otevrit(info.ikona, info.poradi, 0); } else { obraz = Ikony.Otevrit(info.program, 0, 0); } try { obraz.Freeze(); } catch { } Dispatcher.BeginInvoke(DispatcherPriority.Background, (ThreadStart) delegate() { listView1.Items.Add( new Polozky { lvzaskrknuto = zatrhnout, lvobrazek = obraz, lvpripona = pripona, lvtyp = info.typ, lvprogram = info.program + " " + info.parametr, lvikona = cesta_ikona }); }); } } }); ukol.Start(); }