public BF3StatsViewModel(IUIHostService hostService, IZApi api, IDiscord discord, IApplicationState state)
        {
            _api     = api;
            _state   = state;
            _discord = discord;

            WindowBackgroundContent = hostService.GetHostContainer(UIElementConstants.HostWindowBackground) as Grid;
        }
Example #2
0
        public MainWindowViewModel(
            IZApi api,
            ILog logger,
            ISettingsService settingsService,
            IProcessService processService,
            IResolutionRoot kernel,
            IEventService eventService,
            IMainMenuService menuService,
            IUpdateService updateService,
            IGameService gameService,
            IDiscord discordPresence,

            IPageNavigator navigator,
            IApplicationState state,
            IViewModelSource viewModelSource,
            IDialogService dialogService,
            IDialogSystemBase dialogSystemBase,
            IBusyIndicatorBase busyIndicatorBase,
            IBusyIndicatorService busyIndicatorService)
        {
            _navigator            = navigator;
            _state                = state;
            _dialogSystemBase     = dialogSystemBase;
            _dialogService        = dialogService;
            _busyIndicatorBase    = busyIndicatorBase;
            _busyIndicatorService = busyIndicatorService;
            _eventService         = eventService;

            _menuService = menuService;

            _apiConnection   = api.Connection;
            _log             = logger;
            _settingsService = settingsService;
            _processService  = processService;
            _updateService   = updateService;
            _gameService     = gameService;
            _discordPresence = discordPresence;
            _api             = api;

            NonClientDataContext = viewModelSource.Create <WindowNonClientPartViewModel>();
            BottomBarDataContext = viewModelSource.Create <WindowBottomBarPartViewModel>();

            _apiConnection.ConnectionChanged += _apiConnectionConnectionChangedHandler;

            _zClientProcessTracker = new ZProcessTracker(_ZClientProcessName, TimeSpan.FromSeconds(3), true, processes => processes
                                                         .OrderByDescending(process => process.StartTime)
                                                         .First());
            _zClientProcessTracker.ProcessDetected += _zClientProcessDetectedHandler;
            _zClientProcessTracker.ProcessLost     += _zClientProcessLostHandler;

            api.Configure(new ZConfiguration {
                SynchronizationContext = SynchronizationContext.Current
            });

            _gameService.GameCreationError += _GameCreationErrorHandler;
        }
Example #3
0
        private static void _SetupLoggers(IZApi instance, ILog applicationLoggerInstance)
        {
            // setup API logger
            var logger = instance.Logger;

            logger.SetLogLevelFiltering(ZLogLevel.Error | ZLogLevel.Warning);
            logger.LogMessage += (sender, e) => applicationLoggerInstance.Info($"Zlo4NET: {e.Message}");

            // set other loggers
        }
Example #4
0
        public TestRangeGameWorker(
            ISettingsService settingsService
            , IDiscord discord
            , IZApi zloApi
            , ILog logger)
        {
            _settingsService = settingsService;
            _discord         = discord;
            _zloApi          = zloApi;
            _logger          = logger;

            _pipeLogger = new StringBuilder();
        }
Example #5
0
        public MultiplayerGameWorker(
            ISettingsService settingsService
            , IZApi zloApi
            , ILog logger
            , IDiscord discord)
        {
            _settingsService = settingsService;
            _discord         = discord;
            _zloApi          = zloApi;
            _logger          = logger;

            _pipeLogger = new StringBuilder();
        }
Example #6
0
        public GameService(
            IZApi api,
            App application,
            ISettingsService settingsService)
        {
            _kernel = Resolver.Kernel;

            _gameFactory     = api.GameFactory;
            _settingsService = settingsService;
            _log             = application.Logger;

            _canRunNewGame = true;
        }
Example #7
0
        internal static void Main(string[] args)
        {
            // setup internal state
            _zloApi      = ZApi.Instance;
            _gameFactory = _zloApi.GameFactory;

            var logger = _zloApi.Logger;

            // configure logging
            logger.SetLogLevelFiltering(ZLogLevel.Debug | ZLogLevel.Warning | ZLogLevel.Error | ZLogLevel.Info);
            logger.LogMessage += (sender, messageArgs) => Console.WriteLine(messageArgs.Message);

            var connection = _zloApi.Connection;

            // configure api thread synchronization
            _zloApi.Configure(new ZConfiguration
            {
                SynchronizationContext = new SynchronizationContext()
            });

            Console.WriteLine("Connecting to ZClient...");

            // create connection
            var resetEvent = new ManualResetEvent(false);

            connection.ConnectionChanged += (sender, changedArgs) => resetEvent.Set();
            connection.Connect();

            // wait for connection
            resetEvent.WaitOne();

            if (_zloApi.Connection.IsConnected)
            {
                Console.WriteLine("Connected\n");

                // call async version of Main(...)
                MainAsync(args).GetAwaiter().GetResult();
            }
            else
            {
                Console.WriteLine("Cannot connect to ZClient\n");
            }

            Console.ReadKey();
        }
 public BF3ServerBrowserViewModel(
     IZApi api,
     IEventService eventService,
     IGameService gameService,
     IDiscord discord,
     App application,
     IPageNavigator navigator,
     ISettingsService settingsService,
     IDialogService dialogService)
     : base(api, gameService, eventService, discord, application, settingsService, navigator, dialogService)
 {
     MapNames = new [] { "All" }
     .Concat(ZResource.GetBF3MapNames())
     .ToArray();
     GameModeNames = new [] { "All" }
     .Concat(ZResource.GetBF3GameModeNames())
     .ToArray();
 }
        public WindowNonClientPartViewModel(
            IMainMenuService mainMenuService,
            IPageNavigator navigator,
            IZApi api,
            IUpdateService updateService)
        {
            UserPresenterViewModel = Resolver.Kernel.Get <UserPresenterViewModel>();
            UserPresenterViewModel.SetUserData(null);

            _navigator = navigator;

            _navigator.NavigationInitiated += _navigationInitiatedHandler;
            var application = Application.Current as App;

            _wnd = application.MainWindow;
            _launcherProcessService = application.ProcessService;
            _mainMenuService        = mainMenuService;
            _api           = api;
            _updateService = updateService;
        }
Example #10
0
        public HomeViewModel(
            IEventService eventService,
            IGameService gameService,
            ISettingsService settingsService,
            IZApi api,
            IBusyIndicatorService busyIndicatorService,
            IDiscord discord,
            IPageNavigator navigator,
            IApplicationState state,
            IDialogService dialogService)
        {
            _navigator = navigator;
            _state     = state;
            _discord   = discord;

            _eventService         = eventService;
            _gameService          = gameService;
            _settingsService      = settingsService;
            _api                  = api;
            _busyIndicatorService = busyIndicatorService;
            _dialogService        = dialogService;
        }