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); }
public AboutViewModel(INavigationService navigationService, ILauncherService launcherService, IEmailComposeService emailCompose, ReviewService reviewService) { _navigationService = navigationService; _launcherService = launcherService; _emailCompose = emailCompose; _reviewService = reviewService; _version = Package.Current.Id.Version; }
/// <summary> /// Creates an AboutViewModel Object /// </summary> /// <param name="appInformation">Instance of a <see cref="IAppInformation" /> implementation.</param> /// <param name="emailComposeService">Instance of a <see cref="IEmailComposeService" /> implementation.</param> /// <param name="launcherService">Instance of a <see cref="ILauncherService" /> implementation.</param> /// <param name="storeService">Instance of a <see cref="IStoreService" /> implementation.</param> public AboutViewModel(IAppInformation appInformation, IEmailComposeService emailComposeService, ILauncherService launcherService, IStoreService storeService) { this.appInformation = appInformation; this.emailComposeService = emailComposeService; this.launcherService = launcherService; this.storeService = storeService; }
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 MainViewModel(IMainModel mainModel, ISettingsModel settingsModel, IHereMapsService hereMapsService, IKnownCitiesService knownCitiesService, INavigationService navigationService, ILocationService locationService, IMessageBoxService messageBoxService, ISystemTrayService systemTrayService, ISmsComposeService smsComposeService, IShareLinkService shareLinkService, IEmailComposeService emailComposeService) { _mainModel = mainModel; _settingsModel = settingsModel; _hereMapsService = hereMapsService; _knownCitiesService = knownCitiesService; _navigationService = navigationService; _locationService = locationService; _messageBoxService = messageBoxService; _systemTrayService = systemTrayService; _smsComposeService = smsComposeService; _shareLinkService = shareLinkService; _emailComposeService = emailComposeService; UseCurrentLocationCommand = new RelayCommand(UseCurrentLocation); UseAntipodeLocationCommand = new RelayCommand(UseAntipodeLocation); ShareByEmailCommand = new RelayCommand(() => { _emailComposeService.Show("The Other Side", CurrentPosition.ToString()); }); ShareBySmsCommand = new RelayCommand(() => { _smsComposeService.Show(string.Empty, "The Other Side: " + CurrentPosition.ToString()); }); ShareOnSocialNetworkCommand = new RelayCommand(() => { var coordinate = CurrentPosition; var hereMapsUrl = "http://here.com/{0},14".FormatWithInvariantCulture(coordinate); _shareLinkService.Show("The Other Side", CurrentPosition.ToString(), hereMapsUrl); }); PinToStartCommand = new RelayCommand(PinToStart); FindNearestLandMassCommand = new RelayCommand(FindNearestLandMass); FindNearestCityCommand = new RelayCommand(FindNearestCity); ShowLocationInfoCommand = new RelayCommand(ShowLocationInfo); ShowSettingsCommand = new RelayCommand(() => { _navigationService.NavigateTo("/View/SettingsPage.xaml"); }); ShowAboutCommand = new RelayCommand(() => { _navigationService.NavigateTo("/View/AboutPage.xaml"); }); }
/// <summary> /// Initializes a new instance of the <see cref="MainViewModel"/> class. /// </summary> /// <param name="emailComposeService"> /// The email Compose Service. /// </param> /// <param name="marketplaceReviewService"> /// The marketplace review service /// </param> /// <param name="shareLinkService"> /// The share Link Service. /// </param> public MainViewModel( IEmailComposeService emailComposeService, IMarketplaceReviewService marketplaceReviewService, IShareLinkService shareLinkService) { _emailComposeService = emailComposeService; _marketplaceReviewService = marketplaceReviewService; _shareLinkService = shareLinkService; RateCommand = new RelayCommand(this.Rate); SendFeedbackCommand = new RelayCommand(this.SendFeedback); ShareToMailCommand = new RelayCommand(this.ShareToMail); ShareSocialNetworkCommand = new RelayCommand(this.ShareSocialNetwork); _appUrl = string.Concat("http://windowsphone.com/s?appid=8df00038-1b7a-406b-b33f-37a78b17348c"); }
/// <summary> /// Initializes a new instance of the <see cref="AboutViewModel"/> class. /// </summary> /// <param name="emailComposeService"> /// The email Compose Service. /// </param> /// <param name="applicationManifestService"> /// The application Manifest Service. /// </param> /// <param name="marketplaceReviewService"> /// The marketplace review service /// </param> /// <param name="shareLinkService"> /// The share Link Service. /// </param> public AboutViewModel( IEmailComposeService emailComposeService, IApplicationManifestService applicationManifestService, IMarketplaceReviewService marketplaceReviewService, IShareLinkService shareLinkService) { _emailComposeService = emailComposeService; _marketplaceReviewService = marketplaceReviewService; _shareLinkService = shareLinkService; RateCommand = new RelayCommand(this.Rate); SendFeedbackCommand = new RelayCommand(this.SendFeedback); ShareToMailCommand = new RelayCommand(this.ShareToMail); ShareSocialNetworkCommand = new RelayCommand(this.ShareSocialNetwork); _applicationManifest = applicationManifestService.GetApplicationManifest(); _appUrl = string.Concat("http://windowsphone.com/s?appid=", _applicationManifest.App.ProductId); }
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; }
public MainViewModel(IMainModel model, ICttObjectTrackingService cttObjectTrackingService, INavigationService navigationService, ISystemTrayService systemTrayService, IMessageBoxService messageBoxService, IClipboardService clipboardService, IEmailComposeService emailComposeService, ISmsComposeService smsComposeService) { _model = model; _cttObjectTrackingService = cttObjectTrackingService; _navigationService = navigationService; _systemTrayService = systemTrayService; _messageBoxService = messageBoxService; _clipboardService = clipboardService; _emailComposeService = emailComposeService; _smsComposeService = smsComposeService; TrackedObjects = _model.TrackedObjects .Select(x => new ObjectDetailsViewModel(x)) .ToObservableCollection(); ShowObjectDetailsCommand = new RelayCommand <ObjectDetailsViewModel>(item => { var objectId = item.Model.ObjectId; _navigationService.NavigateTo(new Uri("/View/ObjectDetailsPage.xaml?" + objectId, UriKind.Relative)); }); NewObjectCommand = new RelayCommand(() => { _navigationService.NavigateTo(new Uri("/View/NewObjectPage.xaml", UriKind.Relative)); }, () => !IsBusy); EnableSelectionCommand = new RelayCommand(() => { IsSelectionEnabled = true; }, () => !IsTrackedObjectsEmpty && !IsBusy); RefreshCommand = new RelayCommand(() => { var enumerator = TrackedObjects.GetEnumerator(); RefreshNext(enumerator); }, () => !IsTrackedObjectsEmpty && !IsBusy); DeleteObjectsCommand = new RelayCommand <IList>(items => { if (items == null || items.Count == 0) { return; } _messageBoxService.Show("Está prestes a apagar os objectos seleccionados", "Tem a certeza?", new string[] { "eliminar", "cancelar" }, button => { if (button != 0) { return; } var itemsToRemove = items .Cast <ObjectDetailsViewModel>() .ToArray(); foreach (var item in itemsToRemove) { _model.TrackedObjects.Remove(item.Model); TrackedObjects.Remove(item); } IsTrackedObjectsEmpty = (TrackedObjects.Count == 0); _model.Save(); }); }, items => !IsBusy); ShowAboutCommand = new RelayCommand(() => { _navigationService.NavigateTo(new Uri("/View/AboutPage.xaml", UriKind.Relative)); }); BackKeyPressCommand = new RelayCommand <CancelEventArgs>(e => { if (IsSelectionEnabled) { IsSelectionEnabled = false; e.Cancel = true; } }); CopyCodeCommand = new RelayCommand <ObjectDetailsViewModel>(item => { _clipboardService.SetText(item.Model.ObjectId); }); MailCodeCommand = new RelayCommand <ObjectDetailsViewModel>(item => { _emailComposeService.Show("CTT Objectos", string.Format("\nO seu código de tracking: {0}\n\nPode consultar o estado entrando em http://www.ctt.pt e utilizando a opção \"Pesquisa de Objectos\".\n\nEnviado por CTT Objectos (http://bit.ly/cttobjectos)", item.Model.ObjectId)); }); TextCodeCommand = new RelayCommand <ObjectDetailsViewModel>(item => { _smsComposeService.Show(string.Empty, item.Model.ObjectId); }); MessengerInstance.Register <AddObjectMessage>(this, message => { var objectViewModel = TrackedObjects.FirstOrDefault(x => x.Model.ObjectId == message.Model.ObjectId); if (objectViewModel == null) { var objectModel = new ObjectModel(message.Description, message.ETag, message.Model); _model.TrackedObjects.Add(objectModel); TrackedObjects.Add(new ObjectDetailsViewModel(objectModel)); IsTrackedObjectsEmpty = false; } else { objectViewModel.Model.Description = message.Description; objectViewModel.Model.State = message.Model; } _model.Save(); }); IsTrackedObjectsEmpty = (TrackedObjects.Count == 0); }