Ejemplo n.º 1
0
        // Initial setup
        public void Setup()
        {
            InitializeComponent();


            var assembly = typeof(ActivitiesPage).GetTypeInfo().Assembly;             // "EmbeddedImages" should be a class in your app

            foreach (var res in assembly.GetManifestResourceNames())
            {
                System.Diagnostics.Debug.WriteLine("found resource: " + res);
            }



            _hudProvider     = AppContainer.Container.Resolve <IHUDProvider>();
            _userInfoService = AppContainer.Container.Resolve <IUserInfoService>();
            _authManager     = AppContainer.Container.Resolve <IAuthenticationManager>();
            var ci = DependencyService.Get <ILocale>().GetCurrentCultureInfo();

            AppContainer.Container.Resolve <IDeviceSettings>().LoadInfo();

            //localization
            L10n.SetLocale(ci);
            AppResources.Culture = ci;
        }
Ejemplo n.º 2
0
 public GuarantorViewModel(ICreditAppBuilder creditAppBuilder, ICreditAppService creditAppService,
                           IHUDProvider hudProvider)
 {
     _creditAppBuilder = creditAppBuilder;
     _creditAppService = creditAppService;
     _hudProvider      = hudProvider;
 }
Ejemplo n.º 3
0
 public ContractTermsViewModel(ICreditAppBuilder creditAppBuilder, ICreditAppService creditAppService,
                               IHUDProvider hudProvider, IDealerDefaultsManager dealerDefaultsManager)
 {
     _creditAppBuilder      = creditAppBuilder;
     _creditAppService      = creditAppService;
     _hudProvider           = hudProvider;
     _dealerDefaultsManager = dealerDefaultsManager;
 }
Ejemplo n.º 4
0
 public RateOptionsViewModel(IGALogger logger, IRateCardService rateCardService, IHUDProvider hudProvider,
                             IMonthlyPaymentService monthlyPaymentService, IQuoteBuilder quoteBuilder, IDealerDefaultsManager dealerDefaultsManager)
 {
     _hudProvider           = hudProvider;
     _rateCardService       = rateCardService;
     _monthlyPaymentService = monthlyPaymentService;
     _quoteBuilder          = quoteBuilder;
     _dealerDefaultsManager = dealerDefaultsManager;
     _quoteBuilder.CreateQuote();
 }
Ejemplo n.º 5
0
        public SitesViewModel(IGALogger logger, IUserInfoService userInfoService,
                              IHUDProvider hudProvider, ISiteRepository siteRepository)
        {
            _userInfoService = userInfoService;
            _hudProvider     = hudProvider;
            _siteRepository  = siteRepository;

            PageTitle   = AppResources.SitesMenuText;
            NoSitesText = AppResources.NoSitesText;

            //need to get sites
        }
Ejemplo n.º 6
0
        public AboutUsViewModel(IGALogger logger, IUserInfoService userInfoService,
                                IHUDProvider hudProvider, IDeviceSettings deviceSettings)
        {
            _userInfoService = userInfoService;
            _hudProvider     = hudProvider;
            _deviceSettings  = deviceSettings;

            PageTitle = AppResources.AboutMenuText;
            _deviceSettings.LoadInfo();
            VersionLabel      = string.Format("{0}:{1}", AppResources.VersionLabel, _deviceSettings.AppVersion);
            AboutUsDetailText = AppResources.AboutUsDetailText;
        }
Ejemplo n.º 7
0
        public ActivityViewModel(IGALogger logger, IUserInfoService userInfoService,
                                 IHUDProvider hudProvider)
        {
            _userInfoService = userInfoService;
            _hudProvider     = hudProvider;

            ActivityInformationLabel = AppResources.ActivityInformationLabel;
            ActivityManagerLabel     = AppResources.ActivityManagerLabel;
            CountryLabel             = AppResources.CountryLabel;
            ActivityNameLabel        = AppResources.ActivityNameLabel;
            ProjectLabel             = AppResources.ProjectLabel;
            OrganizationLabel        = AppResources.OrganizationLabel;
            PageTitle = AppResources.ActivityDetailPageTitle;
        }
Ejemplo n.º 8
0
        public ChartViewModel(IGALogger logger, IUserInfoService userInfoService,
                              IHUDProvider hudProvider, IDeviceSettings deviceSettings,
                              IIndicatorRepository indicatorRepository)
        {
            _userInfoService     = userInfoService;
            _hudProvider         = hudProvider;
            _deviceSettings      = deviceSettings;
            _indicatorRepository = indicatorRepository;


            //PageTitle = AppResources.AboutUsPageTitle;
            //_deviceSettings.LoadInfo();
            //VersionLabel = string.Format("{0}:{1}", AppResources.VersionLabel, _deviceSettings.AppVersion);
            //AboutUsDetailText = AppResources.AboutUsDetailText;
        }
 public ActivitiesViewModel(IGALogger logger, IUserInfoService userInfoService,
                            IHUDProvider hudProvider, IIndicatorRepository indicatoryRepository, ISiteIndicatorRepository siteIndicatoryRepository,
                            IActivityRepository activityRepository, IObservationRepository observationRepository, IObservationEntryRepository observationEntryRepository,
                            IIndicatorAgeRepository indicatorAgeRepository)
 {
     _userInfoService            = userInfoService;
     _hudProvider                = hudProvider;
     SiteNameLabel               = AppResources.SiteNameLabel;
     PageTitle                   = AppResources.IndicatorsPageTitle;
     _indicatorRepository        = indicatoryRepository;
     _siteIndicatoryRepository   = siteIndicatoryRepository;
     _activitiesRepository       = activityRepository;
     _observationRepository      = observationRepository;
     _observationEntryRepository = observationEntryRepository;
     _indicatorAgeRespository    = indicatorAgeRepository;
 }
Ejemplo n.º 10
0
        public LoginViewModel(IGALogger logger, IAuthenticationManager authManager, IUserInfoService userInfoService,
                              IHUDProvider hudProvider)
        {
            _authManager     = authManager;
            _userInfoService = userInfoService;
            _hudProvider     = hudProvider;

            Email    = string.Empty;
            Password = string.Empty;

            PageTitle                 = AppResources.LoginPageTitle;
            WelcomeLabel              = AppResources.WelcomeLabel;
            EmailHintText             = AppResources.EmailHint;
            PasswordHintText          = AppResources.PassowrdHint;
            CreateProfileLabel        = AppResources.ToCreatePofileLabel;
            CreateProfileEmailAddress = Constants.CreateProfileEmailAddress;
            ForgotPasswordLabel       = AppResources.ForgotPasswordLink;


            LoginButtonText = AppResources.LoginButtonText;
        }
Ejemplo n.º 11
0
        public SiteViewModel(IGALogger logger, IUserInfoService userInfoService,
                             IHUDProvider hudProvider)
        {
            _userInfoService = userInfoService;
            _hudProvider     = hudProvider;

            SiteNameLabel            = AppResources.SiteNameLabel;
            CountryLabel             = AppResources.CountryNameLabel;
            SiteTypeLabel            = AppResources.SiteTypeLabel;
            RegionLabel              = AppResources.RegionLabel;
            DistrictLabel            = AppResources.DistrictLabel;
            SubDistrictLabel         = AppResources.SubDistrictLabel;
            CityTownVillageLabel     = AppResources.CityTownVillageLabel;
            FundingTypeLabel         = AppResources.FundingTypeLabel;
            PartnerLabel             = AppResources.PartnerLabel;
            LongitudeLabel           = AppResources.LongitudeLabel;
            LatitudeLabel            = AppResources.LattitudeLabel;
            QIIndexScoreLabel        = AppResources.QIIndexScoreLabel;
            RuralUrbanLabel          = AppResources.RuralUrbanLabel;
            OtherKeyInformationLabel = AppResources.OtherKeyInformationLabel;
            SiteInformationLabel     = AppResources.SiteInformationLabel;
        }
Ejemplo n.º 12
0
 public CommentViewModel(IGALogger logger, IUserInfoService userInfoService,
                         IHUDProvider hudProvider)
 {
     _userInfoService = userInfoService;
     _hudProvider     = hudProvider;
 }
Ejemplo n.º 13
0
        public LandingViewModel(IGALogger logger, IUserInfoService userInfoService,
                                IHUDProvider hudProvider, IObservationService observationService, ISiteRepository siteRepository,
                                IActivityRepository activityRepository, IIndicatorRepository indicatoryRepository,
                                ISiteIndicatorRepository siteIndicatoryRepository, IObservationRepository observationRepository,
                                IObservationEntryRepository observationEntryRepository, IObservationChangeRepository observationChangeRepository,
                                IObservationCommentRepository observationCommentRepository, IObservationAttachmentRepository observationAttachmentRepository,
                                IIndicatorAgeRepository indicatoryAgeRepository, IDeviceSettings deviceSettings)
        {
            _userInfoService                 = userInfoService;
            _hudProvider                     = hudProvider;
            _observationService              = observationService;
            _siteRepository                  = siteRepository;
            _activityRepository              = activityRepository;
            _indicatorRepository             = indicatoryRepository;
            _siteIndicatorRepository         = siteIndicatoryRepository;
            _observationRepository           = observationRepository;
            _observationEntryRepository      = observationEntryRepository;
            _observationChangeRepository     = observationChangeRepository;
            _observationCommentRepository    = observationCommentRepository;
            _observationAttachmentRepository = observationAttachmentRepository;
            _indicatorAgeRepository          = indicatoryAgeRepository;
            _deviceSettings                  = deviceSettings;

            DownloadText        = AppResources.DownloadText;
            LastInformationText = AppResources.LastInformationText;
            DownloadButtonText  = AppResources.DownloadButtonText;

            var culture = DependencyService.Get <ILocale>().GetCurrentCultureInfo();

            if (culture.TwoLetterISOLanguageName == "fr")
            {
                LanguageId = 2;
            }
            else if (culture.TwoLetterISOLanguageName == "es")
            {
                LanguageId = 3;
            }
            else
            {
                LanguageId = 1;
            }


            //GetUserInfo
            var userInfo = _userInfoService.GetSavedInfo();

            if (!string.IsNullOrEmpty(userInfo.LastDownload))
            {
                try
                {
                    var last = DateTime.Parse(userInfo.LastDownload);
                    var ci   = DependencyService.Get <ILocale>().GetCurrentCultureInfo();
                    LastInformationTextDate = userInfo.LastDownload;                     //string.Format(ci, "{0}", last);
                }
                catch
                {
                    LastInformationText = AppResources.NoDownloadText;
                }
            }
            else
            {
                LastInformationText = AppResources.NoDownloadText;
            }
        }
        public ObservationViewModel(IGALogger logger, IUserInfoService userInfoService, IObservationRepository observationRep,
                                    IHUDProvider hudProvider, IObservationEntryRepository observationEntryRepository,
                                    IObservationChangeRepository observationChangeRepository,
                                    IObservationCommentRepository observationCommentRepository,
                                    IObservationAttachmentRepository observationAttachmentRepository,
                                    IObservationService ObservationService, IDeviceSettings deviceSettings)
        {
            _userInfoService                 = userInfoService;
            _hudProvider                     = hudProvider;
            _observationRep                  = observationRep;
            _observationEntryRepository      = observationEntryRepository;
            _observationChangeRepository     = observationChangeRepository;
            _observationCommentRepository    = observationCommentRepository;
            _observationAttachmentRepository = observationAttachmentRepository;
            _observationService              = ObservationService;
            _deviceSettings                  = deviceSettings;

            TestDate = DateTime.Now;


            MessagingCenter.Subscribe <ObservationChange>(this, "ChangeScreen", (change) =>
            {
                if (Changes == null)
                {
                    Changes = new ObservableCollection <ObservationChange>();
                }
                var item = Changes.Where(m => m == change).FirstOrDefault();
                if (item != null)
                {
                    Changes.Remove(item);
                    Changes.Add(item);
                }
                else
                {
                    Changes.Add(change);
                }
                if (_Navigation.ModalStack.Count != 0)
                {
                    _Navigation.PopModalAsync();
                }
            });

            MessagingCenter.Subscribe <ObservationAttachment>(this, "AttachmentScreen", (attach) =>
            {
                if (Attachments == null)
                {
                    Attachments = new ObservableCollection <ObservationAttachment>();
                }
                var item = Attachments.Where(m => m == attach).FirstOrDefault();
                if (item != null)
                {
                    Attachments.Remove(item);
                    Attachments.Add(item);
                }
                else
                {
                    Attachments.Add(attach);
                }
            });

            MessagingCenter.Subscribe <ObsViewModel>(this, "NumDemUpdate", (change) =>
            {
                RaisePropertyChanged("IndicatorNumCount");
                RaisePropertyChanged("IndicatorDenCount");
                RaisePropertyChanged("IndicatorCount");
                RaisePropertyChanged("IndicatorCountDisplay");
            });



            MessagingCenter.Subscribe <ObservationAttachment>(this, "AttachmentScreenCancel", (change) =>
            {
                if (_Navigation.ModalStack.Count != 0)
                {
                    _Navigation.PopModalAsync();
                }
            });

            MessagingCenter.Subscribe <ObservationChange>(this, "ChangeScreenCancel", (change) =>
            {
                Changes = Changes;
                if (_Navigation.ModalStack.Count != 0)
                {
                    _Navigation.PopModalAsync();
                }
            });

            MessagingCenter.Subscribe <ObservationComment>(this, "CommentScreen", (comment) =>
            {
                var item = Comments.Where(m => m == comment).FirstOrDefault();
                if (item != null)
                {
                    Comments.Remove(item);
                    Comments.Add(item);
                }
                else
                {
                    var i = Comments.Count();
                    Comments.Add(comment);
                }
                if (_Navigation.ModalStack.Count != 0)
                {
                    _Navigation.PopModalAsync();
                }
            });

            MessagingCenter.Subscribe <ObservationComment>(this, "CommentScreenCancel", (change) =>
            {
                Comments = Comments;
                if (_Navigation.ModalStack.Count != 0)
                {
                    _Navigation.PopModalAsync();
                }
            });
        }