예제 #1
0
        protected void Button_Click(object sender, EventArgs e)
        {
            Button b = sender as Button;

            Programme prg = ProgrammeList.FirstOrDefault(p => p.Name.Contains(b.Name));

            if (prg != null)
            {
                Process.Start(Helper.GetVlcPath(), @" dvb-t:// :dvb-frequency=" + prg.Frequency + " :dvb-bandwidth=8 :program=" + prg.Canal + " --one-instance");
            }
        }
예제 #2
0
 private void AddButtons()
 {
     foreach (string fileName in Directory.GetFiles("png", "*png"))
     {
         Button b = new Button();
         flowLayoutPanel1.Controls.Add(b);
         b.Height = 250;
         b.Width  = 250;
         if (Screen.PrimaryScreen.Bounds.Width < 1900)
         {
             b.Height = 150;
             b.Width  = 150;
         }
         b.BackgroundImage       = Image.FromFile(fileName);
         b.BackgroundImageLayout = ImageLayout.Zoom;
         b.TabStop   = false;
         b.FlatStyle = FlatStyle.Flat;
         b.FlatAppearance.BorderSize = 0;
         b.Name   = fileName.Substring(7);
         b.Name   = b.Name.Substring(0, b.Name.Length - 4);
         b.Name   = b.Name.ToLower();
         b.Click += new EventHandler(Button_Click);
         Programme prg = ProgrammeList.FirstOrDefault(p => p.Name.Contains(b.Name));
         if (prg != null)
         {
             ContextMenu cm = new ContextMenu();
             MenuItem    mi;
             mi            = cm.MenuItems.Add(prg.Frequency.ToString());
             mi.Click     += new EventHandler(MenuFrequency_Click);
             mi            = cm.MenuItems.Add(prg.Name);
             mi.Click     += new EventHandler(MenuName_Click);
             mi            = cm.MenuItems.Add(prg.Canal.ToString());
             mi.Enabled    = false;
             mi            = cm.MenuItems.Add(prg.Filename);
             mi.Enabled    = false;
             b.ContextMenu = cm;
         }
     }
 }