public void Test_PropertyLocalization() { var keyModel = new ResourceKeys(); const string modelNameFragment = "DbLocalizationProvider.Tests.ResourceKeys"; Assert.Equal($"{modelNameFragment}.SampleResource", GetMemberFullName(() => keyModel.SampleResource)); Assert.Equal($"{modelNameFragment}.SubResource.AnotherResource", GetMemberFullName(() => ResourceKeys.SubResource.AnotherResource)); Assert.Equal($"{modelNameFragment}.SubResource.EvenMoreComplexResource.Amount", GetMemberFullName(() => ResourceKeys.SubResource.EvenMoreComplexResource.Amount)); Assert.Equal($"{modelNameFragment}.ThisIsConstant", GetMemberFullName(() => ResourceKeys.ThisIsConstant)); }
public void SetKeys(ResourceKeys keys) { if (string.IsNullOrWhiteSpace(keys.TrainingKey)) { throw new ArgumentNullException($"{nameof(keys.TrainingKey)} cannot be null or empty"); } _currentKeys = keys; _trainingApi = new CustomVisionTrainingClient(new Microsoft.Azure.CognitiveServices.Vision.CustomVision.Training.ApiKeyServiceClientCredentials(_currentKeys.TrainingKey)); //_trainingApi.= new System.Uri("https://southcentralus.api.cognitive.microsoft.com/customvision/v3.0/Training/"); _currentProject = null; ResourceKeysChanged?.Invoke(this, null); }
/// <summary> /// Create an instance of <seealso cref="ResourceTypeItemViewModel"/> class. /// </summary> /// <param name="resourceKeys"><seealso cref="ResourceTypeKeys"/> object.</param> /// <param name="dataSource">The logging data source.</param> /// <param name="parent">The parent menu item view model object.</param> public ResourceTypeItemViewModel(ResourceKeys resourceKeys, Lazy <LoggingDataSource> dataSource, MenuItemViewModel parent) : base(parent) { _dataSource = dataSource; ResourceTypeKeys = resourceKeys; Header = ResourceTypeKeys.Type; IsSubmenuPopulated = ResourceTypeKeys.Keys?.FirstOrDefault() == null; // MenuItem determins the MenuRole of SubmenuItem or SubMenuItemHeader by checking if it has sub menuitems. // Adding an invisible item for delay load menu items so that it is recognized as SubMenuItemHeader role. // By setting this role, popup is visible. Otherwise popup is invisible. if (!IsSubmenuPopulated) { MenuItems.Add(MenuItemViewModel.InvisibleItem); } }
public void SetKeys(ResourceKeys keys) { if (string.IsNullOrWhiteSpace(keys.TrainingKey)) { throw new ArgumentNullException($"{nameof(keys.TrainingKey)} cannot be null or empty"); } _currentKeys = keys; _trainingApi = new CustomVisionTrainingClient() { ApiKey = _currentKeys.TrainingKey, Endpoint = "https://southcentralus.api.cognitive.microsoft.com/customvision/v2.2/Training" }; //_trainingApi.BaseUri = new System.Uri("https://southcentralus.api.cognitive.microsoft.com/customvision/v2.2/Training"); _currentProject = null; ResourceKeysChanged?.Invoke(this, null); }
public static bool Commit(string dbKey, ResourceParamsDB db) { bool ret = false; ResourceKeys keys = new ResourceKeys { Keys = db.ResourceKeys }; var keysJson = JsonUtility.ToJson(keys, true); string r; if (ResourceEditGetPoster.HttpPost(dbKey, keysJson, out r)) { try { ret = true; int ct = 0; int totalCt = keys.Keys.Count; foreach (var key in keys.Keys) { ResourceParams ps; if (db.TryGetResourceParams(key, out ps)) { var paramsJson = JsonUtility.ToJson(ps, true); if (!ResourceEditGetPoster.HttpPost(key, paramsJson, out r)) { ret = false; } } ++ct; if (EditorUtility.DisplayCancelableProgressBar("Commit", string.Format("{0}/{1}", ct, totalCt), ct * 1.0f / totalCt)) { break; } } if (ret) { Debug.Log("Commit ok."); } } finally { EditorUtility.ClearProgressBar(); } } return(ret); }
protected virtual object GetDefaultIcon(DefaultToolBarItem item) { switch (item) { case DefaultToolBarItem.Add: return(ResourceKeys.GetAppResource(ResourceKeys.AddIcon)); case DefaultToolBarItem.Edit: return(ResourceKeys.GetAppResource(ResourceKeys.EditIcon)); case DefaultToolBarItem.Remove: return(ResourceKeys.GetAppResource(ResourceKeys.DeleteIcon)); case DefaultToolBarItem.Refresh: return(ResourceKeys.GetAppResource(ResourceKeys.RefreshIcon)); default: return(null); } }