private static void Monitor(IEnumerable <string> args) { NotifyOptions printerNotifyOptions = null; Parser.Default.ParseArguments <Options>(args).WithParsed(o => { if (o.JobNotifyFields.Any() || o.PrinterNotifyFields.Any()) { printerNotifyOptions = new NotifyOptions { Types = new List <NotifyOptionsType>() }; if (o.JobNotifyFields.Any()) { printerNotifyOptions.Types.Add(new NotifyOptionsType { Type = NOTIFY_TYPE.JOB_NOTIFY_TYPE, Fields = o.JobNotifyFields.Cast <UInt16>().ToList(), }); } if (o.PrinterNotifyFields.Any()) { printerNotifyOptions.Types.Add(new NotifyOptionsType { Type = NOTIFY_TYPE.PRINTER_NOTIFY_TYPE, Fields = o.PrinterNotifyFields.Cast <UInt16>().ToList(), }); } } MonitorPrinter(o.PrinterName, printerNotifyOptions, o.PrinterChange); }); }
public void SendEmailAsyncWithCorrectTemplateId(bool isCallBack, string expectedTemplateId) { // arrange var contactUsEmailRequestModel = new ContactUsEmailRequestModel() { IsCallBack = isCallBack, }; var notifyOptions = new NotifyOptions() { ByEmailTemplateId = "ByEmailTemplateId", CallMeBackTemplateId = "CallMeBackTemplateId", }; var notifyEmailService = new NotifyEmailService <ContactUsEmailRequestModel>(fakeLogger, fakeNotifyClientProxy, notifyOptions); A.CallTo(() => fakeNotifyClientProxy.SendEmail(A <string> ._, A <string> ._, A <Dictionary <string, dynamic> > ._)).Returns(A.Dummy <EmailNotificationResponse>()); // act var result = notifyEmailService.SendEmailAsync(contactUsEmailRequestModel).Result; // assert result.Should().BeTrue(); A.CallTo(() => fakeNotifyClientProxy.SendEmail(A <string> ._, A <string> .That.IsEqualTo(expectedTemplateId), A <Dictionary <string, dynamic> > ._)).MustHaveHappened(); }
public FileProgress(ProgressBar ctrlProgress, Form owner, NotifyOptions options = NotifyOptions.All) { _formOwner = owner; _ctrlProgress = ctrlProgress; Reset("Progress: ", ctrlProgress.Maximum, ctrlProgress.Minimum, ctrlProgress.Style, DEFAULT_MARQUEE_TIMEOUT, options); this.OnPercentChange = () => { CommonUtils.ExecuteOnUIThread(() => { _ctrlProgress.Value = (int)Value; OnChange(this.ToString()); }, _formOwner); Application.DoEvents(); }; this.OnValueChange = () => { CommonUtils.ExecuteOnUIThread(() => { _ctrlProgress.Value = (int)Value; OnChange(this.ToString()); }, _formOwner); Application.DoEvents(); }; }
private static void MonitorPrinter(string printerName, NotifyOptions printerNotifyOptions, PRINTER_CHANGE change) { if (printerNotifyOptions == null && change == 0) { throw new Exception("Either or both of printer changes or fields to monitor must be set."); } using var printerChangeNotification = ChangeNotification.Create(change, printerName, PRINTER_NOTIFY_CATEGORY.PRINTER_NOTIFY_CATEGORY_ALL, printerNotifyOptions); while (true) { printerChangeNotification.WaitHandle.WaitOne(); NotifyInfo printerNotifyInfo; bool refresh = false; do { printerNotifyInfo = printerChangeNotification.FindNextPrinterChangeNotification(refresh); WriteToConsole(printerNotifyInfo); refresh = true; // For next iteration if data overflowed } while ((printerNotifyInfo.Flags & NotifyInfo.PRINTER_NOTIFY_INFO_DISCARDED) != 0); } }
private void cbNotify_SelectedValueChanged(object sender, EventArgs e) { NotifyOptions curOption = (NotifyOptions)Enum.Parse(typeof(NotifyOptions), cbNotify.SelectedValue.ToString()); switch (curOption) { case NotifyOptions.Toast: fileNotifySound.Enabled = false; tbarVolume.Enabled = false; btnTest.Enabled = false; break; case NotifyOptions.Sound: fileNotifySound.Enabled = true; tbarVolume.Enabled = true; btnTest.Enabled = true; break; case NotifyOptions.Both: fileNotifySound.Enabled = true; tbarVolume.Enabled = true; btnTest.Enabled = true; break; } }
public AssessmentController(ILogService logService, IMapper mapper, IAssessmentService apiService, ISessionService sessionService, NotifyOptions notifyOptions) : base(sessionService) { this.logService = logService; this.mapper = mapper; this.apiService = apiService; this.notifyOptions = notifyOptions; }
private void AddEmailService(IServiceCollection services) { NotifyOptions options = new NotifyOptions(); Configuration.Bind(nameof(NotifyOptions), options); services.AddTransient <IEmailService, GovUKNotifyService>(); services.AddTransient <IAsyncNotificationClient>(sp => new NotificationClient(options.ApiKey)); }
public void MultipleFields() { // Use a random comment then we don't have t worry about it being set from a previous run. var randomComment = DateTime.Now.Ticks.ToString(); uint priority; var options = new NotifyOptions { Types = new List <NotifyOptionsType> { new NotifyOptionsType() { Fields = new List <ushort> { (ushort)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_COMMENT, (ushort)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_LOCATION, (ushort)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_PRIORITY, }, Type = NOTIFY_TYPE.PRINTER_NOTIFY_TYPE, } } }; using var changeNotification = ChangeNotification.Create(0, NameConstants.PrinterName, PRINTER_NOTIFY_CATEGORY.PRINTER_NOTIFY_CATEGORY_ALL, options); // If we don't close the printer handle before calling WaitOne then WaitOne can block indefinitely using (var printer = new SafePrinter(NameConstants.PrinterName)) { // This should trigger a change var pi2 = printer.GetPrinter(); pi2.pComment = randomComment + "Comment"; pi2.pLocation = randomComment + "Location"; priority = ++pi2.Priority & 0xFF; printer.SetPrinter(pi2, 0); } changeNotification.WaitHandle.WaitOne(); var change = changeNotification.FindNextPrinterChangeNotification(true); Assert.That(change.Change == 0); // We didn't request change monitoring Assert.That(change.Data.Count, Is.EqualTo(3)); var comment = change.Data.First(d => d.Field == (int)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_COMMENT).Value; Assert.That(comment, Is.EqualTo(randomComment + "Comment")); var location = change.Data.First(d => d.Field == (int)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_LOCATION).Value; Assert.That(location, Is.EqualTo(randomComment + "Location")); var newPriority = change.Data.First(d => d.Field == (int)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_PRIORITY).Value; Assert.That(newPriority, Is.EqualTo(priority)); }
private void SaveChanges() { Properties.Settings.Default.EveChatLogsPath = PathHelper.EncryptedPath(folderEveChatLogs.SelectedFolder); Properties.Settings.Default.LogFile = PathHelper.EncryptedPath(fileLog.SelectedFile); Properties.Settings.Default.MoveOldLogs = cbMoveLog.Checked; Properties.Settings.Default.MoveOldLogsPath = PathHelper.EncryptedPath(folderMoveLogs.SelectedFolder); Properties.Settings.Default.DeleteLogs = cbDeleteLogs.Checked; Properties.Settings.Default.NotifyKeywords = tbNotifyKeywords.Text; Properties.Settings.Default.SoundVolume = tbarVolume.Value; Properties.Settings.Default.CheckForUpdates = cbUpdates.Checked; Properties.Settings.Default.ToastFontSizeTitle = Convert.ToInt32(nudFontSizeTitle.Value); Properties.Settings.Default.ToastFontSizeContent = Convert.ToInt32(nudFontSizeContent.Value); Properties.Settings.Default.IgnoreMotd = cbIgnoreMotd.Checked; Properties.Settings.Default.IgnoreOwnMessages = cbIgnoreOwn.Checked; Properties.Settings.Default.MotdUsername = tbMotdUsername.Text; Properties.Settings.Default.IgnoreChannels = tbIgnoreChannels.Text; Properties.Settings.Default.IgnorePilots = tbIgnorePilots.Text; Properties.Settings.Default.AlwaysPilots = tbAlwaysPilots.Text; Properties.Settings.Default.AlwaysChannels = tbAlwaysChannels.Text; Properties.Settings.Default.AutoStartDelayMinutes = Convert.ToInt32(nudAutoStartDelay.Value); NotifyOptions no = (NotifyOptions)cbNotify.SelectedItem; switch (no) { case NotifyOptions.Toast: Properties.Settings.Default.ShowToast = true; Properties.Settings.Default.SoundFilePath = null; break; case NotifyOptions.Sound: Properties.Settings.Default.ShowToast = false; Properties.Settings.Default.SoundFilePath = PathHelper.EncryptedPath(fileNotifySound.SelectedFile); break; case NotifyOptions.Both: Properties.Settings.Default.ShowToast = true; Properties.Settings.Default.SoundFilePath = PathHelper.EncryptedPath(fileNotifySound.SelectedFile); break; } Properties.Settings.Default.Save(); if (cbAutoStart.Enabled) { try { Autostart.ManageAutostart.Instance.Enabled = cbAutoStart.Checked; Autostart.ManageAutostart.Instance.ChangeDelay(Properties.Settings.Default.AutoStartDelayMinutes); } catch (Exception ex) { Logging.WriteLine(string.Format("Error changing autostart enabled:{0}{1}", Environment.NewLine, ex.ToString())); } } }
public AssessmentTestBase() { mapper = A.Fake <IMapper>(); sessionService = A.Fake <ISessionService>(); assessmentService = A.Fake <IAssessmentService>(); logService = A.Fake <ILogService>(); notifyOptions = A.Fake <NotifyOptions>(); assessmentController = new AssessmentController(logService, mapper, assessmentService, sessionService, notifyOptions); }
public AssessmentServiceTests() { logger = A.Fake <ILogger <AssessmentService> >(); notifyOptions = A.Fake <NotifyOptions>(); assessmentApiService = A.Fake <IAssessmentApiService>(); sessionIdToCodeConverter = A.Fake <ISessionIdToCodeConverter>(); sessionService = A.Fake <ISessionService>(); assessmentService = new AssessmentService(logger, notifyOptions, assessmentApiService, sessionIdToCodeConverter, sessionService); }
/// <summary> /// This method is called internally to determine if a new alert /// can be shown from the alert queue. /// </summary> protected static void CheckAlerts() { if (!AlertsShowing && Alerts.Count > 0) { AlertsShowing = true; NotifyOptions Opt = Alerts.Dequeue(); MainForm.Instance.Invoke((Action) delegate { MainForm.SysIcon.ShowBalloonTip(DefaultDockTime, Opt.Message, Opt.SubText, Opt.Icon); }); } }
public AssessmentService( ILogger <AssessmentService> logger, NotifyOptions notifyOptions, IAssessmentApiService assessmentApiService, ISessionIdToCodeConverter sessionIdToCodeConverter, ISessionService sessionService) { this.logger = logger; this.notifyOptions = notifyOptions; this.assessmentApiService = assessmentApiService; this.sessionIdToCodeConverter = sessionIdToCodeConverter; this.sessionService = sessionService; }
public NotifyEmailService( ILogger <NotifyEmailService <TEmailRequestModel> > logger, INotifyClientProxy notifyClientProxy, NotifyOptions notifyOptions) { _ = logger ?? throw new ArgumentNullException(nameof(logger)); _ = notifyClientProxy ?? throw new ArgumentNullException(nameof(notifyClientProxy)); _ = notifyOptions ?? throw new ArgumentNullException(nameof(notifyOptions)); this.logger = logger; this.notifyClientProxy = notifyClientProxy; this.notifyOptions = notifyOptions; }
public void SendEmailAsyncReturnsFailedOnError() { // arrange var contactUsEmailRequestModel = new ContactUsEmailRequestModel(); var dummyNotifyOptions = new NotifyOptions(); var notifyEmailService = new NotifyEmailService <ContactUsEmailRequestModel>(fakeLogger, fakeNotifyClientProxy, dummyNotifyOptions); A.CallTo(() => fakeNotifyClientProxy.SendEmail(A <string> ._, A <string> ._, A <Dictionary <string, dynamic> > ._)).Throws <NotifyClientException>(); // act var result = notifyEmailService.SendEmailAsync(contactUsEmailRequestModel).Result; // assert result.Should().BeFalse(); A.CallTo(() => fakeNotifyClientProxy.SendEmail(A <string> ._, A <string> ._, A <Dictionary <string, dynamic> > ._)).MustHaveHappened(); }
public void MapsString() { var testString = "key1:value1,key2:value2,key3:value3"; var classUnderTest = new NotifyOptions { TemplateIds = testString }; var formattedIds = classUnderTest.GetTemplateIds(); formattedIds.Should().BeEquivalentTo(new Dictionary <string, string> { { "key1", "value1" }, { "key2", "value2" }, { "key3", "value3" }, }); }
public void SendEmailAsyncReturnsSuccess() { // arrange var contactUsEmailRequestModel = new ContactUsEmailRequestModel() { ToEmailAddress = "*****@*****.**", }; var dummyNotifyOptions = new NotifyOptions(); var notifyEmailService = new NotifyEmailService <ContactUsEmailRequestModel>(fakeLogger, fakeNotifyClientProxy, dummyNotifyOptions); A.CallTo(() => fakeNotifyClientProxy.SendEmail(A <string> ._, A <string> ._, A <Dictionary <string, dynamic> > ._)).Returns(A.Dummy <EmailNotificationResponse>()); // act var result = notifyEmailService.SendEmailAsync(contactUsEmailRequestModel).Result; // assert result.Should().BeTrue(); A.CallTo(() => fakeNotifyClientProxy.SendEmail(A <string> .That.IsEqualTo(contactUsEmailRequestModel.ToEmailAddress), A <string> ._, A <Dictionary <string, dynamic> > ._)).MustHaveHappened(); }
public void AddJob() { var options = new NotifyOptions { Types = new List <NotifyOptionsType> { new NotifyOptionsType { Fields = new List <ushort> { (ushort)JOB_NOTIFY_FIELD.JOB_NOTIFY_FIELD_PRINTER_NAME }, Type = NOTIFY_TYPE.JOB_NOTIFY_TYPE, } } }; using var changeNotification = ChangeNotification.Create(0, NameConstants.PrinterName, PRINTER_NOTIFY_CATEGORY.PRINTER_NOTIFY_CATEGORY_ALL, options); using var localPrintServer = new LocalPrintServer(); var defaultPrintQueue = localPrintServer.GetPrintQueue(NameConstants.PrinterName); var myPrintJob = defaultPrintQueue.AddJob(); // Write a Byte buffer to the JobStream and close the stream var myByteBuffer = Encoding.Unicode.GetBytes("This is a test string for the print job stream."); using var myStream = myPrintJob.JobStream; myStream.Write(myByteBuffer, 0, myByteBuffer.Length); myStream.Close(); using var myStream2 = myPrintJob.JobStream; myStream2.Write(myByteBuffer, 0, myByteBuffer.Length); myStream2.Close(); changeNotification.WaitHandle.WaitOne(); var changes = changeNotification.FindNextPrinterChangeNotification(false); Assert.That(changes.Data.Count, Is.EqualTo(1)); Assert.That(changes.Data.First().Value, Is.EqualTo(NameConstants.PrinterName)); }
public void Comment() { // Use a random comment then we don't have t worry about it being set from a previous run. var randomComment = DateTime.Now.Ticks.ToString(); var options = new NotifyOptions { Types = new List <NotifyOptionsType> { new NotifyOptionsType() { Fields = new List <ushort> { (ushort)PRINTER_NOTIFY_FIELD.PRINTER_NOTIFY_FIELD_COMMENT }, Type = NOTIFY_TYPE.PRINTER_NOTIFY_TYPE, } } }; using var changeNotification = ChangeNotification.Create(0, NameConstants.PrinterName, PRINTER_NOTIFY_CATEGORY.PRINTER_NOTIFY_CATEGORY_ALL, options); // If we don't close the printer handle before calling WaitOne then WaitOne can block indefinitely using (var printer = new SafePrinter(NameConstants.PrinterName)) { // This should trigger a change var pi2 = printer.GetPrinter(); pi2.pComment = randomComment; pi2.pSecurityDescriptor = IntPtr.Zero; printer.SetPrinter(pi2, 0); } changeNotification.WaitHandle.WaitOne(); var change = changeNotification.FindNextPrinterChangeNotification(false); Assert.That(change.Change == 0); // We didn't request change monitoring Assert.That(change.Data.Count, Is.EqualTo(1)); Assert.That(change.Data[0].Value, Is.EqualTo(randomComment)); }
private void Reset(string message, long max, long min, ProgressBarStyle style, long marqueeTimeoutMs, NotifyOptions options) { Validate(min, max, 0); _val = 0; _min = min; _max = max; _marqueeTimeoutMs = marqueeTimeoutMs; ReportOption = options; Message = message; Cancel = false; CommonUtils.ExecuteOnUIThread(() => { _ctrlProgress.Maximum = (int)_max; _ctrlProgress.Minimum = (int)_min; _ctrlProgress.Value = 0; _ctrlProgress.Style = style; }, _formOwner); Application.DoEvents(); _stopper.Restart(); }
public void ResetToBlocks(string message = "Progress: ", long max = 100, long min = 0, NotifyOptions options = NotifyOptions.NotifyPercentChange) { Reset(message, max, 0, ProgressBarStyle.Blocks, DEFAULT_MARQUEE_TIMEOUT, options); }
public NotifyClientProxy(NotifyOptions notifyOptions, HttpClient httpClient) { _ = notifyOptions ?? throw new ArgumentNullException(nameof(notifyOptions)); this.notifyOptions = notifyOptions; this.httpClient = httpClient; }
public Settings() { InitializeComponent(); this.Text = string.Format("Settings - v{0}", Application.ProductVersion); cbNotify.DataSource = Enum.GetValues(typeof(NotifyOptions)); // set eve chat path folderEveChatLogs.SelectedFolder = PathHelper.DecryptPath(Properties.Settings.Default.EveChatLogsPath); // set program log path fileLog.SelectedFile = PathHelper.DecryptPath(Properties.Settings.Default.LogFile); // set move old logs cbMoveLog.Checked = Properties.Settings.Default.MoveOldLogs; // set move old logs path folderMoveLogs.SelectedFolder = PathHelper.DecryptPath(Properties.Settings.Default.MoveOldLogsPath); // set delete logs cbDeleteLogs.Checked = Properties.Settings.Default.DeleteLogs; // set notify option NotifyOptions curOption = NotifyOptions.Toast; if (Properties.Settings.Default.ShowToast && string.IsNullOrWhiteSpace(Properties.Settings.Default.SoundFilePath)) { curOption = NotifyOptions.Toast; } if (Properties.Settings.Default.ShowToast && !string.IsNullOrWhiteSpace(Properties.Settings.Default.SoundFilePath)) { curOption = NotifyOptions.Both; } if (!Properties.Settings.Default.ShowToast && !string.IsNullOrWhiteSpace(Properties.Settings.Default.SoundFilePath)) { curOption = NotifyOptions.Sound; } cbNotify.SelectedItem = curOption; // sound file to play if (curOption == NotifyOptions.Both || curOption == NotifyOptions.Sound) { fileNotifySound.SelectedFile = PathHelper.DecryptPath(Properties.Settings.Default.SoundFilePath); } else { fileNotifySound.SelectedFile = ""; } // set notify keywords tbNotifyKeywords.Text = Properties.Settings.Default.NotifyKeywords; // set update check cbUpdates.Checked = Properties.Settings.Default.CheckForUpdates; // set motd username tbMotdUsername.Text = Properties.Settings.Default.MotdUsername; // set ignore pilot and channel tbIgnoreChannels.Text = Properties.Settings.Default.IgnoreChannels; tbIgnorePilots.Text = Properties.Settings.Default.IgnorePilots; // set always pilot and channel tbAlwaysPilots.Text = Properties.Settings.Default.AlwaysPilots; tbAlwaysChannels.Text = Properties.Settings.Default.AlwaysChannels; // set autostart object try { cbAutoStart.Checked = Autostart.ManageAutostart.Instance.Enabled; } catch (Exception ex) { Logging.WriteLine(string.Format("Error getting autostart enabled state:{0}{1}", Environment.NewLine, ex.ToString())); cbAutoStart.Enabled = false; } nudAutoStartDelay.Value = Properties.Settings.Default.AutoStartDelayMinutes; // set font size nudFontSizeTitle.Value = Convert.ToDecimal(Properties.Settings.Default.ToastFontSizeTitle); nudFontSizeContent.Value = Convert.ToDecimal(Properties.Settings.Default.ToastFontSizeContent); // set ignore motd and ignore own messages cbIgnoreMotd.Checked = Properties.Settings.Default.IgnoreMotd; cbIgnoreOwn.Checked = Properties.Settings.Default.IgnoreOwnMessages; initializationFinished = true; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { #if !NETCOREAPP2_0 && !NETCOREAPP2_1 services.AddControllers(); #endif//!NETCOREAPP2_0 && !NETCOREAPP2_1 DatabaseOptions db = Configuration.GetSection("Database").Get <DatabaseOptions>(); string settings = db.Settings; string type = db.Type; bool disabled = db.Disabled; if (disabled) { Console.WriteLine("Database service is disabled."); } else { Console.WriteLine("Database type: " + type); Console.WriteLine("Connecting: " + settings); } DbConnection connection; if (disabled || string.IsNullOrEmpty(type)) { //Gurux.DLMS.AMI DB is defined elsewhere. connection = null; } else if (string.Compare(type, "Oracle", true) == 0) { connection = new OracleConnection(settings); } else if (string.Compare(type, "MSSQL", true) == 0) { connection = new SqlConnection(settings); } else if (string.Compare(type, "MySQL", true) == 0) { connection = new MySql.Data.MySqlClient.MySqlConnection(settings); } else if (string.Compare(type, "SQLite", true) == 0) { connection = new SQLiteConnection(settings); } else { throw new Exception("Invalid connection type. " + type); } if (connection != null) { connection.Open(); GXHost h = new GXHost() { Connection = new GXDbConnection(connection, null) }; h.Connection.OnSqlExecuted += Connection_OnSqlExecuted; if (!h.Connection.TableExist <GXDevice>()) { Console.WriteLine("Creating tables."); h.Connection.CreateTable <GXSystemError>(false, false); h.Connection.CreateTable <GXDeviceTemplate>(false, false); h.Connection.CreateTable <GXDevice>(false, false); h.Connection.CreateTable <GXObjectTemplate>(false, false); h.Connection.CreateTable <GXAttributeTemplate>(false, false); h.Connection.CreateTable <GXObject>(false, false); h.Connection.CreateTable <GXAttribute>(false, false); h.Connection.CreateTable <GXValue>(false, false); h.Connection.CreateTable <GXTask>(false, false); h.Connection.CreateTable <GXError>(false, false); h.Connection.CreateTable <GXSchedule>(false, false); h.Connection.CreateTable <GXScheduleToAttribute>(false, false); h.Connection.CreateTable <GXSchedulerInfo>(false, false); h.Connection.CreateTable <GXReaderInfo>(false, false); h.Connection.CreateTable <GXDeviceToReader>(false, false); h.Connection.CreateTable <GXDeviceLog>(false, false); AddSchedule(h.Connection); } else { h.Connection.UpdateTable <GXSystemError>(); h.Connection.UpdateTable <GXError>(); h.Connection.UpdateTable <GXReaderInfo>(); h.Connection.UpdateTable <GXObjectTemplate>(); h.Connection.UpdateTable <GXAttributeTemplate>(); h.Connection.UpdateTable <GXDeviceTemplate>(); h.Connection.UpdateTable <GXObject>(); h.Connection.UpdateTable <GXAttribute>(); h.Connection.UpdateTable <GXDevice>(); if (!h.Connection.TableExist <GXDeviceLog>()) { h.Connection.CreateTable <GXDeviceLog>(false, false); } else { h.Connection.UpdateTable <GXDeviceLog>(); } } h.Connection.Insert(GXInsertArgs.Insert(new GXSystemError() { Generation = DateTime.Now, Error = "Service started: " + ServerAddress }));; Console.WriteLine("Service started: " + ServerAddress); services.AddScoped <GXHost>(q => { return(h); }); } services.Configure <ListenerOptions>(Configuration.GetSection("Listener")); ListenerOptions listener = Configuration.GetSection("Listener").Get <ListenerOptions>(); if (!listener.Disabled) { services.AddHostedService <GXListenerService>(); } else { Console.WriteLine("Listener service is disabled."); } services.Configure <NotifyOptions>(Configuration.GetSection("Notify")); NotifyOptions n = Configuration.GetSection("Notify").Get <NotifyOptions>(); if (!n.Disabled && n.Port != 0) { services.AddHostedService <GXNotifyService>(); } else { Console.WriteLine("Notify service is disabled."); } services.Configure <SchedulerOptions>(Configuration.GetSection("Scheduler")); SchedulerOptions s = Configuration.GetSection("Scheduler").Get <SchedulerOptions>(); if (!s.Disabled) { services.AddHostedService <GXSchedulerService>(); } else { Console.WriteLine("Scheduler service is disabled."); } services.Configure <ReaderOptions>(Configuration.GetSection("Reader")); ReaderOptions r = Configuration.GetSection("Reader").Get <ReaderOptions>(); Console.WriteLine("Reader trace level is " + r.TraceLevel); Console.WriteLine("Listener trace level is " + listener.TraceLevel); if (r.Threads != 0 && !r.Disabled) { services.AddHostedService <ReaderService>(); } else { Console.WriteLine("Reader '" + r.Name + "' ID: " + r.Id); } #if NETCOREAPP2_0 || NETCOREAPP2_1 services.AddMvc().SetCompatibilityVersion(Microsoft.AspNetCore.Mvc.CompatibilityVersion.Version_2_1); #endif //NETCOREAPP2_0 || NETCOREAPP2_1 }