コード例 #1
0
 public SubredditLinks(IBaconProvider baconProvider, string subreddit, string subredditId = null)
 {
     _redditService  = baconProvider.GetService <IRedditService>();
     _offlineService = baconProvider.GetService <IOfflineService>();
     _subreddit      = subreddit;
     _subredditId    = subredditId;
 }
コード例 #2
0
 public SubredditLinks(IBaconProvider baconProvider, string subreddit, string subredditId = null)
 {
     _redditService = baconProvider.GetService<IRedditService>();
     _offlineService = baconProvider.GetService<IOfflineService>();
     _subreddit = subreddit;
     _subredditId = subredditId;
 }
コード例 #3
0
ファイル: PostComments.cs プロジェクト: Synergex/Baconography
 public PostComments(IBaconProvider baconProvider, string subreddit, string permaLink, string targetName)
 {
     _offlineService = baconProvider.GetService<IOfflineService>();
     _settingsService = baconProvider.GetService<ISettingsService>();
     _subreddit = subreddit;
     _permaLink = permaLink;
     _targetName = targetName;
 }
コード例 #4
0
        public RichMarkdownButton(string url, object content)
		{
			InitializeComponent();
			_offlineService = ServiceLocator.Current.GetInstance<IOfflineService>();
			this.BorderThickness = new Thickness(0);
            Url = url;
            RealContent = content as UIElement;
		}
コード例 #5
0
        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;
        }
コード例 #6
0
        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;
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        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;
		}
コード例 #9
0
        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;
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        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
        }
コード例 #12
0
		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();
        }
コード例 #13
0
        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();
        }
コード例 #14
0
 public MarkdownButton()
 {
     InitializeComponent();
     _offlineService      = ServiceLocator.Current.GetInstance <IOfflineService>();
     this.BorderThickness = new Thickness(0);
 }
コード例 #15
0
 public SubredditSubscriptions(IBaconProvider baconProvider)
 {
     _offlineService = baconProvider.GetService<IOfflineService>();
     _userService = baconProvider.GetService<IUserService>();
 }
コード例 #16
0
        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("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&quot;", "\"").Replace("&apos;", "'").Trim(),
                            LinkId = imageTuple.Item3,
                            Pictures = imageTuple.Item2.Select(tpl => new LinkedPictureViewModel.LinkedPicture
                            {
                                Title = tpl.Item1.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&quot;", "\"").Replace("&apos;", "'").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;
        }
コード例 #17
0
 public VisitedLinkConverter(IBaconProvider baconProvider)
 {
     _offlineService = baconProvider.GetService <IOfflineService>();
 }
コード例 #18
0
 public SearchResults(IBaconProvider baconProvider, string query, bool reddits)
 {
     _offlineService = baconProvider.GetService<IOfflineService>();
     _query = query;
 }
コード例 #19
0
 public VisitedMainLinkConverter(IBaconProvider baconProvider)
 {
     noHistory       = App.Current.Resources["ApplicationForegroundThemeBrush"] as Brush;
     _offlineService = baconProvider.GetService <IOfflineService>();
 }
コード例 #20
0
 public SubredditSubscriptions(IBaconProvider baconProvider)
 {
     _userService    = baconProvider.GetService <IUserService>();
     _redditService  = baconProvider.GetService <IRedditService>();
     _offlineService = baconProvider.GetService <IOfflineService>();
 }
コード例 #21
0
 public VisitedMainLinkConverter(IBaconProvider baconProvider)
 {
     noHistory = App.Current.Resources["ApplicationForegroundThemeBrush"] as Brush;
     _offlineService = baconProvider.GetService<IOfflineService>();
 }
コード例 #22
0
 public VisitedLinkConverter(IBaconProvider baconProvider)
 {
     _offlineService = baconProvider.GetService<IOfflineService>();
 }
コード例 #23
0
        public VisitedMainLinkConverter()
        {
            noHistory = Styles.Resources["PhoneForegroundBrush"] as Brush;
			_offlineService = ServiceLocator.Current.GetInstance<IOfflineService>();
        }
コード例 #24
0
 public SubredditInfo(IBaconProvider baconProvider)
 {
     _offlineService = baconProvider.GetService<IOfflineService>();
     _userService = baconProvider.GetService<IUserService>();
 }
コード例 #25
0
        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();
        }
コード例 #26
0
 public SearchResults(IBaconProvider baconProvider, string query)
 {
     _offlineService = baconProvider.GetService <IOfflineService>();
     _query          = query;
 }
コード例 #27
0
 public VisitedMainLinkConverter()
 {
     noHistory       = App.Current.Resources["PhoneForegroundBrush"] as Brush;
     _offlineService = ServiceLocator.Current.GetInstance <IOfflineService>();
 }