Ejemplo n.º 1
0
 public AboutUsPageViewModel(
     INavigationService navigationService,
     IAnalyticService analyticService) : base(navigationService)
 {
     Title = "About Us";
     analyticService.TrackScreen("about-us-page");
 }
Ejemplo n.º 2
0
        public ContactUsPageViewModel(
            INavigationService navigationService,
            IAnalyticService analyticService,
            IUserService userService) : base(navigationService)
        {
            Title = "Contact Us";
            analyticService.TrackScreen("contact-us-page");
            AddValidationRules();

            Submit = ReactiveCommand.CreateFromTask(
                async _ =>
            {
                if (!IsValid())
                {
                    return;
                }

                analyticService.TrackTapEvent("submit");

                var random = new Random();
                await Task.Delay(random.Next(400, 2000));
                await NavigationService.GoBackAsync(useModalNavigation: true).ConfigureAwait(false);
            });

            Submit.IsExecuting
            .StartWith(false)
            .ToProperty(this, x => x.IsBusy, out _isBusy);

            NavigatingTo
            .Take(1)
            .Subscribe(_ =>
            {
                Email.Value = userService.AuthenticatedUser.EmailAddress;
            });
        }
Ejemplo n.º 3
0
 public PrivacyPolicyPageViewModel(
     INavigationService navigationService,
     IAnalyticService analyticService) : base(navigationService)
 {
     Title = "Privacy Policy";
     analyticService.TrackScreen("privacy-policy-page");
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Creates an instance of the <see cref="MainViewModelNew"/> class.
        /// </summary>
        /// <param name="session">An autheticated session for the current user.</param>
        /// <param name="analyticService"An IAnalyticService provider.></param>
        /// <param name="userService">An IUserService provider.</param>
        public MainViewModelNew(DTO.Session <DTO.NullT> session, IAnalyticService analyticService, IUserService userService) : this()
        {
            if (session == null)
            {
                throw new ArgumentNullException("session", "session cannot be null.");
            }

            if (analyticService == null)
            {
                throw new ArgumentNullException("analyticService", "Value cannot be null.");
            }

            if (userService == null)
            {
                throw new ArgumentNullException("userService", "Value cannot be null.");
            }

            base.Session      = session;
            base.UserServices = new UserDisplayServices(userService);
            _analyticService  = analyticService;
            _userService      = userService;
            //Modules = session.Modules.ToDisplayEntities();
            CurrentUser = session.User.ToDisplayEntity();

            Modules = session.Modules.ToDisplayEntities();
            //Modules = userService.Authenticate(Session).Modules.ToDisplayEntities();
            SelectedModule = Modules.Where(x => x.TypeId == DTO.ModuleType.Planning).FirstOrDefault();
        }
Ejemplo n.º 5
0
        private void Edit(AnalyticDisplayModel analyticDisplayModel)
        {
            AnalyticEditModel analytic = new AnalyticEditModel
            {
                FirstName   = analyticDisplayModel.FirstName,
                LastName    = analyticDisplayModel.LastName,
                PhoneNumber = analyticDisplayModel.PhoneNumber,
                Login       = analyticDisplayModel.Login
            };

            AnalyticInfoViewModel viewModel = new AnalyticInfoViewModel(analytic);
            AnalyticInfoControl   control   = new AnalyticInfoControl(viewModel);
            Window window = WindowFactory.CreateByContentsSize(control);

            viewModel.AnalyticEdited += (s, e) =>
            {
                AnalyticEditModel analyticEditModel = e.Analytic;
                AnalyticEditDTO   analyticEditDTO   = Mapper.Map <AnalyticEditModel, AnalyticEditDTO>(analyticEditModel);

                using (IAnalyticService service = factory.CreateAnalyticService())
                {
                    ServiceMessage serviceMessage = service.Update(analyticEditDTO);
                    RaiseReceivedMessageEvent(serviceMessage);

                    if (serviceMessage.IsSuccessful)
                    {
                        window.Close();
                        Notify();
                    }
                }
            };

            window.Show();
        }
 public OpenDoorViewModel(
     IAuthenticationService authenticationService,
     IAnalyticService analyticService)
 {
     _authenticationService = authenticationService;
     _analyticService       = analyticService;
     _nfcService            = DependencyService.Get <INfcService>();
 }
Ejemplo n.º 7
0
        public MyRoomViewModel(
            IOpenUriService openUrlService,
            IAnalyticService analyticService)
        {
            _openUrlService  = openUrlService;
            _analyticService = analyticService;

            SetNeed();
        }
        public NotificationsViewModel(
            INotificationService notificationService,
            IAnalyticService analyticService)
        {
            _notificationService = notificationService;
            _analyticService     = analyticService;

            HasItems = true;
        }
 /// <summary>
 /// Tracks tap events (button clicks, tap gestures, etc...).
 /// </summary>
 /// <param name="analyticService">The analytic service.</param>
 /// <param name="itemTapped">The item that was tapped.</param>
 public static void TrackTapEvent(this IAnalyticService analyticService, string itemTapped)
 {
     analyticService?.TrackEvent(
         "tapped",
         new Dictionary <string, string>
     {
         { "tapped_item", itemTapped }
     });
 }
Ejemplo n.º 10
0
        public BookingViewModel(
            IAnalyticService analyticService,
            IHotelService hotelService)
        {
            _analyticService = analyticService;
            _hotelService    = hotelService;

            _cities      = new List <Models.City>();
            _suggestions = new List <string>();
        }
        public MyRoomViewModel(
            IOpenUriService openUrlService,
            IAnalyticService analyticService)
        {
            _openUrlService  = openUrlService;
            _analyticService = analyticService;

            // Сразу делаем активной вкладку потребностей
            SetNeed();
        }
        public RegistrationTypeSelectionPageViewModel(
            INavigationService navigationService,
            IAnalyticService analyticService,
            IFirebaseAuthService authService,
            IUserDialogs dialogs) : base(navigationService)
        {
            Title = "Registration Type";
            analyticService.TrackScreen("registration-type");

            Tradesman = ReactiveCommand.CreateFromTask(async() =>
            {
                await dialogs.AlertAsync("Coming Soon!").ConfigureAwait(false);
                analyticService.TrackTapEvent("register-as-tradesman");

                //await navigationService.NavigateAsync(nameof(TradesmentRegistrationPage)).ConfigureAwait(false);
            });

            Contractor = ReactiveCommand.CreateFromTask(async() =>
            {
                analyticService.TrackTapEvent("register-as-contractor");
                await navigationService.NavigateAsync(
                    nameof(ContractorRegistrationPage),
                    new NavigationParameters {
                    { "user_id", _userId }
                }).ConfigureAwait(false);
            });

            GoBack = ReactiveCommand.CreateFromTask <Unit, Unit>(async _ =>
            {
                var result = await dialogs.ConfirmAsync(
                    new ConfirmConfig
                {
                    Title      = "Cancel Account Creation?",
                    Message    = "Are you sure you want to cancel account creation?  This will discard any information you have entered so far",
                    OkText     = "Yes",
                    CancelText = "No"
                });
                if (result)
                {
                    analyticService.TrackTapEvent("cancel-account-creation");

                    // make sure we log out so the user has to log in again
                    await authService.Logout();

                    await NavigationService.NavigateToLoginPageAsync().ConfigureAwait(false);
                }

                return(Unit.Default);
            });

            NavigatingTo
            .Where(args => args.ContainsKey("user_id"))
            .Select(args => args["user_id"].ToString())
            .BindTo(this, x => x._userId);
        }
        /// <summary>
        /// Tracks a screen view.
        /// </summary>
        /// <param name="analyticService">The analytic service.</param>
        /// <param name="screenName">Name of the screen.</param>
        /// <param name="additionalProperties">The additional properties related to the screen.</param>
        public static void TrackScreen(
            this IAnalyticService analyticService,
            string screenName,
            IDictionary <string, string> additionalProperties = null)
        {
            // get or create the dictionary to submit with the event
            additionalProperties = additionalProperties ?? new Dictionary <string, string>();
            additionalProperties.Add("screen_name", screenName);

            analyticService?.TrackEvent("screen_view", additionalProperties);
        }
        public BookingViewModel(
            IAnalyticService analyticService,
            IHotelService hotelService)
        {
            this.analyticService   = analyticService;
            this.hotelService      = hotelService;
            dismissKeyboardService = DependencyService.Get <IDismissKeyboardService>();

            cities      = new List <Models.City>();
            suggestions = new List <string>();
        }
        public SettingsViewModel(
            IAnalyticService analyticService,
            ISettingsService <TRemoteSettingsModel> settingsService)
        {
            _analyticService = analyticService;
            _settingsService = settingsService;

            _settingsFileUrl = new ValidatableObject <string>();

            AddValidations();
        }
Ejemplo n.º 16
0
        public LoginViewModel(
            IAnalyticService analyticService,
            IAuthenticationService authenticationService)
        {
            _analyticService       = analyticService;
            _authenticationService = authenticationService;

            _userName = new ValidatableObject <string>();
            _password = new ValidatableObject <string>();

            AddValidations();
        }
Ejemplo n.º 17
0
 public RelationService(IBaseGenericRepository <Relation> relationRepository,
                        IBaseGenericRepository <Beacon> beaconRepository,
                        IBaseGenericRepository <Artifact> artifactRepository,
                        IBaseGenericRepository <Content> contentRepository,
                        IAnalyticService analyticService, IMapper mapper)
 {
     _relationRepository = relationRepository;
     _beaconRepository   = beaconRepository;
     _artifactRepository = artifactRepository;
     _contentRepository  = contentRepository;
     _analyticService    = analyticService;
     _mapper             = mapper;
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:FacesToSmileys.ViewModels.TakePhotoViewModel"/> class.
        /// </summary>
        /// <param name="photoService">Photo service.</param>
        /// <param name="imageProcessiongService">Image processiong service.</param>
        /// <param name="detectionService">Detection service.</param>
        /// <param name="fileService">File service.</param>
        public TakePhotoViewModel(IPhotoService photoService,
                                  IImageProcessingService imageProcessiongService,
                                  IDetectionService detectionService,
                                  IFileService fileService,
                                  IAnalyticService analyticService)
        {
            PhotoService           = photoService;
            ImageProcessingService = imageProcessiongService;
            DetectionService       = detectionService;
            FileService            = fileService;
            AnalyticService        = analyticService;

            Initialize();
        }
Ejemplo n.º 19
0
        public ProjectDetailsPageViewModel(
            INavigationService navigationService,
            IAnalyticService analyticService) : base(navigationService)
        {
            Title = "Project Details";
            analyticService.TrackScreen("project-detail");

            NavigatedTo
            .Take(1)
            .Select(args => (Project)args["project"])
            .Subscribe(project =>
            {
                Project = project;
            });
        }
Ejemplo n.º 20
0
 public ViewComponentController(
     IMapper mapper,
     IUnitOfWorkAsync unitOfWork,
     IAnalyticService analyticService,
     ILotteryHistoryService lotteryHistoryService,
     IPricePredictionHistoryService pricePredictionHistoryService,
     ISysUserService sysUserService)
 {
     this._mapper                        = mapper;
     this._sysUserService                = sysUserService;
     this._lotteryHistoryService         = lotteryHistoryService;
     this._pricePredictionHistoryService = pricePredictionHistoryService;
     this._analyticService               = analyticService;
     this._unitOfWork                    = unitOfWork;
 }
        public AnalyticDisplayServices(IAnalyticService analyticService, DTO.Session <DTO.NullT> session)
        {
            if (analyticService == null)
            {
                throw new ArgumentNullException("analyticService", "Value cannot be null.");
            }
            if (session == null)
            {
                throw new ArgumentNullException("session", "Value cannot be null.");
            }


            _analyticService = analyticService;
            _session         = session;
        }
        public AnalyticModuleViewModel(IAnalyticService repo, Session <NullT> session, string name)
        {
            Name = name;

            //EventManager.GetEvent<SaveEvent>()
            //    .Subscribe(evt =>
            //    {
            //        Domain.Analytic analyticToSave = null;
            //        //ViewModelBase vm = null;
            //        switch (evt.Section)
            //        {
            //            case Domain.SectionType.PlanningHomeMyMarkuprules:
            //                break;
            //            case Domain.SectionType.PlanningHomeMyRoundingrules:
            //                break;
            //            case Domain.SectionType.PlanningAnalyticsMyAnalytics:
            //                break;
            //            case Domain.SectionType.PlanningAnalyticsIdentity:
            //                var vmi = (ViewModels.Analytic.IdentityViewModel)(SelectedStepViewModel);
            //                var tagsToSave = vmi.SelectedTags;
            //                analyticToSave = vmi.SelectedAnalytic;
            //                vmi.SelectedAnalytic.Tags = tagsToSave.Select(y => y.Value).ToList<string>();


            //                //repo.SaveIdentity(session.Clone<Client.Entity.Analytic>(analyticToSave));
            //                this.Navigate(new NavigateEvent { Module = Domain.ModuleType.Planning, SubModule = Domain.SubModuleType.Analytics, Section = Domain.SectionType.PlanningAnalyticsFilters });
            //                break;
            //            case Domain.SectionType.PlanningAnalyticsFilters:
            //                var vmf = (ViewModels.Analytic.FilterViewModel)(SelectedStepViewModel);
            //                analyticToSave = vmf.SelectedAnalytic;



            //                //repo.SaveFilters(analyticToSave);
            //                this.Navigate(new NavigateEvent { Module = Domain.ModuleType.Planning, SubModule = Domain.SubModuleType.Analytics, Section = Domain.SectionType.PlanningAnalyticsFilters });
            //                break;
            //            case Domain.SectionType.PlanningAnalyticsPriceLists:
            //                break;
            //            case Domain.SectionType.PlanningAnalyticsValueDrivers:
            //                break;
            //            case Domain.SectionType.PlanningAnalyticsResults:
            //                break;
            //            default:
            //                break;
            //        }
            //    });
        }
Ejemplo n.º 23
0
        public MyRoomViewModel(
            IOpenUriService openUrlService,
            IAnalyticService analyticService,
            IRoomDevicesDataService roomDevicesDataService)
        {
            this.openUrlService         = openUrlService;
            this.analyticService        = analyticService;
            this.roomDevicesDataService = roomDevicesDataService;


            delayedTemperatureChangedTimer = new Timer(sliderInertia,
                                                       async() => { await UpdateRoomTemperature(DesiredTemperature); });

            delayedLightChangedTimer = new Timer(sliderInertia,
                                                 async() => { await UpdateRoomLight(DesiredAmbientLight); });

            SetNeed();
        }
        public AuthenticationService(IAnalyticService analyticService,
                                     ISettingsService settingsService,
                                     IOperations operations)
        {
            _analyticService = analyticService;
            _settingsService = settingsService;
            _operations      = operations;
            var userJson = _settingsService.GetItem(Constants.SettingKeys.UserSettingKey);

            if (!string.IsNullOrEmpty(userJson))
            {
                try
                {
                    User = JsonConvert.DeserializeObject <UserModel>(userJson);
                    _analyticService.Init(User.Email, User.Id.ToString());
                }
                catch (Exception ex)
                {
                }
            }
        }
Ejemplo n.º 25
0
        public override IEnumerable <AnalyticDisplayModel> GetAll()
        {
            IEnumerable <AnalyticDisplayModel> analyticModels = null;

            using (IAnalyticService service = factory.CreateAnalyticService())
            {
                DataServiceMessage <IEnumerable <AnalyticDisplayDTO> > serviceMessage = service.GetAll();

                RaiseReveivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);
                if (serviceMessage.IsSuccessful)
                {
                    IEnumerable <AnalyticDisplayDTO> analyticDTOs = serviceMessage.Data;
                    analyticModels = analyticDTOs.Select(analyticDTO => Mapper.Map <AnalyticDisplayDTO, AnalyticDisplayModel>(analyticDTO));
                }
                else
                {
                    analyticModels = new List <AnalyticDisplayModel>();
                }
            }

            return(analyticModels);
        }
Ejemplo n.º 26
0
        public UIElement GetDisplayElement()
        {
            ManageAnalyticsViewModel viewModel = new ManageAnalyticsViewModel(this, facade);
            ManageAnalyticsControl   control   = new ManageAnalyticsControl(viewModel);

            viewModel.AnalyticEdit    += (s, e) => Edit(e.Analytic);
            viewModel.AnalyticDeleted += (s, e) =>
            {
                using (IAnalyticService service = factory.CreateAnalyticService())
                {
                    AnalyticDisplayDTO deletedAnalytic = Mapper.Map <AnalyticDisplayModel, AnalyticDisplayDTO>(e.Analytic);
                    ServiceMessage     serviceMessage  = service.Delete(deletedAnalytic.Login);

                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        Notify();
                    }
                }
            };

            return(control);
        }
Ejemplo n.º 27
0
        public ProjectsPageViewModel(
            INavigationService navigationService,
            IProjectDataStore projectDataStore,
            IAnalyticService analyticService) : base(navigationService)
        {
            Title = "Projects";

            this.WhenActivated((CompositeDisposable _) =>
            {
                // track every time this screen is activated
                analyticService.TrackScreen("my-projects");
            });

            ViewProjectDetails = ReactiveCommand.CreateFromTask <Project, Unit>(async project =>
            {
                analyticService.TrackTapEvent("view-project");

                await NavigationService.NavigateAsync(
                    nameof(ProjectDetailsPage),
                    new NavigationParameters
                {
                    { "project", project }
                }).ConfigureAwait(false);

                return(Unit.Default);
            });

            AddProject = ReactiveCommand.CreateFromTask(async() =>
            {
                analyticService.TrackTapEvent("new-project");
                await NavigationService.NavigateAsync($"NavigationPage/{nameof(EditProjectPage)}", useModalNavigation: true).ConfigureAwait(false);
            });

            Filter = ReactiveCommand.CreateFromTask(async() =>
            {
                // TODO: Finish this
                await NavigationService.NavigateAsync(
                    $"NavigationPage/{nameof(ProjectFilterPage)}",
                    new NavigationParameters
                {
                    { "filter", _filter }
                },
                    useModalNavigation: true).ConfigureAwait(false);
            });

            // set up the command used to load projects
            LoadProjects = ReactiveCommand.CreateFromTask(_ =>
            {
                this.Log().Debug($"Loading projects on thread: {Thread.CurrentThread.ManagedThreadId}, IsBackground = {Thread.CurrentThread.IsBackground}");
                AssertRunningOnBackgroundThread();
                return(projectDataStore.LoadOldProjects(_oldestProject, ItemsPerPage));
            });

            // set up the command used to refresh projects
            RefreshProjects = ReactiveCommand.CreateFromTask(_ =>
            {
                // TODO: Should track this with analytics?
                this.Log().Debug($"Refreshing projects on thread: {Thread.CurrentThread.ManagedThreadId}, IsBackground = {Thread.CurrentThread.IsBackground}");
                AssertRunningOnBackgroundThread();
                return(_newestProject != null ?
                       projectDataStore.LoadNewProjects(_newestProject, ItemsPerPage) :
                       projectDataStore.LoadNewProjects(ItemsPerPage));
            });

            LoadProjects
            .Merge(RefreshProjects)
            .SubscribeSafe(projects =>
            {
                if (projects.Any())
                {
                    // NOTE: This probably isn't necessary...
                    projects = projects.ExceptBy(Projects, p => p.ProjectId);

                    // get the oldest and newest projects from the new data set. Age is simply
                    // determined by the date the project was created
                    var oldProject = projects.MinBy(p => p.CreateDate).First();
                    var newProject = projects.MaxBy(p => p.CreateDate).First();

                    if (_oldestProject == null && _newestProject == null)
                    {
                        _oldestProject = oldProject;
                        _newestProject = newProject;

                        // first projects being added. Add them to the list
                        Projects.AddRange(projects);
                    }
                    else if (_oldestProject?.CreateDate > oldProject.CreateDate)
                    {
                        _oldestProject = oldProject;

                        // if the projects are older, add them to the end of the list
                        Projects.AddRange(projects);
                    }
                    else if (_newestProject?.CreateDate < newProject.CreateDate)
                    {
                        _newestProject = newProject;

                        // if the projects are newer, insert them at the beginning of the list
                        Projects.InsertRange(0, projects);
                    }
                }
            });

            // when either of the commands are executing, update the busy state
            LoadProjects.IsExecuting
            .CombineLatest(RefreshProjects.IsExecuting, (isLoadExecuting, isRefreshExecuting) => isLoadExecuting || isRefreshExecuting)
            .DistinctUntilChanged()
            .StartWith(false)
            .ToProperty(this, x => x.IsBusy, out _isBusy, scheduler: RxApp.MainThreadScheduler);

            // When an exception is thrown for either command, log the error and let the user handle
            // the exception
            LoadProjects.ThrownExceptions
            .Merge(RefreshProjects.ThrownExceptions)
            .SelectMany(exception =>
            {
                this.Log().ErrorException("Error loading or refreshing data", exception);
                return(SharedInteractions.Error.Handle(exception));
            })
            .Subscribe();
        }
Ejemplo n.º 28
0
 public HomeController(IAnalyticService analyticService)
 {
     _analyticService = analyticService;
 }
Ejemplo n.º 29
0
 public CheckoutViewModel(IAnalyticService analyticService)
 {
     _analyticService = analyticService;
 }
 public CheckoutViewModel(IAnalyticService analyticService) => this.analyticService = analyticService;