//Provider public Provider AssignProvider(Provider provider) { if (null == provider) { throw new ArgumentException("No Provider!"); } provider.PersonId = Id; var personProvider = Providers .FirstOrDefault( x => x.Source.IsSameAs(provider.Source) && x.SourceRef.IsSameAs(provider.SourceRef) && x.SourceSys.IsSameAs(provider.SourceSys)); if (null != personProvider) { Providers.Remove(personProvider); personProvider.ChangeTo(provider); Providers.Add(personProvider); return(personProvider); } Providers.Add(provider); return(provider); }
private async void SendRequest() { try { if (Providers != null) { var _name = Providers.FirstOrDefault(p => p.TenantName.ToLower() == Provider.TenantName.ToLower()); if (_name != null) { Acr.UserDialogs.UserDialogs.Instance.HideLoading(); } else { await LinkServiceProvider(); } } else { await LinkServiceProvider(); } } catch (Exception ex) { await Acr.UserDialogs.UserDialogs.Instance.AlertAsync("An error occured, please try again."); } }
public virtual async Task SetAsync(string permissionName, string providerName, string providerScope, string providerKey) { var permission = PermissionDefinitionManager.Get(permissionName); if (permission.Providers.Any() && !permission.Providers.Contains(providerName)) { throw new RocketException($"The permission named '{permission.Name}' has not compatible with the provider named '{providerName}'"); } if (!permission.MultiTenancySide.HasFlag(CurrentTenant.GetMultiTenancySide())) { throw new RocketException($"The permission named '{permission.Name}' has multitenancy side '{permission.MultiTenancySide}' which is not compatible with the current multitenancy side '{CurrentTenant.GetMultiTenancySide()}'"); } var currentGrantInfo = await GetInternalAsync(permission, providerName, providerKey); if (currentGrantInfo.Scope == providerScope) { return; } var provider = Providers.FirstOrDefault(m => m.Name == providerName); if (provider == null) { throw new RocketException("Unknown permission management provider: " + providerName); } await provider.SetAsync(permissionName, providerKey, providerScope); }
/// <summary> /// Activate or deactivate a search provider. /// Call Refresh after this to take effect on the next search. /// </summary> /// <param name="providerId">Provider id to activate or deactivate</param> /// <param name="active">Activation state</param> public static void SetActive(string providerId, bool active = true) { var provider = Providers.FirstOrDefault(p => p.name.id == providerId); if (provider == null) { return; } EditorPrefs.SetBool($"{prefKey}.{providerId}.active", active); provider.active = active; }
/// <summary> /// Activate or deactivate a search provider. /// Call Refresh after this to take effect on the next search. /// </summary> /// <param name="providerId">Provider id to activate or deactivate</param> /// <param name="active">Activation state</param> public static void SetActive(string providerId, bool active = true) { var provider = Providers.FirstOrDefault(p => p.name.id == providerId); if (provider == null) { return; } SearchSettings.GetProviderSettings(providerId).active = active; provider.active = active; }
public static NewBoilerplateResult Process(NewOptions options) { NewBoilerplateResult result = null; //NewBoilerplateContenxt ctx = new NewBoilerplateContenxt(); //ctx.Boilerplate = options.Boilerplate; var provider = Providers.FirstOrDefault(p => p.Name == options.Boilerplate); if (provider != null) { //ctx.BoilerplatPath = DbLoader.CombinePathWithAppDirectory(@"\Boilerplats\"+ ctx.Boilerplate); //ctx.ProjectName = options.Project; //ctx.ProjectOutputPath = DbLoader.CombinePathWithAppDirectory(@"\generate\" + ctx.ProjectName); //result = provider.Process(ctx); string config = DbLoader.CombinePathWithAppDirectory(@"Boilerplats\" + options.Boilerplate + @"\config.xml"); NewBoilerplateManage.DoGen(config, options.Project, options.NameSpace, options.PrefixFilter, options.OnlyGenTable); string genDir = DbLoader.CombinePathWithAppDirectory(@"generate\" + options.Boilerplate); LogStatic("Starting copy resource to generate directory ......"); LogStatic("Generate directory : " + genDir); string resourceDir = DbLoader.CombinePathWithAppDirectory(@"Boilerplats\" + options.Boilerplate + @"\resource"); var dirs = Directory.GetDirectories(resourceDir, "*", SearchOption.TopDirectoryOnly); CurrentGenerateContext.ProjectName = options.Project; foreach (var dir in dirs) { var dirInfo = new DirectoryInfo(dir); var dirname = dirInfo.Name;// Path.GetDirectoryName(dir); string realDirName = FormatSimpleTemplate(dirname); string toDir = Path.Combine(genDir, realDirName); LogStatic("Copy directory resource " + dirname + " to " + toDir); CopyDirectory(dir, toDir); LogStatic("Finish copy directory."); } LogStatic("Finish copy resource to generate directory !"); } else { LogStatic("Not find Boilerplate [" + options.Boilerplate + "] !", null, MessageType.Error); } return(result); }
/// <summary> /// Handle a CodeLens resolve request from VSCode. /// </summary> /// <param name="codeLens">The CodeLens to be resolved/updated.</param> /// <param name="requestContext"></param> private async Task HandleCodeLensResolveRequest( LanguageServer.CodeLens codeLens, RequestContext <LanguageServer.CodeLens> requestContext) { if (codeLens.Data != null) { // TODO: Catch deserializtion exception on bad object CodeLensData codeLensData = codeLens.Data.ToObject <CodeLensData>(); ICodeLensProvider originalProvider = Providers.FirstOrDefault( provider => provider.ProviderId.Equals(codeLensData.ProviderId)); if (originalProvider != null) { ScriptFile scriptFile = _editorSession.Workspace.GetFile( codeLensData.Uri); ScriptRegion region = new ScriptRegion { StartLineNumber = codeLens.Range.Start.Line + 1, StartColumnNumber = codeLens.Range.Start.Character + 1, EndLineNumber = codeLens.Range.End.Line + 1, EndColumnNumber = codeLens.Range.End.Character + 1 }; CodeLens originalCodeLens = new CodeLens( originalProvider, scriptFile, region); var resolvedCodeLens = await originalProvider.ResolveCodeLensAsync( originalCodeLens, CancellationToken.None); await requestContext.SendResult( resolvedCodeLens.ToProtocolCodeLens( _jsonSerializer)); } else { await requestContext.SendError( $"Could not find provider for the original CodeLens: {codeLensData.ProviderId}"); } } }
/// <summary> /// Обновляет одного поставщика. /// </summary> /// <param name="editedProvider">Отредактированный поставщик</param> public void UpdateProvider(ProviderDTO editedProvider) { // Найти поставщика, равного редактированному, в текущем списке поставщиков ОСП. ProviderDTO provider = Providers.FirstOrDefault(x => x.Id == editedProvider.Id); // Если поставщик найден. if (provider != null) { // Присвоить значения свойств отредактированного поставщика текущему. foreach (var prop in provider.GetType().GetProperties()) { prop.SetValue(provider, prop.GetValue(editedProvider)); } } }
public string Check(List <string> arguments) { var id = arguments[0]; var harvester = Harvesters.FirstOrDefault(h => h.Id == id); var provider = Providers.FirstOrDefault(p => p.Id == id); if (harvester != null) { return(harvester.ToString()); } else if (provider != null) { return(provider.ToString()); } return($"No element found with id - {id}"); }
public ImageProvider ChangeActive(ImageBackgroundType newType, string solution) { Providers.ForEach(x => x.IsActive = false); var ret = Providers.FirstOrDefault(x => x.SolutionConfigFile == solution && x.ProviderType == newType); if (!string.IsNullOrEmpty(solution)) { ret = Providers.FirstOrDefault(x => x.SolutionConfigFile == solution); if (ret == null) { ret = Providers.FirstOrDefault(x => x.SolutionConfigFile == null && x.ProviderType == newType); } } else { ret = Providers.FirstOrDefault(x => x.SolutionConfigFile == null && x.ProviderType == newType); } ret.IsActive = true; return(ret); }
/// <summary> /// Gets the specified provider based on the scope specified /// </summary> /// <param name="Scope">Scope</param> /// <returns>The specified provider</returns> public IProvider GetProvider(BaseScope Scope) { return(Providers.FirstOrDefault(x => x.ProviderScope.Equals(Scope))); }
/// <summary> /// Получить URL к личному кабинету на сайте поставщика услуг /// </summary> /// <param name="id"></param> /// <returns></returns> protected string GetWeb(int id) => Providers.FirstOrDefault(p => p.IdProvider == id).WebSite;
internal Provider GetProviderByName(string server) { return(Providers.FirstOrDefault(provider => provider.ComputerName == server)); }
public ExtInfo GetInfo(string section, string key) { ValidateSection(section); return(Providers.FirstOrDefault(b => b.Key == key)); }
public MainViewModel( ProviderViewModelFactory providerFactory, AuthViewModelFactory authFactory, IProviderStorage storage, IScheduler current, IScheduler main) { _storage = storage; _refresh = ReactiveCommand.CreateFromTask( storage.Refresh, outputScheduler: main); var providers = storage.Read(); providers.Transform(x => providerFactory(x, authFactory(x))) .Sort(SortExpressionComparer <IProviderViewModel> .Descending(x => x.Created)) .ObserveOn(RxApp.MainThreadScheduler) .StartWithEmpty() .Bind(out _providers) .Subscribe(); _isLoading = _refresh .IsExecuting .ToProperty(this, x => x.IsLoading, scheduler: current); _isReady = _refresh .IsExecuting .Skip(1) .Select(executing => !executing) .ToProperty(this, x => x.IsReady, scheduler: current); providers.Where(changes => changes.Any()) .ObserveOn(RxApp.MainThreadScheduler) .OnItemAdded(x => SelectedProvider = Providers.FirstOrDefault()) .OnItemRemoved(x => SelectedProvider = null) .Subscribe(); var canRemove = this .WhenAnyValue(x => x.SelectedProvider) .Select(provider => provider != null); _remove = ReactiveCommand.CreateFromTask( () => storage.Remove(SelectedProvider.Id), canRemove); var canAddProvider = this .WhenAnyValue(x => x.SelectedSupportedType) .Select(type => !string.IsNullOrWhiteSpace(type)); _add = ReactiveCommand.CreateFromTask( () => storage.Add(SelectedSupportedType), canAddProvider); _welcomeScreenVisible = this .WhenAnyValue(x => x.SelectedProvider) .Select(provider => provider == null) .ToProperty(this, x => x.WelcomeScreenVisible); _welcomeScreenCollapsed = this .WhenAnyValue(x => x.WelcomeScreenVisible) .Select(visible => !visible) .ToProperty(this, x => x.WelcomeScreenCollapsed); var canUnSelect = this .WhenAnyValue(x => x.SelectedProvider) .Select(provider => provider != null); _unselect = ReactiveCommand.Create( () => { SelectedProvider = null; }, canUnSelect); Activator = new ViewModelActivator(); this.WhenActivated(disposables => { SelectedSupportedType = SupportedTypes.FirstOrDefault(); _refresh.Execute() .Subscribe() .DisposeWith(disposables); }); }
/// <summary> /// Gets the provider which a cartridge comes from, if any. /// </summary> /// <param name="tag"></param> /// <returns></returns> public ICartridgeProvider GetCartridgeTagProvider(CartridgeTag tag) { return(Providers.FirstOrDefault(p => tag.Cartridge.Filename.StartsWith(p.IsoStoreCartridgesPath))); }
/// <summary> /// TODO We need to have some events from providers to invalidate the cache if some project's /// target frameworks are changed (in this case we just need to remove/update cache items that have /// same DTE as changed project). /// For now cache will be invalidated when solution is closed and reopened. /// </summary> /// <param name="filePath">Path to a code file being analyzed</param> /// <returns></returns> public IEnumerable <TargetFrameworkMetadata> GetTargetFrameworks(string filePath) { IEnumerable <TargetFrameworkMetadata> resultFrameworks = null; string uniqueProjectName = null; // try to get framework info for a given file from cache lock (_cacheLock) { if (FilesCache.TryGetValue(filePath, out uniqueProjectName) && ProjectFrameworksCache.TryGetValue(uniqueProjectName, out resultFrameworks)) { return(resultFrameworks); } } if (Providers == null || !Providers.Any()) { return(null); } ThreadHelper.JoinableTaskFactory.Run(async delegate { // Switch to main thread await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); try { var container = ServiceProvider.GetService <IComponentModel, SComponentModel>(); var dteProject = DocumentExtensions.GetVsHierarchy(filePath, ServiceProvider).GetDTEProject(); if (dteProject == null) { return; } var provider = Providers.FirstOrDefault(x => x.SupportsProject(dteProject)); if (provider != null) { uniqueProjectName = dteProject.UniqueName; resultFrameworks = provider.GetTargetFrameworks(dteProject); } } catch (Exception e) { // Add to Package Manager console? Debug.Write(string.Format("{0}. Stack trace: {1}", e.Message, e.StackTrace)); } }); // add file and project frameworks to cache lock (_cacheLock) { if (ProjectFrameworksCache.Keys.Contains(uniqueProjectName)) { ProjectFrameworksCache[uniqueProjectName] = resultFrameworks; } else { ProjectFrameworksCache.Add(uniqueProjectName, resultFrameworks); } if (FilesCache.Keys.Contains(filePath)) { FilesCache[filePath] = uniqueProjectName; } else { FilesCache.Add(filePath, uniqueProjectName); } } return(resultFrameworks); }