public void AppRegistry_InvokeTests() { var module = new AppRegistry(); var name = default(string); var args = default(object[]); module.InvocationHandler = new MockInvocationHandler((n, a) => { name = n; args = a; }); var appKey = "foo"; var appParameters = new Dictionary <string, object>(); module.runApplication(appKey, appParameters); Assert.AreEqual(nameof(AppRegistry.runApplication), name); Assert.AreEqual(2, args.Length); Assert.AreSame(appKey, args[0]); Assert.AreSame(appParameters, args[1]); module.unmountApplicationComponentAtRootTag(42); Assert.AreEqual(nameof(AppRegistry.unmountApplicationComponentAtRootTag), name); Assert.AreEqual(1, args.Length); Assert.AreEqual(42, args[0]); }
public void AppRegistryTest() { var regs = new AppRegistry[] { new AppRegistry { Item = "Person1", Key = "Name", Value = "zmjack" }, new AppRegistry { Item = "Person1", Key = "Age", Value = "28" }, new AppRegistry { Item = "Person1", Key = "Enable", Value = "unknown" }, new AppRegistry { Item = "Person2", Key = "Name", Value = "ashe" }, new AppRegistry { Item = "Person2", Key = "Age", Value = "27" }, }; var zmjack = AppRegistryAgent.Connect(regs, "Person1"); zmjack.Age = 999; Assert.Equal("Person1", zmjack.GetItemString()); Assert.Equal(999, zmjack.Age); Assert.Equal("haha", zmjack.NickName); Assert.False(zmjack.Enable); Assert.Null(zmjack.Address); Assert.Throws <KeyNotFoundException>(() => zmjack.NickName = "new"); Assert.Equal("999", regs.FirstOrDefault(x => x.Key == nameof(AppRegistryAgent.Age))?.Value); }
/// <summary> /// Scan for all dicitionaries (default resx files, without culture identification) /// </summary> private void ScanForDefaultDictionaries() { Dictionaries.Clear(); var culturInfoList = CultureInfo.GetCultures(CultureTypes.AllCultures).Where(c => c.Name.Length > 0); _resourceDirectory = SelectedProjectDirectory.GetDirectories("Resources").Single(); var resxFiles = _resourceDirectory.GetFiles("*.resx"); foreach (FileInfo resxFile in resxFiles) { if (culturInfoList.Any(ci => resxFile.Name.EndsWith(ci.Name + ".resx"))) { continue; } Dictionaries.Add(resxFile.Name.Replace(".resx", String.Empty)); } if (Dictionaries.Any()) { string lastUsedDictionary = AppRegistry.GetValue(RegistryKeys.SelectedDictionary); if (String.IsNullOrEmpty(lastUsedDictionary)) { SelectedDictionary = Dictionaries.First(); } else { SelectedDictionary = Dictionaries.First(dict => dict == lastUsedDictionary); } } }
private void btnResult1_Click(object sender, EventArgs e) { if (btnResult.Text == "") { return; } AppRegistry.loadApp(btnResult.Text); txtSearch.Clear(); btnResult.Text = ""; }
private static AppMetadataChangedEvent ConvertToAppRegistryChangedEvent(AppRegistry registry) { return new AppMetadataChangedEvent { Apps = { registry.Apps.Select(appInfo => new AppMetadataInfo { Id = appInfo.Id, DisplayName = appInfo.DisplayName, LauncherId = appInfo.LauncherId, LauncherParams = { appInfo.LauncherParams.Select(pair => new OptionParameter {Key = pair.Key, Value = pair.Value.ToString() })} })} }; }
private void txtSearch_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { if (btnResult.Text == "") { return; } AppRegistry.loadApp(btnResult.Text); txtSearch.Text = "Search Here"; btnResult.Text = ""; e.Handled = true; } }
private void btnLogin_Click(object sender, EventArgs e) { if (UserRegistry.checkPassword(txtUsername.Text, txtPassword.Text)) { this.pnlLoadingContainer.Visible = true; Desktop desktop = new Desktop(); desktop.Shown += new System.EventHandler(handleLoad); desktop.Show(); } else { AppRegistry.loadMessageDialog("Error", "The Username/Password combination has not been recognized. Please try again."); } }
/// <summary> /// Called, when the solution directory changes /// </summary> private void SolutionDirectoryChangedCallback() { AppRegistry.SetValue(RegistryKeys.SolutionPath, SolutionPath); ProjectDirectories = new ObservableCollection <DirectoryInfo>( SolutionDirectory.GetFiles("*.csproj", SearchOption.AllDirectories) .Select(f => f.Directory) .ToList() ); string lastProjectUsed = AppRegistry.GetValue(RegistryKeys.SelectedProject); if (String.IsNullOrEmpty(lastProjectUsed)) { return; } SelectedProjectDirectory = ProjectDirectories.FirstOrDefault(dir => dir.FullName == lastProjectUsed); }
public MainPage() { var registry = new AppRegistry(); registry.For <ISettingsDictionary>().Use <SettingsDictionary>().Singleton(); Func <INavigation> navigationFactory = NavigationFactory; registry.For <Func <INavigation> >().Use(navigationFactory); _container = new Container(registry); this.InitializeComponent(); var mainPage = _container.GetInstance <Forms.MainPage>(); SettingsPage settingsPage = _container.GetInstance <SettingsPage>(); var navigationService = _container.GetInstance <NavigationService>(); navigationService.SettingsPage = settingsPage; _navigationPage = new NavigationPage(mainPage); LoadApplication(new Forms.App(_navigationPage)); }
public static void registerapps() { AppRegistry.registerApp(typeof(SettingsAppMain), "Settings"); AppRegistry.registerApp(typeof(HybridModeAppMain), "Hybrid Mode"); }
/// <summary> /// Called, when the selected dictionary changes /// </summary> private void SelectedDictionaryChangedCallback() { AppRegistry.SetValue(RegistryKeys.SelectedDictionary, SelectedDictionary); ScanForLocalizations(); }
public MainViewModel() { IsScanInactive = true; SolutionPath = AppRegistry.GetValue(RegistryKeys.SolutionPath); }
private void Desktop_Load(object sender, EventArgs e) { RegisterApps.registerapps(); apps = AppRegistry.listApps(); }
private void btnHybrid_Click(object sender, EventArgs e) { AppRegistry.loadApp("Hybrid Mode"); }
private void btnSettings_Click(object sender, EventArgs e) { AppRegistry.loadApp("Settings"); }
public virtual bool OnAppInitializing(AppRegistry appRegistry) { return true; }
/// <summary> /// Called, when the selected localization project changes /// </summary> private void SelectedProjectDirectoryChangedCallback() { AppRegistry.SetValue(RegistryKeys.SelectedProject, SelectedProjectDirectory.FullName); ScanForDefaultDictionaries(); }