Пример #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="PlanningPokerController" /> class.
 /// </summary>
 /// <param name="planningPokerService">Planning poker client to send messages to server.</param>
 /// <param name="busyIndicator">Service to show busy indicator, when operation is in progress.</param>
 /// <param name="memberCredentialsStore">Service to save and load member credentials.</param>
 public PlanningPokerController(
     IPlanningPokerClient planningPokerService,
     IBusyIndicatorService busyIndicator,
     IMemberCredentialsStore memberCredentialsStore)
 {
     _planningPokerService   = planningPokerService ?? throw new ArgumentNullException(nameof(planningPokerService));
     _busyIndicator          = busyIndicator ?? throw new ArgumentNullException(nameof(busyIndicator));
     _memberCredentialsStore = memberCredentialsStore ?? throw new ArgumentNullException(nameof(memberCredentialsStore));
 }
Пример #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;
        }
Пример #3
0
 public AuthenticationController(
     IBusyIndicatorService busyIndicatorService,
     IAuthenticationService authenticationService,
     NavigationManager navigationManager
     )
 {
     this.busyIndicatorService  = busyIndicatorService;
     this.authenticationService = authenticationService;
     this.navigationManager     = navigationManager;
 }
 public CountryController(
     ICountryService countryService,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService
     )
 {
     this.countryService       = countryService;
     this.messageBoxService    = messageBoxService;
     this.busyIndicatorService = busyIndicatorService;
 }
Пример #5
0
        public CreditCardController(
            ICreditCardService creditCardService,
            IMessageBoxService messageBoxService,
            IBusyIndicatorService busyIndicatorService

            )
        {
            this.creditCardService    = creditCardService;
            this.messageBoxService    = messageBoxService;
            this.busyIndicatorService = busyIndicatorService;
        }
Пример #6
0
        public AddressController(
            IPersonAddressService personAddressService,
            IMessageBoxService messageBoxService,
            IBusyIndicatorService busyIndicatorService

            )
        {
            this.personAddressService = personAddressService;
            this.messageBoxService    = messageBoxService;
            this.busyIndicatorService = busyIndicatorService;
        }
Пример #7
0
        public static async Task BusyWhileAsync(this IBusyIndicatorService busyIndicatorService, Action <object> heavyOperation, object state, string title = null)
        {
            // show indicator
            busyIndicatorService.Open(title);

            // start operation
            await Task.Run(() => heavyOperation.Invoke(state));

            // hide indicator
            busyIndicatorService.Close();
        }
Пример #8
0
        public EmailAddressController(
            IEmailAddressService emailAddressService,
            IMessageBoxService messageBoxService,
            IBusyIndicatorService busyIndicatorService

            )
        {
            this.emailAddressService  = emailAddressService;
            this.messageBoxService    = messageBoxService;
            this.busyIndicatorService = busyIndicatorService;
        }
Пример #9
0
 public UserController(
     IUserService userService,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService,
     NavigationManager navigationManager
     )
 {
     this.userService          = userService;
     this.messageBoxService    = messageBoxService;
     this.busyIndicatorService = busyIndicatorService;
     this.navigationManager    = navigationManager;
 }
 public PersonController(
     IPersonService personService,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService,
     NavigationManager navigationManager
     )
 {
     this.personService        = personService;
     this.messageBoxService    = messageBoxService;
     this.busyIndicatorService = busyIndicatorService;
     this.navigationManager    = navigationManager;
 }
 public CurrencyController(
     ICurrencyService CurrencyService,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService,
     NavigationManager navigationManager
     )
 {
     currencyService           = CurrencyService;
     this.messageBoxService    = messageBoxService;
     this.busyIndicatorService = busyIndicatorService;
     this.navigationManager    = navigationManager;
 }
Пример #12
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CreateTeamController"/> class.
 /// </summary>
 /// <param name="planningPokerService">Planning poker client to create Scrum Team on server.</param>
 /// <param name="planningPokerInitializer">Objects that initialize new Planning Poker game.</param>
 /// <param name="messageBoxService">Service to display message to user.</param>
 /// <param name="busyIndicatorService">Service to display that operation is in progress.</param>
 /// <param name="uriHelper">Service to navigate to specified URL.</param>
 public CreateTeamController(
     IPlanningPokerClient planningPokerService,
     IPlanningPokerInitializer planningPokerInitializer,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService,
     IUriHelper uriHelper)
 {
     _planningPokerService     = planningPokerService ?? throw new ArgumentNullException(nameof(planningPokerService));
     _planningPokerInitializer = planningPokerInitializer ?? throw new ArgumentNullException(nameof(planningPokerInitializer));
     _messageBoxService        = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));
     _busyIndicatorService     = busyIndicatorService ?? throw new ArgumentNullException(nameof(busyIndicatorService));
     _uriHelper = uriHelper ?? throw new ArgumentNullException(nameof(uriHelper));
 }
Пример #13
0
        private static CreateTeamController CreateController(
            IPlanningPokerInitializer planningPokerInitializer = null,
            IPlanningPokerClient planningPokerService          = null,
            IMessageBoxService messageBoxService       = null,
            IBusyIndicatorService busyIndicatorService = null,
            INavigationManager navigationManager       = null,
            TeamResult teamResult = null,
            string errorMessage   = null)
        {
            if (planningPokerInitializer == null)
            {
                var planningPokerInitializerMock = new Mock <IPlanningPokerInitializer>();
                planningPokerInitializer = planningPokerInitializerMock.Object;
            }

            if (planningPokerService == null)
            {
                var planningPokerServiceMock = new Mock <IPlanningPokerClient>();
                var createSetup = planningPokerServiceMock.Setup(o => o.CreateTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <Deck>(), It.IsAny <CancellationToken>()));
                if (errorMessage == null)
                {
                    createSetup.ReturnsAsync(teamResult);
                }
                else
                {
                    createSetup.ThrowsAsync(new PlanningPokerException(errorMessage));
                }

                planningPokerService = planningPokerServiceMock.Object;
            }

            if (messageBoxService == null)
            {
                var messageBoxServiceMock = new Mock <IMessageBoxService>();
                messageBoxService = messageBoxServiceMock.Object;
            }

            if (busyIndicatorService == null)
            {
                var busyIndicatorServiceMock = new Mock <IBusyIndicatorService>();
                busyIndicatorService = busyIndicatorServiceMock.Object;
            }

            if (navigationManager == null)
            {
                var navigationManagerMock = new Mock <INavigationManager>();
                navigationManager = navigationManagerMock.Object;
            }

            return(new CreateTeamController(planningPokerService, planningPokerInitializer, messageBoxService, busyIndicatorService, navigationManager));
        }
Пример #14
0
        private static CreateTeamController CreateController(
            IPlanningPokerInitializer planningPokerInitializer = null,
            IPlanningPokerClient planningPokerService          = null,
            IMessageBoxService messageBoxService       = null,
            IBusyIndicatorService busyIndicatorService = null,
            IUriHelper uriHelper = null,
            ScrumTeam scrumTeam  = null,
            string errorMessage  = null)
        {
            if (planningPokerInitializer == null)
            {
                var planningPokerInitializerMock = new Mock <IPlanningPokerInitializer>();
                planningPokerInitializer = planningPokerInitializerMock.Object;
            }

            if (planningPokerService == null)
            {
                var planningPokerServiceMock = new Mock <IPlanningPokerClient>();
                var createSetup = planningPokerServiceMock.Setup(o => o.CreateTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()));
                if (errorMessage == null)
                {
                    createSetup.ReturnsAsync(scrumTeam);
                }
                else
                {
                    createSetup.ThrowsAsync(new PlanningPokerException(errorMessage));
                }

                planningPokerService = planningPokerServiceMock.Object;
            }

            if (messageBoxService == null)
            {
                var messageBoxServiceMock = new Mock <IMessageBoxService>();
                messageBoxService = messageBoxServiceMock.Object;
            }

            if (busyIndicatorService == null)
            {
                var busyIndicatorServiceMock = new Mock <IBusyIndicatorService>();
                busyIndicatorService = busyIndicatorServiceMock.Object;
            }

            if (uriHelper == null)
            {
                var uriHelperMock = new Mock <IUriHelper>();
                uriHelper = uriHelperMock.Object;
            }

            return(new CreateTeamController(planningPokerService, planningPokerInitializer, messageBoxService, busyIndicatorService, uriHelper));
        }
Пример #15
0
 /// <summary>
 /// Initializes a new instance of the <see cref="JoinTeamController"/> class.
 /// </summary>
 /// <param name="planningPokerService">Planning poker client to create Scrum Team on server.</param>
 /// <param name="planningPokerInitializer">Objects that initialize new Planning Poker game.</param>
 /// <param name="messageBoxService">Service to display message to user.</param>
 /// <param name="busyIndicatorService">Service to display that operation is in progress.</param>
 /// <param name="navigationManager">Service to navigate to specified URL.</param>
 /// <param name="memberCredentialsStore">Service to save and load member credentials.</param>
 public JoinTeamController(
     IPlanningPokerClient planningPokerService,
     IPlanningPokerInitializer planningPokerInitializer,
     IMessageBoxService messageBoxService,
     IBusyIndicatorService busyIndicatorService,
     INavigationManager navigationManager,
     IMemberCredentialsStore memberCredentialsStore)
 {
     _planningPokerService     = planningPokerService ?? throw new ArgumentNullException(nameof(planningPokerService));
     _planningPokerInitializer = planningPokerInitializer ?? throw new ArgumentNullException(nameof(planningPokerInitializer));
     _messageBoxService        = messageBoxService ?? throw new ArgumentNullException(nameof(messageBoxService));
     _busyIndicatorService     = busyIndicatorService ?? throw new ArgumentNullException(nameof(busyIndicatorService));
     _navigationManager        = navigationManager ?? throw new ArgumentNullException(nameof(navigationManager));
     _memberCredentialsStore   = memberCredentialsStore ?? throw new ArgumentNullException(nameof(memberCredentialsStore));
 }
Пример #16
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;
        }
Пример #17
0
        private static JoinTeamController CreateController(
            IPlanningPokerInitializer planningPokerInitializer = null,
            IPlanningPokerClient planningPokerService          = null,
            IMessageBoxService messageBoxService       = null,
            IBusyIndicatorService busyIndicatorService = null,
            IUriHelper uriHelper = null,
            IMemberCredentialsStore memberCredentialsStore = null,
            bool memberExistsError = false,
            ScrumTeam scrumTeam    = null,
            ReconnectTeamResult reconnectTeamResult = null,
            string errorMessage = null,
            MemberCredentials memberCredentials = null)
        {
            if (planningPokerInitializer == null)
            {
                var planningPokerInitializerMock = new Mock <IPlanningPokerInitializer>();
                planningPokerInitializer = planningPokerInitializerMock.Object;
            }

            if (planningPokerService == null)
            {
                var planningPokerServiceMock = new Mock <IPlanningPokerClient>();
                var joinSetup      = planningPokerServiceMock.Setup(o => o.JoinTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <bool>(), It.IsAny <CancellationToken>()));
                var reconnectSetup = planningPokerServiceMock.Setup(o => o.ReconnectTeam(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <CancellationToken>()));
                if (memberExistsError)
                {
                    joinSetup.ThrowsAsync(new PlanningPokerException(ReconnectErrorMessage));
                    if (errorMessage == null)
                    {
                        reconnectSetup.ReturnsAsync(reconnectTeamResult);
                    }
                    else
                    {
                        reconnectSetup.ThrowsAsync(new PlanningPokerException(errorMessage));
                    }
                }
                else
                {
                    if (errorMessage == null)
                    {
                        joinSetup.ReturnsAsync(scrumTeam);
                    }
                    else
                    {
                        joinSetup.ThrowsAsync(new PlanningPokerException(errorMessage));
                    }
                }

                planningPokerService = planningPokerServiceMock.Object;
            }

            if (messageBoxService == null)
            {
                var messageBoxServiceMock = new Mock <IMessageBoxService>();
                if (memberExistsError)
                {
                    SetupReconnectMessageBox(messageBoxServiceMock, true);
                }

                messageBoxService = messageBoxServiceMock.Object;
            }

            if (busyIndicatorService == null)
            {
                var busyIndicatorServiceMock = new Mock <IBusyIndicatorService>();
                busyIndicatorService = busyIndicatorServiceMock.Object;
            }

            if (uriHelper == null)
            {
                var uriHelperMock = new Mock <IUriHelper>();
                uriHelper = uriHelperMock.Object;
            }

            if (memberCredentialsStore == null)
            {
                var memberCredentialsStoreMock = new Mock <IMemberCredentialsStore>();
                memberCredentialsStoreMock.Setup(o => o.GetCredentialsAsync()).ReturnsAsync(memberCredentials);
                memberCredentialsStore = memberCredentialsStoreMock.Object;
            }

            return(new JoinTeamController(planningPokerService, planningPokerInitializer, messageBoxService, busyIndicatorService, uriHelper, memberCredentialsStore));
        }