コード例 #1
0
        private void RunConfiguration(object sender, DoWorkEventArgs e)
        {
            try
            {
                ChangeStatus(RunnerStatus.Starting);

                var originalPanoramaUrl = Config.PanoramaSettings.PanoramaServerUrl;
                Config.MainSettings.ValidateSettings();

                Config.PanoramaSettings.ValidateSettings();

                if (Config.PanoramaSettings.PublishToPanorama && !originalPanoramaUrl.Equals(Config.PanoramaSettings.PanoramaServerUrl))
                {
                    _uiControl.UpdatePanoramaServerUrl(Config);
                }

                // Thread.Sleep(2000);

                _fileWatcher = new AutoQCFileSystemWatcher(_logger, this);

                // Make sure "Integrate all" is checked in the Skyline settings
                if (!IsIntegrateAllChecked(_logger, Config.MainSettings))
                {
                    ChangeStatus(RunnerStatus.Error);
                    return;
                }

                // Export a report from the Skyline document to get the most recent acquisition date on the results files
                // imported into the document.
                if (!ReadLastAcquiredFileDate(_logger, this))
                {
                    ChangeStatus(RunnerStatus.Error);
                    return;
                }

                if (Config.PanoramaSettings.PublishToPanorama)
                {
                    Log("Initializing Panorama pinger...");
                    _panoramaPinger = new PanoramaPinger(Config.PanoramaSettings, _logger);
                    _panoramaPinger.Init();
                }

                _fileWatcher.Init(Config);

                Log("Starting configuration...");
                ChangeStatus(RunnerStatus.Running);

                if (ProcessExistingFiles(e))
                {
                    ProcessNewFiles(e);
                }
                e.Result = COMPLETED;
            }

            catch (ArgumentException x)
            {
                var err = new StringBuilder(string.Format("There was an error validating configuration \"{0}\"",
                                                          Config.Name));

                LogException(x, err.ToString());
                ChangeStatus(RunnerStatus.Error);

                err.AppendLine().AppendLine().Append(x.Message);
                _uiControl.DisplayError("Configuration Validation Error", err.ToString());
            }
            catch (FileWatcherException x)
            {
                var err = new StringBuilder(string.Format("There was an error looking for files for configuration \"{0}\".",
                                                          Config.Name));

                LogException(x, err.ToString());
                ChangeStatus(RunnerStatus.Error);

                err.AppendLine().AppendLine().Append(x.Message);
                _uiControl.DisplayError("File Watcher Error", err.ToString());
            }
            catch (Exception x)
            {
                LogException(x, string.Format("There was an error running configuration \"{0}\"",
                                              Config.Name));
                ChangeStatus(RunnerStatus.Error);
            }
        }
コード例 #2
0
ファイル: AutoQcForm.cs プロジェクト: tomas-pluskal/pwiz
        private async void Run()
        {
            textOutput.Text = String.Empty;

            LogOutput("Starting AutoQC...");

            SetValidatingControls();

            if (!File.Exists(SkylineRunnerPath))
            {
                LogError(
                    "Could not find {0} at this path {1}. {0} should be in the same directory as AutoQC.",
                    SKYLINE_RUNNER, SkylineRunnerPath);
                SetStoppedControls();
                return;
            }

            var mainSettingsTab = GetMainSettingsTab();

            if (!mainSettingsTab.ValidateSettings())
            {
                SetStoppedControls();
                return;
            }

            // Initialize logging to log in the folder with the Skyline document.
            var skylineFileDir = mainSettingsTab.Settings.SkylineFileDir;

            GlobalContext.Properties["WorkingDirectory"] = skylineFileDir;
            XmlConfigurator.Configure();
            Log("Logging to directory: {0}", skylineFileDir);

            // Validate on a background thread. Validating Panorama settings can take a few seconds.
            var validSettings = await Task.Run(() => ValidateAllSettings());

            if (!validSettings)
            {
                SetStoppedControls();
                return;
            }

            SaveSettings();
            PrintSettings();

            SetRunningControls();

            var mainSettings = mainSettingsTab.Settings;

            // Make sure "Integrate all" is checked in the Skyline settings
            if (!(await Task.Run(() => mainSettings.IsIntegrateAllChecked(this))))
            {
                SetStoppedControls();
                return;
            }

            // Export a report from the Skyline document to get the most recent acquisition date on the results files
            // imported into the document.
            if (await Task.Run(() => mainSettings.ReadLastAcquiredFileDate(this, this)))
            {
                _worker.Start(mainSettings);
                var panoramaSettingsTab = GetPanoramaSettingsTab();
                if (panoramaSettingsTab != null && panoramaSettingsTab.IsSelected())
                {
                    _panoramaPinger = new PanoramaPinger(panoramaSettingsTab, this);
                    _panoramaPinger.Init();
                }
            }
            else
            {
                SetStoppedControls();
            }
        }