public CommentsViewModel(IDataService dataService, IDialogService dialogService) { this.dataService = dataService; this.dialogService = dialogService; Comments = new ObservableCollection<Comment>(); SendComment = new RelayCommand(SendCommentCommand, () => !String.IsNullOrWhiteSpace(Comment) && IsCommentAreaEnabled && !IsDataLoading); }
public MainViewModel(IDataService dataService, INavigationService navigationService, IDialogService dialogService) { this.dataService = dataService; this.dialogService = dialogService; Posts = new ObservableCollection<Post>(); RefreshCommand = new RelayCommand(async () => await LoadDataAsync()); NavigateToSettingsCommand = new RelayCommand(() => navigationService.NavigateTo(ViewModelLocator.SettingsPageKey)); NavigateToAboutCommand = new RelayCommand(() => navigationService.NavigateTo(ViewModelLocator.AboutPageKey)); NewsSelectedCommand = new RelayCommand<Post>(p => navigationService.NavigateTo(ViewModelLocator.DetailPageKey, p.ID)); }
public DetailPostViewModel(IDataService service) { this.service = service; Share = new RelayCommand(ShareCommand, () => { return true; }); NavigateToComments = new RelayCommand(() => { var frame = ((Frame)Window.Current.Content); frame.Navigate(typeof(CommentsPage), Post.ID); }); OpenBrowser = new RelayCommand(async () => { await Launcher.LaunchUriAsync(new Uri(Post.short_URL)); }); // Register the current page as a share source. var dataTransferManager = DataTransferManager.GetForCurrentView(); dataTransferManager.DataRequested += OnDataRequested; }