public void Initialize(ApplicationStartupHandler handler, IDIContext container) { _container = container ?? throw new ArgumentNullException(nameof(container)); _configManager = _container.Resolve <IConfigManager>(); _memoryManager = _container.Resolve <IMemoryReaderManager>(); _actorManager = new ActorManager(); _updater = new IndependendBackgroundWorker(); _configManager.AddPropertyChangeListener("behaviour.actor.updateInterval", true, true, ConfigManager_UpdateChatInterval); _configManager.AddPropertyChangeListener("behaviour.actor.active", true, true, ConfigManager_UpdateRangeFilter); _container.Register <IActorManager>((c, p) => _actorManager); }
public void Initialize(ApplicationStartupHandler handler, IDIContext container) { _container = container ?? throw new ArgumentNullException(nameof(container)); _chatLogger = new CustomChatLogger(); //_chatLogger.LogChannels = Enum.GetValues(typeof(ChatChannel)).Cast<ChatChannel>(); //will log everything that comes from the chat manager _configManager = _container.Resolve <IConfigManager>(); _configManager.AddPropertyChangeListener("behaviour.chatlog.active", true, true, ConfigManager_UpdateWriteLog); _configManager.AddPropertyChangeListener("behaviour.chatlog.path", true, true, ConfigManager_UpdateLogPath); _configManager.AddPropertyChangeListener("behaviour.chatlog.format", true, true, ConfigManager_UpdateLogFormat); _configManager.AddPropertyChangeListener("behaviour.channel.log", true, true, ConfigManager_UpdateLogChannels); _chatManager = _container.Resolve <IChatManager>(); _chatManager.OnChatMessage += ChatManager_ChatMessageEvent; }
public void Initialize(ApplicationStartupHandler handler, IDIContext container) { _container = container ?? throw new ArgumentNullException(nameof(container)); _memoryManager = _container.Resolve <IMemoryReaderManager>(); _configManager = _container.Resolve <IConfigManager>(); _configManager.AddPropertyChangeListener("behaviour.hideOnMinimize", true, true, ConfigManager_UpdateHideOnMinimize); _memoryManager.OnWindowFocusChanged += MemoryReader_OnWindowFocusChanged; }
public void Initialize(ApplicationStartupHandler handler, IDIContext container) { _container = container ?? throw new ArgumentNullException(nameof(container)); _browserAPIManager = _container.Resolve <IBrowserAPIManager>(); _configManager = _container.Resolve <IConfigManager>(); _chatManager = _container.Resolve <IChatManager>(); _browserAPIManager.ConfigHandler = new BrowserConfigHandler(this); _configManager.OnProfileChange += ConfigManager_SynchronizeJSConfig; _configManager.AddPropertyChangeListener("*", ConfigManager_SynchronizeJSConfig); }
public ConfigHotkeyUpdater(string hotkeyid, string hotkeyName, IConfigManager configManager, string configKey, IHotkeyManager hotkeyManager, IChatManager chatManager) { _hotkeyId = hotkeyid ?? throw new ArgumentNullException(nameof(hotkeyid)); _configKey = configKey ?? throw new ArgumentNullException(nameof(configKey)); _hotkeyName = hotkeyName ?? throw new ArgumentNullException(nameof(hotkeyName)); _configManager = configManager ?? throw new ArgumentNullException(nameof(configManager)); _hotkeyManager = hotkeyManager ?? throw new ArgumentNullException(nameof(hotkeyManager)); _chatManager = chatManager ?? throw new ArgumentNullException(nameof(chatManager)); _hotkeyManager.RegisterHotkey(_hotkeyId, Hotkey_Action); _configManager.AddPropertyChangeListener(_configKey, true, true, ConfigManager_Update); }
public void Initialize(ApplicationStartupHandler handler, IDIContext container) { _container = container ?? throw new ArgumentNullException(nameof(container)); _configManager = _container.Resolve <IConfigManager>(); _localeManager = new LocaleManager(); _configManager.AddPropertyChangeListener("behaviour.language", true, true, ConfigManager_UpdateLanguage); //update ui thread _localeManager.OnLocaleChange += (s, e) => { _container.Resolve <IUISynchronizer>().RunSync(() => { CultureInfo.DefaultThreadCurrentCulture = e.Locale; CultureInfo.DefaultThreadCurrentUICulture = e.Locale; Thread.CurrentThread.CurrentCulture = e.Locale; Thread.CurrentThread.CurrentUICulture = e.Locale; Resources.Culture = e.Locale; WebUIResources.Culture = e.Locale; }); }; _container.Register <ILocaleManager>((c, p) => _localeManager); }
private void InitializeUI() { _overlay = _manager.CreateUIElement(OverlayUIId, () => new CefOverlayForm()); _overlay.Show(); //initializes all properties _overlay.Visible = false; _configManager.AddPropertyChangeListener("behaviour.frame.chat", true, true, OnEvent_ConfigManager_PositionChange); _moveCallback = new DelayedCallback(TimeSpan.FromSeconds(1), () => { var location = _overlay.Location; if (IsFrameOnScreens(_overlay.DesktopBounds)) { _configManager.SetProperty("behaviour.frame.chat.position.x", location.X); _configManager.SetProperty("behaviour.frame.chat.position.y", location.Y); _configManager.DispatchChangeEvents(); } else // restore last location and size from config { UpdateFormPosition(); } }); _resizeCallback = new DelayedCallback(TimeSpan.FromSeconds(1), () => { var size = _overlay.Size; if (IsFrameOnScreens(_overlay.DesktopBounds)) { _configManager.SetProperty("behaviour.frame.chat.size.width", size.Width); _configManager.SetProperty("behaviour.frame.chat.size.height", size.Height); _configManager.DispatchChangeEvents(); } else // restore last location and size from config { UpdateFormPosition(); } }); _overlay.Move += (s, e) => _moveCallback.Call(); _overlay.SizeChanged += (s, e) => _resizeCallback.Call(); _overlay.Browser.OnBrowserLoadPageDone += (s, e) => { if (!_overlay.Visible) { _manager.UISynchronizer.RunSync(() => _overlay.Visible = true); } }; if (_manager.TryGetUIElement <INotifyIconManager>(AppModuleNotifyIcon.NotifyIconManagerId, out var trayIcon)) { //trayIcon.Icon = Gobchat.Resource.GobTrayIconOff; trayIcon.OnIconClick += (s, e) => _overlay.Visible = !_overlay.Visible; var menuItemHideShow = new ToolStripMenuItem(); menuItemHideShow.Text = _overlay.Visible ? Resources.Module_NotifyIcon_UI_Hide : Resources.Module_NotifyIcon_UI_Show; menuItemHideShow.Click += (s, e) => _overlay.Visible = !_overlay.Visible; _overlay.VisibleChanged += (s, e) => menuItemHideShow.Text = _overlay.Visible ? Resources.Module_NotifyIcon_UI_Hide : Resources.Module_NotifyIcon_UI_Show; trayIcon.AddMenu("overlay.showhide", menuItemHideShow); var menuItemReload = new ToolStripMenuItem(Resources.Module_NotifyIcon_UI_Reload); menuItemReload.Click += (s, e) => _overlay.Reload(); trayIcon.AddMenu("overlay.reload", menuItemReload); var menuItemFrameReset = new ToolStripMenuItem(Resources.Module_NotifyIcon_UI_Reset); menuItemFrameReset.Click += (s, e) => ResetFrameToDefaultLocation(); trayIcon.AddMenu("overlay.reset", menuItemFrameReset); #if DEBUG var menuItemDevTool = new ToolStripMenuItem("DevTool"); menuItemDevTool.Click += (s, e) => _overlay.Browser.ShowDevTools(); trayIcon.AddMenuToGroup("debug", "overlay.devtool", menuItemDevTool); #endif } _overlay.Visible = false; }
public void Initialize(ApplicationStartupHandler handler, IDIContext container) { _container = container ?? throw new ArgumentNullException(nameof(container)); _configManager = _container.Resolve <IConfigManager>(); _memoryManager = _container.Resolve <IMemoryReaderManager>(); var actorManager = _container.Resolve <IActorManager>(); var resourceBundle = _container.Resolve <ILocaleManager>().GetResourceBundle("autotranslate"); var autotranslateProvider = new AutotranslateProvider(resourceBundle); _chatManager = new ChatManager(autotranslateProvider, actorManager); _configManager.AddPropertyChangeListener("behaviour.chat.updateInterval", true, true, ConfigManager_UpdateChatInterval); _configManager.AddPropertyChangeListener("behaviour.channel", true, true, ConfigManager_UpdateChannelProperties); _configManager.AddPropertyChangeListener("behaviour.segment", true, true, ConfigManager_UpdateFormaterProperties); _configManager.AddPropertyChangeListener("behaviour.groups", true, true, ConfigManager_UpdateTriggerGroupProperties); _configManager.AddPropertyChangeListener("behaviour.mentions", true, true, ConfigManager_UpdateMentions); _configManager.AddPropertyChangeListener("behaviour.chat.autodetectEmoteInSay", true, true, ConfigManager_UpdateAutodetectProperties); _configManager.AddPropertyChangeListener("behaviour.language", true, true, ConfigManager_UpdateLanguage); _configManager.AddPropertyChangeListener("behaviour.rangefilter", true, true, ConfigManager_UpdateRangeFilter); _configManager.AddPropertyChangeListener("behaviour.mentions.userCanTriggerMention", true, true, ConfigManager_UpdateUserMentionProperties); _configManager.AddPropertyChangeListener("behaviour.chattabs.data", true, true, ConfigManager_UpdateVisibleChannel); _configManager.AddPropertyChangeListener("behaviour.chattabs.data", true, true, ConfigManager_UpdateUpdateRangeFilterActive); _container.Register <IChatManager>((c, p) => _chatManager); _updater = new IndependendBackgroundWorker(); _updater.Start(UpdateJob); }