Beispiel #1
0
        public App()
        {
            ConfigurationManager <Config> .Initialize("settings.cfg", true);

            LocaleProvider.Initialize("locale").SetActiveLanguage(Cfg.CurrentSettings.ActiveLanguage);
            Instance = this;
        }
Beispiel #2
0
        public PositionPage(Position position)
        {
            InitializeComponent();
            var serviceProvider = Startup.ServiceProvider;

            this.wifiConnector             = serviceProvider.GetService <IWifiConnector>();
            this.bluetoothConnector        = serviceProvider.GetService <IBluetoothConnector>();
            this.magneticFieldSensor       = serviceProvider.GetService <MagneticFieldSensor>();
            this.calibrationsService       = serviceProvider.GetService <ICalibrationService>();
            this.positionSignalDataService = serviceProvider.GetService <IPositionSignalDataService>();
            this.positionEstimationService = serviceProvider.GetService <IPositionEstimationService>();
            this.localeProvider            = serviceProvider.GetService <LocaleProvider>();
            this.configuration             = serviceProvider.GetService <Configuration>();
            this.Position = position;

            PositionSignalDataCollection.RefreshCommand = RefreshData_Command;
            PositionSignalDataCollection.ItemsSource    = PositionSignalData;
            Position.PositionSignalData?
            .OrderBy(data => data.SignalType)
            .ThenByDescending(data => data.Strength)
            .ToList()
            .ForEach(data => PositionSignalData.Add(new PositionSignalDataView(data)));

            BindingContext = this;
            timer          = new Timer(configuration !.DataAquisitionInterval * 1000);
            timer.Elapsed += UpdateMonitoringState;
            timer.Start();
            countLabel.Text = count.ToString();
        }
Beispiel #3
0
 public AddZoneForm(LocaleProvider localeProvider, IZoneService zonesService)
 {
     InitializeComponent();
     this.localeProvider = localeProvider;
     this.zonesService   = zonesService;
     this.BindingContext = localeProvider.Locale;
 }
Beispiel #4
0
        public MainPage(LocaleProvider localeProvider)
        {
            InitializeComponent();

            this.localeProvider = localeProvider;
            this.BindingContext = localeProvider.LocaleView;
        }
Beispiel #5
0
 public AddPositionForm(LocaleProvider localeProvider, IPositionService positionsService, Zone zone)
 {
     InitializeComponent();
     this.localeProvider   = localeProvider;
     this.positionsService = positionsService;
     this.zone             = zone;
     this.BindingContext   = zone;
 }
Beispiel #6
0
        public LocaleZonesPage(LocaleProvider localeProvider)
        {
            this.localeProvider = localeProvider;
            this.BindingContext = this.localeProvider.Locale;
            InitializeComponent();

            Zones = new ObservableCollection <Zone>(this.localeProvider.Locale !.Zones);
            MyListView.ItemsSource    = Zones;
            MyListView.RefreshCommand = RefreshZones_Command;
        }
Beispiel #7
0
        public void InitNoLanguageSelected()
        {
            _ = LocaleProvider.Instance.GetType()
                .GetProperty(nameof(LocaleProvider.Instance), BindingFlags.Public | BindingFlags.Static)
                ?.SetMethod.Invoke(LocaleProvider.Instance, new object[] { null });

            LocaleProvider lpLocal = LocaleProvider.Initialize("Locales/locale");

            Assert.That(lpLocal.CurrentLanguage == null);
        }
Beispiel #8
0
        public LocalesPage(LocaleProvider localeProvider)
        {
            InitializeComponent();

            this.localeProvider = localeProvider;
            Locales             = new ObservableCollection <LocaleView>(localeProvider.ClosestLocales
                                                                        .Select(locale => new LocaleView(locale, locale.Id == localeProvider.Locale?.Id)));
            MyListView.ItemsSource    = Locales;
            MyListView.RefreshCommand = RefreshLocales_Command;
        }
        public void OnRunning(IIdeHost appWindow)
        {
            _wnd = appWindow;
            try
            {
                _lprov = new LocaleProvider(Id, _wnd.CurrentIdeLocale);
            }
            catch
            {
                _logger.Log("WARN", "Cant load locales!");
            }


            _toolbox = new ToolStrip();
            ToolStripButton _btn = new ToolStripButton(_lprov.GetValue("button"));
            Image           _img = null;

            if (_resmngr.TryGetResourceAsImage("ok", out _img))
            {
                _btn.Image = _img;
                _logger.Log("FINE", "Fine loaded image");
            }
            else
            {
                _logger.Log("WARN", "Cant load image!");
            }

            _btn.Click += Main_Click;
            _toolbox.Items.Add(_btn);
            _menu      = new ToolStripMenuItem();
            _menu.Text = "plugin1menu";
            ToolStripMenuItem _1item = new ToolStripMenuItem(_lprov.GetValue("1"));

            _1item.Click += _1item_Click;
            _menu.DropDownItems.Add(_1item);
            _menu.DropDownItems.Add(_lprov.GetValue("2"));


            _wnd.AddMenuEntry(_menu);
            _wnd.AddToolBar(_toolbox);
            _wnd.ChangeStatus("Plugin 1 loaded!");
            string _text = "";

            if (_resmngr.TryGetResourceAsString("Data", out _text))
            {
                _logger.Log("INFO", _text);
            }
            if (_resmngr.TryGetResourceAsString("DataTest", out _text))
            {
                _logger.Log("INFO", _text);
            }
            _logger.Log("INFO", "Plugin 1 loaded!");
        }
Beispiel #10
0
        public void TextRedefinition()
        {
            lp = LocaleProvider.Initialize("Locales/Redefinitions");
            lp.SetActiveLanguage("cs-cz", true);

            Assert.That(lp.Get(1) == "Zpět");
            Assert.That(lp.Get(2) == "Zpět");

            lp.SetActiveLanguage("en-us");

            Assert.That(lp.Get(1) == "Back");
            Assert.That(lp.Get(2) == "Abort");
        }
Beispiel #11
0
            public ExecutionContext(IDataProvider dataProvider, LocaleProvider locale, DisambiguationContext disambiguationContext, ExecutionContext previous)
            {
                // init
                this._DataProvider         = dataProvider;
                this.Locale                = locale;
                this.DisambiguationContext = disambiguationContext;
                this.Previous              = previous;

                // get variables
                var variables = dataProvider.GetVariables();

                // add -first variables for numbers
                var variablesFirst = variables
                                     .Where(x => x.Value is INumberVariable)
                                     .ToDictionary(x => string.Format("{0}-first", x.Key), x => (IVariable) new Data.NumberVariable(((INumberVariable)x.Value).Min));

                // done
                this._Variables = variables.Concat(variablesFirst)
                                  .ToDictionary(x => x.Key.ToLower(), x => x.Value);
            }
Beispiel #12
0
        private void OnGUI()
        {
            Adaptor adaptor;

            adaptor             = ScriptableObject.CreateInstance <Adaptor>();
            adaptor.EditorPrefs = LocaleProvider.ReadFromEditorPrefs();
            adaptor.PlayerPrefs = LocaleProvider.ReadFromPlayerPrefs();

            SerializedObject adaptorObject;

            adaptorObject = new SerializedObject(adaptor);

            SerializedProperty editorPrefsProperty;

            editorPrefsProperty = adaptorObject.FindProperty("EditorPrefs");

            SerializedProperty playerPrefsProperty;

            playerPrefsProperty = adaptorObject.FindProperty("PlayerPrefs");

            EditorGUILayout.PropertyField(
                editorPrefsProperty,
                new GUIContent("Editor Prefs"),
                true
                );

            EditorGUILayout.PropertyField(
                playerPrefsProperty,
                new GUIContent("Player Prefs"),
                true
                );

            adaptorObject.ApplyModifiedProperties();

            LocaleProvider.WriteToEditorPrefs(adaptor.EditorPrefs);
            LocaleProvider.WriteToPlayerPrefs(adaptor.PlayerPrefs);
        }
Beispiel #13
0
 public App()
 {
     LocaleProvider.Initialize("locale").SetActiveLanguage("cs-cz");
     Instance = this;
 }
Beispiel #14
0
 public AddLocaleForm(LocaleProvider localeProvider, ILocaleService localesService)
 {
     InitializeComponent();
     this.localeProvider = localeProvider;
     this.localesService = localesService;
 }
Beispiel #15
0
 public ExecutionContext(IDataProvider dataProvider, LocaleProvider locale, DisambiguationContext disambiguationContext)
     : this(dataProvider, locale, disambiguationContext, null)
 {
 }
Beispiel #16
0
 public void Setup()
 {
     lp = LocaleProvider.Initialize("Locales/locale");
     lp.SetActiveLanguage("en-us", true);
 }