public MainViewModel(IMainModel mainModel, INavigationService navigationService, IEmailComposeService emailComposeService, ISmsComposeService smsComposeService, IShareStatusService shareStatusService)
        {
            _mainModel           = mainModel;
            _navigationService   = navigationService;
            _emailComposeService = emailComposeService;
            _smsComposeService   = smsComposeService;
            _shareStatusService  = shareStatusService;

            PreviousQuoteCommand = new RelayCommand(OnPreviousQuoteCommand,
                                                    () => _mainModel.SelectedIndex > 0);

            NextQuoteCommand = new RelayCommand(OnNextQuoteCommand,
                                                () => _mainModel.SelectedIndex < _mainModel.Quotes.Length - 1);

            RandomQuoteCommand = new RelayCommand(OnRandomQuoteCommand);

            TodaysQuoteCommand = new RelayCommand(OnTodaysQuoteCommand);

            ShowAboutCommand = new RelayCommand(OnShowAboutCommand);

            ShareByEmailCommand = new RelayCommand(OnShareByEmailCommand);

            ShareBySmsCommand = new RelayCommand(OnShareBySmsCommand);

            ShareOnSocialNetworkCommand = new RelayCommand(OnShareOnSocialNetworkCommand);
        }
Exemple #2
0
 public SharingController(IFolderService folderService,
                          IFileService fileService, ISharingService sharingService,
                          IShareStatusService shareStatusService, IAuthorizationService authorizationService)
 {
     _folderService        = folderService;
     _fileService          = fileService;
     _sharingService       = sharingService;
     _shareStatusService   = shareStatusService;
     _authorizationService = authorizationService;
 }
        public ResultsViewModel(IMainModel mainModel, INavigationService navigationService, IEmailComposeService emailComposeService, ISmsComposeService smsComposeService, IShareStatusService shareStatusService)
        {
            _mainModel           = mainModel;
            _navigationService   = navigationService;
            _emailComposeService = emailComposeService;
            _smsComposeService   = smsComposeService;
            _shareStatusService  = shareStatusService;

            SendEmailCommand = new RelayCommand(() =>
            {
                var selectedResult = Results[SelectedResultIndex];
                var subject        = selectedResult.ToString();
                var body           = selectedResult.Result.ToString();

                _emailComposeService.Show(subject, body);
            }, () => SelectedResultIndex != -1);

            SendMessageCommand = new RelayCommand(() =>
            {
                var selectedResult = Results[SelectedResultIndex];
                var subject        = selectedResult.ToString();
                var body           = selectedResult.Result.ToString();

                _smsComposeService.Show(string.Empty, subject + " - " + body);
            }, () => SelectedResultIndex != -1);

            ShareCommand = new RelayCommand(() =>
            {
                var selectedResult = Results[SelectedResultIndex];
                var subject        = selectedResult.ToString();
                var body           = selectedResult.Result.ToString();

                _shareStatusService.Show(subject + " - " + body);
            }, () => SelectedResultIndex != -1);

            RefreshCommand = new RelayCommand(() =>
            {
                _navigationService.NavigateTo(new Uri("/View/RefreshPage.xaml", UriKind.Relative));
            });

            ShowAboutCommand = new RelayCommand(() =>
            {
                _navigationService.NavigateTo(new Uri("/View/AboutPage.xaml", UriKind.Relative));
            });

            ApplicationBarStateChangedCommand = new RelayCommand <ApplicationBarStateChangedEventArgs>(e =>
            {
                ApplicationBarMenuVisible = e.IsMenuVisible;
            });

            PageLoadedCommand = new RelayCommand(() =>
            {
                _navigationService.RemoveBackEntry();
            });
        }
        public SolutionViewModel(IMainModel mainModel, INavigationService navigationService, IEmailComposeService emailComposeService, ISmsComposeService smsComposeService, IShareStatusService shareStatusService)
        {
            _mainModel           = mainModel;
            _navigationService   = navigationService;
            _emailComposeService = emailComposeService;
            _smsComposeService   = smsComposeService;
            _shareStatusService  = shareStatusService;

            IncrementDecimalsCommand = new RelayCommand(() => Decimals++);
            DecrementDecimalsCommand = new RelayCommand(() => Decimals--);

            ShareByEmailCommand = new RelayCommand(OnShareByEmailCommand);

            ShareBySmsCommand = new RelayCommand(OnShareBySmsCommand);

            ShareOnSocialNetworkCommand = new RelayCommand(OnShareOnSocialNetworkCommand);

            ShowAboutCommand = new RelayCommand(OnShowAboutCommand);

            Decimals = 3;
        }