internal void Validate() { if (Collection == null) { throw new RequiredPropertyException(nameof(Collection), this.GetType()); } if (Columns == null) { throw new RequiredPropertyException(nameof(Columns), this.GetType()); } else { foreach (var tgColumn in Columns) { tgColumn.Validate(); } } if (GroupOptions != null) { GroupOptions.Validate(); if (Columns.All(it => it.PropertyName != GroupOptions.GetGroupingColumnName())) { throw new IncorrectTgOptionsException("Columns must contain grouping property"); } } }
private static GroupOptions getGroupOptions(LegendOptions.LegendPositions legendPosition, int columns) { var groupOptions = new GroupOptions { Title = "This is my Group Title using = and ,.", Columns = 2, Rows = 2, HorizontalSep = Helper.Length(2, Helper.MeasurementUnits.em), VerticalSep = Helper.Length(8, Helper.MeasurementUnits.ex), XLabelsAt = GroupOptions.GroupXPositions.EdgeBottom, XTickLabelsAt = GroupOptions.GroupXPositions.EdgeBottom, YLabelsAt = GroupOptions.GroupYPositions.EdgeLeft, YTickLabelsAt = GroupOptions.GroupYPositions.EdgeLeft, GroupLegendOptions = new GroupLegendOptions { LegendEntries = new[] { "Male", "Female" }, LegendOptions = new LegendOptions { Columns = columns, LegendPosition = legendPosition } } }; return(groupOptions); }
public GraphicInformation() { Title = ""; FilePath = ""; SourceType = SourceTypes.none; // from where comes the data? GroupOption = (GroupOptions)Properties.Settings.Default.importGroupItem; //GroupOption.ByColor; SortOption = (SortOptions)Properties.Settings.Default.importGroupSort; //SortOption.ByToolNr; GroupEnable = Properties.Settings.Default.importGroupObjects; FigureEnable = true; ReProcess = false; ApplyHatchFill = Properties.Settings.Default.importSVGApplyFill; PauseBeforePath = Properties.Settings.Default.importPauseElement; PenWidthMin = 999999; PenWidthMax = 0; DotZMin = 999999; DotZMax = 0; OptionZFromWidth = Properties.Settings.Default.importDepthFromWidth; OptionDotFromCircle = Properties.Settings.Default.importSVGCircleToDot; OptionZFromRadius = Properties.Settings.Default.importSVGCircleToDotZ; OptionRepeatCode = Properties.Settings.Default.importRepeatEnable; OptionSortCode = Properties.Settings.Default.importGraphicSortDistance; OptionOffsetCode = Properties.Settings.Default.importGraphicOffsetOrigin; OptionHatchFill = Properties.Settings.Default.importGraphicHatchFillEnable; OptionClipCode = Properties.Settings.Default.importGraphicClipEnable; OptionNodesOnly = Properties.Settings.Default.importSVGNodesOnly; OptionTangentialAxis = Properties.Settings.Default.importGCTangentialEnable; OptionDragTool = Properties.Settings.Default.importGCDragKnifeEnable; OptionExtendPath = Properties.Settings.Default.importGraphicExtendPathEnable; OptionFeedFromToolTable = Properties.Settings.Default.importGCToolTableUse; ConvertArcToLine = Properties.Settings.Default.importGCNoArcs || OptionClipCode || OptionDragTool || OptionHatchFill || ApplyHatchFill; }
protected virtual GroupOptions GetGroupOptions(int numberOfPanes, string title, string[] legendEntries, LegendOptions.LegendPositions legendPosition) { var groupOptions = new GroupOptions { Title = title, Columns = 1, Rows = numberOfPanes, HorizontalSep = Helper.Length(2, Helper.MeasurementUnits.em), VerticalSep = Helper.Length(8, Helper.MeasurementUnits.ex), XLabelsAt = GroupOptions.GroupXPositions.EdgeBottom, XTickLabelsAt = GroupOptions.GroupXPositions.All, YLabelsAt = GroupOptions.GroupYPositions.All, YTickLabelsAt = GroupOptions.GroupYPositions.All, GroupLegendOptions = { LegendEntries = legendEntries, LegendOptions = new LegendOptions { Columns = getLegendColumnsFor(legendEntries.Count(), legendPosition), LegendPosition = legendPosition, FontSize = LegendOptions.FontSizes.scriptsize } } }; return(groupOptions); }
public GroupModule(IOptionsSnapshot <TextOptions> textConfig, IOptionsSnapshot <GroupOptions> groupConfig, ILogger <GroupModule> logger) { _textConfig = textConfig.Value; _groupConfig = groupConfig.Value; _logger = logger; _groupNameMatcher = new Lazy <Predicate <string> >(GetGroupNameMatcher); _rng = new Lazy <Random>(); }
/// <summary> /// Add or update the specified group. /// </summary> /// <param name="config"></param> /// <returns></returns> private async Task <SKModel.GroupModel> AddUpdateGroupAsync(GroupOptions config) { _logger.LogInformation($"Fetch group '{config.Name}'"); var groups = await _client.HandleGetAsync <SKModel.GroupModel[]>(_client.AdminRoute($"groups?search={config.Name}"), r => true); var group = groups.FirstOrDefault(); if (group == null) { _logger.LogInformation($"Add group '{config.Name}'"); group = new SKModel.GroupModel(config); // Add the group to keycloak. var rRes = await _client.SendJsonAsync(_client.AdminRoute("groups"), HttpMethod.Post, group); if (!rRes.IsSuccessStatusCode) { throw new HttpClientRequestException(rRes); } // Have to look for it now that we've added it. groups = await _client.HandleGetAsync <SKModel.GroupModel[]>(_client.AdminRoute($"groups?search={config.Name}"), r => true); group = groups.FirstOrDefault(); } else { _logger.LogInformation($"Update group '{config.Name}'"); group.Name = config.Name; group.RealmRoles = config.RealmRoles.ToArray(); // TODO: Clear existing realm group so that the changes are correct in keycloak. // Update group in keycloak. var rRes = await _client.SendJsonAsync(_client.AdminRoute($"groups/{group.Id}"), HttpMethod.Put, group); if (!rRes.IsSuccessStatusCode) { throw new HttpClientRequestException(rRes); } if (group.RealmRoles.Any()) { // Fetch all roles for the group. Any missing will throw exception. var roles = group.RealmRoles.Select(async r => await _client.HandleGetAsync <SKModel.RoleModel>(_client.AdminRoute($"roles/{r}"))).Select(r => r.Result).ToArray(); // Update group realm roles in keycloak. var grRes = await _client.SendJsonAsync(_client.AdminRoute($"groups/{group.Id}/role-mappings/realm"), HttpMethod.Post, roles); if (!grRes.IsSuccessStatusCode) { throw new HttpClientRequestException(grRes); } } } return(await _client.HandleGetAsync <SKModel.GroupModel>(_client.AdminRoute($"groups/{group.Id}"))); }
/// <summary> /// Creates a new instance of a GroupModel class, initializes with specified arguments. /// </summary> /// <param name="group"></param> public GroupModel(GroupOptions group) { this.Name = group.Name; this.RealmRoles = group.RealmRoles.ToArray(); if (group.ClientRoles != null) { this.ClientRoles = new Dictionary <string, string[]>(); foreach (var role in group.ClientRoles) { this.ClientRoles.Add(role.ClientId, role.ClientRoles.ToArray()); } } }
public PagedListResultOfArrayOfUserDataVUqw3SxC exportGroup(GroupOptions options) { String authToken = client.AuthenticateUser(options.getUserName(), options.getPassword()).ResultData; ServiceOperationResultOfUserGroupDataVUqw3SxC servOP = client.GetUserGroupByName(authToken, options.getGroup()); var groupID = servOP.ResultData.DatabaseId; ServiceOperationResultOfPagedListResultOfArrayOfUserDataVUqw3SxCVUqw3SxC users = client.ListUserGroupMembers(authToken,groupID,options.getpageNum(),options.getpageSize(), options.getsortField(),options.getsortAscend(),options.getfilterField(),options.getfilterValue()); if (!servOP.CallSuccess) { Console.WriteLine("Group Does Not Exist"); } return getServiceOperationResult(users); }
public GroupPlot(IEnumerable <Color> colors, AxisOptions axisOptions, GroupOptions groupOptions, IEnumerable <IBasePlot> groupedPlots, Text caption) { Colors = colors; AxisOptions = axisOptions; GroupOptions = groupOptions; if (GroupOptions.GroupLegendOptions != null && groupOptions.GroupLegendOptions.LegendOptions != null) { axisOptions.LegendOptions = null; } GroupedPlots = groupedPlots; Position = FigureWriter.FigurePositions.htbp; Caption = caption; Label = Helper.Marker(); Landscape = false; }
public IObserverOperation Create(GroupOptions go) { if (go.Operations.Count() == 0) { return(new NoOperation()); } return(new CompositeOperation( go.Operations .Select( oo => _extensions.Select(x => x.Create(go.Name, oo)) .Where(x => x != default).SingleOrDefault() ?? new NoOperation()) .ToArray())); }
internal void AddGroupColumnIfNotSet() { if (GroupOptions != null) { if (Columns.Count(it => it.PropertyName == GroupOptions.GetGroupingColumnName()) == 0) { IList <TgColumn> columns = Columns as IList <TgColumn>; columns.Insert(0, new TgColumn <T> { Property = GroupOptions.GroupingColumn, AutoWidth = true, Style = new TgExcelStyle() { VerticalAlignment = ExcelVerticalAlignment.Center } }); Columns = columns; } } }
public Publisher(ILogger <Publisher> logger, Connection connection, GroupOptions groupOptions) { _logger = logger; _connection = connection; _groupOptions = groupOptions; _onlineMessages = new Messages() .Stream .BufferUntil(connection.State, gateStreamMessageIndex => { var shouldBuffer = gateStreamMessageIndex % 2 != 0; if (shouldBuffer) { _logger.LogWarning("Buffering until connection becomes available: {Url}", connection.Url); } else { _logger.LogWarning("Releasing buffer"); } return(shouldBuffer); }) .Publish(); var eventLoop = new EventLoopScheduler(); _textsReceived = _onlineMessages .OfType <TextReceived>() .ObserveOn(eventLoop) .Do(x => Retry(() => Send(x)).Wait()); _terminates = _onlineMessages .OfType <SessionTerminated>() .ObserveOn(eventLoop) .Do(x => Retry(() => Terminate(x)).Wait()); }
public async Task<IEnumerable<GroupMember>> GetGroupMembersAsync(GroupOptions groupOptions, CancellationToken cancelationToken = new CancellationToken()) { var httpClient = new HttpClient(_httpMessageHandler); var offset = 0; const int count = 1000; const string fields = "uid,first_name,last_name"; var groupMembers = new List<dynamic>(); while (true) { var result = await httpClient.GetAsync($"https://api.vk.com/method/{GroupsGetMembersMethodName}?group_id={groupOptions.GroupId}&offset={offset}&count={count}&fields={fields}", cancelationToken); if (!result.IsSuccessStatusCode) { await Task.Delay(_maxIntervalBetweenApiRequest, cancelationToken); } else { var response = await result.Content.ReadAsStringAsync(); dynamic d = JsonConvert.DeserializeObject(response); var responseCount = d.response.count; var users = d.response.users; groupMembers.AddRange(users); if (responseCount == 0 || responseCount < count) { break; } offset += count; await Task.Delay(_maxIntervalBetweenApiRequest, cancelationToken); } } return groupMembers.Select(t => new GroupMember(t.uid.ToString(), t.first_name.ToString(), t.last_name.ToString())); }
protected abstract GroupPlot GetGroupPlot(ChartData <TXValue, TYValue> chartData, TPopulationAnalysisChart analysisChart, Color[] colors, Text caption, GroupOptions groupOptions);
protected override GroupPlot GetGroupPlot(ChartData <TimeProfileXValue, TimeProfileYValue> chartData, TimeProfileAnalysisChart analysisChart, Color[] colors, Text caption, GroupOptions groupOptions) { var xlabel = chartData.Axis.Caption; var axisOptions = GetAxisOptionsForGroup(xlabel); var groupedPlots = getGroupedPlots(chartData); return(new GroupPlot(colors, axisOptions, groupOptions, groupedPlots, caption) { Position = FigureWriter.FigurePositions.H }); }
protected override GroupPlot GetGroupPlot(ChartData <BoxWhiskerXValue, BoxWhiskerYValue> chartData, BoxWhiskerAnalysisChart analysisChart, Color[] colors, Text caption, GroupOptions groupOptions) { var xTicks = getXTicks(chartData); var xTickLabels = getXTickLabels(chartData); var groupLines = getGroupLines(chartData.AllXValues.ToList(), chartData.AllXValues.Min(x => x.Key.Count)); var axisOptions = getAxisOptionsForGroup(xTicks, xTickLabels); var groupedPlots = getGroupedPlots(chartData, groupLines); return(new GroupPlot(colors, axisOptions, groupOptions, groupedPlots, caption) { Position = FigureWriter.FigurePositions.H }); }
private static void GetGroupOptionsConditionFormulas(GroupOptions rdm_ro, XmlWriter writer) { //TODO: not yet implemented }
public void SetGroup(GroupOptions group, SortOptions sort) { GroupEnable = true; GroupOption = group; SortOption = sort; }