コード例 #1
0
 public override void InitializeFromDefaultSettings()
 {
     Settings = PanoramaSettings.InitializeFromDefaults();
     _appControl.SetUIPanoramaSettings(Settings);
     if (!Settings.PublishToPanorama)
     {
         _appControl.DisablePanoramaSettings();
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AutoQcForm.cs プロジェクト: tomas-pluskal/pwiz
 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;
     });
 }
コード例 #4
0
        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);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
ファイル: AutoQcForm.cs プロジェクト: tomas-pluskal/pwiz
        private PanoramaSettings GetPanoramaSettingsFromUI()
        {
            var panoramaSettings = new PanoramaSettings()
            {
                PanoramaServerUrl = textPanoramaUrl.Text,
                PanoramaUserEmail = textPanoramaEmail.Text,
                PanoramaPassword  = textPanoramaPasswd.Text,
                PanoramaFolder    = textPanoramaFolder.Text,
                PublishToPanorama = cbPublishToPanorama.Checked
            };

            return(panoramaSettings);
        }
コード例 #7
0
ファイル: AutoQcConfig.cs プロジェクト: zrolfs/pwiz
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        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."));
        }
コード例 #10
0
ファイル: TestUtils.cs プロジェクト: lgatto/proteowizard
 public void SetUIPanoramaSettings(PanoramaSettings panoramaSettings)
 {
     _panoramaSettings = panoramaSettings;
 }
コード例 #11
0
 public PanoramaSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
     Settings = new PanoramaSettings();
 }
コード例 #12
0
 public PanoramaPinger(PanoramaSettings panoramaSettings, IAutoQcLogger logger)
 {
     _panoramaSettings = panoramaSettings;
     _logger           = logger;
 }
コード例 #13
0
 public PanoramaSettingsTab(IAppControl appControl, IAutoQCLogger logger)
     : base(appControl, logger)
 {
     Settings = new PanoramaSettings();
 }
コード例 #14
0
        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;
        }
コード例 #15
0
 public override void InitializeFromDefaultSettings()
 {
     Settings = PanoramaSettings.InitializeFromDefaults();
     _appControl.SetUIPanoramaSettings(Settings);
     if (!Settings.PublishToPanorama)
     {
         _appControl.DisablePanoramaSettings();
     }
 }
コード例 #16
0
        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);
        }