Exemplo n.º 1
0
        /// <summary>
        /// Loads the UIConfiguration from its default path.
        /// </summary>
        /// <returns></returns>
        public static UIConfiguration Load()
        {
            UIConfiguration configuration = new UIConfiguration();

            configuration.OperationViewer = SettingsManager.Instance.GetSetting("UIConfiguration", "OperationViewer").GetString();
            configuration.ScaleFactor     = SettingsManager.Instance.GetSetting("UIConfiguration", "ScaleFactor").GetValue <Double>();
            configuration.ScreenId        = SettingsManager.Instance.GetSetting("UIConfiguration", "ScreenId").GetInt32();

            string acknowledgeOperationKeyS = SettingsManager.Instance.GetSetting("UIConfiguration", "AcknowledgeOperationKey").GetString();
            Key    acknowledgeOperationKey  = Key.B;

            Enum.TryParse <Key>(acknowledgeOperationKeyS, out acknowledgeOperationKey);
            configuration.AcknowledgeOperationKey = acknowledgeOperationKey;

            configuration.AutomaticOperationAcknowledgement.IsEnabled = SettingsManager.Instance.GetSetting("UIConfiguration", "AOA.IsEnabled").GetBoolean();
            configuration.AutomaticOperationAcknowledgement.MaxAge    = SettingsManager.Instance.GetSetting("UIConfiguration", "AOA.MaxAge").GetInt32();

            configuration.OperationFetchingArguments.Interval            = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.Interval").GetInt32();
            configuration.OperationFetchingArguments.MaxAge              = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.MaxAge").GetInt32();
            configuration.OperationFetchingArguments.OnlyNonAcknowledged = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.OnlyNonAcknowledged").GetBoolean();
            configuration.OperationFetchingArguments.LimitAmount         = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.LimitAmount").GetInt32();

            configuration.TreatOldOperationsAsNew = SettingsManager.Instance.GetSetting("UIConfiguration", "TreatOldOperationsAsNew").GetBoolean();

            // Jobs configuration
            configuration.EnabledJobs = new ReadOnlyCollection <string>(SettingsManager.Instance.GetSetting("UIConfiguration", "JobsConfiguration").GetValue <ExportConfiguration>().GetEnabledExports());

            return(configuration);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Loads the UIConfiguration from its default path.
        /// </summary>
        /// <returns></returns>
        public static UIConfiguration Load()
        {
            UIConfiguration configuration = new UIConfiguration();
            configuration.OperationViewer = SettingsManager.Instance.GetSetting("UIConfiguration", "OperationViewer").GetString();
            configuration.ScaleFactor = SettingsManager.Instance.GetSetting("UIConfiguration", "ScaleFactor").GetValue<Double>();

            string acknowledgeOperationKeyS = SettingsManager.Instance.GetSetting("UIConfiguration", "AcknowledgeOperationKey").GetString();
            Key acknowledgeOperationKey = Key.B;
            Enum.TryParse<Key>(acknowledgeOperationKeyS, out acknowledgeOperationKey);
            configuration.AcknowledgeOperationKey = acknowledgeOperationKey;

            configuration.AutomaticOperationAcknowledgement.IsEnabled = SettingsManager.Instance.GetSetting("UIConfiguration", "AOA.IsEnabled").GetBoolean();
            configuration.AutomaticOperationAcknowledgement.MaxAge = SettingsManager.Instance.GetSetting("UIConfiguration", "AOA.MaxAge").GetInt32();

            configuration.OperationFetchingArguments.Interval = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.Interval").GetInt32();
            configuration.OperationFetchingArguments.MaxAge = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.MaxAge").GetInt32();
            configuration.OperationFetchingArguments.OnlyNonAcknowledged = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.OnlyNonAcknowledged").GetBoolean();
            configuration.OperationFetchingArguments.LimitAmount = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.LimitAmount").GetInt32();

            configuration.TreatOldOperationsAsNew = SettingsManager.Instance.GetSetting("UIConfiguration", "TreatOldOperationsAsNew").GetBoolean();

            // Jobs configuration
            configuration.EnabledJobs = new ReadOnlyCollection<string>(SettingsManager.Instance.GetSetting("UIConfiguration", "JobsConfiguration").GetValue<ExportConfiguration>().GetEnabledExports());

            return configuration;
        }
Exemplo n.º 3
0
        private void LoadConfiguration()
        {
            try
            {
                AlarmWorkflow.Windows.UI.Properties.Settings.Default.Reload();

                Configuration = new UIConfiguration();
                ExtensionManager = new ExtensionManager();

                Logger.Instance.LogFormat(LogType.Info, this, AlarmWorkflow.Windows.UI.Properties.Resources.UIConfigurationLoaded);
            }
            catch (EndpointNotFoundException ex)
            {
                UIUtilities.ShowError(AlarmWorkflow.Windows.UI.Properties.Resources.UICannotStartWithoutConnectionError);

                Logger.Instance.LogException(this, ex);
                Environment.Exit(1);
            }
            catch (Exception ex)
            {
                Logger.Instance.LogFormat(LogType.Error, this, AlarmWorkflow.Windows.UI.Properties.Resources.UIConfigurationLoadError);
                Logger.Instance.LogException(this, ex);
            }
        }
Exemplo n.º 4
0
        private void LoadConfiguration()
        {
            try
            {
                Configuration = UIConfiguration.Load();
                Logger.Instance.LogFormat(LogType.Info, this, "The UI-configuration was successfully loaded.");
            }
            catch (Exception ex)
            {
                Logger.Instance.LogFormat(LogType.Error, this, "The UI-configuration could not be loaded! Using default configuration.");
                Logger.Instance.LogException(this, ex);

                // Use default configuration
                Configuration = new UIConfiguration();
            }
        }
Exemplo n.º 5
0
        /// <summary>
        /// Loads the UIConfiguration from its default path.
        /// </summary>
        /// <returns></returns>
        public static UIConfiguration Load()
        {
            UIConfiguration configuration = new UIConfiguration();
            configuration.OperationViewer = SettingsManager.Instance.GetSetting("UIConfiguration", "OperationViewer").GetString();
            configuration.ScaleFactor = SettingsManager.Instance.GetSetting("UIConfiguration", "ScaleFactor").GetValue<Double>();
            configuration.ScreenId = SettingsManager.Instance.GetSetting("UIConfiguration", "ScreenId").GetInt32();

            string acknowledgeOperationKeyS = SettingsManager.Instance.GetSetting("UIConfiguration", "AcknowledgeOperationKey").GetString();
            Key acknowledgeOperationKey = Key.B;
            Enum.TryParse<Key>(acknowledgeOperationKeyS, out acknowledgeOperationKey);
            configuration.AcknowledgeOperationKey = acknowledgeOperationKey;

            configuration.AutomaticOperationAcknowledgement.IsEnabled = SettingsManager.Instance.GetSetting("UIConfiguration", "AOA.IsEnabled").GetBoolean();
            configuration.AutomaticOperationAcknowledgement.MaxAge = SettingsManager.Instance.GetSetting("UIConfiguration", "AOA.MaxAge").GetInt32();

            configuration.OperationFetchingArguments.Interval = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.Interval").GetInt32();
            configuration.OperationFetchingArguments.MaxAge = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.MaxAge").GetInt32();
            configuration.OperationFetchingArguments.OnlyNonAcknowledged = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.OnlyNonAcknowledged").GetBoolean();
            configuration.OperationFetchingArguments.LimitAmount = SettingsManager.Instance.GetSetting("UIConfiguration", "OFP.LimitAmount").GetInt32();

            // Jobs configuration
            {
                XDocument jobsConfigE = XDocument.Parse(SettingsManager.Instance.GetSetting("UIConfiguration", "JobsConfiguration").GetString());
                List<string> jobs = new List<string>();
                foreach (XElement exportE in jobsConfigE.Root.Elements("Job"))
                {
                    if (!bool.Parse(exportE.Attribute("IsEnabled").Value))
                    {
                        continue;
                    }

                    string jobName = exportE.TryGetAttributeValue("Name", null);
                    if (string.IsNullOrWhiteSpace(jobName))
                    {
                        continue;
                    }
                    jobs.Add(jobName);
                }

                configuration.EnabledJobs = new ReadOnlyCollection<string>(jobs);
            }

            return configuration;
        }