public override void Put(Item item) { if (!Content.Any(i => i.Name == item.Name && i.GetType() == item.GetType())) { Content.Add(item); } }
private void load() { Content.Add(text = new AttributeText(Point)); timeSignature.BindValueChanged(_ => updateText()); beatLength.BindValueChanged(_ => updateText(), true); }
private void itemsListView_DragDrop(object sender, DragEventArgs e) { if (e.Effect != DragDropEffects.None) { if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun) { IRun item = (IRun)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item); } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { IEnumerable <IRun> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast <IRun>(); if (e.Effect.HasFlag(DragDropEffects.Copy)) { Cloner cloner = new Cloner(); items = items.Select(x => cloner.Clone(x)); } if (RunCollection != null) { RunCollection.AddRange(items); } else // the content is an IItemCollection<IRun> { foreach (IRun item in items) { Content.Add(item); } } } } }
/// <summary> /// Gets a new Intacct API session ID and endpoint URL /// </summary> /// <param name="config"></param> /// <returns></returns> private async Task <SdkConfig> getAPISession(SdkConfig config) { Content content = new Content(); content.Add(new ApiSessionCreate()); RequestHandler requestHandler = new RequestHandler(config); SynchronousResponse response = await requestHandler.ExecuteSynchronous(config, content); OperationBlock operation = response.Operation; Authentication authentication = operation.Authentication; XElement api = operation.Results[0].Data.Element("api"); SdkConfig session = new SdkConfig() { SessionId = api.Element("sessionid").Value, EndpointUrl = api.Element("endpoint").Value, CurrentCompanyId = authentication.CompanyId, CurrentUserId = authentication.UserId, CurrentUserIsExternal = authentication.SlideInUser, Logger = config.Logger, LogFormatter = config.LogFormatter, LogLevel = config.LogLevel, }; return(session); }
protected virtual void addButton_Click(object sender, EventArgs e) { object variableValue = CreateItem(); if (variableValue == null) { return; } string variableName; var namedItem = variableValue as INamedItem; if (namedItem != null) { variableName = GenerateNewVariableName(namedItem.Name, false); } else { variableName = GenerateNewVariableName(); } Content.Add(variableName, variableValue); var item = variableListView.FindItemWithText(variableName); variableListView.SelectedItems.Clear(); item.BeginEdit(); }
protected override void LoadComplete() { base.LoadComplete(); Content.CornerRadius = 0; Content.Masking = false; BackgroundColour = colourProvider.Background2; Content.Add(new Container { RelativeSizeAxes = Axes.Both, Padding = new MarginPadding(15), Children = new Drawable[] { spriteIcon = new SpriteIcon { Icon = icon, Size = new Vector2(22), Anchor = anchor, Origin = anchor, Colour = colourProvider.Background1, }, } }); }
/// <summary>Read the file</summary> /// <param name="fileName">Complete file name (with repository and extension)</param> /// <param name="separator">Columns separator</param> /// <exception cref="ArgumentNullException"/> /// <exception cref="UnauthorizedAccessException"/> /// <exception cref="NotSupportedException"/> /// <exception cref="System.IO.IOException">I/O exception</exception> /// <exception cref="System.Security.SecurityException"/> public void Read(string fileName, char separator) { if (string.IsNullOrEmpty(fileName)) { throw new ArgumentNullException(nameof(fileName)); } ; CleanData(); string[] text = System.IO.File.ReadAllLines(fileName); if (text.Length == 0) { return; } Header.AddRange(text[0].Split(separator)); for (int i = 1; i < text.Length; i++) { string[] line = text[i].Split(separator); Array.Resize(ref line, Header.Count); Content.Add(line); } Readed = true; }
protected override void RunImpl() { var enumHeaderFileName = unrealEnum.CapitalisedName + headerSuffix; var headerGenerator = new UnrealEnumHeaderGenerator(unrealEnum); Content.Add(enumHeaderFileName, headerGenerator.TransformText()); }
protected override void RunImpl() { var componentReaderWriterGenerator = new UnityComponentReaderWriterGenerator(); var commandSenderReceiverGenerator = new UnityCommandSenderReceiverGenerator(); foreach (var componentTarget in componentsToGenerate) { var relativeOutputPath = componentTarget.OutputPath; var componentName = componentTarget.Content.ComponentName; var package = componentTarget.Package; if (componentTarget.Content.CommandDetails.Count > 0) { var commandSenderReceiverFileName = Path.ChangeExtension($"{componentName}CommandSenderReceiver", FileExtension); var commandSenderReceiverCode = commandSenderReceiverGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, commandSenderReceiverFileName), commandSenderReceiverCode); } var componentReaderWriterFileName = Path.ChangeExtension($"{componentName}ComponentReaderWriter", FileExtension); var componentReaderWriterCode = componentReaderWriterGenerator.Generate(componentTarget.Content, package); Content.Add(Path.Combine(relativeOutputPath, componentReaderWriterFileName), componentReaderWriterCode); } }
public NaturalList(string arg) { StringBuilder sb = new(); bool? isnumber = null; for (int i = 0; i < arg.Count(); i++) { if (Char.IsDigit(arg[i]) && isnumber != false) { isnumber = true; sb.Append(arg[i]); } else if (Char.IsDigit(arg[i])) { isnumber = true; Content.Add(new NaturalMember(sb.ToString())); sb = new StringBuilder(); sb.Append(arg[i]); } else if (isnumber != true) { isnumber = false; sb.Append(arg[i]); } else { isnumber = false; Content.Add(new NaturalMember(sb.ToString())); sb = new StringBuilder(); sb.Append(arg[i]); } } Content.Add(new NaturalMember(sb.ToString())); }
public OverlinedParticipants() : base("Participants") { Content.Add(new ParticipantsList { RelativeSizeAxes = Axes.Both }); }
void UpdateSearch(string[] array) { foreach (var item in array) { Content.Add(item); } }
public void Restore(object restoredItem, ItemId id) { CollectionItemIdentifiers oldIds = null; CollectionItemIdentifiers ids; if (!IsNonIdentifiableCollectionContent && TryGetCollectionItemIds(Content.Retrieve(), out ids)) { // Remove the item from deleted ids if it was here. ids.UnmarkAsDeleted(id); // Get a clone of the CollectionItemIdentifiers before we add back the item. oldIds = new CollectionItemIdentifiers(); ids.CloneInto(oldIds, null); } // Actually restore the item. Content.Add(restoredItem); if (TryGetCollectionItemIds(Content.Retrieve(), out ids) && oldIds != null) { // Find the new id that has been generated by the Add var idToReplace = oldIds.FindMissingId(ids); if (idToReplace == ItemId.Empty) { throw new InvalidOperationException("No ItemId to replace has been generated."); } } }
private void LoadAsynchronously() { float inventoryItemCount100 = 0, index = 0; if (ContentToLoad.Count > 0) { inventoryItemCount100 = 100f / ContentToLoad.Count; } foreach (IContentHost t in ContentToLoad) { Content.Add(t); index += 1; lock (this) { _loadingPercentage = index * inventoryItemCount100; } } lock (this) { LoadingComplete = true; _loadingPercentage = 100; } LoadingInProgress = false; }
public FixedPropChest(IMapNode node, IProp[] props, int id) : base(node, new ChestStore(), id) { foreach (var prop in props) { Content.Add(prop); } }
public ProgressNotification() { IconContent.Add(new Box { RelativeSizeAxes = Axes.Both, }); Content.Add(textDrawable = new OsuTextFlowContainer(t => { t.TextSize = 16; }) { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, }); NotificationContent.Add(progressBar = new ProgressBar { Origin = Anchor.BottomLeft, Anchor = Anchor.BottomLeft, RelativeSizeAxes = Axes.X, }); State = ProgressNotificationState.Queued; // don't close on click by default. Activated = () => false; }
public RawBlock(params InlineObject[] inlines) : this() { foreach (var v in inlines) { Content.Add(v); } }
public void Append(Product prod, int co) { Product tmp = Content.Find(p => p.Name == prod.Name); if (tmp == null) { int t = prod.CountOnStorage; prod.SetCount(co); Ingredient tpi = prod as Ingredient; if (tpi != null) { Content.Add((Ingredient)tpi.Clone()); } else { Content.Add((Product)prod.Clone()); } prod.SetCount(t - co); } else { tmp.Append(co); prod.SetCount(prod.CountOnStorage - co); } }
public ISA(string[] elements) : base(null) { foreach (string el in elements) { Content.Add(new EdiSimpleDataElement(null, el)); } }
public EntityHierarchyItemViewModelWrapper(EntityHierarchyItemViewModel entityHierarchyItem, Func <EntityHierarchyItemViewModel, bool> filter, Type componentType) { EntityHierarchyItem = entityHierarchyItem; Entity = entityHierarchyItem as EntityViewModel; if (Entity != null) { if (componentType != null) { Components = new List <Tuple <int, EntityComponent> >(); for (var i = 0; i < Entity.AssetSideEntity.Components.Count; i++) { var component = Entity.AssetSideEntity.Components[i]; if (componentType.IsInstanceOfType(component)) { Components.Add(Tuple.Create(i, component)); } } SelectedComponent = Components.Count > 0 ? Components.First() : null; } matchesCriteria = componentType == null || Components.Count > 0; } foreach (var subEntity in entityHierarchyItem.Children.Where(filter).Select(x => new EntityHierarchyItemViewModelWrapper(x, filter, componentType)).Where(x => x.MatchesCriteria)) { Content.Add(subEntity); } }
public ConsoleOperator(ConsoleModel model, MenuModel menuModel, Dispatcher dispatcher) { this.model = model; this.dispatcher = dispatcher; this.MenuModel = menuModel; this.MenuModel.Title = model.Name; this.MenuModel.Path = model.Path; this.MenuModel.Content = Content; this.mProcessOperator = new ProcessOperator( ProcessOperator.GetProcessStartInfo(model.Path, model.Param, true)); mProcessOperator.OutputDataReceived += (message) => { this.dispatcher.Invoke(new Action(() => { if (Content.Count >= 1000) { Content.RemoveAt(0); } Content.Add(message); HasContent = true; })); }; }
public SimpleNotification() { IconContent.AddRange(new Drawable[] { IconBackgound = new Box { RelativeSizeAxes = Axes.Both, Colour = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.6f)) }, iconDrawable = new SpriteIcon { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = icon, Size = new Vector2(20), } }); Content.Add(textDrawable = new OsuTextFlowContainer(t => t.TextSize = 14) { Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Text = text }); }
public SimpleNotification() { IconContent.Add(new Drawable[] { IconBackgound = new Box { RelativeSizeAxes = Axes.Both, ColourInfo = ColourInfo.GradientVertical(OsuColour.Gray(0.2f), OsuColour.Gray(0.6f)) }, iconDrawable = new TextAwesome { Anchor = Anchor.Centre, Origin = Anchor.Centre, Icon = icon, TextSize = 20 } }); Content.Add(textDrawable = new OsuSpriteText { TextSize = 16, Colour = OsuColour.Gray(128), AutoSizeAxes = Axes.Y, RelativeSizeAxes = Axes.X, Text = text }); }
protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) { if (e.Effect != DragDropEffects.None) { if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { IEnumerable <T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast <T>(); if (e.Effect.HasFlag(DragDropEffects.Copy)) { Cloner cloner = new Cloner(); items = items.Select(x => cloner.Clone(x)); } if (ItemCollection != null) { ItemCollection.AddRange(items); } else { foreach (T item in items) { Content.Add(item); } } } } }
protected override void CreateChildControls() { HtmlGenericControl span = new HtmlGenericControl("span"); Table table = new Table(); table.Attributes.Add("border", "0"); table.Attributes.Add("cellspacing", "0"); table.Attributes.Add("cellpadding", "0"); TableRow row = new TableRow(); table.Rows.Add(row); TableCell cell = new TableCell(); row.Cells.Add(cell); cell.VerticalAlign = VerticalAlign.Middle; cell.HorizontalAlign = HorizontalAlign.Center; cell.CssClass = "ajax__htmleditor_popup_bgibutton"; LiteralControl literal = new LiteralControl(Text); span.Controls.Add(literal); cell.Controls.Add(span); Content.Add(table); base.CreateChildControls(); }
private Content ShowRules(string identifier) { Rule R = Manager.FetchRule(identifier); if (R == null) { R = RuleHelper.GetRulesItem2(identifier); R.Language = RuleLanguage.Sanskrit; if (R == null) { return(null); } } string s = CheatSheet.BuildRulesWithExamples(R); Content C = new Content(); C.Binder = s; C.IsContent = true; C.Title = R.Name + " — " + GetLanaguage(R.Language); C.Description = R.Name + " ఛందస్సు లక్షణాలు,ఉదాహరణలు,స్వభావం"; C.KeyWords = R.Name + ",ఛందస్సు," + R.Identifier; C.Related.Add(GetLangLink(R.Language)); if (R.Language != RuleLanguage.Sanskrit) { C.Add("'" + R.Name + "' పద్య ఛందస్సులో వ్రాసిన పద్యాన్ని గణించండి.", "?chandam=" + R.Identifier); } return(C); }
protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { if (e.Effect != DragDropEffects.None) { var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); var solutions = dropData.GetObjectGraphObjects().OfType <IRegressionSolution>(); if (e.Effect.HasFlag(DragDropEffects.Copy)) { Cloner cloner = new Cloner(); solutions = solutions.Select(s => cloner.Clone(s)); } var solutionCollection = Content as ItemCollection <IRegressionSolution>; if (solutionCollection != null) { solutionCollection.AddRange(solutions); } else { foreach (var solution in solutions) { Content.Add(solution); } } } }
private List <BaseXHTMLFileV2> SplitParagraph(Paragraph paragraph) { var list = new List <BaseXHTMLFileV2>(); foreach (var subElement in paragraph.SubElements()) { var newParagraph = new Paragraph(Compatibility); newParagraph.Add(subElement); ulong itemSize = EstimateSize(newParagraph); if (itemSize > MaxSize) { if (Content.SubElements() != null) { List <BaseXHTMLFileV2> subList = null; if (subElement.GetType() == typeof(SimpleHTML5Text)) { subList = SplitSimpleText(subElement as SimpleHTML5Text); } if (subList != null) { list.AddRange(subList); } } } else { Content.Add(newParagraph); } } return(list); }
protected override void InitContent() { foreach (IField field in currentClass.Fields) { Content.Add(new FieldWrapper(field)); } }
public virtual int Insert(T item) { int index = Content.Add(item); index = BubbleUp(index); return(index); }