Switch to submodules, add options UI, add license and initial readme

This commit is contained in:
2018-02-08 17:00:07 -05:00
parent 6f1f60dfbf
commit d784518863
21 changed files with 990 additions and 79 deletions

6
.gitmodules vendored Normal file
View File

@@ -0,0 +1,6 @@
[submodule "FloatingStatusWindow"]
path = FloatingStatusWindow
url = https://github.com/ckaczor/FloatingStatusWindow.git
[submodule "Common"]
path = Common
url = https://github.com/ckaczor/Common.git

1
Common Submodule

Submodule Common added at 81ef8f451c

1
FloatingStatusWindow Submodule

Submodule FloatingStatusWindow added at 38d692c9fc

View File

@@ -4,5 +4,6 @@
{
public string Name { get; set; }
public string Url { get; set; }
public bool Enabled { get; set; }
}
}

View File

@@ -17,14 +17,6 @@ namespace JenkinsStatusWindow
{
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;
}

View File

@@ -36,17 +36,6 @@
<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" />
@@ -74,27 +63,40 @@
</Compile>
<Compile Include="JenkinsProject.cs" />
<Compile Include="JenkinsProjects.cs" />
<Compile Include="WindowSource.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
<Compile Include="Options\AboutOptionsPanel.xaml.cs">
<DependentUpon>AboutOptionsPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Options\GeneralOptionsPanel.xaml.cs">
<DependentUpon>GeneralOptionsPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Options\JenkinsProjectsOptionsPanel.xaml.cs">
<DependentUpon>JenkinsProjectsOptionsPanel.xaml</DependentUpon>
</Compile>
<Compile Include="Options\JenkinsProjectWindow.xaml.cs">
<DependentUpon>JenkinsProjectWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Resources.resx</DependentUpon>
</Compile>
<Compile Include="WindowSource.cs" />
</ItemGroup>
<ItemGroup>
<Compile Include="Properties\AssemblyInfo.cs">
<SubType>Code</SubType>
</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>
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="LICENSE.md" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
@@ -105,17 +107,48 @@
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<None Include="README.md" />
<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 Include="Common\Common.csproj">
<Project>{17864d82-457d-4a0a-bc10-1d07f2b3a5d6}</Project>
<Name>Common</Name>
</ProjectReference>
<ProjectReference Include="..\Common.Wpf\Common.Wpf.csproj">
<ProjectReference Include="FloatingStatusWindow\Library\Common.Wpf\Common.Wpf.csproj">
<Project>{0074c983-550e-4094-9e8c-f566fb669297}</Project>
<Name>Common.Wpf</Name>
</ProjectReference>
<ProjectReference Include="FloatingStatusWindow\Library\FloatingStatusWindow.csproj">
<Project>{f023a16c-2f13-4a87-a8b7-22c43c4a58a4}</Project>
<Name>FloatingStatusWindow</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="CredentialManagement">
<Version>1.0.2</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>10.0.3</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Page Include="Options\AboutOptionsPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Options\GeneralOptionsPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Options\JenkinsProjectsOptionsPanel.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Options\JenkinsProjectWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

View File

@@ -1,18 +1,20 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.25420.1
# Visual Studio 15
VisualStudioVersion = 15.0.27130.2027
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}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Native", "FloatingStatusWindow\Library\Common.Wpf\Common.Native\Common.Native.csproj", "{ED1C07A1-54F5-4796-8B06-2A0BB1960D84}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Wpf", "..\Common.Wpf\Common.Wpf.csproj", "{0074C983-550E-4094-9E8C-F566FB669297}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common.Wpf", "FloatingStatusWindow\Library\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}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FloatingStatusWindow", "FloatingStatusWindow\Library\FloatingStatusWindow.csproj", "{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Common", "Common\Common.csproj", "{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -32,26 +34,6 @@ Global
{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
@@ -64,8 +46,47 @@ Global
{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
{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
{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|x64.Build.0 = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|x86.ActiveCfg = Debug|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Debug|x86.Build.0 = 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|x64.Build.0 = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|x86.ActiveCfg = Release|Any CPU
{F023A16C-2F13-4A87-A8B7-22C43C4A58A4}.Release|x86.Build.0 = Release|Any CPU
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x64.ActiveCfg = Debug|x64
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x64.Build.0 = Debug|x64
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x86.ActiveCfg = Debug|x86
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Debug|x86.Build.0 = Debug|x86
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|Any CPU.Build.0 = Release|Any CPU
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x64.ActiveCfg = Release|x64
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x64.Build.0 = Release|x64
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x86.ActiveCfg = Release|x86
{17864D82-457D-4A0A-BC10-1D07F2B3A5D6}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {16E9F369-EB32-4F1D-85E7-B17E8A1A48C3}
EndGlobalSection
EndGlobal

21
LICENSE.md Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2018 Chris Kaczor
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,24 @@
<windows:CategoryPanel x:Class="JenkinsStatusWindow.Options.AboutOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<Grid>
<TextBlock Text="[Application Name]"
Name="ApplicationNameLabel"
VerticalAlignment="Top"
FontWeight="Bold" />
<TextBlock Text="[Application Version]"
Margin="0,22,0,0"
Name="VersionLabel"
VerticalAlignment="Top" />
<TextBlock Text="[Company]"
Margin="0,44,0,0"
Name="CompanyLabel"
VerticalAlignment="Top" />
</Grid>
</windows:CategoryPanel>

View File

@@ -0,0 +1,36 @@
using Common.Update;
using System.Reflection;
namespace JenkinsStatusWindow.Options
{
public partial class AboutOptionsPanel
{
public AboutOptionsPanel()
{
InitializeComponent();
}
public override void LoadPanel(object data)
{
base.LoadPanel(data);
ApplicationNameLabel.Text = Properties.Resources.ApplicationName;
var version = UpdateCheck.LocalVersion.ToString();
VersionLabel.Text = string.Format(Properties.Resources.About_Version, version);
CompanyLabel.Text = ((AssemblyCompanyAttribute)Assembly.GetEntryAssembly().GetCustomAttributes(typeof(AssemblyCompanyAttribute), false)[0]).Company;
}
public override bool ValidatePanel()
{
return true;
}
public override void SavePanel()
{
}
public override string CategoryName => Properties.Resources.OptionCategory_About;
}
}

View File

@@ -0,0 +1,22 @@
<windows:CategoryPanel x:Class="JenkinsStatusWindow.Options.GeneralOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
xmlns:properties="clr-namespace:JenkinsStatusWindow.Properties"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<CheckBox Content="{x:Static properties:Resources.StartWithWindows}"
Name="StartWithWindows"
VerticalAlignment="Top"
VerticalContentAlignment="Center"
Grid.ColumnSpan="2" />
</Grid>
</windows:CategoryPanel>

View File

@@ -0,0 +1,39 @@
using Common.Wpf.Extensions;
using System.Windows;
namespace JenkinsStatusWindow.Options
{
public partial class GeneralOptionsPanel
{
public GeneralOptionsPanel()
{
InitializeComponent();
}
public override void LoadPanel(object data)
{
base.LoadPanel(data);
var settings = Properties.Settings.Default;
StartWithWindows.IsChecked = settings.AutoStart;
}
public override bool ValidatePanel()
{
return true;
}
public override void SavePanel()
{
var settings = Properties.Settings.Default;
if (StartWithWindows.IsChecked.HasValue && settings.AutoStart != StartWithWindows.IsChecked.Value)
settings.AutoStart = StartWithWindows.IsChecked.Value;
Application.Current.SetStartWithWindows(settings.AutoStart);
}
public override string CategoryName => Properties.Resources.OptionCategory_General;
}
}

View File

@@ -0,0 +1,87 @@
<Window x:Class="JenkinsStatusWindow.Options.JenkinsProjectWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:properties="clr-namespace:JenkinsStatusWindow.Properties"
mc:Ignorable="d"
WindowStartupLocation="CenterOwner"
Title="JenkinsProjectWindow"
Height="160"
Width="350"
FocusManager.FocusedElement="{Binding ElementName=NameTextBox}">
<Grid>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Label Content="{x:Static properties:Resources.JenkinsProjectNameLabel}"
VerticalContentAlignment="Center"
Target="{Binding ElementName=NameTextBox}"
Grid.Row="0"
Grid.Column="0"
Margin="6"
Padding="0" />
<TextBox Name="NameTextBox"
Grid.Column="1"
Text="{Binding Path=Name, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=true}"
Grid.Row="0"
VerticalAlignment="Center"
Margin="6,0,6,0" />
<Label Content="{x:Static properties:Resources.JenkinsProjectUrlLabel}"
VerticalContentAlignment="Center"
Target="{Binding ElementName=UrlTextBox}"
Grid.Row="1"
Grid.Column="0"
Margin="6"
Padding="0" />
<TextBox Name="UrlTextBox"
Grid.Column="1"
Text="{Binding Path=Url, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=true}"
Grid.Row="1"
VerticalAlignment="Center"
Margin="6,0,6,0" />
<Label Content="{x:Static properties:Resources.JenkinsProjectEnabledLabel}"
VerticalContentAlignment="Center"
Target="{Binding ElementName=NameTextBox}"
Grid.Row="2"
Grid.Column="0"
Margin="6"
Padding="0" />
<CheckBox Grid.Column="1"
IsChecked="{Binding Path=Enabled, UpdateSourceTrigger=Explicit, ValidatesOnExceptions=true}"
Grid.Row="2"
Margin="5,0,5,0"
VerticalAlignment="Center" />
<StackPanel Grid.Column="0"
Grid.ColumnSpan="2"
Grid.Row="3"
Orientation="Horizontal"
HorizontalAlignment="Right"
Margin="6">
<Button Content="{x:Static properties:Resources.OkayButton}"
Height="23"
VerticalAlignment="Bottom"
Width="75"
IsDefault="True"
Click="HandleOkayButtonClick"
Margin="0,0,8,0" />
<Button Content="{x:Static properties:Resources.CancelButton}"
Height="23"
VerticalAlignment="Bottom"
Width="75"
IsCancel="True" />
</StackPanel>
</Grid>
</Grid>
</Window>

View File

@@ -0,0 +1,66 @@
using Common.Wpf.Extensions;
using System.Drawing;
using System.Linq;
using System.Windows;
using System.Windows.Data;
namespace JenkinsStatusWindow.Options
{
public partial class JenkinsProjectWindow
{
public JenkinsProjectWindow()
{
InitializeComponent();
Icon = ((Icon)Properties.Resources.ResourceManager.GetObject("ApplicationIcon")).ToImageSource();
}
public bool? Display(JenkinsProject jenkinsProject, Window owner)
{
// Set the data context
DataContext = jenkinsProject;
// Set the title based on the state of the item
Title = string.IsNullOrWhiteSpace(jenkinsProject.Name) ? Properties.Resources.JenkinsProjectWindowAdd : Properties.Resources.JenkinsProjectWindowEdit;
// Set the window owner
Owner = owner;
// Show the dialog and result the result
return ShowDialog();
}
private void HandleOkayButtonClick(object sender, RoutedEventArgs e)
{
// Get a list of all framework elements and explicit binding expressions
var bindingExpressions = this.GetBindingExpressions(new[] { UpdateSourceTrigger.Explicit });
// Loop over each binding expression and clear any existing error
this.ClearAllValidationErrors(bindingExpressions);
// Force all explicit bindings to update the source
this.UpdateAllSources(bindingExpressions);
// See if there are any errors
var hasError = bindingExpressions.Any(b => b.BindingExpression.HasError);
// If there was an error then set focus to the bad controls
if (hasError)
{
// Get the first framework element with an error
var firstErrorElement = bindingExpressions.First(b => b.BindingExpression.HasError).FrameworkElement;
// Set focus
firstErrorElement.Focus();
return;
}
// Dialog is good
DialogResult = true;
// Close the dialog
Close();
}
}
}

View File

@@ -0,0 +1,79 @@
<windows:CategoryPanel x:Class="JenkinsStatusWindow.Options.JenkinsProjectsOptionsPanel"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:windows="clr-namespace:Common.Wpf.Windows;assembly=Common.Wpf"
xmlns:linkControl="clr-namespace:Common.Wpf.LinkControl;assembly=Common.Wpf"
xmlns:properties="clr-namespace:JenkinsStatusWindow.Properties"
mc:Ignorable="d"
d:DesignHeight="300"
d:DesignWidth="300">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<DataGrid x:Name="JenkinsProjectsGrid"
SelectionMode="Extended"
Grid.Column="0"
Grid.Row="0"
AutoGenerateColumns="False"
GridLinesVisibility="None"
CanUserResizeRows="False"
IsReadOnly="True"
HeadersVisibility="Column"
SelectionUnit="FullRow"
SelectionChanged="HandleJenkinsProjectsSelectionChanged"
Background="{x:Null}"
MouseDoubleClick="HandleJenkinsProjectsDoubleClick">
<DataGrid.Columns>
<DataGridCheckBoxColumn Binding="{Binding Enabled}"
Header="{x:Static properties:Resources.ColumnHeader_Enabled}" />
<DataGridTextColumn Binding="{Binding Name}"
Header="{x:Static properties:Resources.ColumnHeader_Name}"
SortDirection="Ascending"
Width="*" />
<DataGridTextColumn Binding="{Binding Url}"
Header="{x:Static properties:Resources.ColumnHeader_Url}"
Width="2*" />
</DataGrid.Columns>
<DataGrid.CellStyle>
<Style TargetType="DataGridCell">
<Setter Property="BorderThickness"
Value="0"></Setter>
<Setter Property="FocusVisualStyle"
Value="{x:Null}" />
</Style>
</DataGrid.CellStyle>
</DataGrid>
<Border Grid.Column="0"
Grid.Row="1"
BorderThickness="1,0,1,1"
BorderBrush="{DynamicResource {x:Static SystemColors.ActiveBorderBrushKey}}">
<StackPanel Orientation="Horizontal"
Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}">
<linkControl:LinkControl Margin="2"
Click="HandleAddJenkinsProjectButtonClick"
Text="{x:Static properties:Resources.AddJenkinsProject}"
ToolTip="{x:Static properties:Resources.AddJenkinsProject_ToolTip}">
</linkControl:LinkControl>
<linkControl:LinkControl Name="EditJenkinsProjectButton"
Margin="2"
Click="HandleEditJenkinsProjectButtonClick"
Text="{x:Static properties:Resources.EditJenkinsProject}"
ToolTip="{x:Static properties:Resources.EditJenkinsProject_ToolTip}">
</linkControl:LinkControl>
<linkControl:LinkControl Name="DeleteJenkinsProjectButton"
Margin="2"
Click="HandleDeleteJenkinsProjectButtonClick"
Text="{x:Static properties:Resources.DeleteJenkinsProject}"
ToolTip="{x:Static properties:Resources.DeleteJenkinsProject_ToolTip}">
</linkControl:LinkControl>
</StackPanel>
</Border>
</Grid>
</windows:CategoryPanel>

View File

@@ -0,0 +1,114 @@
using System.Linq;
using System.Windows;
using System.Windows.Controls;
namespace JenkinsStatusWindow.Options
{
public partial class JenkinsProjectsOptionsPanel
{
public JenkinsProjectsOptionsPanel()
{
InitializeComponent();
}
private JenkinsProjects JenkinsProjects => Data as JenkinsProjects;
public override void LoadPanel(object data)
{
base.LoadPanel(data);
JenkinsProjectsGrid.ItemsSource = JenkinsProjects;
JenkinsProjectsGrid.SelectedItem = JenkinsProjects.FirstOrDefault();
SetButtonStates();
}
public override bool ValidatePanel()
{
return true;
}
public override void SavePanel()
{
}
public override string CategoryName => Properties.Resources.OptionCategory_JenkinsProjects;
private void SetButtonStates()
{
EditJenkinsProjectButton.IsEnabled = (JenkinsProjectsGrid.SelectedItems.Count == 1);
DeleteJenkinsProjectButton.IsEnabled = (JenkinsProjectsGrid.SelectedItems.Count > 0);
}
private void AddJenkinsProject()
{
var jenkinsProject = new JenkinsProject();
var jenkinsProjectWindow = new JenkinsProjectWindow();
var result = jenkinsProjectWindow.Display(jenkinsProject, Window.GetWindow(this));
if (result.HasValue && result.Value)
{
JenkinsProjects.Add(jenkinsProject);
JenkinsProjectsGrid.SelectedItem = jenkinsProject;
SetButtonStates();
}
}
private void EditSelectedJenkinsProject()
{
if (JenkinsProjectsGrid.SelectedItem == null)
return;
var jenkinsProject = JenkinsProjectsGrid.SelectedItem as JenkinsProject;
var jenkinsProjectWindow = new JenkinsProjectWindow();
jenkinsProjectWindow.Display(jenkinsProject, Window.GetWindow(this));
}
private void DeleteSelectedJenkinsProject()
{
var jenkinsProject = JenkinsProjectsGrid.SelectedItem as JenkinsProject;
var index = JenkinsProjectsGrid.SelectedIndex;
JenkinsProjects.Remove(jenkinsProject);
if (JenkinsProjectsGrid.Items.Count == index)
JenkinsProjectsGrid.SelectedIndex = JenkinsProjectsGrid.Items.Count - 1;
else if (JenkinsProjectsGrid.Items.Count >= index)
JenkinsProjectsGrid.SelectedIndex = index;
SetButtonStates();
}
private void HandleAddJenkinsProjectButtonClick(object sender, RoutedEventArgs e)
{
AddJenkinsProject();
}
private void HandleEditJenkinsProjectButtonClick(object sender, RoutedEventArgs e)
{
EditSelectedJenkinsProject();
}
private void HandleDeleteJenkinsProjectButtonClick(object sender, RoutedEventArgs e)
{
DeleteSelectedJenkinsProject();
}
private void HandleJenkinsProjectsSelectionChanged(object sender, SelectionChangedEventArgs e)
{
SetButtonStates();
}
private void HandleJenkinsProjectsDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e)
{
EditSelectedJenkinsProject();
}
}
}

View File

@@ -19,10 +19,10 @@ namespace JenkinsStatusWindow.Properties {
// 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.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources {
public class Resources {
private static global::System.Resources.ResourceManager resourceMan;
@@ -36,7 +36,7 @@ namespace JenkinsStatusWindow.Properties {
/// 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 {
public 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);
@@ -51,7 +51,7 @@ namespace JenkinsStatusWindow.Properties {
/// 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 {
public static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
@@ -60,20 +60,173 @@ namespace JenkinsStatusWindow.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Version: {0}.
/// </summary>
public static string About_Version {
get {
return ResourceManager.GetString("About_Version", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add.
/// </summary>
public static string AddJenkinsProject {
get {
return ResourceManager.GetString("AddJenkinsProject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add Jenkins Project.
/// </summary>
public static string AddJenkinsProject_ToolTip {
get {
return ResourceManager.GetString("AddJenkinsProject_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
internal static System.Drawing.Icon ApplicationIcon {
public 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 Jenkins Status Window.
/// </summary>
public static string ApplicationName {
get {
return ResourceManager.GetString("ApplicationName", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
public static string CancelButton {
get {
return ResourceManager.GetString("CancelButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Enabled.
/// </summary>
public static string ColumnHeader_Enabled {
get {
return ResourceManager.GetString("ColumnHeader_Enabled", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Name.
/// </summary>
public static string ColumnHeader_Name {
get {
return ResourceManager.GetString("ColumnHeader_Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to URL.
/// </summary>
public static string ColumnHeader_Url {
get {
return ResourceManager.GetString("ColumnHeader_Url", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Delete.
/// </summary>
public static string DeleteJenkinsProject {
get {
return ResourceManager.GetString("DeleteJenkinsProject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Delete Jenkins Project.
/// </summary>
public static string DeleteJenkinsProject_ToolTip {
get {
return ResourceManager.GetString("DeleteJenkinsProject_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edit.
/// </summary>
public static string EditJenkinsProject {
get {
return ResourceManager.GetString("EditJenkinsProject", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edit Jenkins Project.
/// </summary>
public static string EditJenkinsProject_ToolTip {
get {
return ResourceManager.GetString("EditJenkinsProject_ToolTip", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Enabled:.
/// </summary>
public static string JenkinsProjectEnabledLabel {
get {
return ResourceManager.GetString("JenkinsProjectEnabledLabel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Name:.
/// </summary>
public static string JenkinsProjectNameLabel {
get {
return ResourceManager.GetString("JenkinsProjectNameLabel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _URL:.
/// </summary>
public static string JenkinsProjectUrlLabel {
get {
return ResourceManager.GetString("JenkinsProjectUrlLabel", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Add Jenkins Project.
/// </summary>
public static string JenkinsProjectWindowAdd {
get {
return ResourceManager.GetString("JenkinsProjectWindowAdd", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Edit Jenkins Project.
/// </summary>
public static string JenkinsProjectWindowEdit {
get {
return ResourceManager.GetString("JenkinsProjectWindowEdit", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Last build number:.
/// </summary>
internal static string LastBuildNumberHeader {
public static string LastBuildNumberHeader {
get {
return ResourceManager.GetString("LastBuildNumberHeader", resourceCulture);
}
@@ -82,7 +235,7 @@ namespace JenkinsStatusWindow.Properties {
/// <summary>
/// Looks up a localized string similar to {0}: {1}.
/// </summary>
internal static string LastBuildNumberTooltipTemplate {
public static string LastBuildNumberTooltipTemplate {
get {
return ResourceManager.GetString("LastBuildNumberTooltipTemplate", resourceCulture);
}
@@ -91,7 +244,7 @@ namespace JenkinsStatusWindow.Properties {
/// <summary>
/// Looks up a localized string similar to {0,-20} {1}.
/// </summary>
internal static string LastBuildNumberWindowTemplate {
public static string LastBuildNumberWindowTemplate {
get {
return ResourceManager.GetString("LastBuildNumberWindowTemplate", resourceCulture);
}
@@ -100,7 +253,7 @@ namespace JenkinsStatusWindow.Properties {
/// <summary>
/// Looks up a localized string similar to Loading....
/// </summary>
internal static string Loading {
public static string Loading {
get {
return ResourceManager.GetString("Loading", resourceCulture);
}
@@ -109,10 +262,92 @@ namespace JenkinsStatusWindow.Properties {
/// <summary>
/// Looks up a localized string similar to Jenkins Status.
/// </summary>
internal static string Name {
public static string Name {
get {
return ResourceManager.GetString("Name", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
public static string OkayButton {
get {
return ResourceManager.GetString("OkayButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to About.
/// </summary>
public static string OptionCategory_About {
get {
return ResourceManager.GetString("OptionCategory_About", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to General.
/// </summary>
public static string OptionCategory_General {
get {
return ResourceManager.GetString("OptionCategory_General", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Jenkins Projects.
/// </summary>
public static string OptionCategory_JenkinsProjects {
get {
return ResourceManager.GetString("OptionCategory_JenkinsProjects", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Cancel.
/// </summary>
public static string OptionsWindow_CancelButton {
get {
return ResourceManager.GetString("OptionsWindow_CancelButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>
public static System.Drawing.Icon OptionsWindow_Icon {
get {
object obj = ResourceManager.GetObject("OptionsWindow_Icon", resourceCulture);
return ((System.Drawing.Icon)(obj));
}
}
/// <summary>
/// Looks up a localized string similar to OK.
/// </summary>
public static string OptionsWindow_OkayButton {
get {
return ResourceManager.GetString("OptionsWindow_OkayButton", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Options.
/// </summary>
public static string OptionsWindow_Title {
get {
return ResourceManager.GetString("OptionsWindow_Title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to _Start when Windows starts.
/// </summary>
public static string StartWithWindows {
get {
return ResourceManager.GetString("StartWithWindows", resourceCulture);
}
}
}
}

View File

@@ -117,10 +117,61 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="About_Version" xml:space="preserve">
<value>Version: {0}</value>
</data>
<data name="AddJenkinsProject" xml:space="preserve">
<value>Add</value>
</data>
<data name="AddJenkinsProject_ToolTip" xml:space="preserve">
<value>Add Jenkins Project</value>
</data>
<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="ApplicationName" xml:space="preserve">
<value>Jenkins Status Window</value>
</data>
<data name="CancelButton" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="ColumnHeader_Enabled" xml:space="preserve">
<value>Enabled</value>
</data>
<data name="ColumnHeader_Name" xml:space="preserve">
<value>Name</value>
</data>
<data name="ColumnHeader_Url" xml:space="preserve">
<value>URL</value>
</data>
<data name="DeleteJenkinsProject" xml:space="preserve">
<value>Delete</value>
</data>
<data name="DeleteJenkinsProject_ToolTip" xml:space="preserve">
<value>Delete Jenkins Project</value>
</data>
<data name="EditJenkinsProject" xml:space="preserve">
<value>Edit</value>
</data>
<data name="EditJenkinsProject_ToolTip" xml:space="preserve">
<value>Edit Jenkins Project</value>
</data>
<data name="JenkinsProjectEnabledLabel" xml:space="preserve">
<value>_Enabled:</value>
</data>
<data name="JenkinsProjectNameLabel" xml:space="preserve">
<value>_Name:</value>
</data>
<data name="JenkinsProjectUrlLabel" xml:space="preserve">
<value>_URL:</value>
</data>
<data name="JenkinsProjectWindowAdd" xml:space="preserve">
<value>Add Jenkins Project</value>
</data>
<data name="JenkinsProjectWindowEdit" xml:space="preserve">
<value>Edit Jenkins Project</value>
</data>
<data name="LastBuildNumberHeader" xml:space="preserve">
<value>Last build number:</value>
</data>
@@ -136,4 +187,31 @@
<data name="Name" xml:space="preserve">
<value>Jenkins Status</value>
</data>
<data name="OkayButton" xml:space="preserve">
<value>OK</value>
</data>
<data name="OptionCategory_About" xml:space="preserve">
<value>About</value>
</data>
<data name="OptionCategory_General" xml:space="preserve">
<value>General</value>
</data>
<data name="OptionCategory_JenkinsProjects" xml:space="preserve">
<value>Jenkins Projects</value>
</data>
<data name="OptionsWindow_CancelButton" xml:space="preserve">
<value>Cancel</value>
</data>
<data name="OptionsWindow_Icon" 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="OptionsWindow_OkayButton" xml:space="preserve">
<value>OK</value>
</data>
<data name="OptionsWindow_Title" xml:space="preserve">
<value>Options</value>
</data>
<data name="StartWithWindows" xml:space="preserve">
<value>_Start when Windows starts</value>
</data>
</root>

11
README.md Normal file
View File

@@ -0,0 +1,11 @@
# JenkinsStatusWindow
A "floating" status window that shows the last build number of a Jenkins project.
## Authors
* **Chris Kaczor** - *Initial work* - https://github.com/ckaczor - https://chriskaczor.com
## License
This project is licensed under the MIT License - see the [LICENSE.md](LICENSE.md) file for details.

View File

@@ -2,13 +2,17 @@
using FloatingStatusWindowLibrary;
using JenkinsStatusWindow.Properties;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
using System.Threading.Tasks;
using System.Timers;
using System.Windows.Threading;
using Common.Wpf.Windows;
using JenkinsStatusWindow.Options;
namespace JenkinsStatusWindow
{
@@ -23,7 +27,9 @@ namespace JenkinsStatusWindow
private readonly FloatingStatusWindow _floatingStatusWindow;
private readonly Timer _refreshTimer;
private readonly Dispatcher _dispatcher;
private readonly JenkinsProjects _jenkinsProjects;
private JenkinsProjects _jenkinsProjects;
private CategoryWindow _optionsWindow;
internal WindowSource()
{
@@ -54,10 +60,7 @@ namespace JenkinsStatusWindow
public string WindowSettings
{
get
{
return Settings.Default.WindowSettings;
}
get => Settings.Default.WindowSettings;
set
{
Settings.Default.WindowSettings = value;
@@ -95,6 +98,7 @@ namespace JenkinsStatusWindow
}
finally
{
_refreshTimer.Interval = 60000;
_refreshTimer.Start();
}
}
@@ -103,12 +107,14 @@ namespace JenkinsStatusWindow
{
var textResult = new TextResult();
if (_jenkinsProjects.Count == 0)
var enabledProjects = _jenkinsProjects.Where(p => p.Enabled).ToList();
if (enabledProjects.Count == 0)
return textResult;
textResult.WindowText.AppendLine(Resources.LastBuildNumberHeader);
foreach (var jenkinsProject in _jenkinsProjects)
foreach (var jenkinsProject in enabledProjects)
{
if (textResult.WindowText.Length > 0)
textResult.WindowText.AppendLine();
@@ -175,5 +181,48 @@ namespace JenkinsStatusWindow
return textResult;
}
public bool HasSettingsMenu => true;
public bool HasRefreshMenu => true;
public void ShowSettings()
{
var panels = new List<CategoryPanel>
{
new GeneralOptionsPanel(),
new JenkinsProjectsOptionsPanel(),
new AboutOptionsPanel()
};
var jenkinsProjects = JenkinsProjects.Load();
if (_optionsWindow == null)
{
_optionsWindow = new CategoryWindow(jenkinsProjects, panels, Resources.ResourceManager, "OptionsWindow");
_optionsWindow.Closed += (o, args) => { _optionsWindow = null; };
}
var dialogResult = _optionsWindow.ShowDialog();
if (dialogResult.HasValue && dialogResult.Value)
{
jenkinsProjects.Save();
_jenkinsProjects = JenkinsProjects.Load();
Refresh();
}
}
public void Refresh()
{
_refreshTimer.Stop();
_floatingStatusWindow.SetText(Resources.Loading);
_refreshTimer.Interval = 500;
_refreshTimer.Start();
}
}
}

View File

@@ -1,5 +0,0 @@
<?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>