Exemplo n.º 1
1
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);

             _toastService = Mvx.Resolve<IToastService> ();
             AnalyticsService = Mvx.Resolve<IAnalyticsService> ();

             _connectivityManager = (ConnectivityManager)GetSystemService (ConnectivityService);
        }
 public ExecutionService(IBlotterPublisher blotterPublisher, ITradeRepository tradeRepository, IAnalyticsService analyticsService)
 {
     _blotterPublisher = blotterPublisher;
     _tradeRepository = tradeRepository;
     _analyticsService = analyticsService;
     _tradeId = 0;
 }
 public DisclaimerViewModel(IAnalyticsService analytics, Language language, Location location, Func<Language, Location, DisclaimerLoader> disclaimerLoaderFactory)
 :base(analytics) {
     Title = "Disclaimer";
     
     _loader = disclaimerLoaderFactory(language, location);
     Refresh();
 }
Exemplo n.º 4
0
		public NestWebService() {
			_deserializer = ServiceContainer.GetService<INestWebServiceDeserializer>();
			_sessionProvider = ServiceContainer.GetService<ISessionProvider>();
			_analyticsService = ServiceContainer.GetService<IAnalyticsService>();
			_webRequestProvider = ServiceContainer.GetService<IWebRequestProvider>();
			_timestampProvider = ServiceContainer.GetService<ITimestampProvider>();
		}
 public Entity ReplaceAnalyticsService(IAnalyticsService newService)
 {
     var component = CreateComponent<AnalyticsServiceComponent>(ComponentIds.AnalyticsService);
     component.service = newService;
     ReplaceComponent(ComponentIds.AnalyticsService, component);
     return this;
 }
 public DetailedPagesViewModel(IAnalyticsService analytics, PageViewModel parentPage, IEnumerable<PageViewModel> pages)
     : base(analytics)
 {
     Title = parentPage.Title;
     _pages = pages;
     Content = parentPage.Page.Content;
 }
        RecentDocs recentfiles = LifetimeService.Instance.Container.Resolve<RecentDocs>();//21Dec2013

        public Window1(IUnityContainer container, IAnalyticsService analytics, IDashBoardService dashBoardService)
        {
            InitializeComponent();
            ///loading file when its double clicked ////

            try
            {

                //// rest of the old code //
                AssociateShortcutToolbarCommands();//18Mar2014
                recentfiles.recentitemclick = RecentItem_Click;//
                _analyticService = analytics;
                MainWindowMenuFactory mf = new MainWindowMenuFactory(Menu, maintoolbar, dashBoardService);
                Menu.Items.Insert(Menu.Items.Count - 2, omh.OutputMenu);//place output menu just before 2nd-last item.
                RefreshRecent();//recent menu
                Menu.Items.Insert(Menu.Items.Count - 2, chmh.CommandHistMenu);//04Mar2013 //place output menu just before 2nd-last item
            }
            catch (Exception ex)//17Jan2014
            {
                MessageBox.Show("Menus can't be generated...");
                logService.WriteToLogLevel("Menus can't be generated.\n" + ex.StackTrace, LogLevelEnum.Fatal);
                this.Close();
                return;
            }

            this.WindowState = System.Windows.WindowState.Normal;
            this.Dispatcher.UnhandledException += new DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException);
            UIControllerService layoutController = container.Resolve<UIControllerService>();

            layoutController.DocGroup = documentContainer;
            //layoutController.LayoutManager = DockContainer;
            container.RegisterInstance<IUIController>(layoutController);
            //its too early to call it here. BlueSky R pacakge is not yet loaded   SetRDefaults();//30Sep2014
            
        }
Exemplo n.º 8
0
 public PageViewModel(IAnalyticsService analytics, INavigator navigator, Models.Page page, IDialogProvider dialogProvider)
 : base(analytics) {
     Title = page.Title;
     _navigator = navigator;
     _dialogProvider = dialogProvider;
     Page = page;
     ShowPageCommand = new Command(ShowPage);
 }
Exemplo n.º 9
0
 public EpisodeDownloader(ITvService service, ISearchProvider searchProvider, IWebClient webClient, TorrentSearchSettings settings, IAnalyticsService analyticsService)
 {
     _service = service;
     _searchProvider = searchProvider;
     _webClient = webClient;
     _settings = settings;
     _analyticsService = analyticsService;
 }
 public NavigationViewModel(IAnalyticsService analytics, INavigator navigator, Func<Language, Location, DisclaimerViewModel> disclaimerFactory, Func<LocationsViewModel> locationFactory)
 :base(analytics) {
     Console.WriteLine("NavigationViewModel initialized");
     _navigator = navigator;
     Pages = new ObservableCollection<PageViewModel>();
     _disclaimerFactory = disclaimerFactory;
     _locationsFactory = locationFactory;
 }
        public UIControllerService(IAnalyticsService analytics)//, IOutputWindowContainer windowcontainer)
        {
            _analyticsService = analytics;
            //if (GetActiveDocument() == null)//no data set is open. No need to create ouput window.
            //    _outputWindow = null;
            //else
            _outputWindow = null;// windowcontainer.ActiveOutputWindow;

        }
Exemplo n.º 12
0
        public KickassSearchProvider(ISearchProvider nextProvider, IWebClient webClient, IAnalyticsService analyticsService)
        {
            if(nextProvider == null)
                throw new ArgumentNullException(nameof(nextProvider), "nextProvider Cannot be null");

            NextSearchProvider = nextProvider;
            _webClient = webClient;
            _analyticsService = analyticsService;
        }
Exemplo n.º 13
0
        public EpisodeProcessor(EpisodeProcessorSettings settings, ITvService tvService, IFileSystem fileSystem, IAnalyticsService analyticsService)
        {
            _settings = settings;
            _tvService = tvService;
            _fileSystem = fileSystem;
            _analyticsService = analyticsService;

            _sourceFolder = _fileSystem.GetDirectory(_settings.DownloadFolder);
            _destinationFolder = _fileSystem.GetDirectory(_settings.TvLibraryFolder);
        }
Exemplo n.º 14
0
 public Cleaner(ITradeRepository tradeRepository, IAnalyticsService analyticsService,
     IExecutionService executionService, IPriceLastValueCache priceLastValueCache,
     ISchedulerService scheduler)
 {
     _tradeRepository = tradeRepository;
     _analyticsService = analyticsService;
     _executionService = executionService;
     _priceLastValueCache = priceLastValueCache;
     _scheduler = scheduler;
 }
Exemplo n.º 15
0
 public SearchViewModel(IAnalyticsService analytics, IEnumerable<PageViewModel> pages)
 : base (analytics){
     if (pages == null)
     {
         throw new ArgumentNullException(nameof(pages));
     }
     Title = "Search";
     _pages = pages;
     Search();
 }
        public VirtualListDynamic(IAnalyticsService service, DataSource dataSource)
        {
            _service = service;
            _dataSource = dataSource;
            fRecordCount = _dataSource.RowCount;
            fColumnCount = _dataSource.Variables.Count;

            fValues = new Hashtable();
            CreateColumnCollection();
            type = GetObjectType(dataSource.Variables);
        }
        public LocationsViewModel(IAnalyticsService analytics, LocationsLoader locationsLoader, Func<Location, LanguagesViewModel> languageFactory,
            INavigator navigator)
      :base(analytics) {
            Title = "Select a Location";
            Description = "Where do you live?";
            _navigator = navigator;
            _navigator.HideToolbar(this);
            _languageFactory = languageFactory;
            _locationsLoader = locationsLoader;

            ExecuteLoadLocations();
        }
 public PriceFeedSimulator(
     ICurrencyPairRepository currencyPairRepository,
     IPricePublisher pricePublisher,
     IPriceLastValueCache priceLastValueCache,
     IAnalyticsService analyticsService)
 {
     _currencyPairRepository = currencyPairRepository;
     _pricePublisher = pricePublisher;
     _priceLastValueCache = priceLastValueCache;
     _analyticsService = analyticsService;
     _random = new Random(_currencyPairRepository.GetHashCode());
 }
        public AnalyticsServiceHost(IAnalyticsService service, IBroker broker, TradeCache tradeCache) : base(broker, "analytics")
        {
            _service = service;
            _broker = broker;
            _tradeCache = tradeCache;
            _subscriptions = new CompositeDisposable();

            RegisterCall("getAnalytics", GetAnalyticsStream);
            StartHeartBeat();

            ListenForPricesAndTrades();
        }
Exemplo n.º 20
0
        public void SetUp()
        {
            _tradeRepo = Substitute.For<ITradeRepository>();
            _analyticsService = Substitute.For<IAnalyticsService>();
            _executionService = Substitute.For<IExecutionService>();
            _lastValueCache = Substitute.For<IPriceLastValueCache>();

            _scheduler = new HistoricalScheduler();
            _scheduler.AdvanceTo(DateTimeOffset.Now);

            _schedulerService = Substitute.For<ISchedulerService>();
            _schedulerService.ThreadPool.Returns(_scheduler);
        }
Exemplo n.º 21
0
		public MainPageViewModel(ICurrencyConverterService currencyConverter, 
			ICurrencyListService currencyList, 
			IAnalyticsService analyticsService,
			INavigationCache navigationCache,
			IModelFactory modelFactory) 
			: base(analyticsService, navigationCache)
		{
			_currencyConverter = currencyConverter;
			_currencyList = currencyList;
			_modelFactory = modelFactory;

			SetSelectedCurrenciesIfPossible();
		}
	    public LanguagesViewModel (IAnalyticsService analytics, Location location, Func<Location, LanguagesLoader> languageLoaderFactory, INavigator navigator,
            Func<MainPageViewModel> mainPageViewModelFactory)
        : base (analytics) {
			Title = "Select Language";
			Description = "What language do you speak?";
		    _navigator = navigator;
            _navigator.HideToolbar(this);
            _mainPageViewModelFactory = mainPageViewModelFactory;

            Items = new ObservableCollection<Language>();
            _location = location;
            LanguagesLoader = languageLoaderFactory(_location);
            ExecuteLoadLanguages();
        }
Exemplo n.º 23
0
        public SettingsViewModel(IApplicationService applicationService, IFeaturesService featuresService, 
                                 IDefaultValueService defaultValueService, IAccountsService accountsService,
                                 IAnalyticsService analyticsService)
        {
            _applicationService = applicationService;
            _featuresService = featuresService;
            _defaultValueService = defaultValueService;
            _accountsService = accountsService;
            _analyticsService = analyticsService;

            GoToDefaultStartupViewCommand = new ReactiveCommand();
            GoToDefaultStartupViewCommand.Subscribe(_ => ShowViewModel(CreateViewModel<DefaultStartupViewModel>()));

            DeleteAllCacheCommand = new ReactiveCommand();
        }
Exemplo n.º 24
0
        public IndexHtmlMapper(IAppFolderInfo appFolderInfo,
                               IDiskProvider diskProvider,
                               IConfigFileProvider configFileProvider,
                               IAnalyticsService analyticsService,
                               Func<ICacheBreakerProvider> cacheBreakProviderFactory,
                               Logger logger)
            : base(diskProvider, logger)
        {
            _diskProvider = diskProvider;
            _configFileProvider = configFileProvider;
            _analyticsService = analyticsService;
            _cacheBreakProviderFactory = cacheBreakProviderFactory;
            _indexPath = Path.Combine(appFolderInfo.StartUpFolder, "UI", "index.html");

            API_KEY = configFileProvider.ApiKey;
            URL_BASE = configFileProvider.UrlBase;
        }
        public DefaultBlogRepository(ILogger logger, IContext context, IAnalyticsService analyticsService)
        {
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }
            if (analyticsService == null)
            {
                throw new ArgumentNullException(nameof(analyticsService));
            }

            Logger = logger;
            Context = context;
            AnalyticsService = analyticsService;
        }
        public MainPageViewModel(IAnalyticsService analytics, PagesViewModel pagesViewModel, EventPagesViewModel eventPagesViewModel, NavigationViewModel navigationViewModel, TabViewModel tabViewModel,
            IDialogProvider dialogProvider, INavigator navigator,
            Func<IEnumerable<PageViewModel>, SearchViewModel> pageSearchViewModelFactory, PersistenceService persistence)
        : base (analytics) {
            Title = "Information";

            TabViewModel = tabViewModel;
            TabViewModel.PagesViewModel = pagesViewModel;
            TabViewModel.EventPagesViewModel = eventPagesViewModel;

            NavigationViewModel = navigationViewModel;
            NavigationViewModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args)
            {
                if (args.PropertyName.Equals("SelectedPage"))
                {
                    //_pagesViewModel.SelectedPage = NavigationViewModel.SelectedPage;
                    //TODO current workaround
                    if (NavigationViewModel.SelectedPage != null && NavigationViewModel.SelectedPage.ShowPageCommand.CanExecute(null))
                    {
                        NavigationViewModel.SelectedPage.ShowPageCommand.Execute(null);
                        NavigationViewModel.IsPresented = false; // close master page, this should ideally be done within the NavigationViewModel itself (as in the Disclaimer button, the navigation closes itself as well) - Note for when this workaround is properly solved
                    }
                }
            };

            _pagesViewModel = pagesViewModel;
            _pagesViewModel.PropertyChanged += delegate(object sender, PropertyChangedEventArgs args)
            {
                if (args.PropertyName.Equals("LoadedPages"))
                {
                    var pages = _pagesViewModel.LoadedPages;
                    var key = Models.Page.GenerateKey("0", _location, _language);
                    NavigationViewModel.Pages =
                        new ObservableCollection<PageViewModel>(pages.Where(x => x.Page.ParentId == key)
                            .OrderBy(x => x.Page.Order));
                }
            };

            _dialogProvider = dialogProvider;
            _navigator = navigator;
            _pageSearchViewModelFactory = pageSearchViewModelFactory;
            _persistence = persistence;
        }
Exemplo n.º 27
0
        public EditTimeEntryViewModel(
            ITimeService timeService,
            ITogglDataSource dataSource,
            ISyncManager syncManager,
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IOnboardingStorage onboardingStorage,
            IAnalyticsService analyticsService,
            IRxActionFactory actionFactory,
            ISchedulerProvider schedulerProvider)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(actionFactory, nameof(actionFactory));

            this.dataSource        = dataSource;
            this.syncManager       = syncManager;
            this.timeService       = timeService;
            this.interactorFactory = interactorFactory;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;
            this.actionFactory     = actionFactory;
            OnboardingStorage      = onboardingStorage;

            workspaceIdSubject
            .Where(id => id.HasValue)
            .Subscribe(id => workspaceId = id.Value)
            .DisposedBy(disposeBag);

            isEditingDescriptionSubject = new BehaviorSubject <bool>(false);
            Description = new BehaviorRelay <string>(string.Empty, CommonFunctions.Trim);

            projectClientTaskSubject = new BehaviorSubject <ProjectClientTaskInfo>(ProjectClientTaskInfo.Empty);
            ProjectClientTask        = projectClientTaskSubject
                                       .AsDriver(ProjectClientTaskInfo.Empty, schedulerProvider);

            IsBillableAvailable = workspaceIdSubject
                                  .Where(id => id.HasValue)
                                  .SelectMany(workspaceId => interactorFactory.IsBillableAvailableForWorkspace(workspaceId.Value).Execute())
                                  .DistinctUntilChanged()
                                  .AsDriver(false, schedulerProvider);

            isBillableSubject = new BehaviorSubject <bool>(false);
            IsBillable        = isBillableSubject
                                .DistinctUntilChanged()
                                .AsDriver(false, schedulerProvider);

            startTimeSubject = new BehaviorSubject <DateTimeOffset>(DateTimeOffset.UtcNow);
            var startTimeObservable = startTimeSubject.DistinctUntilChanged();

            StartTime = startTimeObservable
                        .AsDriver(default(DateTimeOffset), schedulerProvider);

            var now = timeService.CurrentDateTimeObservable.StartWith(timeService.CurrentDateTime);

            durationSubject = new ReplaySubject <TimeSpan?>(bufferSize: 1);
            Duration        =
                durationSubject
                .Select(duration
                        => duration.HasValue
                            ? Observable.Return(duration.Value)
                            : now.CombineLatest(
                            startTimeObservable,
                            (currentTime, startTime) => currentTime - startTime))
                .Switch()
                .DistinctUntilChanged()
                .AsDriver(TimeSpan.Zero, schedulerProvider);

            var stopTimeObservable = Observable.CombineLatest(startTimeObservable, durationSubject, calculateStopTime)
                                     .DistinctUntilChanged();

            StopTime = stopTimeObservable
                       .AsDriver(null, schedulerProvider);

            var isTimeEntryRunningObservable = stopTimeObservable
                                               .Select(stopTime => !stopTime.HasValue)
                                               .Do(value => isRunning = value)
                                               .DistinctUntilChanged();

            IsTimeEntryRunning = isTimeEntryRunningObservable
                                 .AsDriver(false, schedulerProvider);

            tagsSubject = new BehaviorSubject <IEnumerable <IThreadSafeTag> >(Enumerable.Empty <IThreadSafeTag>());
            Tags        = tagsSubject
                          .Select(tags => tags.Select(ellipsize).ToImmutableList())
                          .AsDriver(ImmutableList <string> .Empty, schedulerProvider);

            isInaccessibleSubject = new BehaviorSubject <bool>(false);
            IsInaccessible        = isInaccessibleSubject
                                    .DistinctUntilChanged()
                                    .AsDriver(false, schedulerProvider);

            syncErrorMessageSubject = new BehaviorSubject <string>(string.Empty);
            SyncErrorMessage        = syncErrorMessageSubject
                                      .Select(error => error ?? string.Empty)
                                      .DistinctUntilChanged()
                                      .AsDriver(string.Empty, schedulerProvider);

            IsSyncErrorMessageVisible = syncErrorMessageSubject
                                        .Select(error => !string.IsNullOrEmpty(error))
                                        .DistinctUntilChanged()
                                        .AsDriver(false, schedulerProvider);

            Preferences = interactorFactory.GetPreferences().Execute()
                          .AsDriver(null, schedulerProvider);

            // Actions
            SelectProject           = actionFactory.FromAsync(selectProject);
            SelectTags              = actionFactory.FromAsync(selectTags);
            ToggleBillable          = actionFactory.FromAction(toggleBillable);
            EditTimes               = actionFactory.FromAsync <EditViewTapSource>(editTimes);
            SelectStartDate         = actionFactory.FromAsync(selectStartDate);
            StopTimeEntry           = actionFactory.FromAction(stopTimeEntry, isTimeEntryRunningObservable);
            DismissSyncErrorMessage = actionFactory.FromAction(dismissSyncErrorMessage);
            Save   = actionFactory.FromAsync(save);
            Delete = actionFactory.FromAsync(delete);
        }
Exemplo n.º 28
0
 public AndroidSchedulerProvider(IAnalyticsService analyticsService)
 {
     MainScheduler       = new HandlerScheduler(new Handler(Looper.MainLooper), Looper.MainLooper.Thread.Id, analyticsService);
     DefaultScheduler    = new TrackedSchedulerWrapper(Scheduler.Default, analyticsService);
     BackgroundScheduler = new TrackedSchedulerWrapper(NewThreadScheduler.Default, analyticsService);
 }
Exemplo n.º 29
0
 public AzureFunctionsApiService(IAnalyticsService analyticsService, IMainThread mainThread, IAzureFunctionsApi azureFunctionsApi) : base(analyticsService, mainThread)
 {
     _azureFunctionsApiClient = azureFunctionsApi;
 }
Exemplo n.º 30
0
 public AnalyticsHub(IContextHolder contextHolder, IAnalyticsService analyticsService)
 {
     _contextHolder = contextHolder;
     _analyticsService = analyticsService;
 }
Exemplo n.º 31
0
 public PageController(IPageService pageService, IPageSectionService sectionService, IAnalyticsService analyticService)
 {
     _pageService     = pageService;
     _sectionService  = sectionService;
     _analyticService = analyticService;
 }
Exemplo n.º 32
0
        public ReportsViewModel(ITogglDataSource dataSource,
                                ITimeService timeService,
                                INavigationService navigationService,
                                IInteractorFactory interactorFactory,
                                IAnalyticsService analyticsService,
                                ISchedulerProvider schedulerProvider,
                                IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));

            this.dataSource        = dataSource;
            this.timeService       = timeService;
            this.analyticsService  = analyticsService;
            this.interactorFactory = interactorFactory;

            CalendarViewModel = new ReportsCalendarViewModel(timeService, dataSource, rxActionFactory, navigationService, schedulerProvider);

            var totalsObservable = reportSubject
                                   .SelectMany(_ => interactorFactory.GetReportsTotals(userId, workspaceId, startDate, endDate).Execute())
                                   .Catch <ITimeEntriesTotals, OfflineException>(_ => Observable.Return <ITimeEntriesTotals>(null))
                                   .Where(report => report != null);

            BarChartViewModel = new ReportsBarChartViewModel(schedulerProvider, dataSource.Preferences, totalsObservable, navigationService);

            IsLoadingObservable = isLoading.AsObservable().AsDriver(schedulerProvider);
            StartDate           = startDateSubject.AsObservable().AsDriver(schedulerProvider);
            EndDate             = endDateSubject.AsObservable().AsDriver(schedulerProvider);

            SelectWorkspace = rxActionFactory.FromAsync(selectWorkspace);

            WorkspaceId = workspaceSubject
                          .Select(workspace => workspace.Id)
                          .DistinctUntilChanged()
                          .AsDriver(schedulerProvider);

            WorkspaceNameObservable = workspaceSubject
                                      .Select(workspace => workspace?.Name ?? string.Empty)
                                      .DistinctUntilChanged()
                                      .AsDriver(schedulerProvider);

            WorkspaceHasBillableFeatureEnabled = workspaceSubject
                                                 .Where(workspace => workspace != null)
                                                 .SelectMany(workspace => interactorFactory.GetWorkspaceFeaturesById(workspace.Id).Execute())
                                                 .Select(workspaceFeatures => workspaceFeatures.IsEnabled(WorkspaceFeatureId.Pro))
                                                 .StartWith(false)
                                                 .DistinctUntilChanged()
                                                 .AsDriver(schedulerProvider);

            CurrentDateRange = currentDateRangeStringSubject
                               .StartWith(Resources.ThisWeek)
                               .Where(text => !string.IsNullOrEmpty(text))
                               .Select(text => $"{text} ▾")
                               .DistinctUntilChanged()
                               .AsDriver(schedulerProvider);

            WorkspacesObservable = interactorFactory.ObserveAllWorkspaces().Execute()
                                   .Select(list => list.Where(w => !w.IsInaccessible))
                                   .Select(readOnlyWorkspaceSelectOptions)
                                   .AsDriver(schedulerProvider);

            DurationFormatObservable = dataSource.Preferences.Current
                                       .Select(prefs => prefs.DurationFormat)
                                       .AsDriver(schedulerProvider);

            SegmentsObservable        = segmentsSubject.CombineLatest(DurationFormatObservable, applyDurationFormat);
            GroupedSegmentsObservable = SegmentsObservable.CombineLatest(DurationFormatObservable, groupSegments);
            ShowEmptyStateObservable  = SegmentsObservable.CombineLatest(IsLoadingObservable, shouldShowEmptyState);
        }
Exemplo n.º 33
0
 public AnalyticsEvent(IAnalyticsService analyticsService, string name)
     : base(analyticsService, name, new string[0])
 {
 }
Exemplo n.º 34
0
        public LoginViewModel(
            IUserAccessManager userAccessManager,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IMvxNavigationService navigationService,
            IPasswordManagerService passwordManagerService,
            IErrorHandlingService errorHandlingService,
            ILastTimeUsageStorage lastTimeUsageStorage,
            ITimeService timeService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
        {
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(passwordManagerService, nameof(passwordManagerService));
            Ensure.Argument.IsNotNull(errorHandlingService, nameof(errorHandlingService));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService            = timeService;
            this.userAccessManager      = userAccessManager;
            this.analyticsService       = analyticsService;
            this.onboardingStorage      = onboardingStorage;
            this.navigationService      = navigationService;
            this.errorHandlingService   = errorHandlingService;
            this.lastTimeUsageStorage   = lastTimeUsageStorage;
            this.passwordManagerService = passwordManagerService;
            this.schedulerProvider      = schedulerProvider;

            var emailObservable = emailSubject.Select(email => email.TrimmedEnd());

            Signup               = rxActionFactory.FromAsync(signup);
            ForgotPassword       = rxActionFactory.FromAsync(forgotPassword);
            StartPasswordManager = rxActionFactory.FromAsync(startPasswordManager);

            Shake = shakeSubject.AsDriver(this.schedulerProvider);

            Email = emailObservable
                    .Select(email => email.ToString())
                    .DistinctUntilChanged()
                    .AsDriver(this.schedulerProvider);

            Password = passwordSubject
                       .Select(password => password.ToString())
                       .DistinctUntilChanged()
                       .AsDriver(this.schedulerProvider);

            IsLoading = isLoadingSubject
                        .DistinctUntilChanged()
                        .AsDriver(this.schedulerProvider);

            ErrorMessage = errorMessageSubject
                           .DistinctUntilChanged()
                           .AsDriver(this.schedulerProvider);

            IsPasswordMasked = isPasswordMaskedSubject
                               .DistinctUntilChanged()
                               .AsDriver(this.schedulerProvider);

            IsShowPasswordButtonVisible = Password
                                          .Select(password => password.Length > 1)
                                          .CombineLatest(isShowPasswordButtonVisibleSubject.AsObservable(), CommonFunctions.And)
                                          .DistinctUntilChanged()
                                          .AsDriver(this.schedulerProvider);

            HasError = ErrorMessage
                       .Select(string.IsNullOrEmpty)
                       .Select(CommonFunctions.Invert)
                       .AsDriver(this.schedulerProvider);

            LoginEnabled = emailObservable
                           .CombineLatest(
                passwordSubject.AsObservable(),
                IsLoading,
                (email, password, isLoading) => email.IsValid && password.IsValid && !isLoading)
                           .DistinctUntilChanged()
                           .AsDriver(this.schedulerProvider);

            IsPasswordManagerAvailable = passwordManagerService.IsAvailable;
        }
Exemplo n.º 35
0
        public SignupViewModel(
            IApiFactory apiFactory,
            IUserAccessManager userAccessManager,
            IAnalyticsService analyticsService,
            IOnboardingStorage onboardingStorage,
            IMvxNavigationService navigationService,
            IErrorHandlingService errorHandlingService,
            ILastTimeUsageStorage lastTimeUsageStorage,
            ITimeService timeService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory,
            IPlatformInfo platformInfo)
        {
            Ensure.Argument.IsNotNull(apiFactory, nameof(apiFactory));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(errorHandlingService, nameof(errorHandlingService));
            Ensure.Argument.IsNotNull(lastTimeUsageStorage, nameof(lastTimeUsageStorage));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));

            this.apiFactory           = apiFactory;
            this.userAccessManager    = userAccessManager;
            this.analyticsService     = analyticsService;
            this.onboardingStorage    = onboardingStorage;
            this.navigationService    = navigationService;
            this.errorHandlingService = errorHandlingService;
            this.lastTimeUsageStorage = lastTimeUsageStorage;
            this.timeService          = timeService;
            this.schedulerProvider    = schedulerProvider;
            this.rxActionFactory      = rxActionFactory;
            this.platformInfo         = platformInfo;

            Login        = rxActionFactory.FromAsync(login);
            Signup       = rxActionFactory.FromAsync(signup);
            GoogleSignup = rxActionFactory.FromAsync(googleSignup);
            PickCountry  = rxActionFactory.FromAsync(pickCountry);

            var emailObservable = emailSubject.Select(email => email.TrimmedEnd());

            Shake = shakeSubject.AsDriver(this.schedulerProvider);

            Email = emailObservable
                    .Select(email => email.ToString())
                    .DistinctUntilChanged()
                    .AsDriver(this.schedulerProvider);

            Password = passwordSubject
                       .Select(password => password.ToString())
                       .DistinctUntilChanged()
                       .AsDriver(this.schedulerProvider);

            IsLoading = isLoadingSubject
                        .DistinctUntilChanged()
                        .AsDriver(this.schedulerProvider);

            IsCountryErrorVisible = isCountryErrorVisibleSubject
                                    .DistinctUntilChanged()
                                    .AsDriver(this.schedulerProvider);

            ErrorMessage = errorMessageSubject
                           .DistinctUntilChanged()
                           .AsDriver(this.schedulerProvider);

            CountryButtonTitle = countryNameSubject
                                 .DistinctUntilChanged()
                                 .AsDriver(this.schedulerProvider);

            IsPasswordMasked = isPasswordMaskedSubject
                               .DistinctUntilChanged()
                               .AsDriver(this.schedulerProvider);

            IsShowPasswordButtonVisible = Password
                                          .Select(password => password.Length > 1)
                                          .CombineLatest(isShowPasswordButtonVisibleSubject.AsObservable(), CommonFunctions.And)
                                          .DistinctUntilChanged()
                                          .AsDriver(this.schedulerProvider);

            HasError = ErrorMessage
                       .Select(string.IsNullOrEmpty)
                       .Select(CommonFunctions.Invert)
                       .AsDriver(this.schedulerProvider);

            SignupEnabled = emailObservable
                            .CombineLatest(
                passwordSubject.AsObservable(),
                IsLoading,
                countryNameSubject.AsObservable(),
                (email, password, isLoading, countryName) => email.IsValid && password.IsValid && !isLoading && (countryName != Resources.SelectCountry))
                            .DistinctUntilChanged()
                            .AsDriver(this.schedulerProvider);

            SuccessfulSignup = successfulSignupSubject
                               .AsDriver(this.schedulerProvider);
        }
Exemplo n.º 36
0
        private static LookForChangeToPushState <TDatabase, TThreadsafe> configurePush <TModel, TDatabase, TThreadsafe>(
            ITransitionConfigurator transitions,
            IStateResult entryPoint,
            IDataSource <TThreadsafe, TDatabase> dataSource,
            IAnalyticsService analyticsService,
            ICreatingApiClient <TModel> creatingApi,
            IUpdatingApiClient <TModel> updatingApi,
            IDeletingApiClient <TModel> deletingApi,
            ILeakyBucket minutesLeakyBucket,
            IRateLimiter rateLimiter,
            WaitForAWhileState waitForAWhileState,
            Func <TModel, TThreadsafe> toClean,
            Func <TThreadsafe, string, TThreadsafe> toUnsyncable)
            where TModel : class, IIdentifiable, ILastChangedDatable
            where TDatabase : class, TModel, IDatabaseSyncable
            where TThreadsafe : class, TDatabase, IThreadSafeModel
        {
            var lookForChange      = new LookForChangeToPushState <TDatabase, TThreadsafe>(dataSource);
            var chooseOperation    = new ChooseSyncOperationState <TThreadsafe>();
            var create             = new CreateEntityState <TModel, TDatabase, TThreadsafe>(creatingApi, dataSource, analyticsService, minutesLeakyBucket, rateLimiter, toClean);
            var update             = new UpdateEntityState <TModel, TThreadsafe>(updatingApi, dataSource, analyticsService, minutesLeakyBucket, rateLimiter, toClean);
            var delete             = new DeleteEntityState <TModel, TDatabase, TThreadsafe>(deletingApi, analyticsService, dataSource, minutesLeakyBucket, rateLimiter);
            var deleteLocal        = new DeleteLocalEntityState <TDatabase, TThreadsafe>(dataSource);
            var processClientError = new ProcessClientErrorState <TThreadsafe>();
            var unsyncable         = new MarkEntityAsUnsyncableState <TThreadsafe>(dataSource, toUnsyncable);

            transitions.ConfigureTransition(entryPoint, lookForChange);
            transitions.ConfigureTransition(lookForChange.ChangeFound, chooseOperation);
            transitions.ConfigureTransition(chooseOperation.CreateEntity, create);
            transitions.ConfigureTransition(chooseOperation.UpdateEntity, update);
            transitions.ConfigureTransition(chooseOperation.DeleteEntity, delete);
            transitions.ConfigureTransition(chooseOperation.DeleteEntityLocally, deleteLocal);

            transitions.ConfigureTransition(create.ClientError, processClientError);
            transitions.ConfigureTransition(update.ClientError, processClientError);
            transitions.ConfigureTransition(delete.ClientError, processClientError);

            transitions.ConfigureTransition(create.ServerError, new FailureState());
            transitions.ConfigureTransition(update.ServerError, new FailureState());
            transitions.ConfigureTransition(delete.ServerError, new FailureState());

            transitions.ConfigureTransition(create.UnknownError, new FailureState());
            transitions.ConfigureTransition(update.UnknownError, new FailureState());
            transitions.ConfigureTransition(delete.UnknownError, new FailureState());

            transitions.ConfigureTransition(processClientError.UnresolvedTooManyRequests, new FailureState());
            transitions.ConfigureTransition(processClientError.Unresolved, unsyncable);

            transitions.ConfigureTransition(create.EntityChanged, lookForChange);
            transitions.ConfigureTransition(update.EntityChanged, lookForChange);

            transitions.ConfigureTransition(create.PreventOverloadingServer, waitForAWhileState);
            transitions.ConfigureTransition(update.PreventOverloadingServer, waitForAWhileState);
            transitions.ConfigureTransition(delete.PreventOverloadingServer, waitForAWhileState);

            transitions.ConfigureTransition(create.Done, lookForChange);
            transitions.ConfigureTransition(update.Done, lookForChange);
            transitions.ConfigureTransition(delete.Done, lookForChange);
            transitions.ConfigureTransition(deleteLocal.Done, lookForChange);
            transitions.ConfigureTransition(deleteLocal.DeletingFailed, lookForChange);
            transitions.ConfigureTransition(unsyncable.Done, lookForChange);

            return(lookForChange);
        }
Exemplo n.º 37
0
        public MainPageViewModel(INavigationService navigationService, IKursnaListaRepository repository, ITimeService timeService, IAnalyticsService analyticsService)
            : base(navigationService, timeService, analyticsService)
        {
            _navigationService          = navigationService;
            _repository                 = repository;
            ZaDevizeItems               = new ObservableCollection <IStavkaKursneListeViewModel>();
            ZaEfektivniStraniNovacItems = new ObservableCollection <IStavkaKursneListeViewModel>();
            SrednjiKursItems            = new ObservableCollection <IStavkaKursneListeViewModel>();

            GoToConverterCommand = new RelayCommand(() =>
                                                    _navigationService.NavigateTo <IConverterPageView>(new { From = "RSD", To = "EUR" })
                                                    );
            IsDataCurrent = true;
        }
Exemplo n.º 38
0
        public MainTabBarViewModel(
            ITimeService timeService,
            ITogglDataSource dataSource,
            ISyncManager syncManager,
            IDialogService dialogService,
            IRatingService ratingService,
            IUserPreferences userPreferences,
            IAnalyticsService analyticsService,
            IBackgroundService backgroundService,
            IInteractorFactory interactorFactory,
            IOnboardingStorage onboardingStorage,
            ISchedulerProvider schedulerProvider,
            IPermissionsService permissionsService,
            INavigationService navigationService,
            IRemoteConfigService remoteConfigService,
            ISuggestionProviderContainer suggestionProviders,
            IIntentDonationService intentDonationService,
            IAccessRestrictionStorage accessRestrictionStorage,
            IStopwatchProvider stopwatchProvider,
            IRxActionFactory rxActionFactory,
            IUserAccessManager userAccessManager,
            IPrivateSharedStorageService privateSharedStorageService,
            IPlatformInfo platformInfo)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(syncManager, nameof(syncManager));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(ratingService, nameof(ratingService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(backgroundService, nameof(backgroundService));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(navigationService, nameof(navigationService));
            Ensure.Argument.IsNotNull(permissionsService, nameof(permissionsService));
            Ensure.Argument.IsNotNull(remoteConfigService, nameof(remoteConfigService));
            Ensure.Argument.IsNotNull(suggestionProviders, nameof(suggestionProviders));
            Ensure.Argument.IsNotNull(accessRestrictionStorage, nameof(accessRestrictionStorage));
            Ensure.Argument.IsNotNull(intentDonationService, nameof(intentDonationService));
            Ensure.Argument.IsNotNull(dialogService, nameof(dialogService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(stopwatchProvider, nameof(stopwatchProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));
            Ensure.Argument.IsNotNull(userAccessManager, nameof(userAccessManager));
            Ensure.Argument.IsNotNull(privateSharedStorageService, nameof(privateSharedStorageService));
            Ensure.Argument.IsNotNull(platformInfo, nameof(platformInfo));

            this.remoteConfigService = remoteConfigService;
            this.stopwatchProvider   = stopwatchProvider;
            this.platformInfo        = platformInfo;

            mainViewModel = new MainViewModel(
                dataSource,
                syncManager,
                timeService,
                ratingService,
                userPreferences,
                analyticsService,
                onboardingStorage,
                interactorFactory,
                navigationService,
                remoteConfigService,
                suggestionProviders,
                intentDonationService,
                accessRestrictionStorage,
                schedulerProvider,
                stopwatchProvider,
                rxActionFactory);

            reportsViewModel = new ReportsViewModel(
                dataSource,
                timeService,
                navigationService,
                interactorFactory,
                analyticsService,
                dialogService,
                intentDonationService,
                schedulerProvider,
                stopwatchProvider,
                rxActionFactory);

            calendarViewModel = new CalendarViewModel(
                dataSource,
                timeService,
                dialogService,
                userPreferences,
                analyticsService,
                backgroundService,
                interactorFactory,
                onboardingStorage,
                schedulerProvider,
                permissionsService,
                navigationService,
                stopwatchProvider,
                rxActionFactory);

            settingsViewModel = new SettingsViewModel(
                dataSource,
                syncManager,
                platformInfo,
                dialogService,
                userPreferences,
                analyticsService,
                userAccessManager,
                interactorFactory,
                onboardingStorage,
                navigationService,
                privateSharedStorageService,
                intentDonationService,
                stopwatchProvider,
                rxActionFactory,
                permissionsService,
                schedulerProvider);

            Tabs = getViewModels().ToList();
        }
Exemplo n.º 39
0
 public LanguageService(IAnalyticsService analyticsService, IPreferences preferences, IMainThread mainThread)
 {
     _mainThread       = mainThread;
     _preferences      = preferences;
     _analyticsService = analyticsService;
 }
Exemplo n.º 40
0
 public RepositoryDatabase(IFileSystem fileSystem, IAnalyticsService analyticsService) : base(fileSystem, analyticsService, TimeSpan.FromDays(90))
 {
 }
Exemplo n.º 41
0
 public SendMailController(ShopContext context, IAnalyticsService analyticsService, IEmailSender emailSender)
 {
     _context          = context;
     _analyticsService = analyticsService;
     _emailSender      = emailSender;
 }
 public static IScheduler ToTrackingScheduler(this IScheduler scheduler, IAnalyticsService analyticsService)
 => new TrackedSchedulerWrapper(scheduler, analyticsService);
Exemplo n.º 43
0
 public BuildController(IPageService pageService, IPageSectionService sectionService, IAnalyticsService analyticService, IUserService userService, ILoginService loginService, IRoleService roleService)
 {
     _pageService     = pageService;
     _sectionService  = sectionService;
     _analyticService = analyticService;
     _userService     = userService;
     _loginService    = loginService;
     _roleService     = roleService;
 }
Exemplo n.º 44
0
 public TrackedSchedulerWrapper(IScheduler innerScheduler, IAnalyticsService analyticsService)
 {
     this.innerScheduler   = innerScheduler;
     this.analyticsService = analyticsService;
     analyticsEventName    = this.innerScheduler.GetType().Name;
 }
Exemplo n.º 45
0
 public ChartOnboardingPage(IAnalyticsService analyticsService, IMainThread mainThread) : base(analyticsService, mainThread, Color.FromHex(BaseTheme.CoralColorHex), OnboardingConstants.SkipText, 1)
 {
 }
Exemplo n.º 46
0
 public DatabaseUpdater(ITvSearchService searchService, ITvContext context, IAnalyticsService analyticsService)
 {
     _searchService    = searchService;
     _context          = context;
     _analyticsService = analyticsService;
 }
Exemplo n.º 47
0
 public ErrorService(IAnalyticsService analyticsService)
 {
     _analyticsService = analyticsService;
     _appVersion = UIApplication.SharedApplication.GetVersion();
     _systemVersion = UIDevice.CurrentDevice.SystemVersion;
 }
        public StartTimeEntryViewModel(
            ITimeService timeService,
            ITogglDataSource dataSource,
            IUserPreferences userPreferences,
            IOnboardingStorage onboardingStorage,
            IInteractorFactory interactorFactory,
            INavigationService navigationService,
            IAnalyticsService analyticsService,
            ISchedulerProvider schedulerProvider,
            IRxActionFactory rxActionFactory)
            : base(navigationService)
        {
            Ensure.Argument.IsNotNull(dataSource, nameof(dataSource));
            Ensure.Argument.IsNotNull(timeService, nameof(timeService));
            Ensure.Argument.IsNotNull(userPreferences, nameof(userPreferences));
            Ensure.Argument.IsNotNull(interactorFactory, nameof(interactorFactory));
            Ensure.Argument.IsNotNull(onboardingStorage, nameof(onboardingStorage));
            Ensure.Argument.IsNotNull(analyticsService, nameof(analyticsService));
            Ensure.Argument.IsNotNull(schedulerProvider, nameof(schedulerProvider));
            Ensure.Argument.IsNotNull(rxActionFactory, nameof(rxActionFactory));

            this.timeService       = timeService;
            this.userPreferences   = userPreferences;
            this.interactorFactory = interactorFactory;
            this.analyticsService  = analyticsService;
            this.schedulerProvider = schedulerProvider;

            DataSource        = dataSource;
            OnboardingStorage = onboardingStorage;

            TextFieldInfo        = textFieldInfo.AsDriver(schedulerProvider);
            IsBillable           = isBillable.AsDriver(schedulerProvider);
            IsSuggestingTags     = isSuggestingTags.AsDriver(schedulerProvider);
            IsSuggestingProjects = isSuggestingProjects.AsDriver(schedulerProvider);
            IsBillableAvailable  = isBillableAvailable.AsDriver(schedulerProvider);
            DisplayedTime        = displayedTime
                                   .Select(time => time.ToFormattedString(DurationFormat.Improved))
                                   .AsDriver(schedulerProvider);

            Done                     = rxActionFactory.FromObservable <IThreadSafeTimeEntry>(done);
            DurationTapped           = rxActionFactory.FromAction(durationTapped);
            ToggleBillable           = rxActionFactory.FromAction(toggleBillable);
            SetStartDate             = rxActionFactory.FromAsync(setStartDate);
            ChangeTime               = rxActionFactory.FromAsync(changeTime);
            ToggleTagSuggestions     = rxActionFactory.FromAction(toggleTagSuggestions);
            ToggleProjectSuggestions = rxActionFactory.FromAction(toggleProjectSuggestions);
            SelectSuggestion         = rxActionFactory.FromAsync <AutocompleteSuggestion>(selectSuggestion);
            SetRunningTime           = rxActionFactory.FromAction <TimeSpan>(setRunningTime);
            ToggleTasks              = rxActionFactory.FromAction <ProjectSuggestion>(toggleTasks);
            SetTextSpans             = rxActionFactory.FromAction <IEnumerable <ISpan> >(setTextSpans);

            var queryByType = queryByTypeSubject
                              .AsObservable()
                              .SelectMany(type => interactorFactory.GetAutocompleteSuggestions(new QueryInfo("", type)).Execute());

            var queryByText = textFieldInfo
                              .SelectMany(setBillableValues)
                              .Select(QueryInfo.ParseFieldInfo)
                              .Do(onParsedQuery)
                              .ObserveOn(schedulerProvider.BackgroundScheduler)
                              .SelectMany(query => interactorFactory.GetAutocompleteSuggestions(query).Execute());

            Suggestions = Observable.Merge(queryByText, queryByType)
                          .Select(items => items.ToList()) // This is line is needed for now to read objects from realm
                          .Select(filter)
                          .Select(group)
                          .CombineLatest(expandedProjects, (groups, _) => groups)
                          .Select(toCollections)
                          .Select(addStaticElements)
                          .AsDriver(schedulerProvider);
        }
 protected BaseServerQueryHandler(
     IAnalyticsService analyticsService)
 {
     AnalyticsService = analyticsService;
 }
Exemplo n.º 50
0
 public AnalyticsManager(IAnalyticsService analytics)
 {
     this.analytics = analytics;
 }
Exemplo n.º 51
0
 public TrendsChartSettingsService(IAnalyticsService analyticsService, IPreferences preferences) =>
 (_analyticsService, _preferences) = (analyticsService, preferences);
Exemplo n.º 52
0
 public GitHubApiV3Service(IAnalyticsService analyticsService, IMainThread mainThread, GitHubUserService gitHubUserService) : base(analyticsService, mainThread)
 {
     _gitHubUserService = gitHubUserService;
 }
Exemplo n.º 53
0
 public WebClient(IAnalyticsService analyticsService)
 {
     _analyticsService = analyticsService;
 }
Exemplo n.º 54
0
 public UpdatePackageProvider(IHttpClient httpClient, ISonarrCloudRequestBuilder requestBuilder, IAnalyticsService analyticsService, IPlatformInfo platformInfo)
 {
     _platformInfo     = platformInfo;
     _analyticsService = analyticsService;
     _requestBuilder   = requestBuilder.Services;
     _httpClient       = httpClient;
 }
 public EventPageViewModel(IAnalyticsService analytics, INavigator navigator, EventPage page, IDialogProvider dialogProvider) : base(analytics, navigator, page, dialogProvider)
 {
 }
Exemplo n.º 56
0
        public App()
        {
            //Calling order found was:: Dispatcher -> Main Window -> XAML Application Dispatcher -> Unhandeled
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            Dispatcher.UnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Dispatcher_UnhandledException);
            Application.Current.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(Application_DispatcherUnhandledException);
            MainWindow mwindow = container.Resolve <MainWindow>();

            container.RegisterInstance <MainWindow>(mwindow);///new line
            mwindow.Show();
            mwindow.Visibility = Visibility.Hidden;

            ShowProgressbar();        //strat showing progress bar
            bool BlueSkyFound = true; //Assuming BlueSky R package is present.

            LifetimeService.Instance.Container = container;
            container.RegisterInstance <ILoggerService>(new LoggerService());                   /// For Application log. Starts with default level "Error"
            container.RegisterInstance <IConfigService>(new ConfigService());                   //For App Config file
            container.RegisterInstance <IAdvancedLoggingService>(new AdvancedLoggingService()); //For Advanced Logging
            ////////////// TRY LOADING BSKY R PACKAGES HERE  /////////

            ILoggerService logService = container.Resolve <ILoggerService>();

            logService.SetLogLevelFromConfig();                                               //loading log level from config file
            logService.WriteToLogLevel("R.Net,Logger and Config loaded:", LogLevelEnum.Info); ///

            ////Recent default packages. This code must appear before loading any R package. (including uadatapackage)
            XMLitemsProcessor defaultpackages = container.Resolve <XMLitemsProcessor>();//06Feb2014

            defaultpackages.MaxRecentItems = 50;
            defaultpackages.XMLFilename    = string.Format(@"{0}DefaultPackages.xml", BSkyAppData.BSkyDataDirConfigFwdSlash);//23Apr2015 @"./Config/DefaultPackages.xml";
            defaultpackages.RefreshXMLItems();
            container.RegisterInstance <XMLitemsProcessor>(defaultpackages);

            //Recent user packages. This code must appear before loading any R package. (including uadatapackage)
            RecentItems userpackages = container.Resolve <RecentItems>();//06Feb2014

            userpackages.MaxRecentItems = 50;
            userpackages.XMLFilename    = string.Format(@"{0}UserPackages.xml", BSkyAppData.BSkyDataDirConfigFwdSlash);//23Apr2015 @"./Config/UserPackages.xml";
            userpackages.RefreshXMLItems();
            container.RegisterInstance <RecentItems>(userpackages);

            try
            {
                BridgeSetup.ConfigureContainer(container);
            }
            catch (Exception ex)
            {
                string s1 = "\n1. R is installed. BlueSky Statistics requires R.";
                string s2 = "\n2. Binary incompatibility between BlueSky Statistics and R. 64bit BlueSky Statistics requires 64bit R and 32bit BlueSky Statistics required 32bit R. (Go to Help > About in BlueSky Statistics)";
                string s3 = "\n3. Another session of the BlueSky application is not already running.";
                MessageBox.Show("Please make sure:" + s1 + s2 + s3, "Error: Can't Launch BlueSky Application!", MessageBoxButton.OK, MessageBoxImage.Stop);
                logService.WriteToLogLevel("Unable to launch the BlueSky Application." + s1 + s3, LogLevelEnum.Error);
                Environment.Exit(0);
            }
            finally
            {
                HideProgressbar();
            }
            container.RegisterInstance <IDashBoardService>(container.Resolve <XmlDashBoardService>());
            container.RegisterInstance <IDataService>(container.Resolve <DataService>());

            IOutputWindowContainer iowc = container.Resolve <OutputWindowContainer>();

            container.RegisterInstance <IOutputWindowContainer>(iowc);

            SessionDialogContainer sdc = container.Resolve <SessionDialogContainer>(); //13Feb2013
            //Recent Files settings
            RecentDocs rdoc = container.Resolve <RecentDocs>();                        //21Feb2013

            rdoc.MaxRecentItems = 7;
            rdoc.XMLFilename    = string.Format(@"{0}Recent.xml", BSkyAppData.BSkyDataDirConfigFwdSlash);
            container.RegisterInstance <RecentDocs>(rdoc);

            Window1 window = container.Resolve <Window1>();

            container.RegisterInstance <Window1>(window);     ///new line
            window.Closed += new EventHandler(window_Closed); //28Jan2013
            window.Owner   = mwindow;                         //28Jan2013

            window.Show();
            window.Activate();
            ShowMouseBusy();//02Apr2015 show mouse busy
            //// one Syntax Editor window for one session ////29Jan2013
            SyntaxEditorWindow sewindow = container.Resolve <SyntaxEditorWindow>();

            container.RegisterInstance <SyntaxEditorWindow>(sewindow);///new line
            sewindow.Owner = mwindow;

            //load default packages
            window.setLMsgInStatusBar("Please wait ... Loading required R packages ...");
            IAnalyticsService IAService = LifetimeService.Instance.Container.Resolve <IAnalyticsService>();

            BridgeSetup.LoadDefaultRPackages(IAService);
            string PkgLoadStatusMessage = BridgeSetup.PkgLoadStatusMessage;

            if (PkgLoadStatusMessage != null && PkgLoadStatusMessage.Trim().Length > 0)
            {
                StringBuilder sb          = new StringBuilder();
                string[]      defpacklist = PkgLoadStatusMessage.Split('\n');
                foreach (string s in defpacklist)
                {
                    if (s != null && (s.ToLower().Contains("error"))) //|| s.ToLower().Contains("warning")))
                    {
                        sb.Append(s.Replace("Error loading R package:", "") + "\n");
                    }
                }
                if (sb.Length > 0)
                {
                    sb.Remove(sb.Length - 1, 1);//removing last comma
                    string defpkgs  = sb.ToString();
                    string firstmsg = "Error loading following R package(s):\n\n";
                    string msg      = "\n\nInstall required R packages from CRAN by clicking:\nTools > Package > Install required package(s) from CRAN.";// +

                    HideMouseBusy();
                    MessageBox.Show(firstmsg + defpkgs + msg, "Error: Required R Package(s) Missing", MessageBoxButton.OK, MessageBoxImage.Warning);

                    if (defpkgs.Contains("BlueSky"))
                    {
                        BlueSkyFound = false;
                    }
                }
            }

            //deimal default should be set here as now BlueSky is loaded
            window.SetRDefaults();
            IAdvancedLoggingService advlog = container.Resolve <IAdvancedLoggingService>();;//01May2015

            advlog.RefreshAdvancedLogging();

            HideMouseBusy();//02Apr2015 hide mouse busy
            if (BlueSkyFound)
            {
                try
                {
                    //Try loading empty dataset(newdataset) just after app finished loading itself and R packages.
                    FileNewCommand newds = new FileNewCommand();
                    newds.NewFileOpen("");
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error Loading new dataset. Make sure you have BlueSky R package installed", "BlueSky pacakge missing", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
            window.setLMsgInStatusBar("For additional functionality and for details on the commercial edition, ");
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="PdfWebViewPageViewModel"/> class.
 /// </summary>
 /// <param name="analyticsService">The analytics service.</param>
 /// <param name="uri">The for the pdf file.</param>
 public PdfWebViewPageViewModel(IAnalyticsService analyticsService, string uri) : base(analyticsService)
 {
     Uri = uri;
 }
Exemplo n.º 58
0
 public AnalyticsController(IAnalyticsService analyticsService)
 {
     _analyticsService = analyticsService;
 }
Exemplo n.º 59
0
 public BaseViewModel(IAnalyticsService analyticsService)
 {
     AnalyticsService = analyticsService;
     BackCommand      = new AsyncCommand(() => BackAsync());
 }
Exemplo n.º 60
0
        private static void configurePullTransitions(
            ITransitionConfigurator transitions,
            ITogglDatabase database,
            ITogglApi api,
            ITogglDataSource dataSource,
            ITimeService timeService,
            IAnalyticsService analyticsService,
            IScheduler scheduler,
            StateResult entryPoint,
            ILeakyBucket leakyBucket,
            IRateLimiter rateLimiter,
            ISyncStateQueue queue)
        {
            var delayState = new WaitForAWhileState(scheduler, analyticsService);

            var fetchAllSince = new FetchAllSinceState(api, database.SinceParameters, timeService, leakyBucket, rateLimiter);

            var ensureFetchWorkspacesSucceeded        = new EnsureFetchListSucceededState <IWorkspace>();
            var ensureFetchWorkspaceFeaturesSucceeded = new EnsureFetchListSucceededState <IWorkspaceFeatureCollection>();
            var ensureFetchTagsSucceeded        = new EnsureFetchListSucceededState <ITag>();
            var ensureFetchClientsSucceeded     = new EnsureFetchListSucceededState <IClient>();
            var ensureFetchProjectsSucceeded    = new EnsureFetchListSucceededState <IProject>();
            var ensureFetchTasksSucceeded       = new EnsureFetchListSucceededState <ITask>();
            var ensureFetchTimeEntriesSucceeded = new EnsureFetchListSucceededState <ITimeEntry>();
            var ensureFetchUserSucceeded        = new EnsureFetchSingletonSucceededState <IUser>();
            var ensureFetchPreferencesSucceeded = new EnsureFetchSingletonSucceededState <IPreferences>();

            var scheduleCleanUp = new ScheduleCleanUpState(queue);

            var detectGainingAccessToWorkspaces =
                new DetectGainingAccessToWorkspacesState(
                    dataSource.Workspaces,
                    analyticsService,
                    () => new HasFinsihedSyncBeforeInteractor(dataSource));

            var resetSinceParams = new ResetSinceParamsState(database.SinceParameters);

            var persistNewWorkspaces =
                new PersistNewWorkspacesState(dataSource.Workspaces);

            var detectLosingAccessToWorkspaces =
                new DetectLosingAccessToWorkspacesState(dataSource.Workspaces, analyticsService);

            var deleteRunningInaccessibleTimeEntry = new DeleteInaccessibleRunningTimeEntryState(dataSource.TimeEntries);

            var markWorkspacesAsInaccessible = new MarkWorkspacesAsInaccessibleState(dataSource.Workspaces);

            var persistWorkspaces =
                new PersistListState <IWorkspace, IDatabaseWorkspace, IThreadSafeWorkspace>(dataSource.Workspaces, Workspace.Clean);

            var updateWorkspacesSinceDate =
                new UpdateSinceDateState <IWorkspace>(database.SinceParameters);

            var detectNoWorkspaceState = new DetectNotHavingAccessToAnyWorkspaceState(dataSource);

            var persistWorkspaceFeatures =
                new PersistListState <IWorkspaceFeatureCollection, IDatabaseWorkspaceFeatureCollection, IThreadSafeWorkspaceFeatureCollection>(
                    dataSource.WorkspaceFeatures, WorkspaceFeatureCollection.From);

            var persistUser =
                new PersistSingletonState <IUser, IDatabaseUser, IThreadSafeUser>(dataSource.User, User.Clean);

            var noDefaultWorkspaceDetectingState = new DetectUserHavingNoDefaultWorkspaceSetState(dataSource, analyticsService);

            var trySetDefaultWorkspaceState = new TrySetDefaultWorkspaceState(timeService, dataSource);

            var persistTags =
                new PersistListState <ITag, IDatabaseTag, IThreadSafeTag>(dataSource.Tags, Tag.Clean);

            var updateTagsSinceDate = new UpdateSinceDateState <ITag>(database.SinceParameters);

            var persistClients =
                new PersistListState <IClient, IDatabaseClient, IThreadSafeClient>(dataSource.Clients, Client.Clean);

            var updateClientsSinceDate = new UpdateSinceDateState <IClient>(database.SinceParameters);

            var persistPreferences =
                new PersistSingletonState <IPreferences, IDatabasePreferences, IThreadSafePreferences>(dataSource.Preferences, Preferences.Clean);

            var persistProjects =
                new PersistListState <IProject, IDatabaseProject, IThreadSafeProject>(dataSource.Projects, Project.Clean);

            var updateProjectsSinceDate = new UpdateSinceDateState <IProject>(database.SinceParameters);

            var createProjectPlaceholders = new CreateArchivedProjectPlaceholdersState(dataSource.Projects, analyticsService);

            var persistTimeEntries =
                new PersistListState <ITimeEntry, IDatabaseTimeEntry, IThreadSafeTimeEntry>(dataSource.TimeEntries, TimeEntry.Clean);

            var updateTimeEntriesSinceDate = new UpdateSinceDateState <ITimeEntry>(database.SinceParameters);

            var persistTasks =
                new PersistListState <ITask, IDatabaseTask, IThreadSafeTask>(dataSource.Tasks, Task.Clean);

            var updateTasksSinceDate = new UpdateSinceDateState <ITask>(database.SinceParameters);

            var refetchInaccessibleProjects =
                new TryFetchInaccessibleProjectsState(dataSource.Projects, timeService, api.Projects);

            // start all the API requests first
            transitions.ConfigureTransition(entryPoint, fetchAllSince);

            // prevent overloading server with too many requests
            transitions.ConfigureTransition(fetchAllSince.PreventOverloadingServer, delayState);

            // detect gaining access to workspaces
            transitions.ConfigureTransition(fetchAllSince.Done, ensureFetchWorkspacesSucceeded);
            transitions.ConfigureTransition(ensureFetchWorkspacesSucceeded.Done, detectGainingAccessToWorkspaces);
            transitions.ConfigureTransition(detectGainingAccessToWorkspaces.Done, detectLosingAccessToWorkspaces);
            transitions.ConfigureTransition(detectGainingAccessToWorkspaces.NewWorkspacesDetected, resetSinceParams);
            transitions.ConfigureTransition(resetSinceParams.Done, persistNewWorkspaces);
            transitions.ConfigureTransition(persistNewWorkspaces.Done, fetchAllSince);

            // detect losing access to workspaces
            transitions.ConfigureTransition(detectLosingAccessToWorkspaces.Done, persistWorkspaces);
            transitions.ConfigureTransition(detectLosingAccessToWorkspaces.WorkspaceAccessLost, markWorkspacesAsInaccessible);
            transitions.ConfigureTransition(markWorkspacesAsInaccessible.Done, scheduleCleanUp);
            transitions.ConfigureTransition(scheduleCleanUp.Done, deleteRunningInaccessibleTimeEntry);
            transitions.ConfigureTransition(deleteRunningInaccessibleTimeEntry.Done, persistWorkspaces);

            // persist all the data pulled from the server
            transitions.ConfigureTransition(persistWorkspaces.Done, updateWorkspacesSinceDate);
            transitions.ConfigureTransition(updateWorkspacesSinceDate.Done, detectNoWorkspaceState);
            transitions.ConfigureTransition(detectNoWorkspaceState.Done, ensureFetchUserSucceeded);

            transitions.ConfigureTransition(ensureFetchUserSucceeded.Done, persistUser);
            transitions.ConfigureTransition(persistUser.Done, ensureFetchWorkspaceFeaturesSucceeded);

            transitions.ConfigureTransition(ensureFetchWorkspaceFeaturesSucceeded.Done, persistWorkspaceFeatures);
            transitions.ConfigureTransition(persistWorkspaceFeatures.Done, ensureFetchPreferencesSucceeded);

            transitions.ConfigureTransition(ensureFetchPreferencesSucceeded.Done, persistPreferences);
            transitions.ConfigureTransition(persistPreferences.Done, ensureFetchTagsSucceeded);

            transitions.ConfigureTransition(ensureFetchTagsSucceeded.Done, persistTags);
            transitions.ConfigureTransition(persistTags.Done, updateTagsSinceDate);
            transitions.ConfigureTransition(updateTagsSinceDate.Done, ensureFetchClientsSucceeded);

            transitions.ConfigureTransition(ensureFetchClientsSucceeded.Done, persistClients);
            transitions.ConfigureTransition(persistClients.Done, updateClientsSinceDate);
            transitions.ConfigureTransition(updateClientsSinceDate.Done, ensureFetchProjectsSucceeded);

            transitions.ConfigureTransition(ensureFetchProjectsSucceeded.Done, persistProjects);
            transitions.ConfigureTransition(persistProjects.Done, updateProjectsSinceDate);
            transitions.ConfigureTransition(updateProjectsSinceDate.Done, ensureFetchTasksSucceeded);

            transitions.ConfigureTransition(ensureFetchTasksSucceeded.Done, persistTasks);
            transitions.ConfigureTransition(persistTasks.Done, updateTasksSinceDate);
            transitions.ConfigureTransition(updateTasksSinceDate.Done, ensureFetchTimeEntriesSucceeded);

            transitions.ConfigureTransition(ensureFetchTimeEntriesSucceeded.Done, createProjectPlaceholders);
            transitions.ConfigureTransition(createProjectPlaceholders.Done, persistTimeEntries);
            transitions.ConfigureTransition(persistTimeEntries.Done, updateTimeEntriesSinceDate);
            transitions.ConfigureTransition(updateTimeEntriesSinceDate.Done, refetchInaccessibleProjects);
            transitions.ConfigureTransition(refetchInaccessibleProjects.FetchNext, refetchInaccessibleProjects);

            transitions.ConfigureTransition(refetchInaccessibleProjects.Done, noDefaultWorkspaceDetectingState);
            transitions.ConfigureTransition(noDefaultWorkspaceDetectingState.NoDefaultWorkspaceDetected, trySetDefaultWorkspaceState);
            transitions.ConfigureTransition(noDefaultWorkspaceDetectingState.Done, new DeadEndState());
            transitions.ConfigureTransition(trySetDefaultWorkspaceState.Done, new DeadEndState());

            // fail for server errors
            transitions.ConfigureTransition(ensureFetchWorkspacesSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchUserSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchWorkspaceFeaturesSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchPreferencesSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchTagsSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchClientsSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchProjectsSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchTasksSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(ensureFetchTimeEntriesSucceeded.ErrorOccured, new FailureState());
            transitions.ConfigureTransition(refetchInaccessibleProjects.ErrorOccured, new FailureState());

            // delay loop
            transitions.ConfigureTransition(delayState.Done, fetchAllSince);
        }