|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using Microsoft.Win32;
using System.Text;
using System.Reflection;
using System.IO;
using System.Windows.Forms;
using MS.WindowsAPICodePack.Internal;
using Microsoft.WindowsAPICodePack.Shell;
using Microsoft.WindowsAPICodePack.Taskbar;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
private const string appId = "SportsScores";
private const string progId = "SportsScores";
private JumpList jumpList;
private string executableFolder;
private readonly string executablePath;
// Keep a reference to the Taskbar instance
private TaskbarManager windowsTaskbar = TaskbarManager.Instance;
public Form1()
{
InitializeComponent();
// Set the application specific id
windowsTaskbar.ApplicationId = appId;
// Save current folder and path of running executable
executablePath = Assembly.GetEntryAssembly().Location;
executableFolder = Path.GetDirectoryName(executablePath);
if (timer1.Enabled == true)
button3.Text = "Stop timer";
else
button3.Text = "Start timer";
txtURL.Text = string.Format("http://www.nhl.com/ice/scores.htm?date={0:00}%2F{1:00}%2F{2}", DateTime.Today.Month, DateTime.Today.Day, DateTime.Today.Year);
webBrowser1.Navigate(txtURL.Text);
}
private void webBrowser1_DocumentCompleted(object sender, WebBrowserDocumentCompletedEventArgs e)
{
string[] games = ScoreList.getNHLGameList(webBrowser1.Document.GetElementsByTagName("tbody")).Split('|');
string IEPath = "C:\\Program Files\\Internet Explorer\\";
// clear the tasks before we loop through the games and add them as jumplist tasks
jumpList.ClearAllUserTasks();
foreach (string g in games)
{
if (!String.IsNullOrEmpty(g))
{
string s = ScoreList.NHLBreakDown(g);
IEPath = String.Format("C:\\Program Files\\Internet Explorer\\iexplore.exe");
JumpListLink jll = new JumpListLink(IEPath, s);
jll.IconReference = new IconReference(IEPath, 0);
jll.Arguments = txtURL.Text;
jumpList.AddUserTasks(jll);
}
}
jumpList.Refresh();
}
private void button2_Click(object sender, EventArgs e)
{
webBrowser1.Navigate(txtURL.Text);
webBrowser1.Refresh();
}
private void timer1_Tick(object sender, EventArgs e)
{
webBrowser1.Refresh();
string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);
jumpList.ClearAllUserTasks();
jumpList.Refresh();
}
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
timer1.Interval = Convert.ToInt32(numericUpDown1.Value * 60000);
}
private void label1_Click(object sender, EventArgs e)
{
}
private void button3_Click(object sender, EventArgs e)
{
timer1.Enabled = !timer1.Enabled;
if (timer1.Enabled == true)
button3.Text = "Stop timer";
else
button3.Text = "Start timer";
}
private void Form1_Shown(object sender, EventArgs e)
{
string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);
jumpList = JumpList.CreateJumpList();
jumpList.ClearAllUserTasks();
jumpList.Refresh();
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.