diff --git a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.Designer.cs b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.Designer.cs
index fdcb4fd..ff40364 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.Designer.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.Designer.cs
@@ -1,5 +1,7 @@
-namespace VersionOne.ServiceHost.ConfigurationTool {
- partial class ConfigurationForm {
+namespace VersionOne.ServiceHost.ConfigurationTool
+{
+ partial class ConfigurationForm
+ {
///
/// Required designer variable.
///
@@ -9,8 +11,10 @@ partial class ConfigurationForm {
/// Clean up any resources being used.
///
/// true if managed resources should be disposed; otherwise, false.
- protected override void Dispose(bool disposing) {
- if (disposing && (components != null)) {
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
components.Dispose();
}
base.Dispose(disposing);
@@ -22,7 +26,8 @@ protected override void Dispose(bool disposing) {
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///
- private void InitializeComponent() {
+ private void InitializeComponent()
+ {
this.msMenu = new System.Windows.Forms.MenuStrip();
this.miFile = new System.Windows.Forms.ToolStripMenuItem();
this.miNewFile = new System.Windows.Forms.ToolStripMenuItem();
@@ -48,6 +53,7 @@ private void InitializeComponent() {
this.lblHeader = new System.Windows.Forms.Label();
this.msMenu.SuspendLayout();
this.tsMenu.SuspendLayout();
+ ((System.ComponentModel.ISupportInitialize)(this.ctlSplitContainer)).BeginInit();
this.ctlSplitContainer.Panel1.SuspendLayout();
this.ctlSplitContainer.Panel2.SuspendLayout();
this.ctlSplitContainer.SuspendLayout();
@@ -77,7 +83,7 @@ private void InitializeComponent() {
this.miSeparator2,
this.miExit});
this.miFile.Name = "miFile";
- this.miFile.Size = new System.Drawing.Size(35, 20);
+ this.miFile.Size = new System.Drawing.Size(37, 20);
this.miFile.Text = "&File";
//
// miNewFile
@@ -86,7 +92,7 @@ private void InitializeComponent() {
this.miNewFile.ImageTransparentColor = System.Drawing.Color.Magenta;
this.miNewFile.Name = "miNewFile";
this.miNewFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
- this.miNewFile.Size = new System.Drawing.Size(151, 22);
+ this.miNewFile.Size = new System.Drawing.Size(146, 22);
this.miNewFile.Text = "&New";
//
// miOpenFile
@@ -95,13 +101,13 @@ private void InitializeComponent() {
this.miOpenFile.ImageTransparentColor = System.Drawing.Color.Magenta;
this.miOpenFile.Name = "miOpenFile";
this.miOpenFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
- this.miOpenFile.Size = new System.Drawing.Size(151, 22);
+ this.miOpenFile.Size = new System.Drawing.Size(146, 22);
this.miOpenFile.Text = "&Open";
//
// miSeparator1
//
this.miSeparator1.Name = "miSeparator1";
- this.miSeparator1.Size = new System.Drawing.Size(148, 6);
+ this.miSeparator1.Size = new System.Drawing.Size(143, 6);
//
// miSaveFile
//
@@ -109,24 +115,24 @@ private void InitializeComponent() {
this.miSaveFile.ImageTransparentColor = System.Drawing.Color.Magenta;
this.miSaveFile.Name = "miSaveFile";
this.miSaveFile.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
- this.miSaveFile.Size = new System.Drawing.Size(151, 22);
+ this.miSaveFile.Size = new System.Drawing.Size(146, 22);
this.miSaveFile.Text = "&Save";
//
// miSaveFileAs
//
this.miSaveFileAs.Name = "miSaveFileAs";
- this.miSaveFileAs.Size = new System.Drawing.Size(151, 22);
+ this.miSaveFileAs.Size = new System.Drawing.Size(146, 22);
this.miSaveFileAs.Text = "Save &As";
//
// miSeparator2
//
this.miSeparator2.Name = "miSeparator2";
- this.miSeparator2.Size = new System.Drawing.Size(148, 6);
+ this.miSeparator2.Size = new System.Drawing.Size(143, 6);
//
// miExit
//
this.miExit.Name = "miExit";
- this.miExit.Size = new System.Drawing.Size(151, 22);
+ this.miExit.Size = new System.Drawing.Size(146, 22);
this.miExit.Text = "E&xit";
//
// miTools
@@ -136,24 +142,24 @@ private void InitializeComponent() {
this.miSeparator3,
this.miOptions});
this.miTools.Name = "miTools";
- this.miTools.Size = new System.Drawing.Size(44, 20);
+ this.miTools.Size = new System.Drawing.Size(48, 20);
this.miTools.Text = "&Tools";
//
// miGenerateSnapshot
//
this.miGenerateSnapshot.Name = "miGenerateSnapshot";
- this.miGenerateSnapshot.Size = new System.Drawing.Size(206, 22);
+ this.miGenerateSnapshot.Size = new System.Drawing.Size(203, 22);
this.miGenerateSnapshot.Text = "Create settings snapshot";
//
// miSeparator3
//
this.miSeparator3.Name = "miSeparator3";
- this.miSeparator3.Size = new System.Drawing.Size(203, 6);
+ this.miSeparator3.Size = new System.Drawing.Size(200, 6);
//
// miOptions
//
this.miOptions.Name = "miOptions";
- this.miOptions.Size = new System.Drawing.Size(206, 22);
+ this.miOptions.Size = new System.Drawing.Size(203, 22);
this.miOptions.Text = "&Options";
//
// miHelp
@@ -161,13 +167,13 @@ private void InitializeComponent() {
this.miHelp.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.miAbout});
this.miHelp.Name = "miHelp";
- this.miHelp.Size = new System.Drawing.Size(40, 20);
+ this.miHelp.Size = new System.Drawing.Size(44, 20);
this.miHelp.Text = "&Help";
//
// miAbout
//
this.miAbout.Name = "miAbout";
- this.miAbout.Size = new System.Drawing.Size(126, 22);
+ this.miAbout.Size = new System.Drawing.Size(116, 22);
this.miAbout.Text = "&About...";
//
// tsMenu
@@ -228,9 +234,9 @@ private void InitializeComponent() {
//
// pnlControlHolder
//
- this.pnlControlHolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.pnlControlHolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.pnlControlHolder.Location = new System.Drawing.Point(0, 29);
this.pnlControlHolder.Name = "pnlControlHolder";
this.pnlControlHolder.Size = new System.Drawing.Size(501, 747);
@@ -275,6 +281,7 @@ private void InitializeComponent() {
this.tsMenu.PerformLayout();
this.ctlSplitContainer.Panel1.ResumeLayout(false);
this.ctlSplitContainer.Panel2.ResumeLayout(false);
+ ((System.ComponentModel.ISupportInitialize)(this.ctlSplitContainer)).EndInit();
this.ctlSplitContainer.ResumeLayout(false);
this.pnlHeader.ResumeLayout(false);
this.pnlHeader.PerformLayout();
@@ -287,8 +294,9 @@ private void InitializeComponent() {
// There is known bug in code generation for SplitContainer, the order of generated statements makes it fail.
// That's why this part should be extracted to separate method to be called just after InitializeComponent.
- private void PostInitializeComponent() {
- ctlSplitContainer.Panel1MinSize = 100;
+ private void PostInitializeComponent()
+ {
+ ctlSplitContainer.Panel1MinSize = 100;
ctlSplitContainer.Panel2MinSize = 450;
ctlSplitContainer.SplitterDistance = 208;
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.cs b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.cs
index 444118f..210c4df 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.cs
@@ -1,47 +1,57 @@
using System;
using System.Collections.Generic;
+using System.Collections.Specialized;
using System.ComponentModel;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using VersionOne.ServiceHost.ConfigurationTool.BZ;
+using VersionOne.ServiceHost.ConfigurationTool.Entities;
+using VersionOne.ServiceHost.ConfigurationTool.UI.Controls;
using VersionOne.ServiceHost.ConfigurationTool.UI.Interfaces;
-namespace VersionOne.ServiceHost.ConfigurationTool {
- public partial class ConfigurationForm : Form, IConfigurationView {
+namespace VersionOne.ServiceHost.ConfigurationTool
+{
+ public partial class ConfigurationForm : Form, IConfigurationView
+ {
private IConfigurationController controller;
-
+
private readonly List coreServiceNodes = new List(new[] { "Tests", "Defects", "Changesets", "Test service" });
- private readonly List nonSelectableNodes = new List(new[] {"Services" });
+ private readonly List nonSelectableNodes = new List(new[] { "Services" });
private readonly List coreServices = new List();
private readonly List customServices = new List();
-
+
private bool coreServicesEnabled = true;
private const string DefaultFilter = "XML Config file (VersionOne.ServiceHost.exe.config) | VersionOne.ServiceHost.exe.config; VersionOne.ServiceExecutor.exe.config";
private static readonly string DefaultFileName = Facade.ConfigurationFileNames[0];
- public string HeaderText {
+ public string HeaderText
+ {
get { return lblHeader.Text; }
set { lblHeader.Text = value; }
}
- public Control CurrentControl {
+ public Control CurrentControl
+ {
get { return pnlControlHolder.Controls.Count > 0 ? pnlControlHolder.Controls[0] : null; }
- set {
+ set
+ {
pnlControlHolder.Controls.Clear();
pnlControlHolder.Controls.Add(value);
value.Dock = DockStyle.Fill;
}
}
- public IConfigurationController Controller {
+ public IConfigurationController Controller
+ {
get { return controller; }
set { controller = value; }
}
- public ConfigurationForm() {
+ public ConfigurationForm()
+ {
InitializeComponent();
// This method must exist to separate part of control init from InitializeComponent().
// Code generation for SplitContainer contains known defect, and things moved to this one should not be generated.
@@ -63,22 +73,27 @@ public ConfigurationForm() {
tsbOpen.Click += OpenFileClick;
}
- private bool IsCoreService(string serviceKey) {
+ private bool IsCoreService(string serviceKey)
+ {
return coreServiceNodes.Contains(serviceKey);
}
- private bool NodeNotSelectable(TreeNode node) {
+ private bool NodeNotSelectable(TreeNode node)
+ {
return (!coreServicesEnabled && IsCoreService(node.Text)) || nonSelectableNodes.Contains(node.Text);
}
- private void ExecuteSaveFileAs() {
- using(var saveFileDialog = new SaveFileDialog()) {
+ private void ExecuteSaveFileAs()
+ {
+ using (var saveFileDialog = new SaveFileDialog())
+ {
saveFileDialog.Filter = DefaultFilter;
saveFileDialog.FileName = controller.CurrentFileName;
saveFileDialog.SupportMultiDottedExtensions = true;
saveFileDialog.AddExtension = true;
-
- if(saveFileDialog.ShowDialog(this) == DialogResult.OK) {
+
+ if (saveFileDialog.ShowDialog(this) == DialogResult.OK)
+ {
controller.SaveToFile(saveFileDialog.FileName);
}
}
@@ -86,8 +101,10 @@ private void ExecuteSaveFileAs() {
#region Event handlers
- private void tvServices_BeforeSelect(object sender, TreeViewCancelEventArgs e) {
- if (NodeNotSelectable(e.Node)) {
+ private void tvServices_BeforeSelect(object sender, TreeViewCancelEventArgs e)
+ {
+ if (NodeNotSelectable(e.Node))
+ {
e.Cancel = true;
return;
}
@@ -96,32 +113,87 @@ private void tvServices_BeforeSelect(object sender, TreeViewCancelEventArgs e) {
e.Cancel = !isAvailable;
}
- private void tvServices_AfterSelect(object sender, TreeViewEventArgs e) {
+ private void tvServices_AfterSelect(object sender, TreeViewEventArgs e)
+ {
controller.ShowPage(e.Node.Text);
+
+ if (controller.View.CurrentControl is V1SettingsPageControl)
+ {
+ controller.Settings.Settings.PropertyChanged += OnPropertyChanged;
+ controller.Settings.Settings.ProxySettings.PropertyChanged += OnPropertyChanged;
+ }
+ else if (controller.View.CurrentControl is WorkitemsPageControl)
+ {
+ var workitemWriter = controller.Settings.Services.OfType().SingleOrDefault();
+ if (workitemWriter != null)
+ workitemWriter.PropertyChanged += OnPropertyChanged;
+ }
+ else if (controller.View.CurrentControl is JiraPageControl)
+ {
+ var jiraService = controller.Settings.Services.OfType().SingleOrDefault();
+ if (jiraService != null)
+ {
+ jiraService.PropertyChanged += OnPropertyChanged;
+ jiraService.Timer.PropertyChanged += OnPropertyChanged;
+ jiraService.CreateDefectFilter.PropertyChanged += OnPropertyChanged;
+ jiraService.CreateStoryFilter.PropertyChanged += OnPropertyChanged;
+ jiraService.ProgressWorkflow.PropertyChanged += OnPropertyChanged;
+ jiraService.ProgressWorkflowClosed.PropertyChanged += OnPropertyChanged;
+ jiraService.ProjectMappings.ToList().ForEach(pm =>
+ {
+ pm.JiraProject.PropertyChanged += OnPropertyChanged;
+ pm.VersionOneProject.PropertyChanged += OnPropertyChanged;
+ });
+ jiraService.PriorityMappings.ToList().ForEach(pm =>
+ {
+ pm.JiraPriority.PropertyChanged += OnPropertyChanged;
+ pm.VersionOnePriority.PropertyChanged += OnPropertyChanged;
+ });
+ jiraService.ProjectMappings.CollectionChanged += OnCollectionChanged;
+ jiraService.PriorityMappings.CollectionChanged += OnCollectionChanged;
+ }
+ }
}
- private void tsbSave_Click(object sender, EventArgs e) {
+ private void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
+ {
+ controller.Settings.HasChanged = true;
+ }
+
+ private void OnCollectionChanged(object o, NotifyCollectionChangedEventArgs args)
+ {
+ controller.Settings.HasChanged = true;
+ }
+
+ private void tsbSave_Click(object sender, EventArgs e)
+ {
controller.SaveToFile(controller.CurrentFileName);
}
- private void miSaveFile_Click(object sender, EventArgs e) {
+ private void miSaveFile_Click(object sender, EventArgs e)
+ {
controller.SaveToFile(controller.CurrentFileName);
}
//TODO move to controller
- private void miSaveFileAs_Click(object sender, EventArgs e) {
+ private void miSaveFileAs_Click(object sender, EventArgs e)
+ {
ExecuteSaveFileAs();
}
//TODO move to controller
- private void OpenFileClick(object sender, EventArgs e) {
- if(CheckChanges()) {
- using (var dialog = new OpenFileDialog()) {
+ private void OpenFileClick(object sender, EventArgs e)
+ {
+ if (CheckChanges())
+ {
+ using (var dialog = new OpenFileDialog())
+ {
dialog.Filter = DefaultFilter;
dialog.FileName = DefaultFileName;
dialog.SupportMultiDottedExtensions = true;
dialog.AddExtension = true;
- if (dialog.ShowDialog(this) == DialogResult.OK) {
+ if (dialog.ShowDialog(this) == DialogResult.OK)
+ {
controller.LoadFromFile(dialog.FileName);
}
}
@@ -133,32 +205,40 @@ private void OpenFileClick(object sender, EventArgs e) {
///
/// False if user pressed Cancel, true otherwise.
// TODO refactor
- private bool CheckChanges() {
- if(controller.Settings.HasChanged) {
+ private bool CheckChanges()
+ {
+ if (controller.Settings.HasChanged)
+ {
var result = MessageBox.Show("Do you want to save changes?", "ServiceHost Settings", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
-
- if (result == DialogResult.Cancel) {
+
+ if (result == DialogResult.Cancel)
+ {
return false;
}
-
- if (result == DialogResult.Yes) {
+
+ if (result == DialogResult.Yes)
+ {
ExecuteSaveFileAs();
}
}
return true;
}
- private void FormClosingHandler(object sender, CancelEventArgs e) {
- if (!CheckChanges()) {
+ private void FormClosingHandler(object sender, CancelEventArgs e)
+ {
+ if (!CheckChanges())
+ {
e.Cancel = true;
}
}
- private void miExit_Click(object sender, EventArgs e) {
+ private void miExit_Click(object sender, EventArgs e)
+ {
Close();
}
- private void miAbout_Click(object sender, EventArgs e) {
+ private void miAbout_Click(object sender, EventArgs e)
+ {
var description = string.Format("VersionOne ServiceHost configuration utility, version {0}. (c) {1}", controller.ApplicationVersion, Application.CompanyName);
MessageBox.Show(description);
}
@@ -166,59 +246,71 @@ private void miAbout_Click(object sender, EventArgs e) {
#region IConfigurationView Members
- public bool NewFileMenuItemEnabled {
+ public bool NewFileMenuItemEnabled
+ {
get { return miNewFile.Enabled; }
set { miNewFile.Enabled = value; }
}
- public bool OpenFileMenuItemEnabled {
+ public bool OpenFileMenuItemEnabled
+ {
get { return miOpenFile.Enabled; }
set { miOpenFile.Enabled = tsbOpen.Enabled = value; }
}
- public bool SaveFileMenuItemEnabled {
+ public bool SaveFileMenuItemEnabled
+ {
get { return miSaveFile.Enabled; }
set { miSaveFile.Enabled = tsbSave.Enabled = value; }
}
- public bool SaveFileAsMenuItemEnabled {
+ public bool SaveFileAsMenuItemEnabled
+ {
get { return miSaveFileAs.Enabled; }
set { miSaveFileAs.Enabled = value; }
}
- public bool OptionsMenuItemEnabled {
+ public bool OptionsMenuItemEnabled
+ {
get { return miOptions.Enabled; }
set { miOptions.Enabled = value; }
}
- public bool GenerateSnapshotMenuItemEnabled {
+ public bool GenerateSnapshotMenuItemEnabled
+ {
get { return miGenerateSnapshot.Enabled; }
set { miGenerateSnapshot.Enabled = value; }
}
- public void SetServiceNodesAndRedraw(IEnumerable coreServiceNodes, IEnumerable customServiceNodes) {
+ public void SetServiceNodesAndRedraw(IEnumerable coreServiceNodes, IEnumerable customServiceNodes)
+ {
SetCoreServiceNodes(coreServiceNodes);
SetCustomServiceNodes(customServiceNodes);
DrawNodes();
}
- private void SetCoreServiceNodes(IEnumerable nodes) {
+ private void SetCoreServiceNodes(IEnumerable nodes)
+ {
coreServices.Clear();
- if (nodes != null) {
+ if (nodes != null)
+ {
coreServices.AddRange(nodes);
}
}
- private void SetCustomServiceNodes(IEnumerable nodes) {
+ private void SetCustomServiceNodes(IEnumerable nodes)
+ {
customServices.Clear();
- if (nodes != null) {
+ if (nodes != null)
+ {
customServices.AddRange(nodes);
}
}
- private void DrawNodes() {
+ private void DrawNodes()
+ {
tvServices.BeginUpdate();
-
+
tvServices.Nodes.Clear();
var generalNode = new TreeNode("General");
@@ -233,15 +325,18 @@ private void DrawNodes() {
tvServices.ExpandAll();
}
- public void SetCoreServiceNodesEnabled(bool enabled) {
+ public void SetCoreServiceNodesEnabled(bool enabled)
+ {
coreServicesEnabled = enabled;
-
- foreach (var node in tvServices.Nodes[0].Nodes.Cast().Where(node => IsCoreService(node.Text))) {
+
+ foreach (var node in tvServices.Nodes[0].Nodes.Cast().Where(node => IsCoreService(node.Text)))
+ {
node.ForeColor = enabled ? SystemColors.ControlText : SystemColors.GrayText;
}
}
- public void ShowErrorMessage(string message) {
+ public void ShowErrorMessage(string message)
+ {
MessageBox.Show(this, message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.resx b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.resx
index cd4bf85..415bea0 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.resx
+++ b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationForm.resx
@@ -112,15 +112,15 @@
2.0
- System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
- System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
104, 17
-
+
17, 17
\ No newline at end of file
diff --git a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationFormController.cs b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationFormController.cs
index 2d6bdf1..355ce4a 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/ConfigurationFormController.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/ConfigurationFormController.cs
@@ -7,55 +7,71 @@
using VersionOne.ServiceHost.ConfigurationTool.BZ;
using VersionOne.ServiceHost.ConfigurationTool.Entities;
using VersionOne.ServiceHost.ConfigurationTool.UI;
+using VersionOne.ServiceHost.ConfigurationTool.UI.Controls;
using VersionOne.ServiceHost.ConfigurationTool.UI.Interfaces;
-namespace VersionOne.ServiceHost.ConfigurationTool {
- public class ConfigurationFormController : IConfigurationController, IFormController {
+namespace VersionOne.ServiceHost.ConfigurationTool
+{
+ public class ConfigurationFormController : IConfigurationController, IFormController
+ {
private IConfigurationView view;
private ServiceHostConfiguration settings;
private string currentFileNameValue = string.Empty;
-
+
private readonly IFacade facadeImpl;
private readonly IUIFactory uiFactory;
#region IConfigurationController Members
- public IConfigurationView View {
+ public IConfigurationView View
+ {
get { return view; }
}
- public ServiceHostConfiguration Settings {
+ public ServiceHostConfiguration Settings
+ {
get { return settings; }
}
- public string ApplicationVersion {
+ public string ApplicationVersion
+ {
get { return Assembly.GetExecutingAssembly().GetName().Version.ToString(); }
}
- public string CurrentFileName {
+ public string CurrentFileName
+ {
get { return currentFileNameValue; }
}
- public ConfigurationFormController(IFacade facade, IUIFactory uiFactory) {
+ public ConfigurationFormController(IFacade facade, IUIFactory uiFactory)
+ {
facadeImpl = facade;
this.uiFactory = uiFactory;
settings = facade.CreateConfiguration();
}
- public void ShowPage(string pageKey) {
- try {
+ public void ShowPage(string pageKey)
+ {
+ try
+ {
var newView = uiFactory.GetNextPage(pageKey, Settings, this);
View.HeaderText = pageKey;
View.CurrentControl = newView;
- } catch(DependencyFailureException ex) {
+ }
+ catch (DependencyFailureException ex)
+ {
view.ShowErrorMessage(ex.Message);
- } catch(V1ConnectionRequiredException) {
+ }
+ catch (V1ConnectionRequiredException)
+ {
view.ShowErrorMessage("To open the page, valid V1 connection is required");
}
}
- public void RegisterView (IConfigurationView configurationView) {
- if (configurationView == null) {
+ public void RegisterView(IConfigurationView configurationView)
+ {
+ if (configurationView == null)
+ {
throw new InvalidOperationException("View must be initialized");
}
@@ -63,7 +79,8 @@ public void RegisterView (IConfigurationView configurationView) {
configurationView.Controller = this;
}
- public void PrepareView() {
+ public void PrepareView()
+ {
view.GenerateSnapshotMenuItemEnabled = false;
view.NewFileMenuItemEnabled = false;
view.OpenFileMenuItemEnabled = true;
@@ -71,25 +88,33 @@ public void PrepareView() {
view.SaveFileAsMenuItemEnabled = true;
view.SaveFileMenuItemEnabled = true;
- if (facadeImpl.AnyFileExists(Facade.ConfigurationFileNames)) {
+ if (facadeImpl.AnyFileExists(Facade.ConfigurationFileNames))
+ {
LoadFromAnyDefaultFile();
- } else {
+ }
+ else
+ {
view.SetServiceNodesAndRedraw(null, null);
view.SetCoreServiceNodesEnabled(false);
}
}
- private void LoadFromAnyDefaultFile() {
- foreach (var fileName in Facade.ConfigurationFileNames) {
- if (facadeImpl.FileExists(fileName)) {
+ private void LoadFromAnyDefaultFile()
+ {
+ foreach (var fileName in Facade.ConfigurationFileNames)
+ {
+ if (facadeImpl.FileExists(fileName))
+ {
LoadFromFile(fileName);
return;
}
}
}
- public void SaveToFile(string fileName) {
- if (string.IsNullOrEmpty(fileName)) {
+ public void SaveToFile(string fileName)
+ {
+ if (string.IsNullOrEmpty(fileName))
+ {
fileName = Facade.ConfigurationFileNames[0];
}
@@ -97,61 +122,78 @@ public void SaveToFile(string fileName) {
var result = facadeImpl.SaveConfigurationToFile(Settings, fileName);
- if(result.IsValid) {
+ if (result.IsValid)
+ {
+ settings.HasChanged = false;
return;
}
var sb = new StringBuilder("Cannot save settings to file. The following errors were encountered: ");
- foreach (var error in result.GeneralErrors) {
+ foreach (var error in result.GeneralErrors)
+ {
AppendErrorString(sb, error);
}
- foreach (var entity in result.InvalidEntities.Keys) {
+ foreach (var entity in result.InvalidEntities.Keys)
+ {
AppendErrorString(sb, GetInvalidPageErrorMessage(entity, result.InvalidEntities[entity]));
}
view.ShowErrorMessage(sb.ToString());
}
- private static void AppendErrorString(StringBuilder sb, string message) {
+ private static void AppendErrorString(StringBuilder sb, string message)
+ {
sb.AppendFormat("{0} {1}", Environment.NewLine, message);
}
- private string GetInvalidPageErrorMessage(BaseServiceEntity entity, IEnumerable messages) {
+ private string GetInvalidPageErrorMessage(BaseServiceEntity entity, IEnumerable messages)
+ {
var pageName = uiFactory.ResolvePageNameByEntity(entity);
return string.Format("{0} page contains invalid data:{1}{2}{3}", pageName, Environment.NewLine, "-", string.Join(Environment.NewLine + "-", messages.ToArray()));
}
- public void LoadFromFile(string fileName) {
- try {
+ public void LoadFromFile(string fileName)
+ {
+ try
+ {
settings = facadeImpl.LoadConfigurationFromFile(fileName);
new DependencyValidator(facadeImpl).CheckServiceDependencies(settings);
-
+
facadeImpl.ResetConnection();
ShowPage("General");
view.SetServiceNodesAndRedraw(uiFactory.GetCoreServiceNames(settings), uiFactory.GetCustomServiceNames(settings));
view.SetCoreServiceNodesEnabled(false);
currentFileNameValue = fileName;
- } catch(InvalidFilenameException ex) {
+ }
+ catch (InvalidFilenameException ex)
+ {
view.ShowErrorMessage(ex.Message);
- } catch(DependencyFailureException) {
+ }
+ catch (DependencyFailureException)
+ {
settings = facadeImpl.CreateConfiguration();
view.SetServiceNodesAndRedraw(null, null);
view.ShowErrorMessage(Resources.ServiceDependenciesInFileInvalid);
}
}
-
- public bool ValidatePageAvailability(string pageKey) {
+
+ public bool ValidatePageAvailability(string pageKey)
+ {
var model = uiFactory.ResolveModel(pageKey, settings);
- try {
- if (model is BaseServiceEntity) {
- new DependencyValidator(facadeImpl).CheckVersionOneDependency((BaseServiceEntity) model);
+ try
+ {
+ if (model is BaseServiceEntity)
+ {
+ new DependencyValidator(facadeImpl).CheckVersionOneDependency((BaseServiceEntity)model);
}
- } catch(V1ConnectionRequiredException) {
+ }
+ catch (V1ConnectionRequiredException)
+ {
View.ShowErrorMessage(Resources.V1ConnectionRequiredForPage);
return false;
}
@@ -163,11 +205,13 @@ public bool ValidatePageAvailability(string pageKey) {
#region IFormController Members
- public void SetCoreServiceNodesEnabled(bool enabled) {
+ public void SetCoreServiceNodesEnabled(bool enabled)
+ {
View.SetCoreServiceNodesEnabled(enabled);
}
- public void FailApplication(string message) {
+ public void FailApplication(string message)
+ {
view.ShowErrorMessage("Could not load application dependency. Application will be closed.");
facadeImpl.LogMessage(message);
Environment.Exit(-1);
@@ -175,8 +219,10 @@ public void FailApplication(string message) {
public event EventHandler BeforeSave;
- private void InvokeBeforeSave() {
- if(BeforeSave != null) {
+ private void InvokeBeforeSave()
+ {
+ if (BeforeSave != null)
+ {
BeforeSave(this, EventArgs.Empty);
}
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseEntity.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseEntity.cs
index 3aab663..946086f 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseEntity.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseEntity.cs
@@ -1,28 +1,39 @@
-using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
using System.Xml.Serialization;
using VersionOne.ServiceHost.ConfigurationTool.Attributes;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public abstract class BaseEntity {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public abstract class BaseEntity : INotifyPropertyChanged
+ {
public const string DisabledProperty = "Disabled";
+ protected bool disabled;
+
[XmlIgnore]
public virtual string TagName { get; set; }
- [XmlAttribute("class")]
- public string ClassName {
- get { return ServicesMap.GetByEntityType(GetType()).FullTypeNameAndAssembly; }
- set { }
- }
-
[XmlIgnore]
[HelpString(HelpResourceKey = "CommonDisabled")]
- public bool Disabled { get; set; }
+ public virtual bool Disabled
+ {
+ get { return disabled; }
+ set
+ {
+ disabled = value;
+ NotifyPropertyChanged();
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
- [XmlAttribute("disabled")]
- public int DisabledNumeric {
- get { return Convert.ToInt32(Disabled); }
- set { Disabled = Convert.ToBoolean(value); }
+ protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
+ {
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
}
}
}
\ No newline at end of file
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseServiceEntity.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseServiceEntity.cs
index 6fa0efa..7163a3e 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseServiceEntity.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/BaseServiceEntity.cs
@@ -1,22 +1,58 @@
+using System;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
using System.Xml.Serialization;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
///
/// Base class for all Service configuration entities.
///
- public abstract class BaseServiceEntity : BaseEntity {
+ public abstract class BaseServiceEntity : BaseEntity
+ {
+ private TimerEntity timer;
+
[XmlIgnore]
- public bool HasTimer {
- get { return Timer != null; }
+ public TimerEntity Timer
+ {
+ get { return timer; }
+ set
+ {
+ timer = value;
+ NotifyPropertyChanged();
+ }
}
[XmlIgnore]
- public TimerEntity Timer { get; set; }
+ public bool HasTimer
+ {
+ get { return Timer != null; }
+ }
+
+ [XmlAttribute("class")]
+ public virtual string ClassName
+ {
+ get
+ {
+ var serviceMap = ServicesMap.GetByEntityType(GetType());
+ return serviceMap != null ? serviceMap.FullTypeNameAndAssembly : string.Empty;
+ }
+ set { }
+ }
+
+ [XmlAttribute("disabled")]
+ public virtual int DisabledNumeric
+ {
+ get { return Convert.ToInt32(Disabled); }
+ set { Disabled = Convert.ToBoolean(value); }
+ }
- protected void CreateTimer(int timeoutMinutes) {
+ protected void CreateTimer(int timeoutMinutes)
+ {
var thisService = ServicesMap.GetByEntityType(GetType());
- Timer = new TimerEntity {
+ Timer = new TimerEntity
+ {
PublishClass = thisService.PublishClass + ", " + thisService.Assembly,
Disabled = false,
TimeoutMinutes = timeoutMinutes
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraFilter.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraFilter.cs
index 6e372a9..7abec57 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraFilter.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraFilter.cs
@@ -3,22 +3,42 @@
using VersionOne.ServiceHost.ConfigurationTool.Attributes;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public class JiraFilter {
- public const string DisabledProperty = "Disabled";
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public class JiraFilter : BaseEntity
+ {
public const string IdProperty = "Id";
+ private string id;
+
[HelpString(HelpResourceKey = "JiraFilterId")]
[XmlAttribute("id")]
[ConditionalNonEmptyStringValidator(DisabledProperty, false)]
- public string Id { get; set; }
+ public string Id
+ {
+ get { return id; }
+ set
+ {
+ id = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraFilterDisabled")]
[XmlIgnore]
- public bool Disabled { get; set; }
+ public override bool Disabled
+ {
+ get { return disabled; }
+ set
+ {
+ disabled = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlAttribute("disabled")]
- public int DisabledNumeric {
+ public int DisabledNumeric
+ {
get { return Convert.ToInt32(Disabled); }
set { Disabled = Convert.ToBoolean(value); }
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraPriorityMapping.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraPriorityMapping.cs
index d1ee96b..f8ec891 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraPriorityMapping.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraPriorityMapping.cs
@@ -1,45 +1,52 @@
using System.Xml.Serialization;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public class JiraPriorityMapping {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public class JiraPriorityMapping
+ {
public const string VersionOnePriorityNameProperty = "VersionOnePriorityName";
public const string VersionOnePriorityIdProperty = "VersionOnePriorityId";
public const string JiraPriorityNameProperty = "JiraPriorityName";
public const string JiraPriorityIdProperty = "JiraPriorityId";
- public JiraPriorityMapping() {
+ public JiraPriorityMapping()
+ {
JiraPriority = new Mapping();
VersionOnePriority = new Mapping();
}
[XmlElement("JIRAPriority")]
public Mapping JiraPriority { get; set; }
-
+
public Mapping VersionOnePriority { get; set; }
[XmlIgnore]
- public string VersionOnePriorityName {
+ public string VersionOnePriorityName
+ {
get { return VersionOnePriority.Name; }
set { VersionOnePriority.Name = value; }
}
[XmlIgnore]
[NonEmptyStringValidator]
- public string VersionOnePriorityId {
+ public string VersionOnePriorityId
+ {
get { return VersionOnePriority.Id; }
set { VersionOnePriority.Id = value; }
}
[XmlIgnore]
- public string JiraPriorityName {
+ public string JiraPriorityName
+ {
get { return JiraPriority.Name; }
set { JiraPriority.Name = value; }
}
[XmlIgnore]
[NonEmptyStringValidator]
- public string JiraPriorityId {
+ public string JiraPriorityId
+ {
get { return JiraPriority.Id; }
set { JiraPriority.Id = value; }
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraProjectMapping.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraProjectMapping.cs
index 880c154..31129c8 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraProjectMapping.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraProjectMapping.cs
@@ -1,13 +1,16 @@
using System.Xml.Serialization;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public class JiraProjectMapping {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public class JiraProjectMapping
+ {
public const string VersionOneProjectNameProperty = "VersionOneProjectName";
public const string VersionOneProjectTokenProperty = "VersionOneProjectToken";
public const string JiraProjectNameProperty = "JiraProjectName";
- public JiraProjectMapping() {
+ public JiraProjectMapping()
+ {
JiraProject = new Mapping();
VersionOneProject = new Mapping();
}
@@ -18,21 +21,24 @@ public JiraProjectMapping() {
public Mapping VersionOneProject { get; set; }
[XmlIgnore]
- public string VersionOneProjectName {
+ public string VersionOneProjectName
+ {
get { return VersionOneProject.Name; }
set { VersionOneProject.Name = value; }
}
[XmlIgnore]
[NonEmptyStringValidator]
- public string VersionOneProjectToken {
+ public string VersionOneProjectToken
+ {
get { return VersionOneProject.Id; }
set { VersionOneProject.Id = value; }
}
[XmlIgnore]
[NonEmptyStringValidator]
- public string JiraProjectName {
+ public string JiraProjectName
+ {
get { return JiraProject.Name; }
set { JiraProject.Name = value; }
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraServiceEntity.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraServiceEntity.cs
index b556db6..21f58d5 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraServiceEntity.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/JiraServiceEntity.cs
@@ -1,16 +1,19 @@
using System.Collections.Generic;
+using System.Collections.ObjectModel;
using System.Xml.Serialization;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using VersionOne.ServiceHost.ConfigurationTool.Attributes;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
[DependsOnVersionOne]
[DependsOnService(typeof(WorkitemWriterEntity))]
[XmlRoot("JiraHostedService")]
[HasSelfValidation]
- public class JiraServiceEntity : BaseServiceEntity {
+ public class JiraServiceEntity : BaseServiceEntity
+ {
private const string jiraServiceFactory = "VersionOne.Jira.SoapProxy.JiraSoapServiceFactory, VersionOne.Jira.SoapProxy";
public const string UrlProperty = "Url";
@@ -33,123 +36,296 @@ public class JiraServiceEntity : BaseServiceEntity {
public const string ProjectMappingsProperty = "ProjectMappings";
public const string PriorityMappingsProperty = "PriorityMappings";
- public JiraServiceEntity () {
+ private string url;
+ private string userName;
+ private string password;
+ private ObservableCollection projectMappings;
+ private ObservableCollection priorityMappings;
+ private JiraFilter createDefectFilter;
+ private JiraFilter createStoryFilter;
+ private string createFieldId;
+ private string createFieldValue;
+ private string closeFieldId;
+ private string closeFieldValue;
+ private NullableInt progressWorkflow;
+ private NullableInt progressWorkflowClosed;
+ private string assigneeStateChanged;
+ private string urlTemplate;
+ private string urlTitle;
+ private string sourceName;
+ private string linkField;
+
+ public JiraServiceEntity()
+ {
CreateTimer(TimerEntity.DefaultTimerIntervalMinutes);
CreateDefectFilter = new JiraFilter();
CreateStoryFilter = new JiraFilter();
ProgressWorkflow = new NullableInt();
ProgressWorkflowClosed = new NullableInt();
- ProjectMappings = new List();
- PriorityMappings = new List();
+ ProjectMappings = new ObservableCollection();
+ PriorityMappings = new ObservableCollection();
}
[XmlElement("JIRAServiceFactory")]
- public string JiraServiceFactory {
+ public string JiraServiceFactory
+ {
get { return jiraServiceFactory; }
- set {}
+ set { }
}
[NonEmptyStringValidator]
[XmlElement("JIRAUrl")]
- public string Url { get; set; }
+ public string Url
+ {
+ get { return url; }
+ set
+ {
+ url = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
[XmlElement("JIRAUserName")]
- public string UserName { get; set; }
+ public string UserName
+ {
+ get { return userName; }
+ set
+ {
+ userName = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
[XmlElement("JIRAPassword")]
- public string Password { get; set; }
+ public string Password
+ {
+ get { return password; }
+ set
+ {
+ password = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlArray("ProjectMappings")]
[XmlArrayItem("Mapping")]
[HelpString(HelpResourceKey = "JiraProjectMappings")]
- public List ProjectMappings { get; set; }
+ public ObservableCollection ProjectMappings
+ {
+ get { return projectMappings; }
+ set
+ {
+ projectMappings = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlArray("PriorityMappings")]
[XmlArrayItem("Mapping")]
[HelpString(HelpResourceKey = "JiraPriorityMappings")]
- public List PriorityMappings { get; set; }
+ public ObservableCollection PriorityMappings
+ {
+ get { return priorityMappings; }
+ set
+ {
+ priorityMappings = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlElement("CreateDefectFilter")]
[ObjectValidator]
- public JiraFilter CreateDefectFilter { get; set; }
+ public JiraFilter CreateDefectFilter
+ {
+ get { return createDefectFilter; }
+ set
+ {
+ createDefectFilter = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlElement("CreateStoryFilter")]
[ObjectValidator]
- public JiraFilter CreateStoryFilter { get; set; }
+ public JiraFilter CreateStoryFilter
+ {
+ get { return createStoryFilter; }
+ set
+ {
+ createStoryFilter = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraCreateFieldId")]
- public string CreateFieldId { get; set; }
+ public string CreateFieldId
+ {
+ get { return createFieldId; }
+ set
+ {
+ createFieldId = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraCreateFieldValue")]
- public string CreateFieldValue { get; set; }
+ public string CreateFieldValue
+ {
+ get { return createFieldValue; }
+ set
+ {
+ createFieldValue = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraCloseFieldId")]
- public string CloseFieldId { get; set; }
+ public string CloseFieldId
+ {
+ get { return closeFieldId; }
+ set
+ {
+ closeFieldId = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraCloseFieldValue")]
- public string CloseFieldValue { get; set; }
+ public string CloseFieldValue
+ {
+ get { return closeFieldValue; }
+ set
+ {
+ closeFieldValue = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraProgressWorkflow")]
- public NullableInt ProgressWorkflow { get; set; }
+ public NullableInt ProgressWorkflow
+ {
+ get { return progressWorkflow; }
+ set
+ {
+ progressWorkflow = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraProgressWorkflowClosed")]
- public NullableInt ProgressWorkflowClosed { get; set; }
+ public NullableInt ProgressWorkflowClosed
+ {
+ get { return progressWorkflowClosed; }
+ set
+ {
+ progressWorkflowClosed = value;
+ NotifyPropertyChanged();
+ }
+ }
[HelpString(HelpResourceKey = "JiraAssigneeStateChanged")]
- public string AssigneeStateChanged { get; set; }
+ public string AssigneeStateChanged
+ {
+ get { return assigneeStateChanged; }
+ set
+ {
+ assigneeStateChanged = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
[RegexValidator(@"^[a-z]+:\/\/.+?\#key\#$", MessageTemplate = "URL must be valid and end with #key# pattern.")]
[XmlElement("JIRAIssueUrlTemplate")]
[HelpString(HelpResourceKey = "JiraIssueUrlTemplate")]
- public string UrlTemplate { get; set; }
+ public string UrlTemplate
+ {
+ get { return urlTemplate; }
+ set
+ {
+ urlTemplate = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlElement("JIRAIssueUrlTitle")]
- public string UrlTitle { get; set; }
+ public string UrlTitle
+ {
+ get { return urlTitle; }
+ set
+ {
+ urlTitle = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
[XmlElement("SourceFieldValue")]
[HelpString(HelpResourceKey = "JiraSourceFieldValue")]
- public string SourceName { get; set; }
+ public string SourceName
+ {
+ get { return sourceName; }
+ set
+ {
+ sourceName = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlElement("WorkitemLinkFieldId")]
[HelpString(HelpResourceKey = "JiraWorkitemLinkFieldId")]
- public string LinkField { get; set; }
+ public string LinkField
+ {
+ get { return linkField; }
+ set
+ {
+ linkField = value;
+ NotifyPropertyChanged();
+ }
+ }
[SelfValidation]
- public void CheckProjectMappings(ValidationResults results) {
+ public void CheckProjectMappings(ValidationResults results)
+ {
var validator = ValidationFactory.CreateValidator();
- foreach(var mapping in ProjectMappings) {
+ foreach (var mapping in ProjectMappings)
+ {
var mappingValidationResults = validator.Validate(mapping);
- if(!mappingValidationResults.IsValid) {
+ if (!mappingValidationResults.IsValid)
+ {
results.AddAllResults(mappingValidationResults);
}
}
}
[SelfValidation]
- public void CheckPriorityMappings(ValidationResults results) {
+ public void CheckPriorityMappings(ValidationResults results)
+ {
var validator = ValidationFactory.CreateValidator();
- foreach (var mapping in PriorityMappings) {
+ foreach (var mapping in PriorityMappings)
+ {
var mappingValidationResults = validator.Validate(mapping);
- if(!mappingValidationResults.IsValid) {
+ if (!mappingValidationResults.IsValid)
+ {
results.AddAllResults(mappingValidationResults);
}
}
}
- public override bool Equals(object obj) {
- if (obj == null || GetType() != obj.GetType()) {
+ public override bool Equals(object obj)
+ {
+ if (obj == null || GetType() != obj.GetType())
+ {
return false;
}
- var other = (JiraServiceEntity) obj;
+ var other = (JiraServiceEntity)obj;
return string.Equals(other.AssigneeStateChanged, AssigneeStateChanged) &&
string.Equals(other.CloseFieldId, CloseFieldId) && string.Equals(other.CloseFieldValue, CloseFieldValue) &&
@@ -167,7 +343,8 @@ public override bool Equals(object obj) {
string.Equals(other.UrlTitle, UrlTitle);
}
- public override int GetHashCode() {
+ public override int GetHashCode()
+ {
return base.GetHashCode();
}
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/Mapping.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/Mapping.cs
index 5d3bb51..e26be4c 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/Mapping.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/Mapping.cs
@@ -1,11 +1,32 @@
using System.Xml.Serialization;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public class Mapping {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public class Mapping : BaseEntity
+ {
+ private string id;
+ private string name;
+
[XmlAttribute("id")]
- public string Id { get; set; }
+ public string Id
+ {
+ get { return id; }
+ set
+ {
+ id = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlText]
- public string Name { get; set; }
+ public string Name
+ {
+ get { return name; }
+ set
+ {
+ name = value;
+ NotifyPropertyChanged();
+ }
+ }
}
}
\ No newline at end of file
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableBool.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableBool.cs
index ce9195a..2fe20c3 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableBool.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableBool.cs
@@ -1,16 +1,20 @@
using System.Xml.Serialization;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public class NullableBool {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public class NullableBool
+ {
private bool boolValue;
public const string StringValueProperty = "StringValue";
public const string BoolValueProperty = "BoolValue";
[XmlText]
- public string StringValue {
+ public string StringValue
+ {
get { return HasValue ? boolValue.ToString().ToLowerInvariant() : null; }
- set {
+ set
+ {
bool boolVal;
HasValue = bool.TryParse(value, out boolVal);
boolValue = boolVal;
@@ -18,9 +22,11 @@ public string StringValue {
}
[XmlIgnore]
- public bool BoolValue {
+ public bool BoolValue
+ {
get { return boolValue; }
- set {
+ set
+ {
HasValue = true;
boolValue = value;
}
@@ -31,29 +37,36 @@ public bool BoolValue {
public NullableBool() { }
- public NullableBool(bool value) {
+ public NullableBool(bool value)
+ {
BoolValue = value;
}
- public override bool Equals(object obj) {
- if (obj == null || GetType() != obj.GetType()) {
+ public override bool Equals(object obj)
+ {
+ if (obj == null || GetType() != obj.GetType())
+ {
return false;
}
- var other = (NullableBool) obj;
+ var other = (NullableBool)obj;
return BoolValue == other.BoolValue && HasValue == other.HasValue;
}
- public override int GetHashCode() {
+ public override int GetHashCode()
+ {
return base.GetHashCode();
}
- public override string ToString() {
+ public override string ToString()
+ {
return StringValue;
}
- public static bool Equals (NullableBool a, NullableBool b) {
- if(a == null || b == null) {
+ public static bool Equals(NullableBool a, NullableBool b)
+ {
+ if (a == null || b == null)
+ {
return false;
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableInt.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableInt.cs
index 1d8de9d..94cc7b8 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableInt.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/NullableInt.cs
@@ -1,40 +1,48 @@
using System.Xml.Serialization;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
- public class NullableInt {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
+ public class NullableInt : BaseEntity
+ {
public const string StringValueProperty = "StringValue";
[XmlIgnore]
public int? NumberValue { get; set; }
[XmlText]
- public string StringValue {
+ public string StringValue
+ {
get { return NumberValue.HasValue ? NumberValue.ToString() : null; }
- set {
+ set
+ {
int parsedValue;
- if(int.TryParse(value, out parsedValue)) {
+ if (int.TryParse(value, out parsedValue))
NumberValue = parsedValue;
- } else {
+ else
NumberValue = null;
- }
+ NotifyPropertyChanged();
}
}
- public override bool Equals(object obj) {
- if(obj == null || obj.GetType() != typeof(NullableInt)) {
+ public override bool Equals(object obj)
+ {
+ if (obj == null || obj.GetType() != typeof(NullableInt))
+ {
return false;
}
- var other = (NullableInt) obj;
+ var other = (NullableInt)obj;
return NumberValue == other.NumberValue ||
(NumberValue.HasValue && other.NumberValue.HasValue && NumberValue.Value == other.NumberValue.Value);
}
- public override int GetHashCode() {
+ public override int GetHashCode()
+ {
return base.GetHashCode();
}
- public override string ToString() {
+ public override string ToString()
+ {
return StringValue;
}
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/ProxyConnectionSettings.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/ProxyConnectionSettings.cs
index 45ad559..75ddc40 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/ProxyConnectionSettings.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/ProxyConnectionSettings.cs
@@ -1,36 +1,97 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
using System.Text;
using System.Xml.Serialization;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
using VersionOne.ServiceHost.ConfigurationTool.Attributes;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
[XmlRoot("ProxySettings")]
- public class ProxyConnectionSettings {
+ public class ProxyConnectionSettings : INotifyPropertyChanged
+ {
+ public readonly static string EnabledProperty = "Enabled";
public readonly static string UriProperty = "Uri";
public readonly static string UsernameProperty = "UserName";
public readonly static string PasswordProperty = "Password";
- public readonly static string EnabledProperty = "Enabled";
public readonly static string DomainProperty = "Domain";
- [NonEmptyStringValidator]
- public string Uri { get; set; }
-
- public string UserName { get; set; }
-
- public string Password { get; set; }
-
- public string Domain { get; set; }
+ private bool enabled;
+ private string uri;
+ private string userName;
+ private string password;
+ private string domain;
[HelpString(HelpResourceKey = "V1PageProxyEnabled")]
[XmlIgnore]
- public bool Enabled { get; set; }
+ public bool Enabled
+ {
+ get { return enabled; }
+ set
+ {
+ enabled = value;
+ NotifyPropertyChanged();
+ }
+ }
[XmlAttribute("disabled")]
- public int DisabledNumeric {
+ public int DisabledNumeric
+ {
get { return Convert.ToInt32(!Enabled); }
set { Enabled = !Convert.ToBoolean(value); }
}
+
+ [NonEmptyStringValidator]
+ public string Uri
+ {
+ get { return uri; }
+ set
+ {
+ uri = value;
+ NotifyPropertyChanged();
+ }
+ }
+
+ public string UserName
+ {
+ get { return userName; }
+ set
+ {
+ userName = value;
+ NotifyPropertyChanged();
+ }
+ }
+
+ public string Password
+ {
+ get { return password; }
+ set
+ {
+ password = value;
+ NotifyPropertyChanged();
+ }
+ }
+
+ public string Domain
+ {
+ get { return domain; }
+ set
+ {
+ domain = value;
+ NotifyPropertyChanged();
+ }
+ }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
+ {
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
}
}
\ No newline at end of file
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/ServiceHostConfiguration.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/ServiceHostConfiguration.cs
index 6e056d0..146828d 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/ServiceHostConfiguration.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/ServiceHostConfiguration.cs
@@ -1,59 +1,73 @@
using System;
using System.Collections.Generic;
+using System.ComponentModel;
using Microsoft.Practices.EnterpriseLibrary.Validation;
using Microsoft.Practices.EnterpriseLibrary.Validation.Validators;
using VersionOne.ServiceHost.ConfigurationTool.UI.Interfaces;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
///
/// Container entity for all services settings.
///
[HasSelfValidation]
- public class ServiceHostConfiguration {
+ public class ServiceHostConfiguration
+ {
private readonly List services = new List();
private ProxyConnectionSettings proxySettings = new ProxyConnectionSettings();
public VersionOneSettings Settings { get; private set; }
- public ProxyConnectionSettings ProxySettings {
+ public ProxyConnectionSettings ProxySettings
+ {
get { return proxySettings; }
private set { proxySettings = value; }
}
public bool HasChanged { get; set; }
- public IEnumerable Services {
+ public IEnumerable Services
+ {
get { return services; }
}
- public ServiceHostConfiguration() {
- HasChanged = true;
+ public ServiceHostConfiguration()
+ {
}
- public ServiceHostConfiguration(IEnumerable entities) : this() {
- foreach(var entity in entities) {
+ public ServiceHostConfiguration(IEnumerable entities)
+ : this()
+ {
+ foreach (var entity in entities)
+ {
AddService(entity);
}
}
- public BaseServiceEntity this[Type type] {
+ public BaseServiceEntity this[Type type]
+ {
get { return services.Find(entity => entity.GetType() == type); }
}
- public void AddService(BaseServiceEntity entity) {
- if(entity is IVersionOneSettingsConsumer) {
- var settingsConsumer = (IVersionOneSettingsConsumer) entity;
+ public void AddService(BaseServiceEntity entity)
+ {
+ if (entity is IVersionOneSettingsConsumer)
+ {
+ var settingsConsumer = (IVersionOneSettingsConsumer)entity;
- if(Settings != null) {
+ if (Settings != null)
+ {
settingsConsumer.Settings = Settings;
- } else {
+ }
+ else
+ {
Settings = settingsConsumer.Settings;
ProxySettings = settingsConsumer.Settings.ProxySettings;
}
}
-
+
services.Add(entity);
}
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/TimerEntity.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/TimerEntity.cs
index eb4d7c1..b22506f 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/TimerEntity.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/TimerEntity.cs
@@ -3,27 +3,32 @@
using System.Xml.Serialization;
using VersionOne.ServiceHost.ConfigurationTool.Attributes;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
///
/// Entity representing Timer triggering Services operations in ServiceHost system.
///
[XmlRoot("TimePublisherService")]
- public sealed class TimerEntity : BaseEntity {
+ public sealed class TimerEntity : BaseServiceEntity
+ {
public const int DefaultTimerIntervalMinutes = 5;
public const int MinimumTimerIntervalMinutes = 1;
private const int minutesToMillisRatio = 60000;
private const int minimumTimerIntervalMillis = minutesToMillisRatio * MinimumTimerIntervalMinutes;
+ public const string TimerProperty = "TimeoutMinutes";
+
[DefaultValue(DefaultTimerIntervalMinutes * minutesToMillisRatio)]
private long timeoutMilliseconds;
- public const string TimerProperty = "TimeoutMinutes";
-
[XmlElement("Interval")]
- public long TimeoutMilliseconds {
+ public long TimeoutMilliseconds
+ {
get { return timeoutMilliseconds; }
- set {
+ set
+ {
timeoutMilliseconds = Math.Max(value, minimumTimerIntervalMillis);
+ NotifyPropertyChanged();
}
}
@@ -32,7 +37,8 @@ public long TimeoutMilliseconds {
///
[XmlIgnore]
[HelpString(HelpResourceKey = "CommonPollInterval")]
- public long TimeoutMinutes {
+ public long TimeoutMinutes
+ {
get { return TimeoutMilliseconds / minutesToMillisRatio; }
set { TimeoutMilliseconds = value * minutesToMillisRatio; }
}
@@ -42,7 +48,8 @@ public long TimeoutMinutes {
///
public string PublishClass { get; set; }
- public TimerEntity() {
+ public TimerEntity()
+ {
TimeoutMinutes = DefaultTimerIntervalMinutes;
}
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/VersionOneSettings.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/VersionOneSettings.cs
index 9fd9776..8179aa7 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/VersionOneSettings.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/VersionOneSettings.cs
@@ -1,3 +1,5 @@
+using System.ComponentModel;
+using System.Runtime.CompilerServices;
using System.Xml.Serialization;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
using VersionOne.ServiceHost.ConfigurationTool.Attributes;
@@ -9,7 +11,7 @@ namespace VersionOne.ServiceHost.ConfigurationTool.Entities
/// VersionOne connection settings node backing class.
///
[XmlRoot("Settings")]
- public class VersionOneSettings
+ public class VersionOneSettings : INotifyPropertyChanged
{
public const string AccessTokenAuthProperty = "AccessTokenAuth";
public const string BasicAuthProperty = "BasicAuth";
@@ -20,6 +22,11 @@ public class VersionOneSettings
public const string UsernameProperty = "Username";
public const string PasswordProperty = "Password";
+ private string applicationUrl;
+ private string accessToken;
+ private string username;
+ private string password;
+
public VersionOneSettings()
{
ProxySettings = new ProxyConnectionSettings();
@@ -36,17 +43,59 @@ public string ApiVersion
[HelpString(HelpResourceKey = "V1PageVersionOneUrl")]
[NonEmptyStringValidator]
- public string ApplicationUrl { get; set; }
+ public string ApplicationUrl
+ {
+ get { return applicationUrl; }
+ set
+ {
+ applicationUrl = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
- public string AccessToken { get; set; }
+ public string AccessToken
+ {
+ get { return accessToken; }
+ set
+ {
+ accessToken = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
- public string Username { get; set; }
+ public string Username
+ {
+ get { return username; }
+ set
+ {
+ username = value;
+ NotifyPropertyChanged();
+ }
+ }
[NonEmptyStringValidator]
- public string Password { get; set; }
+ public string Password
+ {
+ get { return password; }
+ set
+ {
+ password = value;
+ NotifyPropertyChanged();
+ }
+ }
public ProxyConnectionSettings ProxySettings { get; set; }
+
+ public event PropertyChangedEventHandler PropertyChanged;
+
+ protected virtual void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
+ {
+ if (PropertyChanged != null)
+ {
+ PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
+ }
+ }
}
}
\ No newline at end of file
diff --git a/VersionOne.ServiceHost.ConfigurationTool/Entities/WorkitemWriterEntity.cs b/VersionOne.ServiceHost.ConfigurationTool/Entities/WorkitemWriterEntity.cs
index 2e9c839..871bbcd 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/Entities/WorkitemWriterEntity.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/Entities/WorkitemWriterEntity.cs
@@ -3,36 +3,51 @@
using VersionOne.ServiceHost.ConfigurationTool.UI.Interfaces;
using VersionOne.ServiceHost.ConfigurationTool.Validation;
-namespace VersionOne.ServiceHost.ConfigurationTool.Entities {
+namespace VersionOne.ServiceHost.ConfigurationTool.Entities
+{
///
/// Core WorkitemWriterService configuration entity.
///
[DependsOnVersionOne]
[XmlRoot("WorkitemWriterHostedService")]
- public class WorkitemWriterEntity : BaseServiceEntity, IVersionOneSettingsConsumer {
+ public class WorkitemWriterEntity : BaseServiceEntity, IVersionOneSettingsConsumer
+ {
+ private string externalIdFieldName;
public const string ExternalIdFieldNameProperty = "ExternalIdFieldName";
[NonEmptyStringValidator]
[HelpString(HelpResourceKey = "WorkitemsReference")]
- public string ExternalIdFieldName { get; set; }
+ public string ExternalIdFieldName
+ {
+ get { return externalIdFieldName; }
+ set
+ {
+ externalIdFieldName = value;
+ NotifyPropertyChanged();
+ }
+ }
public VersionOneSettings Settings { get; set; }
- public WorkitemWriterEntity() {
+ public WorkitemWriterEntity()
+ {
Settings = new VersionOneSettings();
}
- public override bool Equals(object obj) {
- if(obj == null || obj.GetType() != GetType()) {
+ public override bool Equals(object obj)
+ {
+ if (obj == null || obj.GetType() != GetType())
+ {
return false;
}
- var other = (WorkitemWriterEntity) obj;
+ var other = (WorkitemWriterEntity)obj;
return Disabled == other.Disabled && string.Equals(ExternalIdFieldName, other.ExternalIdFieldName);
}
- public override int GetHashCode() {
+ public override int GetHashCode()
+ {
return base.GetHashCode();
}
}
diff --git a/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.Designer.cs b/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.Designer.cs
index e0a80c0..e2d16af 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.Designer.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.Designer.cs
@@ -54,58 +54,58 @@ private void InitializeComponent() {
//
this.lblV1ConnectionValidationResult.AutoSize = true;
this.lblV1ConnectionValidationResult.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Italic, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
- this.lblV1ConnectionValidationResult.Location = new System.Drawing.Point(17, 371);
+ this.lblV1ConnectionValidationResult.Location = new System.Drawing.Point(17, 405);
this.lblV1ConnectionValidationResult.Name = "lblV1ConnectionValidationResult";
this.lblV1ConnectionValidationResult.Size = new System.Drawing.Size(153, 13);
- this.lblV1ConnectionValidationResult.TabIndex = 16;
+ this.lblV1ConnectionValidationResult.TabIndex = 19;
this.lblV1ConnectionValidationResult.Text = "V1 Connection validation result";
this.lblV1ConnectionValidationResult.Visible = false;
//
// btnVerifyV1Connection
//
- this.btnVerifyV1Connection.Location = new System.Drawing.Point(394, 364);
+ this.btnVerifyV1Connection.Location = new System.Drawing.Point(394, 398);
this.btnVerifyV1Connection.Name = "btnVerifyV1Connection";
this.btnVerifyV1Connection.Size = new System.Drawing.Size(87, 27);
- this.btnVerifyV1Connection.TabIndex = 17;
+ this.btnVerifyV1Connection.TabIndex = 18;
this.btnVerifyV1Connection.Text = "Validate";
this.btnVerifyV1Connection.UseVisualStyleBackColor = true;
//
// txtPassword
//
- this.txtPassword.Location = new System.Drawing.Point(106, 155);
+ this.txtPassword.Location = new System.Drawing.Point(106, 189);
this.txtPassword.Name = "txtPassword";
this.txtPassword.Size = new System.Drawing.Size(375, 20);
- this.txtPassword.TabIndex = 6;
+ this.txtPassword.TabIndex = 8;
this.txtPassword.UseSystemPasswordChar = true;
//
// lblPassword
//
this.lblPassword.AutoSize = true;
- this.lblPassword.Location = new System.Drawing.Point(17, 158);
+ this.lblPassword.Location = new System.Drawing.Point(17, 192);
this.lblPassword.Name = "lblPassword";
this.lblPassword.Size = new System.Drawing.Size(53, 13);
- this.lblPassword.TabIndex = 5;
+ this.lblPassword.TabIndex = 7;
this.lblPassword.Text = "Password";
//
// txtUsername
//
- this.txtUsername.Location = new System.Drawing.Point(106, 120);
+ this.txtUsername.Location = new System.Drawing.Point(106, 154);
this.txtUsername.Name = "txtUsername";
this.txtUsername.Size = new System.Drawing.Size(375, 20);
- this.txtUsername.TabIndex = 4;
+ this.txtUsername.TabIndex = 6;
//
// lblUsername
//
this.lblUsername.AutoSize = true;
- this.lblUsername.Location = new System.Drawing.Point(17, 123);
+ this.lblUsername.Location = new System.Drawing.Point(17, 157);
this.lblUsername.Name = "lblUsername";
this.lblUsername.Size = new System.Drawing.Size(55, 13);
- this.lblUsername.TabIndex = 3;
+ this.lblUsername.TabIndex = 5;
this.lblUsername.Text = "Username";
//
// txtServerUrl
//
- this.txtServerUrl.Location = new System.Drawing.Point(106, 50);
+ this.txtServerUrl.Location = new System.Drawing.Point(106, 84);
this.txtServerUrl.Name = "txtServerUrl";
this.txtServerUrl.Size = new System.Drawing.Size(375, 20);
this.txtServerUrl.TabIndex = 2;
@@ -113,7 +113,7 @@ private void InitializeComponent() {
// lblServerUrl
//
this.lblServerUrl.AutoSize = true;
- this.lblServerUrl.Location = new System.Drawing.Point(17, 53);
+ this.lblServerUrl.Location = new System.Drawing.Point(17, 87);
this.lblServerUrl.Name = "lblServerUrl";
this.lblServerUrl.Size = new System.Drawing.Size(63, 13);
this.lblServerUrl.TabIndex = 1;
@@ -123,92 +123,92 @@ private void InitializeComponent() {
//
this.chkUseProxy.AutoSize = true;
this.chkUseProxy.CheckAlign = System.Drawing.ContentAlignment.MiddleRight;
- this.chkUseProxy.Location = new System.Drawing.Point(332, 197);
+ this.chkUseProxy.Location = new System.Drawing.Point(332, 231);
this.chkUseProxy.Name = "chkUseProxy";
this.chkUseProxy.Size = new System.Drawing.Size(149, 17);
- this.chkUseProxy.TabIndex = 7;
+ this.chkUseProxy.TabIndex = 9;
this.chkUseProxy.Text = "Use Proxy For Connection";
this.chkUseProxy.UseVisualStyleBackColor = true;
//
// lblProxyUri
//
this.lblProxyUri.AutoSize = true;
- this.lblProxyUri.Location = new System.Drawing.Point(17, 223);
+ this.lblProxyUri.Location = new System.Drawing.Point(17, 257);
this.lblProxyUri.Name = "lblProxyUri";
this.lblProxyUri.Size = new System.Drawing.Size(58, 13);
- this.lblProxyUri.TabIndex = 8;
+ this.lblProxyUri.TabIndex = 10;
this.lblProxyUri.Text = "Proxy URL";
//
// lblProxyUserName
//
this.lblProxyUserName.AutoSize = true;
- this.lblProxyUserName.Location = new System.Drawing.Point(17, 259);
+ this.lblProxyUserName.Location = new System.Drawing.Point(17, 293);
this.lblProxyUserName.Name = "lblProxyUserName";
this.lblProxyUserName.Size = new System.Drawing.Size(84, 13);
- this.lblProxyUserName.TabIndex = 10;
+ this.lblProxyUserName.TabIndex = 12;
this.lblProxyUserName.Text = "Proxy Username";
//
// lblProxyPassword
//
this.lblProxyPassword.AutoSize = true;
- this.lblProxyPassword.Location = new System.Drawing.Point(17, 295);
+ this.lblProxyPassword.Location = new System.Drawing.Point(17, 329);
this.lblProxyPassword.Name = "lblProxyPassword";
this.lblProxyPassword.Size = new System.Drawing.Size(82, 13);
- this.lblProxyPassword.TabIndex = 12;
+ this.lblProxyPassword.TabIndex = 14;
this.lblProxyPassword.Text = "Proxy Password";
//
// txtProxyUri
//
- this.txtProxyUri.Location = new System.Drawing.Point(106, 220);
+ this.txtProxyUri.Location = new System.Drawing.Point(106, 254);
this.txtProxyUri.Name = "txtProxyUri";
this.txtProxyUri.Size = new System.Drawing.Size(375, 20);
- this.txtProxyUri.TabIndex = 9;
+ this.txtProxyUri.TabIndex = 11;
//
// txtProxyUsername
//
- this.txtProxyUsername.Location = new System.Drawing.Point(106, 256);
+ this.txtProxyUsername.Location = new System.Drawing.Point(106, 290);
this.txtProxyUsername.Name = "txtProxyUsername";
this.txtProxyUsername.Size = new System.Drawing.Size(375, 20);
- this.txtProxyUsername.TabIndex = 11;
+ this.txtProxyUsername.TabIndex = 13;
//
// txtProxyPassword
//
- this.txtProxyPassword.Location = new System.Drawing.Point(106, 292);
+ this.txtProxyPassword.Location = new System.Drawing.Point(106, 326);
this.txtProxyPassword.Name = "txtProxyPassword";
this.txtProxyPassword.Size = new System.Drawing.Size(375, 20);
- this.txtProxyPassword.TabIndex = 13;
+ this.txtProxyPassword.TabIndex = 15;
//
// lblProxyDomain
//
this.lblProxyDomain.AutoSize = true;
- this.lblProxyDomain.Location = new System.Drawing.Point(17, 331);
+ this.lblProxyDomain.Location = new System.Drawing.Point(17, 365);
this.lblProxyDomain.Name = "lblProxyDomain";
this.lblProxyDomain.Size = new System.Drawing.Size(72, 13);
- this.lblProxyDomain.TabIndex = 14;
+ this.lblProxyDomain.TabIndex = 16;
this.lblProxyDomain.Text = "Proxy Domain";
//
// txtProxyDomain
//
- this.txtProxyDomain.Location = new System.Drawing.Point(106, 328);
+ this.txtProxyDomain.Location = new System.Drawing.Point(106, 362);
this.txtProxyDomain.Name = "txtProxyDomain";
this.txtProxyDomain.Size = new System.Drawing.Size(375, 20);
- this.txtProxyDomain.TabIndex = 15;
+ this.txtProxyDomain.TabIndex = 17;
//
// lblAccessToken
//
this.lblAccessToken.AutoSize = true;
- this.lblAccessToken.Location = new System.Drawing.Point(17, 88);
+ this.lblAccessToken.Location = new System.Drawing.Point(17, 122);
this.lblAccessToken.Name = "lblAccessToken";
this.lblAccessToken.Size = new System.Drawing.Size(76, 13);
- this.lblAccessToken.TabIndex = 18;
+ this.lblAccessToken.TabIndex = 3;
this.lblAccessToken.Text = "Access Token";
//
// txtAccessToken
//
- this.txtAccessToken.Location = new System.Drawing.Point(106, 85);
+ this.txtAccessToken.Location = new System.Drawing.Point(106, 119);
this.txtAccessToken.Name = "txtAccessToken";
this.txtAccessToken.Size = new System.Drawing.Size(375, 20);
- this.txtAccessToken.TabIndex = 19;
+ this.txtAccessToken.TabIndex = 4;
//
// gbAuthentication
//
@@ -216,20 +216,20 @@ private void InitializeComponent() {
this.gbAuthentication.Controls.Add(this.rbtnAccessTokenAuth);
this.gbAuthentication.Controls.Add(this.rbtnIntegratedAuth);
this.gbAuthentication.Controls.Add(this.rbtnBasicAuth);
- this.gbAuthentication.Location = new System.Drawing.Point(20, 8);
+ this.gbAuthentication.Location = new System.Drawing.Point(20, 18);
this.gbAuthentication.Name = "gbAuthentication";
- this.gbAuthentication.Size = new System.Drawing.Size(461, 36);
- this.gbAuthentication.TabIndex = 23;
+ this.gbAuthentication.Size = new System.Drawing.Size(461, 57);
+ this.gbAuthentication.TabIndex = 0;
this.gbAuthentication.TabStop = false;
this.gbAuthentication.Text = "Authentication";
//
// rbtnIntegratedWithCredentialsAuth
//
this.rbtnIntegratedWithCredentialsAuth.AutoSize = true;
- this.rbtnIntegratedWithCredentialsAuth.Location = new System.Drawing.Point(329, 13);
+ this.rbtnIntegratedWithCredentialsAuth.Location = new System.Drawing.Point(305, 24);
this.rbtnIntegratedWithCredentialsAuth.Name = "rbtnIntegratedWithCredentialsAuth";
this.rbtnIntegratedWithCredentialsAuth.Size = new System.Drawing.Size(132, 17);
- this.rbtnIntegratedWithCredentialsAuth.TabIndex = 23;
+ this.rbtnIntegratedWithCredentialsAuth.TabIndex = 4;
this.rbtnIntegratedWithCredentialsAuth.TabStop = true;
this.rbtnIntegratedWithCredentialsAuth.Text = "NTLM with Credentials";
this.rbtnIntegratedWithCredentialsAuth.UseVisualStyleBackColor = true;
@@ -237,10 +237,10 @@ private void InitializeComponent() {
// rbtnAccessTokenAuth
//
this.rbtnAccessTokenAuth.AutoSize = true;
- this.rbtnAccessTokenAuth.Location = new System.Drawing.Point(86, 13);
+ this.rbtnAccessTokenAuth.Location = new System.Drawing.Point(21, 24);
this.rbtnAccessTokenAuth.Name = "rbtnAccessTokenAuth";
this.rbtnAccessTokenAuth.Size = new System.Drawing.Size(94, 17);
- this.rbtnAccessTokenAuth.TabIndex = 20;
+ this.rbtnAccessTokenAuth.TabIndex = 1;
this.rbtnAccessTokenAuth.TabStop = true;
this.rbtnAccessTokenAuth.Text = "Access Token";
this.rbtnAccessTokenAuth.UseVisualStyleBackColor = true;
@@ -248,10 +248,10 @@ private void InitializeComponent() {
// rbtnIntegratedAuth
//
this.rbtnIntegratedAuth.AutoSize = true;
- this.rbtnIntegratedAuth.Location = new System.Drawing.Point(259, 13);
+ this.rbtnIntegratedAuth.Location = new System.Drawing.Point(222, 24);
this.rbtnIntegratedAuth.Name = "rbtnIntegratedAuth";
this.rbtnIntegratedAuth.Size = new System.Drawing.Size(55, 17);
- this.rbtnIntegratedAuth.TabIndex = 22;
+ this.rbtnIntegratedAuth.TabIndex = 3;
this.rbtnIntegratedAuth.TabStop = true;
this.rbtnIntegratedAuth.Text = "NTLM";
this.rbtnIntegratedAuth.UseVisualStyleBackColor = true;
@@ -259,10 +259,10 @@ private void InitializeComponent() {
// rbtnBasicAuth
//
this.rbtnBasicAuth.AutoSize = true;
- this.rbtnBasicAuth.Location = new System.Drawing.Point(194, 13);
+ this.rbtnBasicAuth.Location = new System.Drawing.Point(143, 24);
this.rbtnBasicAuth.Name = "rbtnBasicAuth";
this.rbtnBasicAuth.Size = new System.Drawing.Size(51, 17);
- this.rbtnBasicAuth.TabIndex = 21;
+ this.rbtnBasicAuth.TabIndex = 2;
this.rbtnBasicAuth.TabStop = true;
this.rbtnBasicAuth.Text = "Basic";
this.rbtnBasicAuth.UseVisualStyleBackColor = true;
@@ -292,7 +292,7 @@ private void InitializeComponent() {
this.Controls.Add(this.txtServerUrl);
this.Controls.Add(this.lblServerUrl);
this.Name = "V1SettingsPageControl";
- this.Size = new System.Drawing.Size(540, 400);
+ this.Size = new System.Drawing.Size(540, 440);
this.gbAuthentication.ResumeLayout(false);
this.gbAuthentication.PerformLayout();
this.ResumeLayout(false);
diff --git a/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.cs b/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.cs
index 932c238..f85228d 100644
--- a/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.cs
+++ b/VersionOne.ServiceHost.ConfigurationTool/UI/Controls/V1SettingsPageControl.cs
@@ -37,18 +37,6 @@ public V1SettingsPageControl()
public override void DataBind()
{
- AddControlBinding(txtServerUrl, Model.Settings, VersionOneSettings.ApplicationUrlProperty);
- AddControlBinding(txtAccessToken, Model.Settings, VersionOneSettings.AccessTokenProperty);
- AddControlBinding(txtUsername, Model.Settings, VersionOneSettings.UsernameProperty);
- AddControlBinding(txtPassword, Model.Settings, VersionOneSettings.PasswordProperty);
- AddControlBinding(chkUseProxy, Model.ProxySettings, ProxyConnectionSettings.EnabledProperty);
- AddControlBinding(txtProxyUri, Model.ProxySettings, ProxyConnectionSettings.UriProperty);
- AddControlBinding(txtProxyUsername, Model.ProxySettings, ProxyConnectionSettings.UsernameProperty);
- AddControlBinding(txtProxyPassword, Model.ProxySettings, ProxyConnectionSettings.PasswordProperty);
- AddControlBinding(txtProxyDomain, Model.ProxySettings, ProxyConnectionSettings.DomainProperty);
-
- BindHelpStrings();
-
switch (Model.Settings.AuthenticationType)
{
case AuthenticationTypes.AccessToken:
@@ -66,6 +54,18 @@ public override void DataBind()
default:
throw new Exception("You must set an authentication type in config file"); // TODO: check error message
}
+
+ AddControlBinding(txtServerUrl, Model.Settings, VersionOneSettings.ApplicationUrlProperty);
+ AddControlBinding(txtAccessToken, Model.Settings, VersionOneSettings.AccessTokenProperty);
+ AddControlBinding(txtUsername, Model.Settings, VersionOneSettings.UsernameProperty);
+ AddControlBinding(txtPassword, Model.Settings, VersionOneSettings.PasswordProperty);
+ AddControlBinding(chkUseProxy, Model.ProxySettings, ProxyConnectionSettings.EnabledProperty);
+ AddControlBinding(txtProxyUri, Model.ProxySettings, ProxyConnectionSettings.UriProperty);
+ AddControlBinding(txtProxyUsername, Model.ProxySettings, ProxyConnectionSettings.UsernameProperty);
+ AddControlBinding(txtProxyPassword, Model.ProxySettings, ProxyConnectionSettings.PasswordProperty);
+ AddControlBinding(txtProxyDomain, Model.ProxySettings, ProxyConnectionSettings.DomainProperty);
+
+ BindHelpStrings();
}
private void BindHelpStrings()
@@ -148,6 +148,8 @@ private void radioButtons_CheckedChanged(object sender, EventArgs e)
RemoveControlValidation(txtUsername);
RemoveControlValidation(txtPassword);
Model.Settings.AuthenticationType = AuthenticationTypes.AccessToken;
+ Model.Settings.Username = string.Empty;
+ Model.Settings.Password = string.Empty;
}
else if (rbtnBasicAuth.Checked)
{
@@ -155,6 +157,7 @@ private void radioButtons_CheckedChanged(object sender, EventArgs e)
AddControlTextValidation(txtPassword, VersionOneSettings.PasswordProperty);
RemoveControlValidation(txtAccessToken);
Model.Settings.AuthenticationType = AuthenticationTypes.Basic;
+ Model.Settings.AccessToken = string.Empty;
}
else if (rbtnIntegratedAuth.Checked)
{
@@ -162,6 +165,9 @@ private void radioButtons_CheckedChanged(object sender, EventArgs e)
RemoveControlValidation(txtUsername);
RemoveControlValidation(txtPassword);
Model.Settings.AuthenticationType = AuthenticationTypes.Integrated;
+ Model.Settings.AccessToken = string.Empty;
+ Model.Settings.Username = string.Empty;
+ Model.Settings.Password = string.Empty;
}
else if (rbtnIntegratedWithCredentialsAuth.Checked)
{
@@ -169,6 +175,7 @@ private void radioButtons_CheckedChanged(object sender, EventArgs e)
AddControlTextValidation(txtPassword, VersionOneSettings.PasswordProperty);
RemoveControlValidation(txtAccessToken);
Model.Settings.AuthenticationType = AuthenticationTypes.IntegratedWithCredentials;
+ Model.Settings.AccessToken = string.Empty;
}
ErrorProvider.Clear();