public override void InitializeFromDefaultSettings() { Settings = PanoramaSettings.InitializeFromDefaults(); _appControl.SetUIPanoramaSettings(Settings); if (!Settings.PublishToPanorama) { _appControl.DisablePanoramaSettings(); } }
protected bool Equals(PanoramaSettings other) { var equal = PublishToPanorama == other.PublishToPanorama && string.Equals(PanoramaServerUrl, other.PanoramaServerUrl) && string.Equals(PanoramaUserEmail, other.PanoramaUserEmail) && string.Equals(PanoramaPassword, other.PanoramaPassword) && string.Equals(PanoramaFolder, other.PanoramaFolder); return(equal); }
public void SetUIPanoramaSettings(PanoramaSettings panoramaSettings) { RunUI(() => { textPanoramaUrl.Text = panoramaSettings.PanoramaServerUrl; textPanoramaEmail.Text = panoramaSettings.PanoramaUserEmail; textPanoramaPasswd.Text = panoramaSettings.PanoramaPassword; textPanoramaFolder.Text = panoramaSettings.PanoramaFolder; cbPublishToPanorama.Checked = panoramaSettings.PublishToPanorama; }); }
public static PanoramaSettings InitializeFromDefaults() { var settings = new PanoramaSettings() { PanoramaServerUrl = Settings.Default.PanoramaUrl, PanoramaUserEmail = Settings.Default.PanoramaUserEmail, PanoramaPassword = Settings.Default.PanoramaPassword, PanoramaFolder = Settings.Default.PanoramaFolder, PublishToPanorama = Settings.Default.PublishToPanorama, }; return(settings); }
public static PanoramaSettings InitializeFromDefaults() { var settings = new PanoramaSettings() { PanoramaServerUrl = Settings.Default.PanoramaUrl, PanoramaUserEmail = Settings.Default.PanoramaUserEmail, PanoramaPassword = Settings.Default.PanoramaPassword, PanoramaFolder = Settings.Default.PanoramaFolder, PublishToPanorama = Settings.Default.PublishToPanorama, }; return settings; }
private PanoramaSettings GetPanoramaSettingsFromUI() { var panoramaSettings = new PanoramaSettings() { PanoramaServerUrl = textPanoramaUrl.Text, PanoramaUserEmail = textPanoramaEmail.Text, PanoramaPassword = textPanoramaPasswd.Text, PanoramaFolder = textPanoramaFolder.Text, PublishToPanorama = cbPublishToPanorama.Checked }; return(panoramaSettings); }
public void ReadXml(XmlReader reader) { Name = reader.GetAttribute(ATTR.name); // TODO: Configurations shouldn't start automatically when the program starts up. // Remove this attribute from the config XML? IsEnabled = false; // reader.GetBoolAttribute(ATTR.is_enabled); User = reader.GetAttribute(ATTR.user); DateTime dateTime; DateTime.TryParse(reader.GetAttribute(ATTR.created), out dateTime); Created = dateTime; DateTime.TryParse(reader.GetAttribute(ATTR.modified), out dateTime); Modified = dateTime; do { reader.Read(); } while (reader.NodeType != XmlNodeType.Element); var mainSettings = new MainSettings(); mainSettings.ReadXml(reader); MainSettings = mainSettings; do { reader.Read(); } while (reader.NodeType != XmlNodeType.Element); var panoramaSettings = new PanoramaSettings(); panoramaSettings.ReadXml(reader); PanoramaSettings = panoramaSettings; do { reader.Read(); } while (reader.NodeType != XmlNodeType.EndElement); }
public void ReadXml(XmlReader reader) { Name = reader.GetAttribute(ATTR.name); IsEnabled = reader.GetBoolAttribute(ATTR.is_enabled); User = reader.GetAttribute(ATTR.user); DateTime dateTime; DateTime.TryParse(reader.GetAttribute(ATTR.created), out dateTime); Created = dateTime; DateTime.TryParse(reader.GetAttribute(ATTR.modified), out dateTime); Modified = dateTime; do { reader.Read(); } while (reader.NodeType != XmlNodeType.Element); var mainSettings = new MainSettings(); mainSettings.ReadXml(reader); MainSettings = mainSettings; do { reader.Read(); } while (reader.NodeType != XmlNodeType.Element); var panoramaSettings = new PanoramaSettings(); panoramaSettings.ReadXml(reader); PanoramaSettings = panoramaSettings; do { reader.Read(); } while (reader.NodeType != XmlNodeType.EndElement); }
public void TestValidatePanoramaSettings() { var logger = new TestLogger(); var settings = new PanoramaSettings(); var mainControl = new TestAppControl(); mainControl.SetUIPanoramaSettings(settings); var panoramaSettingsTab = new PanoramaSettingsTab(mainControl, logger); Assert.IsTrue(panoramaSettingsTab.ValidateSettings()); var log = logger.GetLog(); Assert.IsTrue(log.Contains("Will NOT publish Skyline documents to Panorama.")); settings.PublishToPanorama = true; logger.Clear(); panoramaSettingsTab.Settings = settings; Assert.IsFalse(panoramaSettingsTab.ValidateSettings()); log = logger.GetLog(); Assert.IsTrue(log.Contains("Please specify a Panorama server URL.")); Assert.IsTrue(log.Contains("Please specify a Panorama login name.")); Assert.IsTrue(log.Contains("Please specify a Panorama user password.")); Assert.IsTrue(log.Contains("Please specify a folder on the Panorama server.")); }
public void SetUIPanoramaSettings(PanoramaSettings panoramaSettings) { _panoramaSettings = panoramaSettings; }
public PanoramaSettingsTab(IAppControl appControl, IAutoQCLogger logger) : base(appControl, logger) { Settings = new PanoramaSettings(); }
public PanoramaPinger(PanoramaSettings panoramaSettings, IAutoQcLogger logger) { _panoramaSettings = panoramaSettings; _logger = logger; }
public override bool ValidateSettings() { var panoramaSettingsUI = _appControl.GetUIPanoramaSettings(); if (!panoramaSettingsUI.PublishToPanorama) { LogOutput("Will NOT publish Skyline documents to Panorama."); Settings.PublishToPanorama = false; return true; } LogOutput("Validating Panorama settings..."); var error = false; var panoramaUrl = panoramaSettingsUI.PanoramaServerUrl; Uri serverUri = null; if (string.IsNullOrWhiteSpace(panoramaUrl)) { LogErrorOutput("Please specify a Panorama server URL."); error = true; } else { try { serverUri = new Uri(PanoramaUtil.ServerNameToUrl(panoramaUrl)); } catch (UriFormatException) { LogError("Panorama server name is invalid."); return false; } } var panoramaEmail = panoramaSettingsUI.PanoramaUserEmail; var panoramaPasswd = panoramaSettingsUI.PanoramaPassword; var panoramaFolder = panoramaSettingsUI.PanoramaFolder; if (string.IsNullOrWhiteSpace(panoramaEmail)) { LogErrorOutput("Please specify a Panorama login name."); error = true; } if (string.IsNullOrWhiteSpace(panoramaPasswd)) { LogErrorOutput("Please specify a Panorama user password."); error = true; } else { if (!panoramaPasswd.Equals(Settings.PanoramaPassword)) { // Encrypt the password try { panoramaPasswd = EncryptPassword(panoramaPasswd); panoramaSettingsUI.PanoramaPassword = panoramaPasswd; } catch (ObjectDisposedException) { } } } if (string.IsNullOrWhiteSpace(panoramaFolder)) { LogErrorOutput("Please specify a folder on the Panorama server."); error = true; } if (error) { return false; } // Verify that we can connect to the given Panorama server with the user's credentials. var panoramaClient = new WebPanoramaClient(serverUri); try { PanoramaUtil.VerifyServerInformation(panoramaClient, serverUri, panoramaEmail, DecryptPassword(panoramaPasswd)); } catch (Exception ex) { LogErrorOutput(ex.Message); return false; } try { PanoramaUtil.VerifyFolder(panoramaClient, new Server(serverUri, panoramaEmail, DecryptPassword(panoramaPasswd)), panoramaFolder); } catch (Exception ex) { LogErrorOutput(ex.Message); return false; } Settings = panoramaSettingsUI; return true; }
public override bool ValidateSettings() { var panoramaSettingsUI = _appControl.GetUIPanoramaSettings(); if (!panoramaSettingsUI.PublishToPanorama) { LogOutput("Will NOT publish Skyline documents to Panorama."); Settings.PublishToPanorama = false; return(true); } LogOutput("Validating Panorama settings..."); var error = false; var panoramaUrl = panoramaSettingsUI.PanoramaServerUrl; Uri serverUri = null; if (string.IsNullOrWhiteSpace(panoramaUrl)) { LogErrorOutput("Please specify a Panorama server URL."); error = true; } else { try { serverUri = new Uri(PanoramaUtil.ServerNameToUrl(panoramaUrl)); } catch (UriFormatException) { LogError("Panorama server name is invalid."); return(false); } } var panoramaEmail = panoramaSettingsUI.PanoramaUserEmail; var panoramaPasswd = panoramaSettingsUI.PanoramaPassword; var panoramaFolder = panoramaSettingsUI.PanoramaFolder; if (string.IsNullOrWhiteSpace(panoramaEmail)) { LogErrorOutput("Please specify a Panorama login name."); error = true; } if (string.IsNullOrWhiteSpace(panoramaPasswd)) { LogErrorOutput("Please specify a Panorama user password."); error = true; } else { if (!panoramaPasswd.Equals(Settings.PanoramaPassword)) { // Encrypt the password try { panoramaPasswd = EncryptPassword(panoramaPasswd); panoramaSettingsUI.PanoramaPassword = panoramaPasswd; } catch (ObjectDisposedException) { } } } if (string.IsNullOrWhiteSpace(panoramaFolder)) { LogErrorOutput("Please specify a folder on the Panorama server."); error = true; } if (error) { return(false); } // Verify that we can connect to the given Panorama server with the user's credentials. var panoramaClient = new WebPanoramaClient(serverUri); try { PanoramaUtil.VerifyServerInformation(panoramaClient, serverUri, panoramaEmail, DecryptPassword(panoramaPasswd)); } catch (Exception ex) { LogErrorOutput(ex.Message); return(false); } try { PanoramaUtil.VerifyFolder(panoramaClient, new Server(serverUri, panoramaEmail, DecryptPassword(panoramaPasswd)), panoramaFolder); } catch (Exception ex) { LogErrorOutput(ex.Message); return(false); } Settings = panoramaSettingsUI; return(true); }