Click here to Skip to main content
12,453,354 members (61,052 online)
Click here to Skip to main content

Stats

22.7K views
852 downloads
23 bookmarked
Posted

WPF: Integrating our application with the Windows 7 Taskbar (I)

, 24 Jul 2010 CPOL
The taskbar of Windows 7 is one of the major changes in the Operating System, and brings many advantages.
WPF Icon Overlay And ProgressBar
bin
Debug
WPF Icon Overlay And ProgressBar.vshost.exe
WPF Icon Overlay And ProgressBar.vshost.exe.manifest
images
BlueToy.ico
FireToy.ico
GreenToy.ico
NinjaToy.ico
overlay.png
PinkToy.ico
progressbar.png
My Project
MyExtensions
WPF Icon Overlay And ProgressBar.vbproj.user
Class MainWindow

#Region "Window Code"
    Private Sub MainWindow_Loaded(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles Me.Loaded
        Me.TaskbarItemInfo.ProgressState = Shell.TaskbarItemProgressState.None
        Me.TaskbarItemInfo.Overlay = Nothing
    End Sub
#End Region

#Region "Taskbar IconOverlay"
    Private Sub btnIconBlack_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIconBlack.Click
        Me.TaskbarItemInfo.Overlay = CType(Resources("IconBlack"), ImageSource)
    End Sub

    Private Sub btnIconBlue_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIconBlue.Click
        Me.TaskbarItemInfo.Overlay = CType(Resources("IconBlue"), ImageSource)
    End Sub

    Private Sub btnIconGreen_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIconGreen.Click
        Me.TaskbarItemInfo.Overlay = CType(Resources("IconGreen"), ImageSource)
    End Sub

    Private Sub btnIconPink_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIconPink.Click
        Me.TaskbarItemInfo.Overlay = CType(Resources("IconPink"), ImageSource)
    End Sub

    Private Sub btnIconRed_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIconRed.Click
        Me.TaskbarItemInfo.Overlay = CType(Resources("IconRed"), ImageSource)
    End Sub

    Private Sub btnIconReset_Click(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles btnIconReset.Click
        Me.TaskbarItemInfo.Overlay = Nothing
    End Sub
#End Region

#Region "Taskbar ProgressBar"
    Private Sub SlidValue_ValueChanged(ByVal sender As Object, ByVal e As System.Windows.RoutedPropertyChangedEventArgs(Of Double)) Handles SlidValue.ValueChanged
        Me.TaskbarItemInfo.ProgressValue = SlidValue.Value / 100
    End Sub

    Private Sub cmbEstilos_SelectionChanged(ByVal sender As Object, ByVal e As System.Windows.Controls.SelectionChangedEventArgs) Handles cmbEstilos.SelectionChanged
        Select Case DirectCast(e.AddedItems(0), System.Windows.Controls.ComboBoxItem).Content
            Case "Normal"
                SlidValue.IsEnabled = True
                Pbar.IsIndeterminate = False
                Me.TaskbarItemInfo.ProgressState = Shell.TaskbarItemProgressState.Normal
            Case "Error"
                SlidValue.IsEnabled = True
                Pbar.IsIndeterminate = False
                Me.TaskbarItemInfo.ProgressState = Shell.TaskbarItemProgressState.Error
            Case "Stop"
                SlidValue.IsEnabled = True
                Pbar.IsIndeterminate = False
                Me.TaskbarItemInfo.ProgressState = Shell.TaskbarItemProgressState.Paused
            Case "Indeterminate"
                SlidValue.IsEnabled = False
                Pbar.IsIndeterminate = True
                Me.TaskbarItemInfo.ProgressState = Shell.TaskbarItemProgressState.Indeterminate
            Case "None"
                SlidValue.IsEnabled = True
                Pbar.IsIndeterminate = False
                Me.TaskbarItemInfo.ProgressState = Shell.TaskbarItemProgressState.None
        End Select
    End Sub
#End Region
End Class

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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Josué Yeray Julián Ferreiro
Software Developer (Senior) Freelance Developer
Spain Spain
MVP Windows Platform Development 2014
MVP Windows Phone Development 2013
MVP Windows Phone Development 2012

You may also be interested in...

Pro
Pro
| Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.160826.1 | Last Updated 24 Jul 2010
Article Copyright 2010 by Josué Yeray Julián Ferreiro
Everything else Copyright © CodeProject, 1999-2016
Layout: fixed | fluid