Esempio n. 1
0
 private void btnOpenUrl_Click(object sender, EventArgs e)
 {
     if (tbxUrl.Text.Length > 0)
     {
         string url = Tools.ParseUrl(FussballdeScoreParser.GetMainUrl(tbxUrl.Text), m_center.Parameters);
         Process.Start(url);
     }
 }
Esempio n. 2
0
        private void btnIcon_Click(object sender, EventArgs e)
        {
            if (tbxUrl.Text.Length > 0)
            {
                if (pictureBox1.Image != null)
                {
                    pictureBox1.Image.Dispose();
                    pictureBox1.Image = null;
                }

                ScoreCache cache = new ScoreCache(0);

                string url       = Tools.ParseUrl(FussballdeScoreParser.GetMainUrl(tbxUrl.Text), m_center.Parameters);
                string home      = cache.GetScore(url, "", false);
                string emblemUrl = FussballdeScoreParser.GetEmblemUrl(home, m_iconIndex++);

                if (String.IsNullOrEmpty(emblemUrl))
                {
                    return;
                }

                string tmpfile = Path.GetTempFileName();
                File.Delete(tmpfile);
                tmpfile += ".png";
                Bitmap bmp = null;
                try
                {
                    cache.GetImage(emblemUrl, tmpfile);
                    bmp = new Bitmap(tmpfile);
                    Image icon = Tools.FixedBitmapSize(bmp, 48, 48, Color.White);
                    pictureBox1.Image = icon;

                    string relpath = Path.Combine("Football", tbxScoreId.Text);
                    string path    = Path.Combine(Config.GetSubFolder(Config.Dir.Thumbs, "ScoreCenter"), relpath) + ".png";
                    icon.Save(path, ImageFormat.Png);
                    NotifySetIcon(relpath);
                }
                finally
                {
                    cache = null;
                    if (bmp != null)
                    {
                        bmp.Dispose();
                    }
                    File.Delete(tmpfile);
                }
            }
        }