コード例 #1
0
        public DropDownListDescriptor DataSource <T>()
        {
            if (_data == null)
            {
                _data = new Dictionary <string, string>();
            }
            Type dataType = typeof(T);

            if (!dataType.GetTypeInfo().IsEnum)
            {
                throw new Exception(dataType.FullName + " is not Enum type");
            }
            string[]  text     = Enum.GetNames(dataType);
            ILocalize localize = ServiceLocator.GetService <ILocalize>();

            for (int i = 0; i < text.Length; i++)
            {
                this._data.Add(Enum.Format(dataType, Enum.Parse(dataType, text[i], true), "d"), localize.Get(text[i]));
            }
            return(this);
        }
コード例 #2
0
        protected APBaseViewModel(BaseServices baseServices)
        {
            Disposables       = new CompositeDisposable();
            NavigationService = baseServices.NavigationService;
            DeviceService     = baseServices.DeviceService;
            DialogService     = baseServices.DialogService;
            Localize          = baseServices.Localize;
            Logger            = baseServices.Logger;
            EventAggregator   = baseServices.EventAggregator;
            PageDialogService = baseServices.PageDialogService;

            Title            = GetTitle();
            _isNotBusyHelper = this.WhenAnyValue(x => x.IsBusy)
                               .Select(x => !x)
                               .ToProperty(this, nameof(IsNotBusy), true, true)
                               .DisposeWith(Disposables);

            NavigateCommand = ReactiveCommand.CreateFromTask <string>(
                OnNavigateCommandExecuted, this.WhenAnyValue(x => x.IsNotBusy))
                              .DisposeWith(Disposables);
        }
コード例 #3
0
        public MainWindowViewModel(MainWindow window,
                                   ILogger logger,
                                   IPluginLoader pluginLoader,
                                   ILocalize localize,
                                   IConfigService configService,
                                   IDnsQuery dnsQuery)
        {
            _window       = window;
            _logger       = logger;
            _pluginLoader = pluginLoader;
            _localize     = localize;
            ConfigService = configService;
            _dnsQuery     = dnsQuery;

            ServerSourceList
            .Connect()
            .ObserveOnDispatcher()
            .Bind(out ServerList)
            .DisposeMany()
            .Subscribe(_ =>
            {
                ResetListIndex();
                SaveList();
            });

            InitAsync().NoWarning();

            ShowWindowCommand = ReactiveCommand.Create(ShowWindow);
            HideWindowCommand = ReactiveCommand.Create(HideWindow);
            ExitCommand       = ReactiveCommand.Create(Exit);
            TestCommand       = ReactiveCommand.CreateFromObservable(Test);
            TestCommand.ThrownExceptions.Subscribe(ex =>
            {
                _logger.LogError(ex, @"Test Error");
            });
        }
コード例 #4
0
        public App()
        {
            InitializeComponent();

            // Configurar idioma cada vez que el app inicializa
            ILocalize   localizeDependency = DependencyService.Get <ILocalize>();
            CultureInfo ci = localizeDependency.GetCurrentCultureInfo();

            ConfigureCultureIdiomsApp(ci);

            // Inicializamos locker del app instance
            if (_lockeable == null)
            {
                _lockeable = FreshIOC.Container.Resolve <ILockeable>();
            }

            // Solo se necesita inicializar sonidos cuando se reproduce un sound personalizado, con PlaySound
            // Si usar PlayNotificationDefaultSound no se necesita
            //// Inicializamos sonidos
            //if (Device.RuntimePlatform == Device.Android)
            //{
            //    InicializarSoundsFiles();
            //}

            if (!string.IsNullOrWhiteSpace(RecordedPerson) && !string.IsNullOrWhiteSpace(RecordedIdiomPerson) && !string.IsNullOrWhiteSpace(RecordedUser) && !string.IsNullOrWhiteSpace(RecordedPasswordUser))
            {
                MainPage = FreshPageModelResolver.ResolvePageModel <LottieLoadPageModel>();
            }
            else
            {
                FreshNavigationContainer basicNavContainer = ConfigureNavigationContainer();
                MainPage = basicNavContainer;
            }

            _appInicializada = true;
        }
コード例 #5
0
 public LocalizeConverter()
 {
     _localize = (ILocalize)Bootstrap.Instance.Services.GetService(typeof(ILocalize));
 }
コード例 #6
0
ファイル: Translator.cs プロジェクト: jphacks/E_2007
 static Translator()
 {
     Lang = new JaEx();
 }
コード例 #7
0
        public TrackingViewModel(ILog log, IAccount account, ILocalize localize, IApplication application,
                                 IGeoPositionWatcher<GeoCoordinate> coordinateProvider, IHistory history,
                                 IRepository repository, ISettings settings)
        {
            _log = log;
            _localize = localize;
            _application = application;
            _coordinateProvider = coordinateProvider;
            _history = history;
            _repository = repository;
            _settings = settings;
            Account = account;

            _started = false;
            _startTime = System.Environment.TickCount;

            _coordinateProvider.PositionChanged += _coordinateProvider_PositionChanged;
            _coordinateProvider.Start();
            UICoordinates = new GeoCoordinateCollection();
            _timer.Interval = TimeSpan.FromSeconds(1);
            _timer.Tick += Timer_Tick;

            MapCenter = new GeoCoordinate(0, 0);
            Heading = 0;
            ZoomLevel = 15;
            Pitch = 55;
            PedestrianFeaturesEnabled = true;
            LandmarksEnabled = true;

            DistanceDisplay = "0 km";
            if (!_settings.IsMetric) DistanceDisplay = "0 mi";
            PaceDisplay = "00:00";
            CaloriesDisplay = "0";
            TimeDisplay = "00:00";

            StrokeColor = System.Windows.Media.Colors.Red;
            StrokeThickness = 5;
            Coordinates.Clear();

            StartVisibility = (!_started ? Visibility.Visible : Visibility.Collapsed);
            StopVisibility = (_started ? Visibility.Visible : Visibility.Collapsed);
            PauseVisibility = (!_paused ? Visibility.Visible : Visibility.Collapsed);
            ResumeVisibility = (_paused ? Visibility.Visible : Visibility.Collapsed);

        }
コード例 #8
0
 /// <summary>
 /// Removes a Localization listener.
 /// </summary>
 /// <param name="localize"></param>
 public void RemoveOnLocalizeEvent(ILocalize localize)
 {
     Localize.RemoveListener(localize.OnLocalize);
 }
コード例 #9
0
 public NumberFormDataValidator(ILocalize localize)
 {
     _localize = localize;
 }
コード例 #10
0
 public CurrencyDoubleConverter()
 {
     _Localize = DependencyService.Get<ILocalize>();
 }
コード例 #11
0
 public DateTimeFormDataValidator(ILocalize localize)
 {
     _localize = localize;
 }
コード例 #12
0
 public ResourceContainer(ResourceManager manager, ILocalize localize)
 {
     _cultureInfo     = localize.GetCurrentCultureInfo();
     _resourceManager = manager;
 }
コード例 #13
0
 public NavigationController(INavigationService service,
                             ILocalize localize)
     : base(service)
 {
     _localize = localize;
 }
 public NotifyOnFormDataSubmittedEventHandler(INotificationManager notificationManager, ILocalize localize)
 {
     _notificationManager = notificationManager;
     _localize            = localize;
 }
コード例 #15
0
 public TranslateExtension()
 {
     localize = DependencyService.Get <ILocalize>();
 }
コード例 #16
0
 public EmailFormDataValidator(ILocalize localize)
 {
     _localize = localize;
 }
コード例 #17
0
 public ResxLocalize()
 {
     _current = this;
 }
コード例 #18
0
ファイル: ArticleService.cs プロジェクト: zww11/ZKEACMS
 public ArticleService(IApplicationContext applicationContext, ILocalize localize, CMSDbContext dbContext)
     : base(applicationContext, dbContext)
 {
     _localize = localize;
 }
コード例 #19
0
 public ValidCodeFormDataValidator(ILocalize localize, IImageCaptchaService imageCaptchaService)
 {
     _localize            = localize;
     _imageCaptchaService = imageCaptchaService;
 }
コード例 #20
0
 public PageExistException(ILocalize localize)
     : base(localize.Get("URL already exists"))
 {
 }
コード例 #21
0
 /// <summary>
 /// Add a Localization listener to catch the event that is invoked when the selected language is changed.
 /// </summary>
 /// <param name="localize"></param>
 public void AddOnLocalizeEvent(ILocalize localize)
 {
     Localize.RemoveListener(localize.OnLocalize);
     Localize.AddListener(localize.OnLocalize);
     localize.OnLocalize();
 }
コード例 #22
0
 public ArticleTypeService(IApplicationContext applicationContext, IArticleService articleService, ILocalize localize, CMSDbContext dbContext)
     : base(applicationContext, dbContext)
 {
     _articleService = articleService;
     _localize       = localize;
 }
コード例 #23
0
ファイル: LanguageController.cs プロジェクト: skehya/cms
 public LanguageController(ILanguageService languageService, IOptions <CultureOption> cultureOption, ILocalize localize)
 {
     _languageService = languageService;
     _cultureOption   = cultureOption;
     _localize        = localize;
 }
コード例 #24
0
 public PhoneFormDataValidator(ILocalize localize)
 {
     _localize = localize;
 }
コード例 #25
0
 public UrlRedirectionController(IUrlRedirectService service, ILocalize localize) : base(service)
 {
     _localize = localize;
 }
コード例 #26
0
 public MaxLengthFormDataValidator(ILocalize localize)
 {
     _localize = localize;
 }
コード例 #27
0
 /// <summary>
 /// Add a Localization listener to catch the event that is invoked when the selected language is changed.
 /// </summary>
 /// <param name="localize"></param>
 public void AddOnLocalizeEvent(ILocalize localize)
 {
     Localize.RemoveListener(localize.OnLocalize);
     Localize.AddListener(localize.OnLocalize);
     localize.OnLocalize();
 }
コード例 #28
0
 /// <summary>
 /// Removes a Localization listener.
 /// </summary>
 /// <param name="localize"></param>
 public void RemoveOnLocalizeEvent(ILocalize localize)
 {
     Localize.RemoveListener(localize.OnLocalize);
 }
コード例 #29
0
        public HomeViewModel(ILog log, IAccount account, ILocalize localize, IApplication application, IHistory history,
                             INavigationService navigationService, IUser user, IRepository repository,
                             IList<IExerciseType> exerciseTypes, ISettings settings)
        {
            _log = log;
            _localize = localize;
            _application = application;
            Account = account;

            _history = history;
            _history.OnHistoryItemsChanged += _history_OnHistoryItemsChanged;
            _NavigationService = navigationService;
            User = user;
            ExerciseTypes = exerciseTypes;
            _repository = repository;
            _settings = settings;
            _settings.OnSettingsChanged += _settings_OnSettingsChanged;
            _settings.Load();
            _history.Load();

            _repository.Single<User>(1).ContinueWith(t =>
                {
                    var foundUser = t.Result;
                    if (foundUser == null)
                    {
                        //this is first load of the app, set it up
                        _repository.Insert<User>(this.User).ContinueWith(task =>
                            {
                                this.User = this.User;
                                Account.AccessToken = this.User.RunkeeperToken;

                            });
                    }
                    else
                    {
                        User = foundUser;
                        Account.AccessToken = foundUser.RunkeeperToken;
                    }
                });

            if (_exerciseTypes == null || _exerciseTypes.Count == 0 ||
                (_exerciseTypes.Count == 1 && _exerciseTypes[0].Id == 0))
            {
                if (HomeViewModel.cachedTypes != null)
                {
                    this.ExerciseTypes = HomeViewModel.cachedTypes;
                    _log.Info("cache hit");
                }
                else
                {
                    _log.Info("cache miss");
                    this.ExerciseTypes = DefaultTypes;
                    _log.Info("default types set, querying");
                    _repository.Query<ExerciseType>("select * from ExerciseType").ContinueWith(t =>
                        {
                            _log.Info("query complete");
                            var types = t.Result;
                            if (types == null || types.Count == 0)
                            {

                                _log.Info("db does not have Exercise types, loading default items");
                                foreach (var e in from tt in this.ExerciseTypes orderby tt.Id select tt)
                                {
                                    _repository.Insert<ExerciseType>(e);
                                }
                            }
                            else
                            {
                                _log.Info("all excecise types retreived from the db, update local data store");
                                this.ExerciseTypes = (from tt in types select tt).ToArray();
                            }
                            _log.Info("cache extypes to static var");
                            HomeViewModel.cachedTypes = ExerciseTypes;

                        });
                }
            }
        }
コード例 #30
0
 public ValidCodeFormDataValidator(ILocalize localize, IValidateService validateService)
 {
     _localize = localize;
     _validate = validateService;
 }
コード例 #31
0
 public RequiredFormDataValidator(ILocalize localize)
 {
     _localize = localize;
 }
コード例 #32
0
 public CurrencyDoubleConverter()
 {
     _Localize = DependencyService.Get <ILocalize>();
 }
コード例 #33
0
 public NotifyOnCommentsSubmittedEventHandler(INotificationManager notificationManager, IApplicationSettingService applicationSettingService, ILocalize localize)
 {
     _notificationManager       = notificationManager;
     _applicationSettingService = applicationSettingService;
     _localize = localize;
 }
コード例 #34
0
 public UserController(IUserService userService, IApplicationContextAccessor applicationContextAccessor, ILocalize localize)
     : base(userService)
 {
     _applicationContextAccessor = applicationContextAccessor;
     _localize = localize;
 }
コード例 #35
0
        public MainWindowViewModel(MainWindow window, ILogger logger, IPluginLoader pluginLoader, ILocalize localize)
        {
            _window       = window;
            _logger       = logger;
            _pluginLoader = pluginLoader;
            _localize     = localize;

            ReloadDefaultPlugins().NoWarning();

            ShowWindowCommand = ReactiveCommand.Create(ShowWindow);
        }