Exemplo n.º 1
0
        public Presenter(IView view, IFileDetailProvider fileDetailProvider, IDisplayErrorMessages errorMessage)
        {
            var attendeeSource = new AttendeeSource(errorMessage);
            var swagSource = new SwagSource(errorMessage);
            var winnersSource = new WinnersSource(fileDetailProvider);

            _model = new Model(attendeeSource, swagSource, winnersSource, fileDetailProvider.FileLocation);
            _model.WinnerAvailable += _model_WinnerAvailable;

            _view = view;
            view.AttendeeLeft += view_AttendeeLeft;
            view.AttendeeRefused += view_AttendeeRefused;
            view.NewWinnerRequested += view_NewWinnerRequested;
            view.WinnersReportRequired += view_WinnersReportRequired;
        }
Exemplo n.º 2
0
        public SwagOMeterView()
        {
            var errorMessage = new DisplayErrorMessages();

            var attendeeSource = new AttendeeSource(errorMessage);
            var swagSource = new SwagSource(errorMessage);

            _viewModel = new SwagOMeterViewModel(attendeeSource, swagSource, new WinnersSource(), new SwagOMeterAwardEngine(attendeeSource, swagSource));

            _viewModel.Close += (s, e) => Close();
            _viewModel.PlayMusic += (s, e) => mediaElement.Play();
            _viewModel.StopMusic += (s, e) => mediaElement.Pause();

            DataContext = _viewModel;

            InitializeComponent();
        }
Exemplo n.º 3
0
        public SwagOMeterView()
        {
            var fileDetailProvider = FileDetailProvider.Create(Settings.Default.FileLocation, (string)Resources["SwagWinnersFile"]);

            var errorMessage = new DisplayErrorMessages();

            var attendeeSource = new AttendeeSource(errorMessage);
            var swagSource = new SwagSource(errorMessage);

            var viewModel = new SwagOMeterViewModel(attendeeSource, swagSource, new WinnersSource(fileDetailProvider), new SwagOMeterAwardEngine(Settings.Default.FileLocation, attendeeSource, swagSource, Constants.AttendeesFilename, Constants.SwagFilename), Settings.Default.SaveWinnersOnExit);

            viewModel.Close += (s, e) => Close();
            viewModel.PlayMusic += (s, e) => mediaElement.Play();
            viewModel.StopMusic += (s, e) => mediaElement.Pause();

            DataContext = viewModel;

            InitializeComponent();
        }
        public SwagOMeterView()
        {
            var fileDetailProvider = FileDetailProvider.Create(Settings.Default.FileLocation, (string)Resources["SwagWinnersFile"]);

            var errorMessage = new DisplayErrorMessages();

            var attendeeSource = new AttendeeSource(errorMessage);
            var swagSource     = new SwagSource(errorMessage);

            var viewModel = new SwagOMeterViewModel(attendeeSource, swagSource, new WinnersSource(fileDetailProvider), new SwagOMeterAwardEngine(Settings.Default.FileLocation, attendeeSource, swagSource, Constants.AttendeesFilename, Constants.SwagFilename), Settings.Default.SaveWinnersOnExit);

            viewModel.Close     += (s, e) => Close();
            viewModel.PlayMusic += (s, e) => mediaElement.Play();
            viewModel.StopMusic += (s, e) => mediaElement.Pause();

            DataContext = viewModel;

            InitializeComponent();
        }