/// <summary>
        /// Prevents a default instance of the <see cref="AlarmWorkflowConfiguration"/> class from being created.
        /// </summary>
        private AlarmWorkflowConfiguration()
        {
            this.OperationStoreAlias = SettingsManager.Instance.GetSetting("Shared", "OperationStore").GetString();
            this.RoutePlanProviderAlias = SettingsManager.Instance.GetSetting("Shared", "RoutePlanProvider").GetString();

            this.DownloadRoutePlan = SettingsManager.Instance.GetSetting("Shared", "DownloadRoutePlan").GetBoolean();
            this.RouteImageHeight = SettingsManager.Instance.GetSetting("Shared", "RouteImageHeight").GetInt32();
            this.RouteImageWidth = SettingsManager.Instance.GetSetting("Shared", "RouteImageWidth").GetInt32();

            // FD Information
            this.FDInformation = new FireDepartmentInfo();
            this.FDInformation.Name = SettingsManager.Instance.GetSetting("Shared", "FD.Name").GetString();
            this.FDInformation.Location = new PropertyLocation();
            this.FDInformation.Location.ZipCode = SettingsManager.Instance.GetSetting("Shared", "FD.ZipCode").GetString();
            this.FDInformation.Location.City = SettingsManager.Instance.GetSetting("Shared", "FD.City").GetString();
            this.FDInformation.Location.Street = SettingsManager.Instance.GetSetting("Shared", "FD.Street").GetString();
            this.FDInformation.Location.StreetNumber = SettingsManager.Instance.GetSetting("Shared", "FD.StreetNumber").GetString();

            // Jobs and AlarmSources configuration
            this.EnabledJobs = new ReadOnlyCollection<string>(SettingsManager.Instance.GetSetting("Shared", "JobsConfiguration").GetValue<ExportConfiguration>().GetEnabledExports());
            this.EnabledAlarmSources = new ReadOnlyCollection<string>(SettingsManager.Instance.GetSetting("Shared", "AlarmSourcesConfiguration").GetValue<ExportConfiguration>().GetEnabledExports());

            // Address book
            this.AddressBook = Addressing.AddressBook.Parse(SettingsManager.Instance.GetSetting("Shared", "AddressBook").GetString());

            _instance = this;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Prevents a default instance of the <see cref="AlarmWorkflowConfiguration"/> class from being created.
        /// </summary>
        private AlarmWorkflowConfiguration()
        {
            this.OperationStoreAlias    = SettingsManager.Instance.GetSetting("Shared", "OperationStore").GetString();
            this.RoutePlanProviderAlias = SettingsManager.Instance.GetSetting("Shared", "RoutePlanProvider").GetString();

            this.DownloadRoutePlan = SettingsManager.Instance.GetSetting("Shared", "DownloadRoutePlan").GetBoolean();
            this.RouteImageHeight  = SettingsManager.Instance.GetSetting("Shared", "RouteImageHeight").GetInt32();
            this.RouteImageWidth   = SettingsManager.Instance.GetSetting("Shared", "RouteImageWidth").GetInt32();

            // FD Information
            this.FDInformation                       = new FireDepartmentInfo();
            this.FDInformation.Name                  = SettingsManager.Instance.GetSetting("Shared", "FD.Name").GetString();
            this.FDInformation.Location              = new PropertyLocation();
            this.FDInformation.Location.ZipCode      = SettingsManager.Instance.GetSetting("Shared", "FD.ZipCode").GetString();
            this.FDInformation.Location.City         = SettingsManager.Instance.GetSetting("Shared", "FD.City").GetString();
            this.FDInformation.Location.Street       = SettingsManager.Instance.GetSetting("Shared", "FD.Street").GetString();
            this.FDInformation.Location.StreetNumber = SettingsManager.Instance.GetSetting("Shared", "FD.StreetNumber").GetString();

            // Jobs and AlarmSources configuration
            this.EnabledJobs         = new ReadOnlyCollection <string>(SettingsManager.Instance.GetSetting("Shared", "JobsConfiguration").GetValue <ExportConfiguration>().GetEnabledExports());
            this.EnabledAlarmSources = new ReadOnlyCollection <string>(SettingsManager.Instance.GetSetting("Shared", "AlarmSourcesConfiguration").GetValue <ExportConfiguration>().GetEnabledExports());

            // Address book
            this.AddressBook = Addressing.AddressBook.Parse(SettingsManager.Instance.GetSetting("Shared", "AddressBook").GetString());

            _instance = this;
        }
        /// <summary>
        /// Prevents a default instance of the <see cref="AlarmWorkflowConfiguration"/> class from being created.
        /// </summary>
        private AlarmWorkflowConfiguration()
        {
            this.OperationStoreAlias = SettingsManager.Instance.GetSetting("Shared", "OperationStore").GetString();
            this.RoutePlanProviderAlias = SettingsManager.Instance.GetSetting("Shared", "RoutePlanProvider").GetString();

            this.DownloadRoutePlan = SettingsManager.Instance.GetSetting("Shared", "DownloadRoutePlan").GetBoolean();
            this.RouteImageHeight = SettingsManager.Instance.GetSetting("Shared", "RouteImageHeight").GetInt32();
            this.RouteImageWidth = SettingsManager.Instance.GetSetting("Shared", "RouteImageWidth").GetInt32();

            // FD Information
            this.FDInformation = new FireDepartmentInfo();
            this.FDInformation.Name = SettingsManager.Instance.GetSetting("Shared", "FD.Name").GetString();
            this.FDInformation.Location = new PropertyLocation();
            this.FDInformation.Location.ZipCode = SettingsManager.Instance.GetSetting("Shared", "FD.ZipCode").GetInt32().ToString();
            this.FDInformation.Location.City = SettingsManager.Instance.GetSetting("Shared", "FD.City").GetString();
            this.FDInformation.Location.Street = SettingsManager.Instance.GetSetting("Shared", "FD.Street").GetString();
            this.FDInformation.Location.StreetNumber = SettingsManager.Instance.GetSetting("Shared", "FD.StreetNumber").GetString();

            // Jobs configuration
            {
                XDocument docJC = XDocument.Parse(SettingsManager.Instance.GetSetting("Shared", "JobsConfiguration").GetString());
                List<string> jobs = new List<string>();
                foreach (XElement exportE in docJC.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);
                }

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

            // AlarmSources configuration
            {
                XDocument docAS = XDocument.Parse(SettingsManager.Instance.GetSetting("Shared", "AlarmSourcesConfiguration").GetString());
                List<string> sources = new List<string>();
                foreach (XElement exportE in docAS.Root.Elements("AlarmSource"))
                {
                    if (!bool.Parse(exportE.Attribute("IsEnabled").Value))
                    {
                        continue;
                    }

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

                this.EnabledAlarmSources = new ReadOnlyCollection<string>(sources);
            }

            _instance = this;
        }