static async Task Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile("appsettings.Development.json", true) .Build(); var httpClient = new HttpClient(); var notificationsApiUrl = configuration["NotificationsApiUrl"]; var serviceBusConnectionString = configuration["ServiceBusConnectionString"]; var productsNotificationListener = new NotificationListener(httpClient, serviceBusConnectionString, "products", "web-api", notificationsApiUrl); var customersNotificationListener = new NotificationListener(httpClient, serviceBusConnectionString, "customers", "web-api", notificationsApiUrl); var ordersNotificationListener = new NotificationListener(httpClient, serviceBusConnectionString, "orders", "web-api", notificationsApiUrl); productsNotificationListener.StartListening(); customersNotificationListener.StartListening(); ordersNotificationListener.StartListening(); Console.WriteLine("listening for notifications ... press any key to quit"); Console.ReadKey(); await productsNotificationListener.StopListening(); await customersNotificationListener.StopListening(); await ordersNotificationListener.StopListening(); }
protected override void OnShown(EventArgs e) { base.OnShown(e); EmuApi.InitDll(); ConfigManager.Config.Video.ApplyConfig(); EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false); ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.ApplyConfig(); _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames); _displayManager.UpdateViewerSize(); _shortcuts = new ShortcutHandler(_displayManager); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts); SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts); BindShortcuts(); ctrlRecentGames.Initialize(); ResizeRecentGames(); _commandLine.LoadGameFromCommandLine(); if (!EmuRunner.IsRunning()) { ctrlRecentGames.Visible = true; } this.Resize += frmMain_Resize; }
protected override void OnStartup(StartupEventArgs e) { _notificationListener = new NotificationListener(); _notificationListener.OnNotification += _notificationListener_OnNotification; base.OnStartup(e); }
public WindowRefreshManager(IRefresh window) { _window = window; _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; _timer = Stopwatch.StartNew(); }
public void DeregisterListener(NotificationListener listener) { if (listeners.Contains(listener)) { listeners.Remove(listener); } }
protected override void OnNewIntent(Intent intent) { base.OnNewIntent(intent); var listener = new NotificationListener(); listener.NotificationRecieved(intent); }
protected override void OnLoad(EventArgs evt) { base.OnLoad(evt); if (DesignMode) { return; } _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; InitShortcuts(); RegisterViewerConfig config = ConfigManager.Config.Debug.RegisterViewer; RestoreLocation(config.WindowLocation, config.WindowSize); mnuAutoRefresh.Checked = config.AutoRefresh; ctrlScanlineCycleSelect.Initialize(config.RefreshScanline, config.RefreshCycle, EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy ? CpuType.Gameboy : CpuType.Cpu); _refreshManager = new WindowRefreshManager(this); _refreshManager.AutoRefresh = config.AutoRefresh; _refreshManager.AutoRefreshSpeed = RefreshSpeed.High; UpdateTabs(); RefreshData(); RefreshViewer(); mnuAutoRefresh.CheckedChanged += mnuAutoRefresh_CheckedChanged; }
protected override void OnClosing(CancelEventArgs e) { base.OnClosing(e); DebuggerInfo cfg = ConfigManager.Config.Debug.Debugger; cfg.WindowSize = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Size : this.Size; cfg.WindowLocation = this.WindowState != FormWindowState.Normal ? this.RestoreBounds.Location : this.Location; cfg.SplitterDistance = ctrlSplitContainer.SplitterDistance; _entityBinder.UpdateObject(); ConfigManager.ApplyChanges(); switch (_cpuType) { case CpuType.Cpu: ConfigApi.SetDebuggerFlag(DebuggerFlags.CpuDebuggerEnabled, false); break; case CpuType.Spc: ConfigApi.SetDebuggerFlag(DebuggerFlags.SpcDebuggerEnabled, false); break; case CpuType.Sa1: ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, false); break; case CpuType.Gsu: ConfigApi.SetDebuggerFlag(DebuggerFlags.GsuDebuggerEnabled, false); break; } BreakpointManager.RemoveCpuType(_cpuType); if (this._notifListener != null) { this._notifListener.Dispose(); this._notifListener = null; } }
public void RegisterListener(NotificationListener listener) { if (!listeners.Contains(listener)) { listeners.Add(listener); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!this.DesignMode) { InitShortcuts(); EventViewerConfig config = ConfigManager.Config.Debug.EventViewer; RestoreLocation(config.WindowLocation, config.WindowSize); mnuRefreshOnBreakPause.Checked = ConfigManager.Config.Debug.EventViewer.RefreshOnBreakPause; ctrlPpuView.ImageScale = config.ImageScale; _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; _refreshManager = new WindowRefreshManager(this); _refreshManager.AutoRefresh = config.AutoRefresh; _refreshManager.AutoRefreshSpeed = config.AutoRefreshSpeed; mnuAutoRefresh.Checked = config.AutoRefresh; mnuAutoRefreshLow.Click += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Low; mnuAutoRefreshNormal.Click += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.Normal; mnuAutoRefreshHigh.Click += (s, evt) => _refreshManager.AutoRefreshSpeed = RefreshSpeed.High; mnuAutoRefreshSpeed.DropDownOpening += (s, evt) => UpdateRefreshSpeedMenu(); ctrlFilters.Init(); RefreshData(); RefreshViewer(); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); this.Text = _cpuType == CpuType.Cpu ? "CPU Debugger" : "SPC Debugger"; _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; switch (_cpuType) { case CpuType.Cpu: ctrlDisassemblyView.Initialize(new CpuDisassemblyManager(), new CpuLineStyleProvider()); break; case CpuType.Spc: ctrlDisassemblyView.Initialize(new SpcDisassemblyManager(), new SpcLineStyleProvider()); break; } ctrlBreakpoints.CpuType = _cpuType; ctrlWatch.CpuType = _cpuType; InitShortcuts(); InitToolbar(); LoadConfig(); toolTip.SetToolTip(picWatchHelp, ctrlWatch.GetTooltipText()); BreakpointManager.BreakpointsEnabled = true; DebugApi.Step(10000, StepType.CpuStep); }
public void TestAwsNotification() { var listener = new NotificationListener { Context = InRiverContext }; listener.Context.Settings = TestSettings; // todo: fill in your SNS settings in this test message var result = listener.Add(@"{ ""Type"" : ""Notification"", ""MessageId"" : ""da41e39f-ea4d-435a-b922-c6aae3915ebe"", ""TopicArn"" : ""arn:aws:sns:us-west-2:123456789012:MyTopic"", ""Subject"" : ""asset_bank.media.uploaded"", ""Message"" : ""{\""media_id\"": \""9542A933-2DF5-4999-9AB52701F33613C0\""}"", ""Timestamp"" : ""2012-04-25T21:49:25.719Z"", ""SignatureVersion"" : ""1"", ""Signature"" : ""EXAMPLElDMXvB8r9R83tGoNn0ecwd5UjllzsvSvbItzfaMpN2nk5HVSw7XnOn/49IkxDKz8YrlH2qJXj2iZB0Zo2O71c4qQk1fMUDi3LGpij7RCW7AW9vYYsSqIKRnFS94ilu7NFhUzLiieYr4BKHpdTmdD6c0esKEYBpabxDSc="", ""SigningCertURL"" : ""https://sns.us-west-2.amazonaws.com/SimpleNotificationService-f3ecfb7224c7233fe7bb5f59f96de52f.pem"", ""UnsubscribeURL"" : ""https://sns.us-west-2.amazonaws.com/?Action=Unsubscribe&SubscriptionArn=arn:aws:sns:us-west-2:123456789012:MyTopic:2bcfbf39-05c3-41de-beaa-fcfcc21c8f55"" } "); Logger.Log(result); Assert.AreNotEqual(string.Empty, result, "Got no result"); }
static async Task Main(string[] args) { var configuration = new ConfigurationBuilder() .AddJsonFile("appsettings.json") .AddJsonFile("appsettings.Development.json", true) .Build(); //IServiceCollection services = new ServiceCollection(); //services.AddDbContext<MyDbContext>(options => // options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection"))); //services.AddScoped<IMyService, MyService>(); //IServiceProvider provider = services.BuildServiceProvider(); //IMyService myService = provider.GetService<IMyService>(); var httpClient = new HttpClient(); var notificationsApiUrl = configuration["NotificationsApiUrl"]; var serviceBusConnectionString = configuration["ServiceBusConnectionString"]; var ordersNotificationListener = new NotificationListener(httpClient, serviceBusConnectionString, "orders", "products-api", notificationsApiUrl); ordersNotificationListener.StartListening(); Console.WriteLine("listening for notifications ... press any key to quit"); Console.ReadKey(); await ordersNotificationListener.StopListening(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (DesignMode) { return; } _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; BaseConfigForm.InitializeComboBox(cboFormat, typeof(TileFormat)); _tileData = new byte[512 * 512 * 4]; _tileImage = new Bitmap(512, 512, PixelFormat.Format32bppArgb); picTilemap.Image = _tileImage; ctrlScanlineCycleSelect.Initialize(241, 0); _options.Format = TileFormat.Bpp4; _options.Width = 32; _options.Palette = ctrlPaletteViewer.SelectedPalette; RefreshData(); RefreshViewer(); InitMemoryTypeDropdown(); cboFormat.SetEnumValue(TileFormat.Bpp4); ctrlPaletteViewer.SelectionMode = PaletteSelectionMode.SixteenColors; }
public TelemetryListener(EventSubscriptionWrapper espw, TelemetrySubscription ts, IConnect connect, NotificationListener notificationListener) { _connect = connect; _eventSubscriptionWrapper = espw; _telemetrySubscription = ts; _notificationListener = notificationListener; }
public WindowRefreshManager(IRefresh window) { _window = window; _notifListener = new NotificationListener(ConfigManager.Config.DebugInfo.DebugConsoleId); _notifListener.OnNotification += OnNotificationReceived; _timer = Stopwatch.StartNew(); }
private void StartEmulatorProcess(string baseDir) { var test = SnesApi.TestDll(); SnesApi.InitDll(); //EmuApi.InitDll(); var version = SnesApi.GetMesenVersion(); //InteropEmu.SetDisplayLanguage(Brewmaster.Emulation.Language.English); //SnesApi.SetDisplayLanguage(Mesen.GUI.Forms.Language.English); ApplyVideoConfig(); SnesApi.InitializeEmu(baseDir, _mainWindow.Handle, _renderControl.Handle, false, false, false); ApplyVideoConfig(); ApplyAudioConfig(); ApplyInputConfig(); ApplyEmulationConfig(); ApplyPreferenceConfig(); ApplyDebuggerConfig(); Mesen.GUI.ScreenSize size = SnesApi.GetScreenSize(false); _renderControl.Size = new Size(size.Width, size.Height); //SnesApi.AddKnownGameFolder(@"C:\Users\dkmrs\Documents\NesDev\sc"); _notifListener = new NotificationListener(); _notifListener.OnNotification += HandleNotification; //SnesApi.SetNesModel(NesModel.Auto); //SnesApi.DebugSetDebuggerConsole(SnesApi.ConsoleId.Master); }
public WindowRefreshManager(IRefresh window, CpuType cpuType = CpuType.Cpu) { _cpuType = cpuType; _window = window; _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; _timer = Stopwatch.StartNew(); }
public void SetUp() { // Setup the observer. _resultObserver = new MockObserver(); NotificationListener.Subscribe(_resultObserver); _listnerToTest = new Notifications.iOS.NotificationListener(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); HexEditorInfo config = ConfigManager.Config.Debug.HexEditor; _entityBinder.Entity = config; _entityBinder.AddBinding(nameof(config.AutoRefresh), mnuAutoRefresh); _entityBinder.AddBinding(nameof(config.HighDensityTextMode), mnuHighDensityMode); _entityBinder.AddBinding(nameof(config.ByteEditingMode), mnuByteEditingMode); _entityBinder.AddBinding(nameof(config.EnablePerByteNavigation), mnuEnablePerByteNavigation); _entityBinder.AddBinding(nameof(config.IgnoreRedundantWrites), mnuIgnoreRedundantWrites); _entityBinder.AddBinding(nameof(config.HighlightCurrentRowColumn), mnuHighlightCurrentRowColumn); _entityBinder.AddBinding(nameof(config.ShowCharacters), mnuShowCharacters); _entityBinder.AddBinding(nameof(config.ShowLabelInfo), mnuShowLabelInfoOnMouseOver); _entityBinder.AddBinding(nameof(config.HighlightExecution), mnuHighlightExecution); _entityBinder.AddBinding(nameof(config.HighlightReads), mnuHightlightReads); _entityBinder.AddBinding(nameof(config.HighlightWrites), mnuHighlightWrites); _entityBinder.AddBinding(nameof(config.HideUnusedBytes), mnuHideUnusedBytes); _entityBinder.AddBinding(nameof(config.HideReadBytes), mnuHideReadBytes); _entityBinder.AddBinding(nameof(config.HideWrittenBytes), mnuHideWrittenBytes); _entityBinder.AddBinding(nameof(config.HideExecutedBytes), mnuHideExecutedBytes); _entityBinder.AddBinding(nameof(config.HighlightLabelledBytes), mnuHighlightLabelledBytes); _entityBinder.AddBinding(nameof(config.HighlightBreakpoints), mnuHighlightBreakpoints); _entityBinder.AddBinding(nameof(config.HighlightCodeBytes), mnuHighlightCodeBytes); _entityBinder.AddBinding(nameof(config.HighlightDataBytes), mnuHighlightDataBytes); _entityBinder.UpdateUI(); UpdateRefreshSpeedMenu(); UpdateFlags(); this.ctrlHexViewer.HighlightCurrentRowColumn = config.HighlightCurrentRowColumn; this.ctrlHexViewer.TextZoom = config.TextZoom; this.ctrlHexViewer.BaseFont = new Font(config.FontFamily, config.FontSize, config.FontStyle); this.UpdateFadeOptions(); this.InitTblMappings(); this.ctrlHexViewer.StringViewVisible = mnuShowCharacters.Checked; UpdateImportButton(); InitMemoryTypeDropdown(true); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; this.mnuShowCharacters.CheckedChanged += this.mnuShowCharacters_CheckedChanged; this.mnuIgnoreRedundantWrites.CheckedChanged += mnuIgnoreRedundantWrites_CheckedChanged; RestoreLocation(config.WindowLocation, config.WindowSize); this.InitShortcuts(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); _notifListener = new NotificationListener(); _notifListener.OnNotification += this._notifListener_OnNotification; this.InitShortcuts(); }
public static void InitImpl() { if (BooksApp != null) { return; } LogFilePath = ConfigurationManager.AppSettings["LogFilePath"]; DeleteLocalLogFile(); var protectedSection = (NameValueCollection)ConfigurationManager.GetSection("protected"); var loginCryptoKey = protectedSection["LoginInfoCryptoKey"]; var connString = protectedSection["MsSqlConnectionString"]; var logConnString = protectedSection["MsSqlLogConnectionString"]; BooksApp = new BooksEntityApp(loginCryptoKey); //Add mock email/sms service NotificationListener = new NotificationListener(BooksApp, blockAll: true); //Set magic captcha in login settings, so we can pass captcha in unit tests var loginStt = BooksApp.GetConfig <Vita.Modules.Login.LoginModuleSettings>(); loginStt.MagicCaptcha = "Magic"; BooksApp.Init(); //connect to database var driver = MsSqlDbDriver.Create(connString); var dbOptions = MsSqlDbDriver.DefaultMsSqlDbOptions; var dbSettings = new DbSettings(driver, dbOptions, connString, upgradeMode: DbUpgradeMode.Always); // schemas); var resetDb = ConfigurationManager.AppSettings["ResetDatabase"] == "true"; if (resetDb) { Vita.UnitTests.Common.TestUtil.DropSchemaObjects(dbSettings); } BooksApp.ConnectTo(dbSettings); var logDbSettings = new DbSettings(driver, dbOptions, logConnString); BooksApp.LoggingApp.ConnectTo(logDbSettings); BooksApp.LoggingApp.LogPath = LogFilePath; TestUtil.DeleteAllData(BooksApp, exceptEntities: new [] { typeof(IDbInfo), typeof(IDbModuleInfo) }); TestUtil.DeleteAllData(BooksApp.LoggingApp); SampleDataGenerator.CreateUnitTestData(BooksApp); // Start service var serviceUrl = ConfigurationManager.AppSettings["ServiceUrl"]; var jsonNames = ConfigurationManager.AppSettings["JsonStyleNames"] == "true"; var jsonMappingMode = jsonNames ? ApiNameMapping.UnderscoreAllLower : ApiNameMapping.Default; StartService(serviceUrl, jsonMappingMode); // create client var clientContext = new OperationContext(BooksApp); // change options to None to disable logging of test client calls Client = new WebApiClient(clientContext, serviceUrl, clientName: "TestClient", nameMapping: jsonMappingMode, options: ClientOptions.EnableLog, badRequestContentType: typeof(List <ClientFault>)); WebApiClient.SharedHttpClientHandler.AllowAutoRedirect = false; //we need it for Redirect test }
protected override void OnFormClosed(FormClosedEventArgs e) { base.OnFormClosed(e); if (_notifListener != null) { _notifListener.Dispose(); _notifListener = null; } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); if (!this.DesignMode) { _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; } }
public App() { InitializeComponent(); // Register the notification listener. NotificationListener.Subscribe(new NotificationObserver()); MainPage = new NavigationPage(new Views.MainPage()); }
/// <summary> /// This is called when a new notification is recieved. /// </summary> /// <param name="intent">The intent that contains information about the nofication.</param> /// <remarks> /// This event could get triggered by non-notification intents but for this example /// program it should only ever be notifications. /// </remarks> protected override void OnNewIntent(Intent intent) { // Let the parent do it's thing. base.OnNewIntent(intent); // Let the notification plugin translate the Andorid notification (i.e. Intent) // to a XPlugins notification. This will also trigger the event in the portable // project assuming it has registered an observer. var listener = new NotificationListener(); listener.NotificationRecieved(intent); }
protected override void OnShown(EventArgs e) { base.OnShown(e); EmuApi.InitDll(); bool showUpgradeMessage = UpdateHelper.PerformUpgrade(); ConfigManager.Config.Video.ApplyConfig(); EmuApi.InitializeEmu(ConfigManager.HomeFolder, Handle, ctrlRenderer.Handle, false, false, false); ConfigManager.Config.InitializeDefaults(); ConfigManager.Config.ApplyConfig(); _displayManager = new DisplayManager(this, ctrlRenderer, pnlRenderer, mnuMain, ctrlRecentGames); _displayManager.SetScaleBasedOnWindowSize(); _shortcuts = new ShortcutHandler(_displayManager); _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; _commandLine.LoadGameFromCommandLine(); SaveStateManager.InitializeStateMenu(mnuSaveState, true, _shortcuts); SaveStateManager.InitializeStateMenu(mnuLoadState, false, _shortcuts); BindShortcuts(); Task.Run(() => { Thread.Sleep(25); this.BeginInvoke((Action)(() => { ResizeRecentGames(); ctrlRecentGames.Initialize(); if (!EmuRunner.IsRunning()) { ctrlRecentGames.Visible = true; } })); }); if (showUpgradeMessage) { MesenMsgBox.Show("UpgradeSuccess", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (ConfigManager.Config.Preferences.AutomaticallyCheckForUpdates) { UpdateHelper.CheckForUpdates(true); } InBackgroundHelper.StartBackgroundTimer(); this.Resize += frmMain_Resize; }
protected override void OnLoad(EventArgs e) { _notifListener = new NotificationListener(); _notifListener.OnNotification += OnNotificationReceived; switch (_cpuType) { case CpuType.Cpu: ctrlDisassemblyView.Initialize(new CpuDisassemblyManager(), new CpuLineStyleProvider()); ConfigApi.SetDebuggerFlag(DebuggerFlags.CpuDebuggerEnabled, true); this.Text = "CPU Debugger"; break; case CpuType.Spc: ctrlDisassemblyView.Initialize(new SpcDisassemblyManager(), new SpcLineStyleProvider()); ConfigApi.SetDebuggerFlag(DebuggerFlags.SpcDebuggerEnabled, true); this.Text = "SPC Debugger"; break; case CpuType.Sa1: ctrlDisassemblyView.Initialize(new Sa1DisassemblyManager(), new Sa1LineStyleProvider()); ConfigApi.SetDebuggerFlag(DebuggerFlags.Sa1DebuggerEnabled, true); this.Text = "SA-1 Debugger"; break; case CpuType.Gsu: ctrlDisassemblyView.Initialize(new GsuDisassemblyManager(), new GsuLineStyleProvider()); ConfigApi.SetDebuggerFlag(DebuggerFlags.GsuDebuggerEnabled, true); this.Text = "GSU Debugger"; ctrlCallstack.Visible = false; ctrlLabelList.Visible = false; mnuStepOver.Visible = false; mnuStepOut.Visible = false; mnuStepInto.Text = "Step"; tlpBottomPanel.ColumnCount = 2; break; } ctrlBreakpoints.CpuType = _cpuType; ctrlWatch.CpuType = _cpuType; InitShortcuts(); InitToolbar(); LoadConfig(); toolTip.SetToolTip(picWatchHelp, ctrlWatch.GetTooltipText()); BreakpointManager.AddCpuType(_cpuType); DebugApi.Step(_cpuType, 10000, StepType.Step); base.OnLoad(e); }
public void TestTestMethod() { var listener = new NotificationListener { Context = InRiverContext }; listener.Context.Settings = TestSettings; var result = listener.Test(); Logger.Log(result); Assert.AreNotEqual(string.Empty, result, "Got no result"); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); // Allow more CPU types later ctrlWatch.CpuType = EmuApi.GetRomInfo().CoprocessorType == CoprocessorType.Gameboy ? CpuType.Gameboy : CpuType.Cpu; if (!DesignMode) { RestoreLocation(ConfigManager.Config.WatchWindow.WindowLocation, ConfigManager.Config.WatchWindow.WindowSize); _notifListener = new NotificationListener(); _notifListener.OnNotification += _notifListener_OnNotification; ctrlWatch.UpdateWatch(true); } }