public WaitGameStartFlowViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            _messageBoxDialogService = messageBoxDialogService;

            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Challenge")
                {
                    ChallengeString = CommonDataManager.Challenge;
                }

                if (args.PropertyName == "PlayerId")
                {
                    PlayerId = CommonDataManager.PlayerId;
                }
            };

            ChallengeString = CommonDataManager.Challenge;
            PlayerId        = CommonDataManager.PlayerId;

            _isExecuting = false;
        }
Esempio n. 2
0
        public PageComposer(INavigationService navigator)
        {
            if (navigator == null)
            {
                throw new ArgumentNullException(nameof(navigator));
            }

            // initialisation des dépendances avec un cycle de vie de singleton
            this.navigator = navigator;

            fileService = new WindowsFileService();

            articlePictureSettings = CreateArticlePictureSettings();

            articlePictureNameFormatter = new ArticlePictureNameFormatter(
                articlePictureSettings);

            pictureLocator = new ArticlePictureLocator(
                fileService,
                articlePictureNameFormatter,
                articlePictureSettings);

            passwordHashGenerator = new PasswordHashGenerator();
            passwordHashComparer  = new PasswordHashComparer();

            messageBoxDialogService = new MessageBoxDialogService();

            CreatePictureFolderIfDoesNotExist();
            CreateDatabaseIfDoesNotExist();
        }
Esempio n. 3
0
        public void Constructor_NullDialogServicePassed_Throws()
        {
            IMessageBoxDialogService nullDialogService = null;

            Assert.Catch <ArgumentNullException>(() =>
                                                 new PasswordUpdatedUserNotifier(nullDialogService));
        }
 public InitLoginViewModel(
     ICommonDataManager commonDataManager,
     IServiceCallInvoker serviceCallInvoker,
     IMessageBoxDialogService messageBoxDialogService) : base(commonDataManager, serviceCallInvoker)
 {
     _messageBoxDialogService = messageBoxDialogService;
 }
 public CreatePlayerViewModel(
     ICommonDataManager commonDataManager,
     IServiceCallInvoker serviceCallInvoker,
     IMessageBoxDialogService messageBoxDialogService)
     : base(commonDataManager, serviceCallInvoker)
 {
     _messageBoxDialogService = messageBoxDialogService;
 }
Esempio n. 6
0
        public PasswordUpdatedUserNotifier(IMessageBoxDialogService dialogService)
        {
            if (dialogService == null)
            {
                throw new ArgumentNullException(nameof(dialogService));
            }

            this.dialogService = dialogService;
        }
Esempio n. 7
0
        public void Constructor_NullDialogServicePassed_Throws()
        {
            var stubSearchEngine = Substitute.For <IArticleSearchEngine>();
            IMessageBoxDialogService nullDialogService = null;

            Assert.Catch <ArgumentNullException>(() =>
                                                 new SearchEngineNoResultFoundNotifier(
                                                     stubSearchEngine,
                                                     nullDialogService));
        }
 public CreatePlayerFlowViewModel(
     ICommonDataManager commonDataManager,
     IServiceCallInvoker serviceCallInvoker,
     IMessageBoxDialogService messageBoxDialogService,
     ISessionIdGenerator sessionIdGenerator)
     : base(commonDataManager, serviceCallInvoker)
 {
     _messageBoxDialogService = messageBoxDialogService;
     _sessionIdGenerator      = sessionIdGenerator;
 }
Esempio n. 9
0
 public LoginViewModel(
     IRegionManager regionManager,
     ISettingsManager settingsManager,
     IAdministrationServiceGateway administrationServiceGateway,
     IMessageBoxDialogService messageBoxDialogService)
 {
     _regionManager   = regionManager;
     _settingsManager = settingsManager;
     _administrationServiceGateway = administrationServiceGateway;
     _messageBoxDialogService      = messageBoxDialogService;
 }
Esempio n. 10
0
 public LobbyViewModel(
     IAdministrationServiceGateway administrationService,
     IRegionManager regionManager,
     IConfirmationDialogService confirmationDialogService,
     IMessageBoxDialogService messageBoxDialogService)
 {
     _administrationService     = administrationService;
     _regionManager             = regionManager;
     _confirmationDialogService = confirmationDialogService;
     _messageBoxDialogService   = messageBoxDialogService;
 }
 public OpenGameViewModel(
     IRegionManager regionManager,
     IAdministrationServiceGateway administrationService,
     IFileDialogService dialogService,
     IMapService mapService,
     IMessageBoxDialogService messageBoxDialogService)
 {
     _regionManager           = regionManager;
     _administrationService   = administrationService;
     _dialogService           = dialogService;
     _mapService              = mapService;
     _messageBoxDialogService = messageBoxDialogService;
 }
Esempio n. 12
0
        public SearchEngineNoResultFoundNotifier(
            IArticleSearchEngine decoratedSearchEngine,
            IMessageBoxDialogService dialogService)
        {
            if (decoratedSearchEngine == null)
            {
                throw new ArgumentNullException(nameof(decoratedSearchEngine));
            }
            if (dialogService == null)
            {
                throw new ArgumentNullException(nameof(dialogService));
            }

            this.decoratedSearchEngine = decoratedSearchEngine;
            this.dialogService         = dialogService;
        }
        public ErrorHandlerUpdaterDecorator(
            ICommandService <UpdateArticles> decoratedUpdater,
            IMessageBoxDialogService messageBoxService)
        {
            if (decoratedUpdater == null)
            {
                throw new ArgumentNullException(nameof(decoratedUpdater));
            }

            if (messageBoxService == null)
            {
                throw new ArgumentNullException(nameof(messageBoxService));
            }

            this.decoratedUpdater  = decoratedUpdater;
            this.messageBoxService = messageBoxService;
        }
        public LeaveGameViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            _messageBoxDialogService           = messageBoxDialogService;
            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "PlayerId")
                {
                    PlayerId = CommonDataManager.PlayerId;
                }
            };

            PlayerId = CommonDataManager.PlayerId;
        }
Esempio n. 15
0
        public CompleteLoginViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            _messageBoxDialogService = messageBoxDialogService;

            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Challenge")
                {
                    ChallengeString = CommonDataManager.Challenge;
                }
            };

            ChallengeString = CommonDataManager.Challenge;
        }
Esempio n. 16
0
        public GetTurnResultViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMapService mapService,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "PlayerId")
                {
                    PlayerId = CommonDataManager.PlayerId;
                }
            };

            _mapService = mapService;
            _messageBoxDialogService = messageBoxDialogService;
            PlayerId = CommonDataManager.PlayerId;
        }
Esempio n. 17
0
        public CreatePlayerFlowViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            _messageBoxDialogService = messageBoxDialogService;

            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Challenge")
                {
                    ChallengeString = CommonDataManager.Challenge;
                }
            };

            ChallengeString = CommonDataManager.Challenge;
            SessionId       = CommonDataManager.SessionId;
        }
Esempio n. 18
0
        public WaitNextTurnViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            _messageBoxDialogService = messageBoxDialogService;
            PlayerId = CommonDataManager.PlayerId;
            Turn     = CommonDataManager.Turn;

            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Turn")
                {
                    Turn = CommonDataManager.Turn;
                }
                if (args.PropertyName == "PlayerId")
                {
                    PlayerId = CommonDataManager.PlayerId;
                }
            };
        }
        public MaintenanceConnexionViewModel(
            IMessageBoxDialogService messageBoxService,
            IAuthenticator authenticator,
            INavigationService navigator)
        {
            if (messageBoxService == null)
            {
                throw new ArgumentNullException(nameof(messageBoxService));
            }
            if (authenticator == null)
            {
                throw new ArgumentNullException(nameof(authenticator));
            }
            if (navigator == null)
            {
                throw new ArgumentNullException(nameof(navigator));
            }

            this.messageBoxService = messageBoxService;
            this.authenticator     = authenticator;
            this.navigator         = navigator;

            LoginCommand = new RelayParameterizedCommand((param) => Login(param));
        }
Esempio n. 20
0
        public NouveauMotDePasseViewModel(
            IMessageBoxDialogService messageBoxService,
            IAuthenticator authenticator,
            IPasswordUpdater passwordUpdater)
        {
            if (messageBoxService == null)
            {
                throw new ArgumentNullException(nameof(messageBoxService));
            }
            if (authenticator == null)
            {
                throw new ArgumentNullException(nameof(authenticator));
            }
            if (passwordUpdater == null)
            {
                throw new ArgumentNullException(nameof(passwordUpdater));
            }

            this.messageBoxService = messageBoxService;
            this.authenticator     = authenticator;
            this.passwordUpdater   = passwordUpdater;

            NewPasswordCommand = new RelayParameterizedCommand((param) => NewPassword(param as object[]));
        }
        public PerformMoveViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMapService mapService,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "PlayerId")
                {
                    PlayerId = CommonDataManager.PlayerId;
                }
            };

            _mapService = mapService;
            _messageBoxDialogService = messageBoxDialogService;
            PlayerId = CommonDataManager.PlayerId;

            _mapService.MapChanged += (sender, args) =>
            {
                var cellViewModels = new List <CellViewModel>();

                for (int row = 0; row < _mapService.Height; row++)
                {
                    for (int col = 0; col < _mapService.Width; col++)
                    {
                        cellViewModels.Add(new CellViewModel
                        {
                            X     = col,
                            Y     = row,
                            State = _mapService.Map[row, col]
                        });
                    }
                }

                CellCollection = new ObservableCollection <CellViewModel>(cellViewModels);
                MoveCollection = new ObservableCollection <PlayerMoveModel>(_mapService.Actors.Select(a => new PlayerMoveModel
                {
                    Index    = a.Index,
                    Name     = a.Name,
                    Move     = a.Position,
                    IsTecman = a.IsTecman
                }));
            };

            _mapService.CellChanged += (sender, args) =>
            {
                var index = args.Y * _mapService.Width + args.X;
                CellCollection[index].State = args.State;
            };

            if (_mapService.Map != null)
            {
                var cellViewModels = new List <CellViewModel>();

                for (int row = 0; row < _mapService.Height; row++)
                {
                    for (int col = 0; col < _mapService.Width; col++)
                    {
                        cellViewModels.Add(new CellViewModel
                        {
                            X     = col,
                            Y     = row,
                            State = _mapService.Map[row, col]
                        });
                    }
                }

                CellCollection = new ObservableCollection <CellViewModel>(cellViewModels);
                MoveCollection = new ObservableCollection <PlayerMoveModel>(_mapService.Actors.Select(a => new PlayerMoveModel
                {
                    Index    = a.Index,
                    Name     = a.Name,
                    Move     = a.Position,
                    IsTecman = a.IsTecman
                }));
            }
            else
            {
                CellCollection = new ObservableCollection <CellViewModel>();
                MoveCollection = new ObservableCollection <PlayerMoveModel>();
            }

            this.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "SelectedCell")
                {
                    if (SelectedCell != null && SelectedActor != null)
                    {
                        SelectedActor.Move = new Point(SelectedCell.Y, SelectedCell.X);
                        Positions          = string.Concat(MoveCollection.Select(m => $"{m.Move.Row},{m.Move.Col},"));
                    }
                }
            };
        }
        public PlayerModeFlowViewModel(
            ICommonDataManager commonDataManager,
            IServiceCallInvoker serviceCallInvoker,
            IMapService mapService,
            IMessageBoxDialogService messageBoxDialogService)
            : base(commonDataManager, serviceCallInvoker)
        {
            _mapService = mapService;
            _messageBoxDialogService = messageBoxDialogService;

            PlayerId = CommonDataManager.PlayerId;
            Turn     = CommonDataManager.Turn;

            CommonDataManager.PropertyChanged += (sender, args) =>
            {
                if (args.PropertyName == "Turn")
                {
                    Turn = CommonDataManager.Turn;
                }

                if (args.PropertyName == "PlayerId")
                {
                    PlayerId = CommonDataManager.PlayerId;
                }
            };

            _mapService.MapChanged += (sender, args) =>
            {
                var cellViewModels = new List <CellViewModel>();

                for (int i = 0; i < _mapService.Map.Length; i++)
                {
                    for (int j = 0; j < _mapService.Map[i].Length; j++)
                    {
                        cellViewModels.Add(new CellViewModel {
                            X = j, Y = i, State = Convert.ToString(_mapService.Map[i][j]),
                        });
                    }
                }

                CellCollection   = new ObservableCollection <CellViewModel>(cellViewModels);
                PlayerCollection = new ObservableCollection <PlayerViewModel>(_mapService.Players.Select(p => new PlayerViewModel
                {
                    Condition = p.Condition,
                    Index     = p.Index,
                }));
            };

            _mapService.CellChanged += (sender, args) =>
            {
                int index = args.Y * _mapService.Map.First().Length + args.X;

                CellCollection[index].State = args.State;

                PlayerCollection = new ObservableCollection <PlayerViewModel>(_mapService.Players.Select(p => new PlayerViewModel
                {
                    Condition = p.Condition,
                    Index     = p.Index,
                }));
            };

            if (_mapService.Map != null)
            {
                var cellViewModels = new List <CellViewModel>();

                for (int i = 0; i < _mapService.Map.Length; i++)
                {
                    for (int j = 0; j < _mapService.Map[i].Length; j++)
                    {
                        cellViewModels.Add(new CellViewModel {
                            X = j, Y = i, State = Convert.ToString(_mapService.Map[i][j]),
                        });
                    }
                }

                CellCollection   = new ObservableCollection <CellViewModel>(cellViewModels);
                PlayerCollection = new ObservableCollection <PlayerViewModel>(_mapService.Players.Select(p => new PlayerViewModel
                {
                    Condition = p.Condition,
                    Index     = p.Index,
                }));
            }
            else
            {
                CellCollection   = new ObservableCollection <CellViewModel>();
                PlayerCollection = new ObservableCollection <PlayerViewModel>();
            }

            _isExecuting = false;
        }