public MainWindow(BotController botController, InMemorySink sink)
        {
            InitializeComponent();
            _botController = botController;
            _sink          = sink;
            DataContext    = this;



            ConsoleStrings = new ObservableCollection <string>();
            BindingOperations.EnableCollectionSynchronization(ConsoleStrings, consoleStringsLock);

            Task.Run(async() =>
            {
                while (true)
                {
                    await Task.Delay(100);


                    while (sink.Events.TryDequeue(out var logEvent))
                    {
                        ConsoleStrings.Add(DateTime.Now.ToLongTimeString() + ": " + logEvent);
                    }
                }
            });
        }
Exemple #2
0
        private static void ConfigureServices(IServiceCollection services)
        {
            var sink = new InMemorySink();


            Log.Logger = new LoggerConfiguration()
                         .MinimumLevel.Debug()
                         .WriteTo.File("log-.txt", rollingInterval: RollingInterval.Day)
                         .WriteTo.Sink(sink, LogEventLevel.Information)
                         .CreateLogger();


            // Configuration Builder

            services.AddSingleton(Log.Logger);
            services.AddSingleton(sink);


            // UI
            services.AddSingleton <MainWindow>();


            // Input Related
            services.AddSingleton <IMouseSimulator, MouseSimulator>();
            services.AddSingleton <IKeyboardSimulator, KeyboardSimulator>();

            // WoW Related
            services.AddSingleton <InMemoryActionBars>();
            services.AddSingleton <InMemoryKeyBinds>();

            services.AddSingleton <BotController>();
            services.AddSingleton <WowWindow>();


            services.AddSingleton <KeyBindSender>();


            services.AddSingleton <BitmapProvider>();


            services.AddReaders();
            services.AddPlayer();
        }