From 04cb9e6d69cad17d1de33974547828cd0b53605e Mon Sep 17 00:00:00 2001 From: Chris Kaczor Date: Thu, 12 Jan 2017 10:47:44 -0500 Subject: [PATCH] Initial commit --- .gitignore | 275 +++++++++++++++++++++++++++++++ App.config | 27 +++ App.xaml | 7 + App.xaml.cs | 34 ++++ JenkinsProject.cs | 8 + JenkinsProjects.cs | 50 ++++++ JenkinsStatusWindow.csproj | 128 ++++++++++++++ JenkinsStatusWindow.sln | 71 ++++++++ Properties/AssemblyInfo.cs | 55 +++++++ Properties/Resources.Designer.cs | 118 +++++++++++++ Properties/Resources.resx | 139 ++++++++++++++++ Properties/Settings.Designer.cs | 74 +++++++++ Properties/Settings.settings | 18 ++ Resources/Jenkins.ico | Bin 0 -> 17542 bytes WindowSource.cs | 165 +++++++++++++++++++ packages.config | 5 + 16 files changed, 1174 insertions(+) create mode 100644 .gitignore create mode 100644 App.config create mode 100644 App.xaml create mode 100644 App.xaml.cs create mode 100644 JenkinsProject.cs create mode 100644 JenkinsProjects.cs create mode 100644 JenkinsStatusWindow.csproj create mode 100644 JenkinsStatusWindow.sln create mode 100644 Properties/AssemblyInfo.cs create mode 100644 Properties/Resources.Designer.cs create mode 100644 Properties/Resources.resx create mode 100644 Properties/Settings.Designer.cs create mode 100644 Properties/Settings.settings create mode 100644 Resources/Jenkins.ico create mode 100644 WindowSource.cs create mode 100644 packages.config diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1d1e837 --- /dev/null +++ b/.gitignore @@ -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 diff --git a/App.config b/App.config new file mode 100644 index 0000000..7cdf840 --- /dev/null +++ b/App.config @@ -0,0 +1,27 @@ + + + + +
+ + + + + + + + + True + + + + + + + + + {0}lastBuild/buildNumber + + + + diff --git a/App.xaml b/App.xaml new file mode 100644 index 0000000..6b598c6 --- /dev/null +++ b/App.xaml @@ -0,0 +1,7 @@ + + + + + diff --git a/App.xaml.cs b/App.xaml.cs new file mode 100644 index 0000000..6478411 --- /dev/null +++ b/App.xaml.cs @@ -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); + } + } +} diff --git a/JenkinsProject.cs b/JenkinsProject.cs new file mode 100644 index 0000000..1430e3f --- /dev/null +++ b/JenkinsProject.cs @@ -0,0 +1,8 @@ +namespace JenkinsStatusWindow +{ + public class JenkinsProject + { + public string Name { get; set; } + public string Url { get; set; } + } +} diff --git a/JenkinsProjects.cs b/JenkinsProjects.cs new file mode 100644 index 0000000..65714ac --- /dev/null +++ b/JenkinsProjects.cs @@ -0,0 +1,50 @@ +using JenkinsStatusWindow.Properties; +using Newtonsoft.Json; +using System.Collections.ObjectModel; + +namespace JenkinsStatusWindow +{ + public class JenkinsProjects : ObservableCollection + { + public static JenkinsProjects Load() + { + var jenkinsProjects = Load(Settings.Default.JenkinsProjects); + + return jenkinsProjects; + } + + private static JenkinsProjects Load(string serializedData) + { + var jenkinsProjects = JsonConvert.DeserializeObject(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); + } + } +} diff --git a/JenkinsStatusWindow.csproj b/JenkinsStatusWindow.csproj new file mode 100644 index 0000000..15e8754 --- /dev/null +++ b/JenkinsStatusWindow.csproj @@ -0,0 +1,128 @@ + + + + + Debug + AnyCPU + {017E00C9-1D38-4077-92F5-AE1C4BA5A5C6} + WinExe + Properties + JenkinsStatusWindow + JenkinsStatusWindow + v4.5 + 512 + {60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + 4 + true + + + + AnyCPU + true + full + false + bin\Debug\ + DEBUG;TRACE + prompt + 4 + + + AnyCPU + pdbonly + true + bin\Release\ + TRACE + prompt + 4 + + + + packages\CredentialManagement.1.0.2\lib\net35\CredentialManagement.dll + + + False + ..\FloatingStatusWindowLibrary\FloatingStatusWindowLibrary\bin\Debug\FloatingStatusWindowLibrary.dll + + + packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll + True + + + + + + + + + + + + 4.0 + + + + + + + + MSBuild:Compile + Designer + + + App.xaml + Code + + + + + + + + Code + + + True + True + Resources.resx + + + True + Settings.settings + True + + + ResXFileCodeGenerator + Resources.Designer.cs + + + + SettingsSingleFileGenerator + Settings.Designer.cs + + + + + + + + + + + + {ed1c07a1-54f5-4796-8b06-2a0bb1960d84} + Common.Native + + + {0074c983-550e-4094-9e8c-f566fb669297} + Common.Wpf + + + + + \ No newline at end of file diff --git a/JenkinsStatusWindow.sln b/JenkinsStatusWindow.sln new file mode 100644 index 0000000..dfc3eb6 --- /dev/null +++ b/JenkinsStatusWindow.sln @@ -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 diff --git a/Properties/AssemblyInfo.cs b/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..9097d71 --- /dev/null +++ b/Properties/AssemblyInfo.cs @@ -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 +//CultureYouAreCodingWith in your .csproj file +//inside a . For example, if you are using US english +//in your source files, set the 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")] diff --git a/Properties/Resources.Designer.cs b/Properties/Resources.Designer.cs new file mode 100644 index 0000000..ca3e2f6 --- /dev/null +++ b/Properties/Resources.Designer.cs @@ -0,0 +1,118 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +namespace JenkinsStatusWindow.Properties { + using System; + + + /// + /// A strongly-typed resource class, for looking up localized strings, etc. + /// + // 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() { + } + + /// + /// Returns the cached ResourceManager instance used by this class. + /// + [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; + } + } + + /// + /// Overrides the current thread's CurrentUICulture property for all + /// resource lookups using this strongly typed resource class. + /// + [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] + internal static global::System.Globalization.CultureInfo Culture { + get { + return resourceCulture; + } + set { + resourceCulture = value; + } + } + + /// + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon ApplicationIcon { + get { + object obj = ResourceManager.GetObject("ApplicationIcon", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + + /// + /// Looks up a localized string similar to Last build number:. + /// + internal static string LastBuildNumberHeader { + get { + return ResourceManager.GetString("LastBuildNumberHeader", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0}: {1}. + /// + internal static string LastBuildNumberTooltipTemplate { + get { + return ResourceManager.GetString("LastBuildNumberTooltipTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to {0,-20} {1}. + /// + internal static string LastBuildNumberWindowTemplate { + get { + return ResourceManager.GetString("LastBuildNumberWindowTemplate", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Loading.... + /// + internal static string Loading { + get { + return ResourceManager.GetString("Loading", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Jenkins Status. + /// + internal static string Name { + get { + return ResourceManager.GetString("Name", resourceCulture); + } + } + } +} diff --git a/Properties/Resources.resx b/Properties/Resources.resx new file mode 100644 index 0000000..051467f --- /dev/null +++ b/Properties/Resources.resx @@ -0,0 +1,139 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + + ..\Resources\Jenkins.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + + Last build number: + + + {0}: {1} + + + {0,-20} {1} + + + Loading... + + + Jenkins Status + + \ No newline at end of file diff --git a/Properties/Settings.Designer.cs b/Properties/Settings.Designer.cs new file mode 100644 index 0000000..d1669ec --- /dev/null +++ b/Properties/Settings.Designer.cs @@ -0,0 +1,74 @@ +//------------------------------------------------------------------------------ +// +// 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. +// +//------------------------------------------------------------------------------ + +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; + } + } + } +} diff --git a/Properties/Settings.settings b/Properties/Settings.settings new file mode 100644 index 0000000..f261135 --- /dev/null +++ b/Properties/Settings.settings @@ -0,0 +1,18 @@ + + + + + + True + + + + + + + + + {0}lastBuild/buildNumber + + + \ No newline at end of file diff --git a/Resources/Jenkins.ico b/Resources/Jenkins.ico new file mode 100644 index 0000000000000000000000000000000000000000..e6d7748d5576066255e271a3c16ebff7849637d6 GIT binary patch literal 17542 zcmb_j2UL_ZMXHEJlpsNZAOZ@K6_p?$YTGD?2@!M7 zIp>5~5Jk*wE81eh*mfHbNfL^>d+&q4EXpcGdg`24?|<)q@80j_`|iEJfk7XGuMH#; z1B?v~wwoCkcpDfP7#en_zcVnX!MwlzwIf~duLcH7Z4C^*!+a{A{I!9>Kimuq_*e%? z7{p?reD*W#i1hs%_B9!g0fq+H!|Y67NE_-1alx`)1y4so9iJapXDRsMm8pr_TcoS< zc6TT%*){pY`UR;~CdTIN$BvzZ#>OW2_19mawY3$T9UUK>-#-N?teiC*oaB~j-ZCK{ zOpQ&K=)+F=$m5E!p(*5#_Gb8p53*6$|I&8w%!GAP+q3mD`&&RkYFk!sW*%C@GqZRo zuoP6KrDe1~dh`VD-mQYYd-uWHx9`Bw-r+Y6|I!%=U~Xy#Q3I?Q1|Mf3m>8M9(uW_h z8&co*a}YD^Gt>L`8v77`DVUkMHp?A;X4ttlP;4of^48eMynXAoop8760X%&47=F5W z8|Ken1Uz%gW`(Wffv2+!OpHyz+2&*aQ#*|MnzSQExvn-~{#e34I?{#V&rSB|HGV%= zAqa%|N}0p$Pw-P4tZnx+nws!c4)#v%(b2I@7JQkK$8&5lGY@=gVVP7Xmiz#Go)7rD zin?GBS@PZ^#sWR~%W!_d%ygd){3AUeF|>E{$427PCbvDM((HHcS#E!`MPj|J+1S{o zSs-3qV`Ac5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7v*Q1Wl|9XJ&BU46mmMHM08R$N0*DqM!E0eL-p8@FBS!QPrmnfp8_|pK%Mx_&G^%^vnQy=XOCz2 z!=n;wINcYGiN3oK$D88a7oU*tyUx2d&e6Zv$nEQjismujkJ#a9Z@4wQ?bMIp?H`JM zS2=2*H%+=5&_8|Q&NHM_sY5z?{bp=!?CsGPuie+jANqOvzPW^c3$!QDJUn&#HLTjJ zTX(m!IJ7i~!U zl^M@6hTNcX0OB60%x7Y<&0M`skISQ7n&zK4?4ZV^E9F&1gVV zvhXd7Yw?-FV|=GC(0i)ajK(x28o&UJPVhLF*^9nI=7t#5au|N|ul+-eU-`O7-;9Y; zd?LTt$y2L@(lz(pT|zDw7awa~yL$Dnd0F8NAzl)&ms;#1T3BBk;w^6_J4^h)k2Z;6 zf!3(MSoD(Q8*AH>@1@e%S0eGuH`ek6%|rdI!Oh<4I@bLI1xud!3|D(m-499qn7t-p zNYL9^1!!jxXVr>ikqbIIjfiI;(StHs+lyb4<06Bgf~@YnRM9(@Nh zck^+!ztFiu=Pt=7$yvEIB7xODu8wAm^=*q*?QEmHiuMayCx>y5BHeBN((N#9#V)p& zqij&2S&yFm0tW}-H(QTa?d|FdMr(rfP|2wGnmBt6`+jRg_B8r#n8a-LFM4>!eNBCd z<{G8vUF8p9CE7ShpG|TLo+}YtWu(<-{M7jkG)0v*A^#Wp7L4{VPEO$ZW5cm)N`@EAiW1 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; + } + } +} diff --git a/packages.config b/packages.config new file mode 100644 index 0000000..f628df4 --- /dev/null +++ b/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file