/// <summary> /// The send feedback. /// </summary> private void SendFeedback() { const string To = "*****@*****.**"; const string Subject = "My Feedback"; var body = string.Format( "Application {0}\n Version: {1}", _applicationManifest.App.Title, _applicationManifest.App.Version); _emailComposeService.Show(To, Subject, body); }
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"); }); }
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); }
private void OnShareByEmailCommand() { _emailComposeService.Show("Quadratic Solver", GetMessageForSharing()); }
private void OnShareByEmailCommand() { _emailComposeService.Show("The Bro Code", Title + "\n\n" + Description); }