Skip to content
Browse files

Initial add of files from my old Subversion repository

  • Loading branch information...
0 parents commit ddf57e9332848b02e016fb383064bd3172b7996d @PaulStovell committed Jan 17, 2009
Showing with 1,342 additions and 0 deletions.
  1. +24 −0 Source/TeamBuildMonitorGadget.sln
  2. +19 −0 Source/TeamBuildMonitorGadget/App.xaml
  3. +16 −0 Source/TeamBuildMonitorGadget/App.xaml.cs
  4. +80 −0 Source/TeamBuildMonitorGadget/BuildStoreDriver.cs
  5. +63 −0 Source/TeamBuildMonitorGadget/BuildStoreWorker.cs
  6. +72 −0 Source/TeamBuildMonitorGadget/BuildSummary.cs
  7. +34 −0 Source/TeamBuildMonitorGadget/BuildSummaryFactory.cs
  8. +38 −0 Source/TeamBuildMonitorGadget/DateConverter.cs
  9. +24 −0 Source/TeamBuildMonitorGadget/Gadget.html
  10. +21 −0 Source/TeamBuildMonitorGadget/Gadget.xml
  11. BIN Source/TeamBuildMonitorGadget/GadgetBackground.png
  12. BIN Source/TeamBuildMonitorGadget/GadgetIcon.gif
  13. +26 −0 Source/TeamBuildMonitorGadget/IsNullVisibilityConverter.cs
  14. +147 −0 Source/TeamBuildMonitorGadget/MainPage.xaml
  15. +83 −0 Source/TeamBuildMonitorGadget/MainPage.xaml.cs
  16. +62 −0 Source/TeamBuildMonitorGadget/Properties/AssemblyInfo.cs
  17. +63 −0 Source/TeamBuildMonitorGadget/Properties/Resources.Designer.cs
  18. +117 −0 Source/TeamBuildMonitorGadget/Properties/Resources.resx
  19. +26 −0 Source/TeamBuildMonitorGadget/Properties/Settings.Designer.cs
  20. +7 −0 Source/TeamBuildMonitorGadget/Properties/Settings.settings
  21. +33 −0 Source/TeamBuildMonitorGadget/Properties/app.manifest
  22. +85 −0 Source/TeamBuildMonitorGadget/Settings.cs
  23. +64 −0 Source/TeamBuildMonitorGadget/SettingsWindow.xaml
  24. +52 −0 Source/TeamBuildMonitorGadget/SettingsWindow.xaml.cs
  25. +186 −0 Source/TeamBuildMonitorGadget/TeamBuildMonitorGadget.csproj
  26. BIN Source/TeamBuildMonitorGadget/TeamBuildMonitorGadget_TemporaryKey.pfx
24 Source/TeamBuildMonitorGadget.sln
@@ -0,0 +1,24 @@
+
+Microsoft Visual Studio Solution File, Format Version 9.00
+# Visual Studio 2005
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TeamBuildMonitorGadget", "TeamBuildMonitorGadget\TeamBuildMonitorGadget.csproj", "{BA7022CF-10AD-4F4A-9C01-86E739B92318}"
+ ProjectSection(WebsiteProperties) = preProject
+ Debug.AspNetCompiler.Debug = "True"
+ Release.AspNetCompiler.Debug = "False"
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {BA7022CF-10AD-4F4A-9C01-86E739B92318}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {BA7022CF-10AD-4F4A-9C01-86E739B92318}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BA7022CF-10AD-4F4A-9C01-86E739B92318}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {BA7022CF-10AD-4F4A-9C01-86E739B92318}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
19 Source/TeamBuildMonitorGadget/App.xaml
@@ -0,0 +1,19 @@
+<Application x:Class="TeamBuildMonitorGadget.App"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ StartupUri="MainPage.xaml"
+ xmlns:local="clr-namespace:PaulStovell.TeamBuildMonitorGadget"
+ >
+ <Application.Resources>
+ <Style TargetType="{x:Type TextBlock}">
+ <Setter Property="FontFamily" Value="Segoe UI" />
+ <Setter Property="FontSize" Value="9pt" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ </Style>
+
+ <local:DateConverter x:Key="Converter_DateConverter" />
+ <local:IsNullVisibilityConverter x:Key="Converter_IsNullVisibilityConverter" />
+
+
+ </Application.Resources>
+</Application>
16 Source/TeamBuildMonitorGadget/App.xaml.cs
@@ -0,0 +1,16 @@
+using System;
+using System.Windows;
+using System.Windows.Navigation;
+using System.Data;
+using System.Xml;
+using System.Configuration;
+
+namespace TeamBuildMonitorGadget {
+ /// <summary>
+ /// Interaction logic for App.xaml
+ /// </summary>
+
+ public partial class App : System.Windows.Application {
+
+ }
+}
80 Source/TeamBuildMonitorGadget/BuildStoreDriver.cs
@@ -0,0 +1,80 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows;
+using Microsoft.TeamFoundation.Build.Proxy;
+using System.ComponentModel;
+using System.Windows.Documents;
+using System.Collections.ObjectModel;
+using Microsoft.TeamFoundation.Client;
+using System.Net;
+using Microsoft.TeamFoundation.Build.Common;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class BuildStoreDriver : DependencyObject {
+ private BuildStoreWorker _backgroundWorker;
+
+ public BuildStoreDriver() {
+
+ }
+
+ public static readonly DependencyProperty TeamFoundationServerUriProperty = DependencyProperty.Register("TeamFoundationServerUri", typeof(string), typeof(BuildStoreDriver), new UIPropertyMetadata(null, RecreateBackgroundWorker));
+ public static readonly DependencyProperty TeamProjectNameProperty = DependencyProperty.Register("TeamProjectName", typeof(string), typeof(BuildStoreDriver), new UIPropertyMetadata(null, RecreateBackgroundWorker));
+ public static readonly DependencyProperty TeamBuildTypeNameProperty = DependencyProperty.Register("TeamBuildTypeName", typeof(string), typeof(BuildStoreDriver), new UIPropertyMetadata(null, RecreateBackgroundWorker));
+ public static readonly DependencyProperty IsUpdatingProperty = DependencyProperty.Register("IsUpdating", typeof(bool), typeof(BuildStoreDriver), new UIPropertyMetadata(false));
+ public static readonly DependencyProperty LastExceptionProperty = DependencyProperty.Register("LastException", typeof(Exception), typeof(BuildStoreDriver), new UIPropertyMetadata(null));
+ private static readonly DependencyPropertyKey PreviousBuildsPropertyKey = DependencyProperty.RegisterReadOnly("PreviousBuilds", typeof(ObservableCollection<BuildSummary>), typeof(BuildStoreDriver), new UIPropertyMetadata(null));
+ public static readonly DependencyProperty PreviousBuildsProperty = PreviousBuildsPropertyKey.DependencyProperty;
+
+ public ObservableCollection<BuildSummary> PreviousBuilds {
+ get { return (ObservableCollection<BuildSummary>)GetValue(PreviousBuildsProperty); }
+ private set { SetValue(PreviousBuildsPropertyKey, value); }
+ }
+
+ public string TeamFoundationServerUri {
+ get { return (string)GetValue(TeamFoundationServerUriProperty); }
+ set { SetValue(TeamFoundationServerUriProperty, value); }
+ }
+
+ public string TeamProjectName {
+ get { return (string)GetValue(TeamProjectNameProperty); }
+ set { SetValue(TeamProjectNameProperty, value); }
+ }
+
+ public string TeamBuildTypeName {
+ get { return (string)GetValue(TeamBuildTypeNameProperty); }
+ set { SetValue(TeamBuildTypeNameProperty, value); }
+ }
+
+ public Exception LastException {
+ get { return (Exception)GetValue(LastExceptionProperty); }
+ set { SetValue(LastExceptionProperty, value); }
+ }
+
+ private static void RecreateBackgroundWorker(DependencyObject dependencyObject, DependencyPropertyChangedEventArgs e) {
+ BuildStoreDriver driver = dependencyObject as BuildStoreDriver;
+ if (driver != null) {
+ driver.PreviousBuilds = new ObservableCollection<BuildSummary>();
+ if (driver._backgroundWorker != null) {
+ driver._backgroundWorker.CancelAsync();
+ }
+ driver._backgroundWorker = new BuildStoreWorker(driver.TeamFoundationServerUri, driver.TeamProjectName, driver.TeamBuildTypeName, driver.PreviousBuilds);
+ driver._backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(
+ delegate(object sender, RunWorkerCompletedEventArgs workedCompletedEventArgs) {
+ if (workedCompletedEventArgs.Error != null) {
+ driver.LastException = workedCompletedEventArgs.Error;
+ }
+ });
+ }
+ }
+
+ public void Monitor() {
+ VerifyAccess();
+
+ if (!_backgroundWorker.IsBusy) {
+ this.LastException = null;
+ _backgroundWorker.RunWorkerAsync();
+ }
+ }
+ }
+}
63 Source/TeamBuildMonitorGadget/BuildStoreWorker.cs
@@ -0,0 +1,63 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+using Microsoft.TeamFoundation.Client;
+using Microsoft.TeamFoundation.Build.Proxy;
+using System.Collections.ObjectModel;
+using System.Net;
+using System.Threading;
+using System.Windows;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class BuildStoreWorker : BackgroundWorker {
+ private string _teamFoundationServerUri;
+ private string _teamProjectName;
+ private string _teamBuildTypeName;
+ private BuildSummaryFactory _summaryFactory;
+ private ObservableCollection<BuildSummary> _buildSummaries;
+
+ public BuildStoreWorker(string teamFoundationServerUri, string teamProjectName, string teamBuildTypeName, ObservableCollection<BuildSummary> buildSummaries) {
+ _teamFoundationServerUri = teamFoundationServerUri;
+ _teamProjectName = teamProjectName;
+ _teamBuildTypeName = teamBuildTypeName;
+ _buildSummaries = buildSummaries;
+ _summaryFactory = new BuildSummaryFactory();
+
+ this.WorkerSupportsCancellation = true;
+ this.WorkerReportsProgress = true;
+ this.DoWork += new DoWorkEventHandler(BuildStoreWorker_DoWork);
+ this.ProgressChanged += new ProgressChangedEventHandler(BuildStoreWorker_ProgressChanged);
+ }
+
+ private void BuildStoreWorker_DoWork(object sender, DoWorkEventArgs e) {
+
+ TeamFoundationServer server = new TeamFoundationServer(_teamFoundationServerUri, CredentialCache.DefaultCredentials);
+ server.EnsureAuthenticated();
+
+ while (!this.CancellationPending) {
+ BuildStore store = (BuildStore)server.GetService(typeof(BuildStore));
+ BuildData[] builds = store.GetListOfBuilds(_teamProjectName, _teamBuildTypeName);
+ this.ReportProgress(0, builds);
+ Thread.Sleep(30000);
+ }
+ }
+
+ private void BuildStoreWorker_ProgressChanged(object sender, ProgressChangedEventArgs e) {
+ BuildData[] results = (BuildData[])e.UserState;
+
+ List<BuildSummary> summaries = new List<BuildSummary>();
+ foreach (BuildData buildData in results) {
+ BuildSummary summary = _summaryFactory.GetBuildSummary(buildData);
+ summaries.Add(summary);
+ }
+ summaries.Sort();
+
+ _buildSummaries.Clear();
+ for (int i = 0; i < summaries.Count && i < 4; i++) {
+ _buildSummaries.Add(summaries[i]);
+ }
+
+ }
+ }
+}
72 Source/TeamBuildMonitorGadget/BuildSummary.cs
@@ -0,0 +1,72 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.ComponentModel;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class BuildSummary : INotifyPropertyChanged, IComparable<BuildSummary> {
+ private string _buildNumber;
+ private DateTime _buildDate;
+ private string _buildStatus;
+ private string _buildUri;
+ private string _dropLocation;
+
+ public static readonly PropertyChangedEventArgs BuildNumberPropertyChangedEventArgs = new PropertyChangedEventArgs("BuildNumber");
+ public static readonly PropertyChangedEventArgs BuildDatePropertyChangedEventArgs = new PropertyChangedEventArgs("BuildDate");
+ public static readonly PropertyChangedEventArgs BuildStatusPropertyChangedEventArgs = new PropertyChangedEventArgs("BuildStatus");
+ public static readonly PropertyChangedEventArgs DropLocationPropertyChangedEventArgs = new PropertyChangedEventArgs("DropLocation");
+
+ public string BuildUri {
+ get { return _buildUri; }
+ internal set { _buildUri = value; }
+ }
+
+ public string BuildNumber {
+ get { return _buildNumber; }
+ set {
+ _buildNumber = value;
+ OnPropertyChanged(BuildNumberPropertyChangedEventArgs);
+ }
+ }
+
+ public DateTime BuildDate {
+ get { return _buildDate; }
+ set {
+ _buildDate = value;
+ OnPropertyChanged(BuildDatePropertyChangedEventArgs);
+ }
+ }
+
+ public string BuildStatus {
+ get { return _buildStatus; }
+ set {
+ _buildStatus = value;
+ OnPropertyChanged(BuildStatusPropertyChangedEventArgs);
+ }
+ }
+
+ public string DropLocation {
+ get { return _dropLocation; }
+ set {
+ _dropLocation = value;
+ OnPropertyChanged(DropLocationPropertyChangedEventArgs);
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void OnPropertyChanged(PropertyChangedEventArgs e) {
+ if (this.PropertyChanged != null) {
+ this.PropertyChanged(this, e);
+ }
+ }
+
+ #region IComparable<BuildSummary> Members
+
+ public int CompareTo(BuildSummary other) {
+ return other.BuildDate.CompareTo(this.BuildDate);
+ }
+
+ #endregion
+ }
+}
34 Source/TeamBuildMonitorGadget/BuildSummaryFactory.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using Microsoft.TeamFoundation.Build.Proxy;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class BuildSummaryFactory {
+ private List<BuildSummary> _summaries = new List<BuildSummary>();
+
+ public BuildSummary GetBuildSummary(BuildData buildData) {
+ BuildSummary result = null;
+
+ foreach (BuildSummary summary in _summaries) {
+ if (summary.BuildUri == buildData.BuildUri) {
+ result = summary;
+ break;
+ }
+ }
+
+ if (result == null) {
+ result = new BuildSummary();
+ _summaries.Add(result);
+ }
+
+ result.BuildDate = buildData.StartTime;
+ result.BuildNumber = buildData.BuildNumber;
+ result.BuildStatus = buildData.BuildStatus;
+ result.BuildUri = buildData.BuildUri;
+ result.DropLocation = buildData.DropLocation;
+
+ return result;
+ }
+ }
+}
38 Source/TeamBuildMonitorGadget/DateConverter.cs
@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Data;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class DateConverter : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
+ string result = string.Empty;
+
+ if (value != null) {
+ DateTime dt = (DateTime)value;
+ if (parameter != null) {
+ if (parameter.ToString() == "today") {
+ if (dt.Date == DateTime.Today) {
+ result = "Today";
+ } else if (dt.Date == DateTime.Today.AddDays(-1)) {
+ result = "Yesterday";
+ } else {
+ result = dt.ToString("dd-MMM");
+ }
+ } else {
+ result = dt.ToString(parameter.ToString());
+ }
+ } else {
+ result = dt.ToString("dd-MMM");
+ }
+ }
+
+ return result;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+}
24 Source/TeamBuildMonitorGadget/Gadget.html
@@ -0,0 +1,24 @@
+<html>
+ <head>
+ <title>Team Build Monitor Gadget</title>
+ <style>
+ body {
+ width:130;
+ height:200;
+ padding:0;
+ margin:0;
+ background:transparent;
+ background-image: url('GadgetBackground.png');
+ }
+ </style>
+
+ </head>
+ <body>
+ <iframe
+ width="130"
+ height="200"
+ src="TeamBuildMonitorGadget.xbap"
+ >
+ </iframe>
+ </body>
+</html>
21 Source/TeamBuildMonitorGadget/Gadget.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<gadget>
+ <name>Team Build Monitor</name>
+ <namespace>PaulStovell.TeamBuildMonitorGadget</namespace>
+ <version>1.0.0.0</version>
+ <author name="Paul Stovell">
+ <info url="http://paulstovell.net/" />
+ </author>
+ <copyright>2007</copyright>
+ <description>Team Build Monitor</description>
+ <icons>
+ <icon height="48" width="48" src="GadgetIcon.gif" />
+ </icons>
+ <hosts>
+ <host name="sidebar">
+ <base type="HTML" apiVersion="1.0.0" src="Gadget.html" />
+ <permissions>full</permissions>
+ <platform minPlatformVersion="0.3" />
+ </host>
+ </hosts>
+</gadget>
BIN Source/TeamBuildMonitorGadget/GadgetBackground.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
BIN Source/TeamBuildMonitorGadget/GadgetIcon.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 Source/TeamBuildMonitorGadget/IsNullVisibilityConverter.cs
@@ -0,0 +1,26 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Data;
+using System.Windows;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class IsNullVisibilityConverter : IValueConverter {
+
+ public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
+ Visibility result = Visibility.Visible;
+
+ if (parameter == null) {
+ result = (value == null) ? Visibility.Visible : Visibility.Collapsed;
+ } else if (parameter.ToString().ToLower().Contains("not")) {
+ result = (value == null) ? Visibility.Collapsed : Visibility.Visible;
+ }
+
+ return result;
+ }
+
+ public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) {
+ throw new Exception("The method or operation is not implemented.");
+ }
+ }
+}
147 Source/TeamBuildMonitorGadget/MainPage.xaml
@@ -0,0 +1,147 @@
+<Page
+ x:Class="PaulStovell.TeamBuildMonitorGadget.MainPage"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="MainPage"
+ x:Name="_this"
+ xmlns:tfsbuildcommon="clr-namespace:Microsoft.TeamFoundation.Build.Common;assembly=Microsoft.TeamFoundation.Build.Common"
+ xmlns:local="clr-namespace:PaulStovell.TeamBuildMonitorGadget"
+ Background="Black"
+ >
+ <Page.Resources>
+
+ <RadialGradientBrush x:Key="Local_FailedItemBackgroundBrush">
+ <GradientStop Color="#551111" Offset="0" />
+ <GradientStop Color="#AA3311" Offset="1" />
+ </RadialGradientBrush>
+
+ <RadialGradientBrush x:Key="Local_SuccessfullItemBackgroundBrush">
+ <GradientStop Color="#115511" Offset="0.5" />
+ <GradientStop Color="#337711" Offset="1" />
+ </RadialGradientBrush>
+
+ <RadialGradientBrush x:Key="Local_InProgressItemBackgroundBrush">
+ <GradientStop Color="#111155" Offset="0" />
+ <GradientStop Color="#1133AA" Offset="1" />
+ </RadialGradientBrush>
+
+ <Style TargetType="{x:Type TextBlock}">
+ <Setter Property="Margin" Value="0,2,0,2" />
+ </Style>
+
+ <Style x:Key="Local_BuildSummaryStyle" TargetType="{x:Type ListBoxItem}">
+ <Setter Property="Template">
+ <Setter.Value>
+ <ControlTemplate TargetType="{x:Type ListBoxItem}">
+ <Border
+ CornerRadius="3"
+ BorderBrush="#000000"
+ BorderThickness="1"
+ SnapsToDevicePixels="True"
+ >
+ <Border
+ CornerRadius="3"
+ BorderBrush="#333333"
+ BorderThickness="1"
+ Background="{StaticResource Local_InProgressItemBackgroundBrush}"
+ x:Name="PART_BuildSummaryStyle_Border"
+ Padding="7"
+ SnapsToDevicePixels="True"
+ MouseDown="BuildItem_Clicked"
+ Tag="{Binding }"
+ ToolTip="{Binding Path=BuildStatus}"
+ Cursor="Hand"
+ >
+ <DockPanel>
+ <TextBlock
+ Foreground="White"
+ Text="{Binding Path=BuildDate, Converter={StaticResource Converter_DateConverter}, ConverterParameter=hh:mm tt}"
+ DockPanel.Dock="Left"
+ >
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="Black" GlowSize="5" Noise="0" Opacity="0.5" />
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ <TextBlock
+ Foreground="White"
+ Text="{Binding Path=BuildDate, Converter={StaticResource Converter_DateConverter}, ConverterParameter=today}"
+ DockPanel.Dock="Right"
+ TextAlignment="Right"
+ >
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="Black" GlowSize="5" Noise="0" Opacity="0.5" />
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+ </DockPanel>
+ </Border>
+ </Border>
+
+ <ControlTemplate.Triggers>
+ <DataTrigger Binding="{Binding Path=BuildStatus}" Value="Failed">
+ <Setter TargetName="PART_BuildSummaryStyle_Border" Property="Background" Value="{StaticResource Local_FailedItemBackgroundBrush}" />
+ </DataTrigger>
+ <DataTrigger Binding="{Binding Path=BuildStatus}" Value="Successfully Completed">
+ <Setter TargetName="PART_BuildSummaryStyle_Border" Property="Background" Value="{StaticResource Local_SuccessfullItemBackgroundBrush}" />
+ </DataTrigger>
+ </ControlTemplate.Triggers>
+ </ControlTemplate>
+ </Setter.Value>
+ </Setter>
+ </Style>
+ </Page.Resources>
+
+ <DockPanel MaxWidth="130">
+
+ <TextBlock
+ DockPanel.Dock="Top"
+ TextAlignment="Center"
+ Text="{Binding ElementName=_this, Path=FriendlyName}"
+ Foreground="White"
+ TextWrapping="Wrap"
+ TextTrimming="CharacterEllipsis"
+ >
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="#444444" GlowSize="3" Noise="0" Opacity="0.7" />
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+
+ <TextBlock DockPanel.Dock="Bottom" TextAlignment="Center">
+ <Hyperlink Click="SettingsLink_Clicked" Foreground="#CCCCCC">Settings</Hyperlink>
+ <TextBlock.BitmapEffect>
+ <OuterGlowBitmapEffect GlowColor="#444444" GlowSize="3" Noise="0" Opacity="0.7" />
+ </TextBlock.BitmapEffect>
+ </TextBlock>
+
+ <Grid>
+ <ListBox
+ ItemContainerStyle="{StaticResource Local_BuildSummaryStyle}"
+ ItemsSource="{Binding ElementName=_this, Path=BuildStoreDriver.PreviousBuilds}"
+ Padding="0"
+ BorderBrush="Transparent"
+ BorderThickness="0"
+ Background="Transparent"
+ ScrollViewer.CanContentScroll="False"
+ ScrollViewer.HorizontalScrollBarVisibility="Disabled"
+ ScrollViewer.VerticalScrollBarVisibility="Disabled"
+ Visibility="{Binding ElementName=_this, Path=BuildStoreDriver.LastException, Converter={StaticResource Converter_IsNullVisibilityConverter}}"
+ >
+ </ListBox>
+
+ <TextBlock
+ Foreground="White"
+ Visibility="{Binding ElementName=_this, Path=BuildStoreDriver.LastException, Converter={StaticResource Converter_IsNullVisibilityConverter}, ConverterParameter=NOT}"
+ TextWrapping="Wrap"
+ TextTrimming="CharacterEllipsis"
+ >
+ <TextBlock
+ TextWrapping="Wrap"
+ TextTrimming="CharacterEllipsis"
+ >There was an error communicating with the server. </TextBlock>
+ <Hyperlink Foreground="White" Click="ExceptionDetailsLink_Clicked">View details</Hyperlink>
+ <TextBlock> | </TextBlock>
+ <Hyperlink Foreground="White" Click="TryAgainLink_Clicked">Try again</Hyperlink>
+ </TextBlock>
+
+ </Grid>
+ </DockPanel>
+</Page>
83 Source/TeamBuildMonitorGadget/MainPage.xaml.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+using System.Timers;
+using System.Diagnostics;
+using Microsoft.TeamFoundation.VersionControl.Client;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ /// <summary>
+ /// Interaction logic for MainPage.xaml
+ /// </summary>
+ public partial class MainPage : System.Windows.Controls.Page {
+ /// <summary>
+ /// Constructor.
+ /// </summary>
+ public MainPage() {
+ InitializeComponent();
+
+ LoadSettings();
+ }
+
+ public static readonly DependencyProperty BuildStoreDriverProperty = DependencyProperty.Register("BuildStoreDriver", typeof(BuildStoreDriver), typeof(MainPage), new UIPropertyMetadata(null));
+ public static readonly DependencyProperty FriendlyNameProperty = DependencyProperty.Register("FriendlyName", typeof(string), typeof(MainPage), new UIPropertyMetadata(null));
+
+ public BuildStoreDriver BuildStoreDriver {
+ get { return (BuildStoreDriver)GetValue(BuildStoreDriverProperty); }
+ set { SetValue(BuildStoreDriverProperty, value); }
+ }
+
+ public string FriendlyName {
+ get { return (string)GetValue(FriendlyNameProperty); }
+ set { SetValue(FriendlyNameProperty, value); }
+ }
+
+ private void BuildItem_Clicked(object sender, RoutedEventArgs e) {
+ FrameworkElement element = sender as FrameworkElement;
+ if (element != null) {
+ BuildSummary summary = element.Tag as BuildSummary;
+ if (summary != null && summary.DropLocation != null && summary.DropLocation.Length > 0) {
+ Process.Start(summary.DropLocation);
+ }
+ }
+ }
+
+ private void ExceptionDetailsLink_Clicked(object sender, RoutedEventArgs e) {
+ if (BuildStoreDriver.LastException != null) {
+ MessageBox.Show(BuildStoreDriver.LastException.ToString());
+ }
+ }
+
+ private void TryAgainLink_Clicked(object sender, RoutedEventArgs e) {
+ this.BuildStoreDriver.Monitor();
+ }
+
+ private void SettingsLink_Clicked(object sender, RoutedEventArgs e) {
+ SettingsWindow window = new SettingsWindow();
+ window.ShowDialog();
+ LoadSettings();
+ }
+
+ private void LoadSettings() {
+ Settings settings = Settings.GetSettings();
+ this.FriendlyName = settings.FriendlyName;
+
+ BuildStoreDriver driver = new BuildStoreDriver();
+ driver.TeamFoundationServerUri = settings.TeamFoundationServerUri;
+ driver.TeamProjectName = settings.TeamProjectName;
+ driver.TeamBuildTypeName = settings.TeamBuildTypeName;
+ driver.Monitor();
+
+ this.BuildStoreDriver = driver;
+ }
+ }
+}
62 Source/TeamBuildMonitorGadget/Properties/AssemblyInfo.cs
@@ -0,0 +1,62 @@
+#region Using directives
+
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Resources;
+using System.Globalization;
+using System.Windows;
+using System.Runtime.InteropServices;
+
+#endregion
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("TeamBuildMonitorGadget")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("TeamBuildMonitorGadget")]
+[assembly: AssemblyCopyright("Copyright @ 2007")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+[assembly: ComVisible(false)]
+
+//In order to begin building localizable applications, set
+//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
+//inside a <PropertyGroup>. For example, if you are using US english
+//in your source files, set the <UICulture> to en-US. Then uncomment
+//the NeutralResourceLanguage attribute below. Update the "en-US" in
+//the line below to match the UICulture setting in the project file.
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+// Specifies the location in which theme dictionaries are stored for types in an assembly.
+[assembly: ThemeInfo(
+ // Specifies the location of system theme-specific resource dictionaries for this project.
+ // The default setting in this project is "None" since this default project does not
+ // include these user-defined theme files:
+ // Themes\Aero.NormalColor.xaml
+ // Themes\Classic.xaml
+ // Themes\Luna.Homestead.xaml
+ // Themes\Luna.Metallic.xaml
+ // Themes\Luna.NormalColor.xaml
+ // Themes\Royale.NormalColor.xaml
+ ResourceDictionaryLocation.None,
+
+ // Specifies the location of the system non-theme specific resource dictionary:
+ // Themes\generic.xaml
+ ResourceDictionaryLocation.SourceAssembly)]
+
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Revision and Build Numbers
+// by using the '*' as shown below:
+[assembly: AssemblyVersion("1.0.*")]
63 Source/TeamBuildMonitorGadget/Properties/Resources.Designer.cs
@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.312
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PaulStovell.TeamBuildMonitorGadget.Properties {
+ using System;
+
+
+ /// <summary>
+ /// A strongly-typed resource class, for looking up localized strings, etc.
+ /// </summary>
+ // This class was auto-generated by the StronglyTypedResourceBuilder
+ // class via a tool like ResGen or Visual Studio.
+ // To add or remove a member, edit your .ResX file then rerun ResGen
+ // with the /str option, or rebuild your VS project.
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ internal class Resources {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal Resources() {
+ }
+
+ /// <summary>
+ /// Returns the cached ResourceManager instance used by this class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PaulStovell.TeamBuildMonitorGadget.Properties.Resources", typeof(Resources).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ /// <summary>
+ /// Overrides the current thread's CurrentUICulture property for all
+ /// resource lookups using this strongly typed resource class.
+ /// </summary>
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ internal static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+ }
+}
117 Source/TeamBuildMonitorGadget/Properties/Resources.resx
@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+ <!--
+ Microsoft ResX Schema
+
+ Version 2.0
+
+ The primary goals of this format is to allow a simple XML format
+ that is mostly human readable. The generation and parsing of the
+ various data types are done through the TypeConverter classes
+ associated with the data types.
+
+ Example:
+
+ ... ado.net/XML headers & schema ...
+ <resheader name="resmimetype">text/microsoft-resx</resheader>
+ <resheader name="version">2.0</resheader>
+ <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+ <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+ <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+ <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+ <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+ <value>[base64 mime encoded serialized .NET Framework object]</value>
+ </data>
+ <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+ <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+ <comment>This is a comment</comment>
+ </data>
+
+ There are any number of "resheader" rows that contain simple
+ name/value pairs.
+
+ Each data row contains a name, and value. The row also contains a
+ type or mimetype. Type corresponds to a .NET class that support
+ text/value conversion through the TypeConverter architecture.
+ Classes that don't support this are serialized and stored with the
+ mimetype set.
+
+ The mimetype is used for serialized objects, and tells the
+ ResXResourceReader how to depersist the object. This is currently not
+ extensible. For a given mimetype the value must be set accordingly:
+
+ Note - application/x-microsoft.net.object.binary.base64 is the format
+ that the ResXResourceWriter will generate, however the reader can
+ read any of the formats listed below.
+
+ mimetype: application/x-microsoft.net.object.binary.base64
+ value : The object must be serialized with
+ : System.Serialization.Formatters.Binary.BinaryFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.soap.base64
+ value : The object must be serialized with
+ : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+ : and then encoded with base64 encoding.
+
+ mimetype: application/x-microsoft.net.object.bytearray.base64
+ value : The object must be serialized into a byte array
+ : using a System.ComponentModel.TypeConverter
+ : and then encoded with base64 encoding.
+ -->
+ <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+ <xsd:element name="root" msdata:IsDataSet="true">
+ <xsd:complexType>
+ <xsd:choice maxOccurs="unbounded">
+ <xsd:element name="metadata">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" />
+ <xsd:attribute name="type" type="xsd:string" />
+ <xsd:attribute name="mimetype" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="assembly">
+ <xsd:complexType>
+ <xsd:attribute name="alias" type="xsd:string" />
+ <xsd:attribute name="name" type="xsd:string" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="data">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+ <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+ <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+ </xsd:complexType>
+ </xsd:element>
+ <xsd:element name="resheader">
+ <xsd:complexType>
+ <xsd:sequence>
+ <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+ </xsd:sequence>
+ <xsd:attribute name="name" type="xsd:string" use="required" />
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:choice>
+ </xsd:complexType>
+ </xsd:element>
+ </xsd:schema>
+ <resheader name="resmimetype">
+ <value>text/microsoft-resx</value>
+ </resheader>
+ <resheader name="version">
+ <value>2.0</value>
+ </resheader>
+ <resheader name="reader">
+ <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+ <resheader name="writer">
+ <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+ </resheader>
+</root>
26 Source/TeamBuildMonitorGadget/Properties/Settings.Designer.cs
@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+// This code was generated by a tool.
+// Runtime Version:2.0.50727.312
+//
+// Changes to this file may cause incorrect behavior and will be lost if
+// the code is regenerated.
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace PaulStovell.TeamBuildMonitorGadget.Properties {
+
+
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "8.0.0.0")]
+ internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+
+ private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+
+ public static Settings Default {
+ get {
+ return defaultInstance;
+ }
+ }
+ }
+}
7 Source/TeamBuildMonitorGadget/Properties/Settings.settings
@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='iso-8859-1'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+ <Profiles>
+ <Profile Name="(Default)" />
+ </Profiles>
+ <Settings />
+</SettingsFile>
33 Source/TeamBuildMonitorGadget/Properties/app.manifest
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<asmv1:assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1" xmlns:asmv1="urn:schemas-microsoft-com:asm.v1" xmlns:asmv2="urn:schemas-microsoft-com:asm.v2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
+ <security>
+ <applicationRequestMinimum>
+ <defaultAssemblyRequest permissionSetReference="Custom" />
+ <PermissionSet class="System.Security.PermissionSet" version="1" Unrestricted="true" ID="Custom" SameSite="site">
+ <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.FileDialogPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.RegistryPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="Assertion, UnmanagedCode, Execution, ControlThread, ControlEvidence, ControlPolicy, SerializationFormatter, ControlDomainPolicy, ControlPrincipal, ControlAppDomain, RemotingConfiguration, Infrastructure, BindingRedirects" />
+ <IPermission class="System.Security.Permissions.UIPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.KeyContainerPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.StorePermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Net.DnsPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Drawing.Printing.PrintingPermission, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" version="1" Unrestricted="true" />
+ <IPermission class="System.Net.SocketPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Net.WebPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Diagnostics.EventLogPermission, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Data.OleDb.OleDbPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.DataProtectionPermission, System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" version="1" Unrestricted="true" />
+ <IPermission class="System.Security.Permissions.MediaPermission, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" version="1" Audio="SafeAudio" Video="SafeVideo" Image="SafeImage" />
+ <IPermission class="System.Security.Permissions.WebBrowserPermission, WindowsBase, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" version="1" Level="Safe" />
+ </PermissionSet>
+ </applicationRequestMinimum>
+ </security>
+ </trustInfo>
+</asmv1:assembly>
85 Source/TeamBuildMonitorGadget/Settings.cs
@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Deployment.Application;
+using System.Xml.Serialization;
+using System.Collections;
+using System.Web;
+using System.Reflection;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ public class Settings {
+ private string _settingsFileName;
+ private Dictionary<string, string> _innerSettings;
+
+ private Settings(string fileName) {
+ _settingsFileName = fileName;
+
+ _innerSettings = new Dictionary<string,string>();
+ if (File.Exists(_settingsFileName)) {
+ string[] lines = File.ReadAllLines(_settingsFileName);
+ foreach (string line in lines) {
+ string[] keyValuePair = line.Split('=');
+ string key = HttpUtility.UrlDecode(keyValuePair[0]);
+ string value = HttpUtility.UrlDecode(keyValuePair[1]);
+ _innerSettings[key] = value;
+ }
+ }
+ }
+
+ public string TeamFoundationServerUri {
+ get { return GetSetting("TeamFoundationServerUri", "http://myserver:8080"); }
+ set { SetSetting("TeamFoundationServerUri", value); }
+ }
+
+ public string TeamProjectName {
+ get { return GetSetting("TeamProjectName", "MyProjectName"); }
+ set { SetSetting("TeamProjectName", value); }
+ }
+
+ public string TeamBuildTypeName {
+ get { return GetSetting("TeamBuildTypeName", "MyBuildName"); }
+ set { SetSetting("TeamBuildTypeName", value); }
+ }
+
+ public string FriendlyName {
+ get { return GetSetting("FriendlyName", "My project\r\nMy favourite build"); }
+ set { SetSetting("FriendlyName", value); }
+ }
+
+ public string SettingsFileName {
+ get { return _settingsFileName; }
+ }
+
+ private string GetSetting(string settingName, string defaultValue) {
+ string result = defaultValue;
+ if (_innerSettings.ContainsKey(settingName)) {
+ result = _innerSettings[settingName];
+ }
+ return result;
+ }
+
+ private void SetSetting(string settingName, string value) {
+ _innerSettings[settingName] = value;
+ }
+
+ public void Save() {
+ List<string> lines = new List<string>();
+ foreach (KeyValuePair<string, string> kvp in _innerSettings) {
+ lines.Add(HttpUtility.UrlEncode(kvp.Key) + "=" + HttpUtility.UrlEncode(kvp.Value));
+ }
+ File.WriteAllLines(_settingsFileName, lines.ToArray());
+ }
+
+ public static Settings GetSettings() {
+ string startDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location.Replace("file:///", ""));
+ string filename = Path.Combine(startDirectory, "PaulStovell.NET\\TeamBuildMonitor");
+ if (!Directory.Exists(filename)) {
+ Directory.CreateDirectory(filename);
+ }
+ filename = Path.Combine(filename, "Settings.xml");
+ return new Settings(filename);
+ }
+ }
+}
64 Source/TeamBuildMonitorGadget/SettingsWindow.xaml
@@ -0,0 +1,64 @@
+<Window
+ x:Class="PaulStovell.TeamBuildMonitorGadget.SettingsWindow"
+ xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+ xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+ Title="PaulStovell.TeamBuildMonitorGadget"
+ Width="500"
+ Height="260"
+ x:Name="_this"
+ >
+ <Window.Resources>
+ <Style TargetType="{x:Type TextBox}">
+ <Setter Property="FontFamily" Value="Segoe UI" />
+ <Setter Property="FontSize" Value="10pt" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ <Setter Property="Margin" Value="7" />
+ </Style>
+
+ <Style TargetType="{x:Type TextBlock}">
+ <Setter Property="FontFamily" Value="Segoe UI" />
+ <Setter Property="FontSize" Value="10pt" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ <Setter Property="Margin" Value="7" />
+ </Style>
+
+ <Style TargetType="{x:Type Button}">
+ <Setter Property="FontFamily" Value="Segoe UI" />
+ <Setter Property="FontSize" Value="10pt" />
+ <Setter Property="VerticalAlignment" Value="Center" />
+ <Setter Property="Margin" Value="7" />
+ <Setter Property="Width" Value="75" />
+ <Setter Property="Height" Value="23" />
+ </Style>
+ </Window.Resources>
+
+ <Grid Margin="7">
+ <Grid.ColumnDefinitions>
+ <ColumnDefinition Width="Auto" />
+ <ColumnDefinition Width="*" />
+ </Grid.ColumnDefinitions>
+
+ <Grid.RowDefinitions>
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ <RowDefinition Height="Auto" />
+ </Grid.RowDefinitions>
+
+ <TextBlock Grid.Column="0" Grid.Row="0" Text="Team Foundation Server URL:" />
+ <TextBlock Grid.Column="0" Grid.Row="1" Text="Team Project Name:" />
+ <TextBlock Grid.Column="0" Grid.Row="2" Text="Team Build Name:" />
+ <TextBlock Grid.Column="0" Grid.Row="3" Text="Display Name:" />
+
+ <TextBox Grid.Column="1" Grid.Row="0" Text="{Binding ElementName=_this, Path=Settings.TeamFoundationServerUri}" />
+ <TextBox Grid.Column="1" Grid.Row="1" Text="{Binding ElementName=_this, Path=Settings.TeamProjectName}" />
+ <TextBox Grid.Column="1" Grid.Row="2" Text="{Binding ElementName=_this, Path=Settings.TeamBuildTypeName}" />
+ <TextBox Grid.Column="1" Grid.Row="3" Text="{Binding ElementName=_this, Path=Settings.FriendlyName}" AcceptsReturn="True" Height="50" />
+
+ <StackPanel Grid.Column="1" HorizontalAlignment="Right" Grid.Row="4" Orientation="Horizontal">
+ <Button Click="SaveButton_Clicked">Save</Button>
+ <Button Click="CancelButton_Clicked">Cancel</Button>
+ </StackPanel>
+ </Grid>
+</Window>
52 Source/TeamBuildMonitorGadget/SettingsWindow.xaml.cs
@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows;
+using System.Windows.Controls;
+using System.Windows.Data;
+using System.Windows.Documents;
+using System.Windows.Input;
+using System.Windows.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Shapes;
+
+namespace PaulStovell.TeamBuildMonitorGadget {
+ /// <summary>
+ /// Interaction logic for SettingsWindow.xaml
+ /// </summary>
+ public partial class SettingsWindow : System.Windows.Window {
+ public SettingsWindow() {
+ InitializeComponent();
+
+ this.Settings = Settings.GetSettings();
+ }
+
+ /// <summary>
+ /// DependencyProperty for the Settings property.
+ /// </summary>
+ public static readonly DependencyProperty SettingsProperty = DependencyProperty.Register("Settings", typeof(Settings), typeof(SettingsWindow), new UIPropertyMetadata(null));
+
+ /// <summary>
+ /// Gets or sets the settings shown on the dialog.
+ /// </summary>
+ public Settings Settings {
+ get { return (Settings)GetValue(SettingsProperty); }
+ set { SetValue(SettingsProperty, value); }
+ }
+
+ /// <summary>
+ /// Called when the Save button is clicked.
+ /// </summary>
+ public void SaveButton_Clicked(object sender, RoutedEventArgs e) {
+ this.Settings.Save();
+ this.Close();
+ }
+
+ /// <summary>
+ /// Called when the Cancel button is clicked.
+ /// </summary>
+ public void CancelButton_Clicked(object sender, RoutedEventArgs e) {
+ this.Close();
+ }
+ }
+}
186 Source/TeamBuildMonitorGadget/TeamBuildMonitorGadget.csproj
@@ -0,0 +1,186 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProjectGuid>{BA7022CF-10AD-4F4A-9C01-86E739B92318}</ProjectGuid>
+ <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <RootNamespace>PaulStovell.TeamBuildMonitorGadget</RootNamespace>
+ <AssemblyName>TeamBuildMonitorGadget</AssemblyName>
+ <WarningLevel>4</WarningLevel>
+ <OutputType>winexe</OutputType>
+ <EnableSecurityDebugging>false</EnableSecurityDebugging>
+ <TargetZone>Custom</TargetZone>
+ <StartAction>Program</StartAction>
+ <StartProgram>$(WINDIR)\System32\PresentationHost.exe</StartProgram>
+ <StartArguments>-debug "$(MSBuildProjectDirectory)\bin\$(Configuration)\$(AssemblyName)$(ApplicationExtension)"</StartArguments>
+ <SignManifests>True</SignManifests>
+ <MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired>
+ <HostInBrowser>true</HostInBrowser>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <ManifestKeyFile>TeamBuildMonitorGadget_TemporaryKey.pfx</ManifestKeyFile>
+ <ManifestCertificateThumbprint>F77084D76CC675AC29126AB31829820F50E2E98C</ManifestCertificateThumbprint>
+ <GenerateManifests>true</GenerateManifests>
+ <ExcludedPermissions>
+ </ExcludedPermissions>
+ <PublishUrl>Publish\</PublishUrl>
+ <Install>false</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>false</MapFileExtensions>
+ <SupportUrl>http://www.paulstovell.net/</SupportUrl>
+ <ProductName>Team Build Monitor Gadget</ProductName>
+ <PublisherName>Paul Stovell</PublisherName>
+ <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
+ <TrustUrlParameters>true</TrustUrlParameters>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <ApplicationExtension>.xbap</ApplicationExtension>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>.\bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugSymbols>false</DebugSymbols>
+ <Optimize>true</Optimize>
+ <OutputPath>.\bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="Microsoft.TeamFoundation, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Build.Client, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.Client.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Build.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Build.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Client, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Client.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.VersionControl.Client, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Client.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.VersionControl.Common, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Common.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.VersionControl.Common.Integration, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Common.Integration.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.TeamFoundation.VersionControl.Controls, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.TeamFoundation.VersionControl.Controls.dll</HintPath>
+ </Reference>
+ <Reference Include="Microsoft.VisualStudio.TeamFoundation.VersionControl, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=x86">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>C:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PrivateAssemblies\Microsoft.VisualStudio.TeamFoundation.VersionControl.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Deployment" />
+ <Reference Include="System.Web" />
+ <Reference Include="System.Web.Services" />
+ <Reference Include="System.Xml" />
+ <Reference Include="WindowsBase" />
+ <Reference Include="PresentationCore" />
+ <Reference Include="PresentationFramework" />
+ <Reference Include="UIAutomationProvider" />
+ <Reference Include="UIAutomationTypes" />
+ <Reference Include="System.Printing" />
+ </ItemGroup>
+ <ItemGroup>
+ <ApplicationDefinition Include="App.xaml" />
+ <Compile Include="App.xaml.cs">
+ <DependentUpon>App.xaml</DependentUpon>
+ <SubType>Code</SubType>
+ </Compile>
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BuildStoreDriver.cs" />
+ <Compile Include="BuildStoreWorker.cs">
+ <SubType>Component</SubType>
+ </Compile>
+ <Compile Include="BuildSummary.cs" />
+ <Compile Include="BuildSummaryFactory.cs" />
+ <Compile Include="IsNullVisibilityConverter.cs" />
+ <Compile Include="DateConverter.cs" />
+ <Compile Include="MainPage.xaml.cs">
+ <DependentUpon>MainPage.xaml</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <EmbeddedResource Include="Properties\Resources.resx">
+ <Generator>ResXFileCodeGenerator</Generator>
+ <SubType>Designer</SubType>
+ <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+ </EmbeddedResource>
+ <None Include="Properties\Settings.settings">
+ <Generator>SettingsSingleFileGenerator</Generator>
+ <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+ </None>
+ <None Include="Properties\app.manifest" />
+ <None Include="TeamBuildMonitorGadget_TemporaryKey.pfx" />
+ <Compile Include="Properties\Resources.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTime>True</DesignTime>
+ <DependentUpon>Resources.resx</DependentUpon>
+ </Compile>
+ <Compile Include="Properties\Settings.Designer.cs">
+ <AutoGen>True</AutoGen>
+ <DesignTimeSharedInput>True</DesignTimeSharedInput>
+ <DependentUpon>Settings.settings</DependentUpon>
+ </Compile>
+ <Compile Include="Settings.cs" />
+ <Compile Include="SettingsWindow.xaml.cs">
+ <SubType>Code</SubType>
+ <DependentUpon>SettingsWindow.xaml</DependentUpon>
+ </Compile>
+ <AppDesigner Include="Properties\" />
+ </ItemGroup>
+ <ItemGroup>
+ <Page Include="MainPage.xaml" />
+ <Page Include="SettingsWindow.xaml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Content Include="Gadget.html">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="Gadget.xml">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="GadgetBackground.png">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ <Content Include="GadgetIcon.gif">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.2.0">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 2.0</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(MSBuildBinPath)\Microsoft.WinFX.targets" />
+</Project>
BIN Source/TeamBuildMonitorGadget/TeamBuildMonitorGadget_TemporaryKey.pfx
Binary file not shown.

0 comments on commit ddf57e9

Please sign in to comment.
Something went wrong with that request. Please try again.