Initial commit

This commit is contained in:
Chris Kaczor
2017-01-12 10:47:44 -05:00
commit 04cb9e6d69
16 changed files with 1174 additions and 0 deletions

275
.gitignore vendored Normal file
View File

@@ -0,0 +1,275 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.suo
*.user
*.userosscache
*.sln.docstates
# User-specific files (MonoDevelop/Xamarin Studio)
*.userprefs
# Build results
[Dd]ebug/
[Dd]ebugPublic/
[Rr]elease/
[Rr]eleases/
x64/
x86/
bld/
[Bb]in/
[Oo]bj/
[Ll]og/
# Visual Studio 2015 cache/options directory
.vs/
# Uncomment if you have tasks that create the project's static files in wwwroot
#wwwroot/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
# NUNIT
*.VisualState.xml
TestResult.xml
# Build Results of an ATL Project
[Dd]ebugPS/
[Rr]eleasePS/
dlldata.c
# .NET Core
project.lock.json
project.fragment.lock.json
artifacts/
**/Properties/launchSettings.json
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.svclog
*.scc
# Chutzpah Test files
_Chutzpah*
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opendb
*.opensdf
*.sdf
*.cachefile
*.VC.db
*.VC.VC.opendb
# Visual Studio profiler
*.psess
*.vsp
*.vspx
*.sap
# TFS 2012 Local Workspace
$tf/
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# JustCode is a .NET coding add-in
.JustCode
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# Visual Studio code coverage results
*.coverage
*.coveragexml
# NCrunch
_NCrunch_*
.*crunch*.local.xml
nCrunchTemp_*
# MightyMoose
*.mm.*
AutoTest.Net/
# Web workbench (sass)
.sass-cache/
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.[Pp]ublish.xml
*.azurePubxml
# TODO: Comment the next line if you want to checkin your web deploy settings
# but database connection strings (with potential passwords) will be unencrypted
*.pubxml
*.publishproj
# Microsoft Azure Web App publish settings. Comment the next line if you want to
# checkin your Azure Web App publish settings, but sensitive information contained
# in these scripts will be unencrypted
PublishScripts/
# NuGet Packages
*.nupkg
# The packages folder can be ignored because of Package Restore
**/packages/*
# except build/, which is used as an MSBuild target.
!**/packages/build/
# Uncomment if necessary however generally it will be regenerated when needed
#!**/packages/repositories.config
# NuGet v3's project.json files produces more ignoreable files
*.nuget.props
*.nuget.targets
# Microsoft Azure Build Output
csx/
*.build.csdef
# Microsoft Azure Emulator
ecf/
rcf/
# Windows Store app package directories and files
AppPackages/
BundleArtifacts/
Package.StoreAssociation.xml
_pkginfo.txt
# Visual Studio cache files
# files ending in .cache can be ignored
*.[Cc]ache
# but keep track of directories ending in .cache
!*.[Cc]ache/
# Others
ClientBin/
~$*
*~
*.dbmdl
*.dbproj.schemaview
*.jfm
*.pfx
*.publishsettings
node_modules/
orleans.codegen.cs
# Since there are multiple workflows, uncomment next line to ignore bower_components
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
#bower_components/
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file
# to a newer Visual Studio version. Backup files are not needed,
# because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
*.mdf
*.ldf
# Business Intelligence projects
*.rdl.data
*.bim.layout
*.bim_*.settings
# Microsoft Fakes
FakesAssemblies/
# GhostDoc plugin setting file
*.GhostDoc.xml
# Node.js Tools for Visual Studio
.ntvs_analysis.dat
# Visual Studio 6 build log
*.plg
# Visual Studio 6 workspace options file
*.opt
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
*.vbw
# Visual Studio LightSwitch build output
**/*.HTMLClient/GeneratedArtifacts
**/*.DesktopClient/GeneratedArtifacts
**/*.DesktopClient/ModelManifest.xml
**/*.Server/GeneratedArtifacts
**/*.Server/ModelManifest.xml
_Pvt_Extensions
# Paket dependency manager
.paket/paket.exe
paket-files/
# FAKE - F# Make
.fake/
# JetBrains Rider
.idea/
*.sln.iml
# CodeRush
.cr/
# Python Tools for Visual Studio (PTVS)
__pycache__/
*.pyc
# Cake - Uncomment if you are using it
# tools/**
# !tools/packages.config

27
App.config Normal file
View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<section name="JenkinsStatusWindow.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false"/>
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
<userSettings>
<JenkinsStatusWindow.Properties.Settings>
<setting name="AutoStart" serializeAs="String">
<value>True</value>
</setting>
<setting name="WindowSettings" serializeAs="String">
<value />
</setting>
<setting name="JenkinsProjects" serializeAs="String">
<value />
</setting>
<setting name="JenkinsUrlTemplate" serializeAs="String">
<value>{0}lastBuild/buildNumber</value>
</setting>
</JenkinsStatusWindow.Properties.Settings>
</userSettings>
</configuration>

7
App.xaml Normal file
View File

@@ -0,0 +1,7 @@
<Application x:Class="JenkinsStatusWindow.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Application.Resources>
</Application.Resources>
</Application>

34
App.xaml.cs Normal file
View File

@@ -0,0 +1,34 @@
using FloatingStatusWindowLibrary;
using JenkinsStatusWindow.Properties;
using System.Diagnostics;
using System.Windows;
namespace JenkinsStatusWindow
{
public partial class App
{
private WindowSource _windowSource;
protected override void OnStartup(StartupEventArgs e)
{
base.OnStartup(e);
StartManager.ManageAutoStart = true;
StartManager.AutoStartEnabled = !Debugger.IsAttached && Settings.Default.AutoStart;
StartManager.AutoStartChanged += (value =>
{
Settings.Default.AutoStart = value;
Settings.Default.Save();
});
_windowSource = new WindowSource();
}
protected override void OnExit(ExitEventArgs e)
{
_windowSource.Dispose();
base.OnExit(e);
}
}
}

8
JenkinsProject.cs Normal file
View File

@@ -0,0 +1,8 @@
namespace JenkinsStatusWindow
{
public class JenkinsProject
{
public string Name { get; set; }
public string Url { get; set; }
}
}

50
JenkinsProjects.cs Normal file
View File

@@ -0,0 +1,50 @@
using JenkinsStatusWindow.Properties;
using Newtonsoft.Json;
using System.Collections.ObjectModel;
namespace JenkinsStatusWindow
{
public class JenkinsProjects : ObservableCollection<JenkinsProject>
{
public static JenkinsProjects Load()
{
var jenkinsProjects = Load(Settings.Default.JenkinsProjects);
return jenkinsProjects;
}
private static JenkinsProjects Load(string serializedData)
{
var jenkinsProjects = JsonConvert.DeserializeObject<JenkinsProjects>(serializedData) ?? new JenkinsProjects();
if (jenkinsProjects.Count == 0)
{
jenkinsProjects.Add(new JenkinsProject { Name = "VPW - Phase 2", Url = "http://jenkins-master.vertical.com:8080/job/vpw/" });
jenkinsProjects.Add(new JenkinsProject { Name = "VPW - Phase 3", Url = "http://172.22.1.60:8080/view/Phase%203%20Apps/job/P3%20VPW/" });
jenkinsProjects.Add(new JenkinsProject { Name = "Company Manager", Url = "http://172.22.1.60:8080/view/Phase%203%20Apps/job/P3%20Company%20Manager/" });
jenkinsProjects.Add(new JenkinsProject { Name = "Profile", Url = "http://172.22.1.60:8080/view/Phase%203%20Apps/job/P3%20Profile/" });
}
return jenkinsProjects;
}
public void Save()
{
Settings.Default.JenkinsProjects = Serialize();
Settings.Default.Save();
}
private string Serialize()
{
return JsonConvert.SerializeObject(this);
}
public JenkinsProjects Clone()
{
var data = Serialize();
return Load(data);
}
}
}

128
JenkinsStatusWindow.csproj Normal file
View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="14.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}</ProjectGuid>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>JenkinsStatusWindow</RootNamespace>
<AssemblyName>JenkinsStatusWindow</AssemblyName>
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<WarningLevel>4</WarningLevel>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="CredentialManagement">
<HintPath>packages\CredentialManagement.1.0.2\lib\net35\CredentialManagement.dll</HintPath>
</Reference>
<Reference Include="FloatingStatusWindowLibrary, Version=1.0.5626.29578, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary\bin\Debug\FloatingStatusWindowLibrary.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Web" />
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="JenkinsProject.cs" />
<Compile Include="JenkinsProjects.cs" />
<Compile Include="WindowSource.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</Compile>
<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>
<DependentUpon>Settings.settings</DependentUpon>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
</Compile>
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
<AppDesigner Include="Properties\" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="Resources\Jenkins.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Common.Native\Common.Native.csproj">
<Project>{ed1c07a1-54f5-4796-8b06-2a0bb1960d84}</Project>
<Name>Common.Native</Name>
</ProjectReference>
<ProjectReference Include="..\Common.Wpf\Common.Wpf.csproj">
<Project>{0074c983-550e-4094-9e8c-f566fb669297}</Project>
<Name>Common.Wpf</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

71
JenkinsStatusWindow.sln Normal file
View File

@@ -0,0 +1,71 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JenkinsStatusWindow", "JenkinsStatusWindow.csproj", "{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}"
ProjectSection(ProjectDependencies) = postProject
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4} = {F023A16C-2F13-4A87-A8B7-22C43C4A58A4}
EndProjectSection
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloatingStatusWindowLibrary", "..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Wpf", "..\Common.Wpf\Common.Wpf.csproj", "{0074C983-550E-4094-9E8C-F566FB669297}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Native", "..\Common.Native\Common.Native.csproj", "{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Debug|x64.ActiveCfg = Debug|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Debug|x86.ActiveCfg = Debug|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Release|Any CPU.Build.0 = Release|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Release|x64.ActiveCfg = Release|Any CPU
{017E00C9-1D38-4077-92F5-AE1C4BA5A5C6}.Release|x86.ActiveCfg = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|x64.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|x86.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|Any CPU.Build.0 = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|x64.ActiveCfg = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|x86.ActiveCfg = Release|Any CPU
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|Any CPU.Build.0 = Debug|Any CPU
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x64.ActiveCfg = Debug|x64
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x64.Build.0 = Debug|x64
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x86.ActiveCfg = Debug|x86
{0074C983-550E-4094-9E8C-F566FB669297}.Debug|x86.Build.0 = Debug|x86
{0074C983-550E-4094-9E8C-F566FB669297}.Release|Any CPU.ActiveCfg = Release|Any CPU
{0074C983-550E-4094-9E8C-F566FB669297}.Release|Any CPU.Build.0 = Release|Any CPU
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x64.ActiveCfg = Release|x64
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x64.Build.0 = Release|x64
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x86.ActiveCfg = Release|x86
{0074C983-550E-4094-9E8C-F566FB669297}.Release|x86.Build.0 = Release|x86
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|Any CPU.Build.0 = Debug|Any CPU
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x64.ActiveCfg = Debug|x64
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x64.Build.0 = Debug|x64
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x86.ActiveCfg = Debug|x86
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Debug|x86.Build.0 = Debug|x86
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|Any CPU.ActiveCfg = Release|Any CPU
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|Any CPU.Build.0 = Release|Any CPU
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x64.ActiveCfg = Release|x64
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x64.Build.0 = Release|x64
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x86.ActiveCfg = Release|x86
{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal

View File

@@ -0,0 +1,55 @@
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Windows;
// 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("JenkinsStatusWindow")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("JenkinsStatusWindow")]
[assembly: AssemblyCopyright("Copyright © 2015")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[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)]
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
// 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 Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]

118
Properties/Resources.Designer.cs generated Normal file
View File

@@ -0,0 +1,118 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JenkinsStatusWindow.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", "4.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("JenkinsStatusWindow.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;
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon ApplicationIcon {
get {
object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to Last build number:.
/// </summary>
internal static string LastBuildNumberHeader {
get {
return ResourceManager.GetString("LastBuildNumberHeader", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0}: {1}.
/// </summary>
internal static string LastBuildNumberTooltipTemplate {
get {
return ResourceManager.GetString("LastBuildNumberTooltipTemplate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to {0,-20} {1}.
/// </summary>
internal static string LastBuildNumberWindowTemplate {
get {
return ResourceManager.GetString("LastBuildNumberWindowTemplate", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Loading....
/// </summary>
internal static string Loading {
get {
return ResourceManager.GetString("Loading", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Jenkins Status.
/// </summary>
internal static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
}
}
}

139
Properties/Resources.resx Normal file
View File

@@ -0,0 +1,139 @@
<?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.Runtime.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:import namespace="http://www.w3.org/XML/1998/namespace" />
<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" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</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" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="ApplicationIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Jenkins.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="LastBuildNumberHeader" xml:space="preserve">
<value>Last build number:</value>
</data>
<data name="LastBuildNumberTooltipTemplate" xml:space="preserve">
<value>{0}: {1}</value>
</data>
<data name="LastBuildNumberWindowTemplate" xml:space="preserve">
<value>{0,-20} {1}</value>
</data>
<data name="Loading" xml:space="preserve">
<value>Loading...</value>
</data>
<data name="Name" xml:space="preserve">
<value>Jenkins Status</value>
</data>
</root>

74
Properties/Settings.Designer.cs generated Normal file
View File

@@ -0,0 +1,74 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace JenkinsStatusWindow.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.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;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("True")]
public bool AutoStart {
get {
return ((bool)(this["AutoStart"]));
}
set {
this["AutoStart"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string WindowSettings {
get {
return ((string)(this["WindowSettings"]));
}
set {
this["WindowSettings"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("")]
public string JenkinsProjects {
get {
return ((string)(this["JenkinsProjects"]));
}
set {
this["JenkinsProjects"] = value;
}
}
[global::System.Configuration.UserScopedSettingAttribute()]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Configuration.DefaultSettingValueAttribute("{0}lastBuild/buildNumber")]
public string JenkinsUrlTemplate {
get {
return ((string)(this["JenkinsUrlTemplate"]));
}
set {
this["JenkinsUrlTemplate"] = value;
}
}
}
}

View File

@@ -0,0 +1,18 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="JenkinsStatusWindow.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="AutoStart" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">True</Value>
</Setting>
<Setting Name="WindowSettings" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="JenkinsProjects" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="JenkinsUrlTemplate" Type="System.String" Scope="User">
<Value Profile="(Default)">{0}lastBuild/buildNumber</Value>
</Setting>
</Settings>
</SettingsFile>

BIN
Resources/Jenkins.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

165
WindowSource.cs Normal file
View File

@@ -0,0 +1,165 @@
using CredentialManagement;
using FloatingStatusWindowLibrary;
using JenkinsStatusWindow.Properties;
using System;
using System.Drawing;
using System.IO;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Threading;
namespace JenkinsStatusWindow
{
public class TextResult
{
public StringBuilder WindowText { get; set; } = new StringBuilder();
public StringBuilder TooltipText { get; set; } = new StringBuilder();
}
public class WindowSource : IWindowSource, IDisposable
{
private readonly FloatingStatusWindow _floatingStatusWindow;
private readonly Timer _refreshTimer;
private readonly Dispatcher _dispatcher;
private readonly JenkinsProjects _jenkinsProjects;
internal WindowSource()
{
_dispatcher = Dispatcher.CurrentDispatcher;
_floatingStatusWindow = new FloatingStatusWindow(this);
_floatingStatusWindow.SetText(Resources.Loading);
_jenkinsProjects = JenkinsProjects.Load();
_refreshTimer = new Timer(60000) { AutoReset = false };
_refreshTimer.Elapsed += HandleTimerElapsed;
Task.Factory.StartNew(UpdateText);
}
public void Dispose()
{
_refreshTimer.Dispose();
_floatingStatusWindow.Save();
_floatingStatusWindow.Dispose();
}
public string Name => Resources.Name;
public Icon Icon => Resources.ApplicationIcon;
public string WindowSettings
{
get
{
return Settings.Default.WindowSettings;
}
set
{
Settings.Default.WindowSettings = value;
Settings.Default.Save();
}
}
private void HandleTimerElapsed(object sender, ElapsedEventArgs elapsedEventArgs)
{
UpdateText();
}
private void UpdateText()
{
var textResult = GetText();
// Update the window on the main thread
_dispatcher.Invoke(() =>
{
_floatingStatusWindow.SetText(textResult.WindowText.ToString());
_floatingStatusWindow.IconToolTipText = textResult.TooltipText.ToString();
});
_refreshTimer.Start();
}
private TextResult GetText()
{
var textResult = new TextResult();
if (_jenkinsProjects.Count == 0)
return textResult;
textResult.WindowText.AppendLine(Resources.LastBuildNumberHeader);
foreach (var jenkinsProject in _jenkinsProjects)
{
if (textResult.WindowText.Length > 0)
textResult.WindowText.AppendLine();
if (textResult.TooltipText.Length > 0)
textResult.TooltipText.AppendLine();
var buildNumberUrl = string.Format(Settings.Default.JenkinsUrlTemplate, jenkinsProject.Url);
var buildNumberUri = new Uri(buildNumberUrl);
var credential = new Credential
{
Target = buildNumberUri.Host,
PersistanceType = PersistanceType.Enterprise,
Type = CredentialType.Generic
};
credential.Load();
var httpWebRequest = (HttpWebRequest)WebRequest.Create(buildNumberUrl);
httpWebRequest.ContentType = "application/x-www-form-urlencoded";
httpWebRequest.Method = "POST";
var credentialBuffer = new UTF8Encoding().GetBytes(credential.Username + ":" + credential.Password);
httpWebRequest.Headers["Authorization"] = "Basic " + Convert.ToBase64String(credentialBuffer);
httpWebRequest.PreAuthenticate = true;
try
{
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
var stream = httpResponse.GetResponseStream();
if (stream == null)
continue;
string lastBuildNumber;
using (var streamReader = new StreamReader(stream))
lastBuildNumber = streamReader.ReadToEnd();
textResult.WindowText.AppendFormat(Resources.LastBuildNumberWindowTemplate, jenkinsProject.Name, lastBuildNumber);
textResult.TooltipText.AppendFormat(Resources.LastBuildNumberTooltipTemplate, jenkinsProject.Name, lastBuildNumber);
}
catch (WebException excp)
{
var stream = excp.Response.GetResponseStream();
if (stream == null)
continue;
using (var streamReader = new StreamReader(stream))
{
var errorText = streamReader.ReadToEnd();
textResult.WindowText.AppendFormat(Resources.LastBuildNumberWindowTemplate, jenkinsProject.Name, errorText);
textResult.TooltipText.AppendFormat(Resources.LastBuildNumberTooltipTemplate, jenkinsProject.Name, errorText);
}
}
}
return textResult;
}
}
}

5
packages.config Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="CredentialManagement" version="1.0.2" targetFramework="net45" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net45" />
</packages>