In this article, new Windows 7 features like Jumplist, Taskbar Progressbar, Tabbed Thumbnail, Icon Overlays, Application Restart Data Recovery, Network Management, Power Management, Task dialog, Sensor API, etc. are explained with simple demo applications
|
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.WindowsAPICodePack.Taskbar;
using System.IO;
using Microsoft.WindowsAPICodePack.Shell;
namespace TaskbarDemo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
//RegistrationHelper.RegisterFileAssociation("TaskbarDemo", "abc");
}
private void hscrTaskbarProgress_Scroll(object sender, ScrollEventArgs e)
{
TaskbarManager.Instance.SetProgressState((TaskbarProgressBarState)Enum.Parse(typeof(TaskbarProgressBarState), this.comboBox1.SelectedText));
TaskbarManager.Instance.SetProgressValue(hscrTaskbarProgress.Value, hscrTaskbarProgress.Maximum);
}
private void Form1_Load(object sender, EventArgs e)
{
var enums = Enum.GetNames(typeof(TaskbarProgressBarState));
this.comboBox1.DataSource = enums;
}
private void Form1_Shown(object sender, EventArgs e)
{
TaskbarManager.Instance.SetProgressValue(0, hscrTaskbarProgress.Maximum);
TaskbarManager.Instance.SetOverlayIcon(this.Icon, "Taskbar Demo Application");
JumpList list = JumpList.CreateJumpList();//JumpList.CreateJumpListForIndividualWindow("TaskbarDemo.Form1", this.Handle);
JumpListCustomCategory jcategory = new JumpListCustomCategory("My New Category");
list.ClearAllUserTasks();
string desktop = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
//jcategory.AddJumpListItems(new JumpListItem(Path.Combine(desktop, "a.abc")));
list.AddCustomCategories(jcategory);
string systemFolder = Environment.GetFolderPath(Environment.SpecialFolder.System);
//Add links to Tasks
list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "notepad.exe"), "Open Notepad")
{
IconReference = new IconReference(Path.Combine(systemFolder, "notepad.exe"), 0)
});
list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "calc.exe"), "Open Calculator")
{
IconReference = new IconReference(Path.Combine(systemFolder, "calc.exe"), 0)
});
list.AddUserTasks(new JumpListSeparator());
list.AddUserTasks(new JumpListLink(Path.Combine(systemFolder, "mspaint.exe"), "Open Paint")
{
IconReference = new IconReference(Path.Combine(systemFolder, "mspaint.exe"), 0)
});
//Adding links to RecentItems
//list.AddToRecent(Path.Combine(systemFolder, "mspaint.exe"));
list.Refresh();
}
private void button1_Click(object sender, EventArgs e)
{
Thumbnail th = new Thumbnail();
th.Show();
}
}
}
|
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.
Did you like his post?
Oh, lets go a bit further to know him better.
Visit his Website :
www.abhisheksur.com to know more about Abhishek.
Abhishek also authored a book on .NET 4.5 Features and recommends you to read it, you will learn a lot from it.
http://bit.ly/EXPERTCookBook
Basically he is from India, who loves to explore the .NET world. He loves to code and in his leisure you always find him talking about technical stuffs.
Working as a VP product of
APPSeCONNECT, an integration platform of future, he does all sort of innovation around the product.
Have any problem? Write to him in his
Forum.
You can also mail him directly to
abhi2434@yahoo.com
Want a Coder like him for your project?
Drop him a mail to
contact@abhisheksur.com
Visit His Blog
Dotnet Tricks and Tips
Dont forget to vote or share your comments about his Writing