Exemplo n.º 1
0
        public CashGameViewModel(ICashGameService cashGameService,
                                 ISessionRepository sessionRepository,
                                 IOpenFileDialogService openFileDialogService,
                                 ISaveFileDialogService saveFileDialogService,
                                 IWaitDialogService waitDialogService,
                                 IFilterWindowService filterWindowService,
                                 IInfoDialogService infoDialogService)
        {
            _cashGameService       = cashGameService;
            _sessionRepository     = sessionRepository;
            _openFileDialogService = openFileDialogService;
            _saveFileDialogService = saveFileDialogService;
            _waitDialogService     = waitDialogService;
            _filterWindowService   = filterWindowService;
            _infoDialogService     = infoDialogService;

            OpenFileCommand         = new RelayCommand(OpenFile);
            FetchFromServerCommand  = new RelayCommand(FetchFromServer);
            ClearCommand            = new RelayCommand(() => UserSessionId = "");
            SaveSessionsCommand     = new RelayCommand(SaveSessions);
            ClearSessionsCommand    = new RelayCommand(ClearSessions);
            ShowSessionsOnlyCommand = new RelayCommand <bool>(ShowSessionsOnly);

            FilterCommand = new RelayCommand(FilterSessions);

            UserSessionId = "Liitä wcusersessionid tähän";

            Messenger.Default.Register <UserSessionIdChangedMessage>(this,
                                                                     message =>
            {
                if (message.Sender != this && message.NewUserSessionId != _userSessionId)
                {
                    UserSessionId = message.NewUserSessionId;
                }
            });

            LoadStoredSessions();

            if (_sessionRepository.GetAll().Count > 0)
            {
                StartDate       = PlayingSessions.Max(s => s.StartTime);
                FilterViewModel = new FilterViewModel(_sessionRepository.GetAll().Min(s => s.StartTime), _sessionRepository.GetAll().Max(s => s.EndTime));
            }
            else
            {
                StartDate       = new DateTime(2010, 11, 1);
                FilterViewModel = new FilterViewModel();
            }

            EndDate = DateTime.Now;
            Filter  = new CashGameFilter();
        }
Exemplo n.º 2
0
        public TournamentViewModel(ITournamentService tournamentService,
                                   ITournamentRepository tournamentRepository,
                                   IOpenFileDialogService openFileDialogService,
                                   ISaveFileDialogService saveFileDialogService,
                                   IWaitDialogService waitDialogService,
                                   IInfoDialogService infoDialogService)
        {
            _tournamentService     = tournamentService;
            _tournamentRepository  = tournamentRepository;
            _openFileDialogService = openFileDialogService;
            _saveFileDialogService = saveFileDialogService;
            _waitDialogService     = waitDialogService;
            _infoDialogService     = infoDialogService;

            FetchFromServerCommand  = new RelayCommand(FetchFromServer);
            ClearTournamentsCommand = new RelayCommand(ClearTournaments);
            ClearCommand            = new RelayCommand(() => UserSessionId = "");
            SaveTournamentsCommand  = new RelayCommand(SaveTournaments);

            UserSessionId = "Liitä wcusersessionid tähän";

            Messenger.Default.Register <UserSessionIdChangedMessage>(this,
                                                                     message =>
            {
                if (message.Sender != this && message.NewUserSessionId != _userSessionId)
                {
                    UserSessionId = message.NewUserSessionId;
                }
            });

            LoadStoredTournaments();

            if (_tournamentRepository.GetAll().Count > 0)
            {
                StartDate = Tournaments.Max(t => t.StartTime);
            }
            else
            {
                StartDate = new DateTime(2010, 11, 1);
            }

            EndDate = DateTime.Now;
        }