public SubredditLinks(IBaconProvider baconProvider, string subreddit, string subredditId = null) { _redditService = baconProvider.GetService <IRedditService>(); _offlineService = baconProvider.GetService <IOfflineService>(); _subreddit = subreddit; _subredditId = subredditId; }
public SubredditLinks(IBaconProvider baconProvider, string subreddit, string subredditId = null) { _redditService = baconProvider.GetService<IRedditService>(); _offlineService = baconProvider.GetService<IOfflineService>(); _subreddit = subreddit; _subredditId = subredditId; }
public PostComments(IBaconProvider baconProvider, string subreddit, string permaLink, string targetName) { _offlineService = baconProvider.GetService<IOfflineService>(); _settingsService = baconProvider.GetService<ISettingsService>(); _subreddit = subreddit; _permaLink = permaLink; _targetName = targetName; }
public RichMarkdownButton(string url, object content) { InitializeComponent(); _offlineService = ServiceLocator.Current.GetInstance<IOfflineService>(); this.BorderThickness = new Thickness(0); Url = url; RealContent = content as UIElement; }
public void Initialize(IImagesService imagesService, IOfflineService offlineService, IOOMService oomService, ISettingsService settingsService, ISuspensionService suspensionService, ISmartOfflineService smartOfflineService, ISimpleHttpService simpleHttpService) { _imagesService = imagesService; _offlineService = offlineService; _oomService = oomService; _settingsService = settingsService; _suspensionService = suspensionService; _smartOfflineService = smartOfflineService; _smartOfflineService.OffliningOpportunity += _smartOfflineService_OffliningOpportunity; _oomService.OutOfMemory += _oomService_OutOfMemory; }
public void Initialize(IViewModelContextService viewModelContextService, IOOMService oomService, ISettingsService settingsService, ISuspensionService suspensionService, IDynamicViewLocator dynamicViewLocator, IOfflineService offlineService, IImagesService imagesService, ISystemServices systemServices, ISuspendableWorkQueue suspendableWorkQueue) { _viewModelContextService = viewModelContextService; _oomService = oomService; _settingsService = settingsService; _suspensionService = suspensionService; _dynamicViewLocator = dynamicViewLocator; _offlineService = offlineService; _imagesService = imagesService; _systemServices = systemServices; _suspendableWorkQueue = suspendableWorkQueue; _oomService.OutOfMemory += _oomService_OutOfMemory; }
public void Initialize(ISmartOfflineService smartOfflineService, ISuspensionService suspensionService, IRedditService redditService, ISettingsService settingsService, ISystemServices systemServices, IOfflineService offlineService, INotificationService notificationService, IUserService userService, ISuspendableWorkQueue suspendableWorkQueue) { _smartOfflineService = smartOfflineService; _suspensionService = suspensionService; _redditService = redditService; _settingsService = settingsService; _systemServices = systemServices; _offlineService = offlineService; _notificationService = notificationService; _userService = userService; _suspendableWorkQueue = suspendableWorkQueue; _smartOfflineService.OffliningOpportunity += _smartOfflineService_OffliningOpportunity; Messenger.Default.Register<UserLoggedInMessage>(this, UserLoggedIn); }
static Brush noHistory;//new SolidColorBrush(Color.FromArgb(255, 218, 165, 32)); public MarkdownButton(string url, object content) { if (noHistory == null) { noHistory = Styles.Resources["PhoneForegroundBrush"] as Brush; } InitializeComponent(); _offlineService = ServiceLocator.Current.GetInstance<IOfflineService>(); this.BorderThickness = new Thickness(0); Url = url; if (url.StartsWith("#") && url == ((string)content)) { Text = ""; } else Text = content as string; }
public RedditViewModel(IBaconProvider baconProvider) { _baconProvider = baconProvider; _redditService = baconProvider.GetService<IRedditService>(); _dynamicViewLocator = baconProvider.GetService<IDynamicViewLocator>(); _navigationService = baconProvider.GetService<INavigationService>(); _userService = baconProvider.GetService<IUserService>(); _liveTileService = baconProvider.GetService<ILiveTileService>(); _offlineService = baconProvider.GetService<IOfflineService>(); _settingsService = baconProvider.GetService<ISettingsService>(); MessengerInstance.Register<UserLoggedInMessage>(this, OnUserLoggedIn); MessengerInstance.Register<ConnectionStatusMessage>(this, OnConnectionStatusChanged); MessengerInstance.Register<SelectSubredditMessage>(this, OnSubredditChanged); MessengerInstance.Register<RefreshSubredditMessage>(this, OnSubredditRefreshed); MessengerInstance.Register<SettingsChangedMessage>(this, OnSettingsChanged); IsTemporary = false; }
public MainPageViewModel(IBaconProvider baconProvider) { _baconProvider = baconProvider; _redditService = baconProvider.GetService <IRedditService>(); _dynamicViewLocator = baconProvider.GetService <IDynamicViewLocator>(); _navigationService = baconProvider.GetService <INavigationService>(); _userService = baconProvider.GetService <IUserService>(); _liveTileService = baconProvider.GetService <ILiveTileService>(); _offlineService = baconProvider.GetService <IOfflineService>(); _settingsService = baconProvider.GetService <ISettingsService>(); MessengerInstance.Register <UserLoggedInMessage>(this, OnUserLoggedIn); MessengerInstance.Register <SelectSubredditMessage>(this, OnSubredditChanged); MessengerInstance.Register <SelectTemporaryRedditMessage>(this, OnSelectTemporarySubreddit); MessengerInstance.Register <CloseSubredditMessage>(this, OnCloseSubreddit); MessengerInstance.Register <ReorderSubredditMessage>(this, OnReorderSubreddit); _pivotItems = new RedditViewModelCollection(_baconProvider); _subreddits = new ObservableCollection <TypedThing <Subreddit> >(); _subreddits.CollectionChanged += _subreddits_CollectionChanged; }
public CustomerViewModel(ICustomerService customerService, IFrameNavigationService navigationService, IGoogleMapsService googleMapsService, IOfflineService offlineService) { _customerService = customerService; _navigationService = navigationService; if (_navigationService.Parameter is int customerId) { Customer = _customerService.GetCustomer(customerId); CanDeleteCustomer = _customerService.CanDeleteCustomer(Customer); SaveCommand = new RelayCommand(UpdateCustomer); CurrentAddress = $"Huidige adres: {Customer.Address}"; } else { Customer = new Customer(); CanDeleteCustomer = false; SaveCommand = new RelayCommand(AddCustomer); } EditCustomerCommand = new RelayCommand(() => _navigationService.NavigateTo("UpdateCustomer", Customer.Id), () => offlineService.IsOnline, true); AddFestivalCommand = new RelayCommand(() => _navigationService.NavigateTo("CreateFestival", Customer.Id), () => offlineService.IsOnline, true); NavigateToCustomerListCommand = new RelayCommand(() => _navigationService.NavigateTo("CustomerList")); NavigateToCustomerInfoCommand = new RelayCommand(() => _navigationService.NavigateTo("CustomerInfo", Customer.Id)); DeleteCommand = new RelayCommand(RemoveCustomer, () => offlineService.IsOnline, true); OpenDeleteCheckCommand = new RelayCommand(OpenDeletePopup, () => CanDeleteCustomer, true); customerService.Sync(); #region Google Search _googleService = googleMapsService; SearchCommand = new RelayCommand(Search); SelectCommand = new RelayCommand <string>(Select); #endregion }
public MainPageViewModel(IBaconProvider baconProvider) { _baconProvider = baconProvider; _redditService = baconProvider.GetService<IRedditService>(); _dynamicViewLocator = baconProvider.GetService<IDynamicViewLocator>(); _navigationService = baconProvider.GetService<INavigationService>(); _userService = baconProvider.GetService<IUserService>(); _liveTileService = baconProvider.GetService<ILiveTileService>(); _offlineService = baconProvider.GetService<IOfflineService>(); _settingsService = baconProvider.GetService<ISettingsService>(); _notificationService = baconProvider.GetService<INotificationService>(); MessengerInstance.Register<UserLoggedInMessage>(this, OnUserLoggedIn); MessengerInstance.Register<SelectSubredditMessage>(this, OnSubredditChanged); MessengerInstance.Register<SelectTemporaryRedditMessage>(this, OnSelectTemporarySubreddit); MessengerInstance.Register<CloseSubredditMessage>(this, OnCloseSubreddit); MessengerInstance.Register<ReorderSubredditMessage>(this, OnReorderSubreddit); MessengerInstance.Register<SettingsChangedMessage>(this, OnSettingsChanged); _subreddits = new ObservableCollection<TypedThing<Subreddit>>(); _pivotItems = new RedditViewModelCollection(); }
public CertificateListViewModel(IEmployeeService employeeService, IFrameNavigationService navigationService, IOfflineService offlineService) { if (!(navigationService.Parameter is int employeeId)) { throw new InvalidNavigationException(); } Employee = employeeService.GetEmployee(employeeId); AddNewCertificateCommand = new RelayCommand(() => navigationService.NavigateTo("CreateCertificate", Employee), () => offlineService.IsOnline, true); NavigateToEmployeeInfoCommand = new RelayCommand(() => navigationService.NavigateTo("EmployeeInfo", Employee.Id)); EditCertificateCommand = new RelayCommand <int>( certificateId => navigationService.NavigateTo("UpdateCertificate", certificateId), _ => offlineService.IsOnline, true); CertificateList = (CollectionView)CollectionViewSource.GetDefaultView(Employee.Certificates); CertificateList.Filter = Filter; employeeService.Sync(); }
public MarkdownButton() { InitializeComponent(); _offlineService = ServiceLocator.Current.GetInstance <IOfflineService>(); this.BorderThickness = new Thickness(0); }
public SubredditSubscriptions(IBaconProvider baconProvider) { _offlineService = baconProvider.GetService<IOfflineService>(); _userService = baconProvider.GetService<IUserService>(); }
private static async Task<ViewModelBase> MakeContextedTuple(IImagesService imagesService, IOfflineService offlineService, ISettingsService settingsService, NeverEndingRedditView linksEnumerator) { ViewModelBase vm; while ((vm = await linksEnumerator.Next()) != null) { if (vm is LinkViewModel && imagesService.MightHaveImagesFromUrl(((LinkViewModel)vm).Url) && (!settingsService.OnlyFlipViewUnread || !offlineService.HasHistory(((LinkViewModel)vm).Url))) { var targetViewModel = vm as LinkViewModel; var smartOfflineService = ServiceLocator.Current.GetInstance<ISmartOfflineService>(); smartOfflineService.NavigatedToOfflineableThing(targetViewModel.LinkThing, false); Messenger.Default.Send<LoadingMessage>(new LoadingMessage { Loading = true }); await ServiceLocator.Current.GetInstance<IOfflineService>().StoreHistory(targetViewModel.Url); var imageResults = await ServiceLocator.Current.GetInstance<IImagesService>().GetImagesFromUrl(targetViewModel.LinkThing == null ? "" : targetViewModel.LinkThing.Data.Title, targetViewModel.Url); Messenger.Default.Send<LoadingMessage>(new LoadingMessage { Loading = false }); if (imageResults != null && imageResults.Count() > 0) { var imageTuple = new Tuple<string, IEnumerable<Tuple<string, string>>, string>(targetViewModel.LinkThing != null ? targetViewModel.LinkThing.Data.Title : "", imageResults, targetViewModel.LinkThing != null ? targetViewModel.LinkThing.Data.Id : ""); Messenger.Default.Send<LongNavigationMessage>(new LongNavigationMessage { Finished = true, TargetUrl = targetViewModel.Url }); return new LinkedPictureViewModel { LinkTitle = imageTuple.Item1.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(""", "\"").Replace("'", "'").Trim(), LinkId = imageTuple.Item3, Pictures = imageTuple.Item2.Select(tpl => new LinkedPictureViewModel.LinkedPicture { Title = tpl.Item1.Replace("&", "&").Replace("<", "<").Replace(">", ">").Replace(""", "\"").Replace("'", "'").Trim(), ImageSource = tpl.Item2, Url = tpl.Item2 }) }; } } else if (vm is LinkViewModel && LinkGlyphUtility.GetLinkGlyph(vm) == LinkGlyphUtility.WebGlyph && !settingsService.OnlyFlipViewImages && settingsService.ApplyReadabliltyToLinks && (!settingsService.OnlyFlipViewUnread || !offlineService.HasHistory(((LinkViewModel)vm).Url))) { var targetViewModel = vm as LinkViewModel; var smartOfflineService = ServiceLocator.Current.GetInstance<ISmartOfflineService>(); smartOfflineService.NavigatedToOfflineableThing(targetViewModel.LinkThing, true); await ServiceLocator.Current.GetInstance<IOfflineService>().StoreHistory(targetViewModel.Url); var result = await ReadableArticleViewModel.LoadAtLeastOne(ServiceLocator.Current.GetInstance<ISimpleHttpService>(), targetViewModel.Url, targetViewModel.LinkThing.Data.Id); result.WasStreamed = true; result.ContentIsFocused = false; return result; } else if (vm is LinkViewModel && ((LinkViewModel)vm).IsSelfPost && !settingsService.OnlyFlipViewImages && (!settingsService.OnlyFlipViewUnread || !offlineService.HasHistory(((LinkViewModel)vm).Url))) { var targetViewModel = vm as LinkViewModel; var smartOfflineService = ServiceLocator.Current.GetInstance<ISmartOfflineService>(); smartOfflineService.NavigatedToOfflineableThing(targetViewModel.LinkThing, true); await ServiceLocator.Current.GetInstance<IOfflineService>().StoreHistory(targetViewModel.Url); return vm; } } return null; }
public VisitedLinkConverter(IBaconProvider baconProvider) { _offlineService = baconProvider.GetService <IOfflineService>(); }
public SearchResults(IBaconProvider baconProvider, string query, bool reddits) { _offlineService = baconProvider.GetService<IOfflineService>(); _query = query; }
public VisitedMainLinkConverter(IBaconProvider baconProvider) { noHistory = App.Current.Resources["ApplicationForegroundThemeBrush"] as Brush; _offlineService = baconProvider.GetService <IOfflineService>(); }
public SubredditSubscriptions(IBaconProvider baconProvider) { _userService = baconProvider.GetService <IUserService>(); _redditService = baconProvider.GetService <IRedditService>(); _offlineService = baconProvider.GetService <IOfflineService>(); }
public VisitedMainLinkConverter(IBaconProvider baconProvider) { noHistory = App.Current.Resources["ApplicationForegroundThemeBrush"] as Brush; _offlineService = baconProvider.GetService<IOfflineService>(); }
public VisitedLinkConverter(IBaconProvider baconProvider) { _offlineService = baconProvider.GetService<IOfflineService>(); }
public VisitedMainLinkConverter() { noHistory = Styles.Resources["PhoneForegroundBrush"] as Brush; _offlineService = ServiceLocator.Current.GetInstance<IOfflineService>(); }
public SubredditInfo(IBaconProvider baconProvider) { _offlineService = baconProvider.GetService<IOfflineService>(); _userService = baconProvider.GetService<IUserService>(); }
public CustomerListViewModel(ICustomerService customerService, IFrameNavigationService navigationService, IOfflineService offlineService) { AddNewCustomerCommand = new RelayCommand(() => navigationService.NavigateTo("CreateCustomer"), () => offlineService.IsOnline, true); ViewCustomerCommand = new RelayCommand <int>(customerId => navigationService.NavigateTo("CustomerInfo", customerId)); CustomerList = (CollectionView)CollectionViewSource.GetDefaultView(customerService.GetAllCustomers()); CustomerList.Filter = Filter; customerService.Sync(); }
public SearchResults(IBaconProvider baconProvider, string query) { _offlineService = baconProvider.GetService <IOfflineService>(); _query = query; }
public VisitedMainLinkConverter() { noHistory = App.Current.Resources["PhoneForegroundBrush"] as Brush; _offlineService = ServiceLocator.Current.GetInstance <IOfflineService>(); }