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); }
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); }
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"); }); }
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; }
public LocalizeConverter() { _localize = (ILocalize)Bootstrap.Instance.Services.GetService(typeof(ILocalize)); }
static Translator() { Lang = new JaEx(); }
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); }
/// <summary> /// Removes a Localization listener. /// </summary> /// <param name="localize"></param> public void RemoveOnLocalizeEvent(ILocalize localize) { Localize.RemoveListener(localize.OnLocalize); }
public NumberFormDataValidator(ILocalize localize) { _localize = localize; }
public CurrencyDoubleConverter() { _Localize = DependencyService.Get<ILocalize>(); }
public DateTimeFormDataValidator(ILocalize localize) { _localize = localize; }
public ResourceContainer(ResourceManager manager, ILocalize localize) { _cultureInfo = localize.GetCurrentCultureInfo(); _resourceManager = manager; }
public NavigationController(INavigationService service, ILocalize localize) : base(service) { _localize = localize; }
public NotifyOnFormDataSubmittedEventHandler(INotificationManager notificationManager, ILocalize localize) { _notificationManager = notificationManager; _localize = localize; }
public TranslateExtension() { localize = DependencyService.Get <ILocalize>(); }
public EmailFormDataValidator(ILocalize localize) { _localize = localize; }
public ResxLocalize() { _current = this; }
public ArticleService(IApplicationContext applicationContext, ILocalize localize, CMSDbContext dbContext) : base(applicationContext, dbContext) { _localize = localize; }
public ValidCodeFormDataValidator(ILocalize localize, IImageCaptchaService imageCaptchaService) { _localize = localize; _imageCaptchaService = imageCaptchaService; }
public PageExistException(ILocalize localize) : base(localize.Get("URL already exists")) { }
/// <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(); }
public ArticleTypeService(IApplicationContext applicationContext, IArticleService articleService, ILocalize localize, CMSDbContext dbContext) : base(applicationContext, dbContext) { _articleService = articleService; _localize = localize; }
public LanguageController(ILanguageService languageService, IOptions <CultureOption> cultureOption, ILocalize localize) { _languageService = languageService; _cultureOption = cultureOption; _localize = localize; }
public PhoneFormDataValidator(ILocalize localize) { _localize = localize; }
public UrlRedirectionController(IUrlRedirectService service, ILocalize localize) : base(service) { _localize = localize; }
public MaxLengthFormDataValidator(ILocalize localize) { _localize = localize; }
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; }); } } }
public ValidCodeFormDataValidator(ILocalize localize, IValidateService validateService) { _localize = localize; _validate = validateService; }
public RequiredFormDataValidator(ILocalize localize) { _localize = localize; }
public CurrencyDoubleConverter() { _Localize = DependencyService.Get <ILocalize>(); }
public NotifyOnCommentsSubmittedEventHandler(INotificationManager notificationManager, IApplicationSettingService applicationSettingService, ILocalize localize) { _notificationManager = notificationManager; _applicationSettingService = applicationSettingService; _localize = localize; }
public UserController(IUserService userService, IApplicationContextAccessor applicationContextAccessor, ILocalize localize) : base(userService) { _applicationContextAccessor = applicationContextAccessor; _localize = localize; }
public MainWindowViewModel(MainWindow window, ILogger logger, IPluginLoader pluginLoader, ILocalize localize) { _window = window; _logger = logger; _pluginLoader = pluginLoader; _localize = localize; ReloadDefaultPlugins().NoWarning(); ShowWindowCommand = ReactiveCommand.Create(ShowWindow); }