public void ShouldBeAbleToClearLabelsOfCurrentScope() { _labels = new LabelCollection(); _labels.Scopes.SetCurrent("Test Scenario 1"); _labels.Add(_label1Name, _label1Index); _labels.Count().Should().Be(1); _labels.Scopes.SetCurrent("Function 2"); _labels.Add(_label2Name, _label2Index); _labels.Count().Should().Be(2); _labels.Contains(_label1Name).Should().BeFalse(); _labels.GetValue(_label1Name).Should().Be(-1); _labels.Contains(_label2Name).Should().BeTrue(); _labels.GetValue(_label2Name).Should().Be(_label2Index); _labels.RemoveCurrentScopedValues(); _labels.Count().Should().Be(1); _labels.Contains(_label2Name).Should().BeFalse(); _labels.GetValue(_label2Name).Should().Be(-1); _labels.Contains(_label1Name).Should().BeTrue(); _labels.GetValue(_label1Name).Should().Be(_label1Index); }
public new virtual void SetUp() { SystemSettings.ApiKey.Returns(ApiKey); ContentAreasServiceAgent.GetByCollectionNameAndApiKey(ApiKey, CollectionName).Returns(contentAreas); LabelCollectionMapper.Map(contentAreas).Returns(mappedValueFromServiceAgent); result = LabelCollectionRetriever.Get(CollectionName); }
public virtual void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: _id = value.StringVal; break; case 1: _familyName = value.StringVal; break; case 2: _givenName = value.StringVal; break; case 3: if (_middleNames == null) { _middleNames = new LabelCollection(this); } ((IXbimNoNotifyCollection)_middleNames).Add(new IfcLabel(value.StringVal)); break; case 4: if (_prefixTitles == null) { _prefixTitles = new LabelCollection(this); } ((IXbimNoNotifyCollection)_prefixTitles).Add(new IfcLabel(value.StringVal)); break; case 5: if (_suffixTitles == null) { _suffixTitles = new LabelCollection(this); } ((IXbimNoNotifyCollection)_suffixTitles).Add(new IfcLabel(value.StringVal)); break; case 6: if (_roles == null) { _roles = new ActorRoleCollection(this); } ((IXbimNoNotifyCollection)_roles).Add((IfcActorRole)value.EntityVal); break; case 7: if (_addresses == null) { _addresses = new AddressCollection(this); } ((IXbimNoNotifyCollection)_addresses).Add((IfcAddress)value.EntityVal); break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
private static void UpdateTerm(TermSetItem termSet, ManagedMetadataEntity entity, IEnumerable <IEnumerable <ManagedMetadataEntity> > termLevels, int currLevel) { int lcid = entity.LCID.HasValue ? entity.LCID.Value : 1033; string termName = TaxonomyItem.NormalizeName(entity.GetTermLevel(currLevel)); if (string.IsNullOrEmpty(termName)) { return; } Term term = termSet is TermSet ? (termSet as TermSet).GetTerms(termName, lcid, true, StringMatchOption.ExactMatch, 1, false). FirstOrDefault() : termSet.Terms.FirstOrDefault(t => t.Name.Equals(termName, StringComparison.InvariantCulture)); if (term == null) { //try //{ term = termSet.CreateTerm(termName, lcid, Guid.NewGuid()); term.IsAvailableForTagging = entity.AvailableForTagging; //} //catch (Exception ex) //{ //} } LabelCollection allLabels = term.GetAllLabels(lcid); if (allLabels.Count == 0 || !allLabels.Select(x => x.Value).Contains(termName)) { //try //{ term.CreateLabel(termName, lcid, true); term.SetDescription(entity.TermDescription, lcid); //} //catch (Exception ex) //{ //} } if (termLevels == null) { return; } if (currLevel >= termLevels.Count()) { return; } IEnumerable <ManagedMetadataEntity> childList = termLevels.ElementAt(currLevel).Where( t => t.HasSameLevelTerm(currLevel, entity)); foreach (ManagedMetadataEntity childEntity in childList) { UpdateTerm(term, childEntity, termLevels, currLevel + 1); } }
public new virtual void SetUp() { base.SetUp(); ContentAreasServiceAgent.GetByCollectionNameAndApiKey(ApiKey, CollectionName) .Returns(x => { throw new ApiKeyNotValidException(); }); SystemSettings.ApiKey.Returns(ApiKey); _result = LabelCollectionRetriever.Get(CollectionName); }
public override EditResult Write(int address, byte[] data, byte[] oriData, LabelCollection labels) { for (int i = 0; i < count; i++) { data[address + i] = 0x90; } return(EditResult.NoErrors); }
/// <summary> /// /// </summary> public void PopulateDefaults() { DefaultLanguage = "en"; TitleLabels = new LabelCollection <TitlePageLabel> { [DefaultLanguage] = new TitlePageLabel { Value = "Default Survey Title", Survey = this } }; SurveyPermissions = new HashSet <SurveyPermission>(); SurveyViews = new SurveyViewCollection <SurveyView>() { new SurveyView { ViewName = "Standard", Survey = this, WelcomePageLabels = new LabelCollection <WelcomePageLabel> { [DefaultLanguage] = new WelcomePageLabel { Value = null } }, ThankYouPageLabels = new LabelCollection <ThankYouPageLabel> { [DefaultLanguage] = new ThankYouPageLabel { Value = null } }, TermsAndConditionsLabels = new LabelCollection <TermsAndConditionsPageLabel> { [DefaultLanguage] = new TermsAndConditionsPageLabel { // language is set on the object with the helper Value = null } }, ScreeningQuestionLabels = new LabelCollection <ScreeningQuestionsPageLabel> { [DefaultLanguage] = new ScreeningQuestionsPageLabel { Value = null } } } }; }
public ViewResult Index() { const string collectionName = "Home Page"; LabelCollection labelCollection = _labelCollectionRetriever.Get(collectionName); return(View(new HomeViewModel { Labels = labelCollection })); }
public new virtual void SetUp() { base.SetUp(); contentAreasToMap = new List <ContentArea> { contentarea1, contentarea2 }; ContentAreaMapper.Map(contentarea1).Returns(mappedContentArea1); ContentAreaMapper.Map(contentarea2).Returns(mappedContentArea2); result = LabelCollectionMapper.Map(contentAreasToMap); }
private void InitCollections() { controls = new ControlCollection(control.Controls); // These will be initialized as needed buttons = null; labels = null; textboxes = null; combos = null; }
private void InitCollections() { controls = new ControlCollection( control.Controls ); // These will be initialized as needed buttons = null; labels = null; textboxes = null; combos = null; }
/// <summary> /// </summary> public static string LabelsToString(LabelCollection labels, string termName) { if (labels == null || labels.Count <= 0) { return(""); } List <string> lstLabels = labels.Where(x => x.Value != termName).Select(x => x.Value).ToList <string>(); string strLabels = string.Join(";", lstLabels.ToArray <string>()); return(strLabels); }
public void SetMiddleNames(params string[] middleNames) { if (_middleNames == null) { _middleNames = new LabelCollection(this); } else { _middleNames.Clear(); } foreach (string item in middleNames) { _middleNames.Add(item); } }
/// <summary> /// Initialise the ElectronicMailAddress the list of email addresses. Clears any existing addresses, further lines can be added through the ElectronicMailAddress property. /// </summary> public LabelCollection SetElectronicMailAddress(params string[] emails) { if (_electronicMailAddresses == null) { _electronicMailAddresses = new LabelCollection(this); } else { _electronicMailAddresses.Clear(); } foreach (string email in emails) { _electronicMailAddresses.Add(email); } return(_electronicMailAddresses); }
/// <summary> /// Initialise the FacsimileNumbers to the list of numbers. Clears any existing numbers, further lines can be added through the FacsimileNumbers property. /// </summary> public LabelCollection SetFacsimileNumbers(params string[] numbers) { if (_facsimileNumbers == null) { _facsimileNumbers = new LabelCollection(this); } else { _facsimileNumbers.Clear(); } foreach (string num in numbers) { _facsimileNumbers.Add(num); } return(_facsimileNumbers); }
private static JArray TermLabels(LabelCollection labels) { JArray labelArray = new JArray(); foreach (Label label in labels) { var json = new JObject(); json.Add(new JProperty("isDefaultForLanguage", label.IsDefaultForLanguage)); json.Add(new JProperty("language", label.Language)); json.Add(new JProperty("value", label.Value)); labelArray.Add(new JObject(json)); } return(labelArray); }
public void ShouldBeAbleToAddLabel() { _labels = new LabelCollection(); _labels.Scopes.SetCurrent("Test Scenario 1"); _labels.Add(_label1Name, _label1Index); _labels.Add(_label2Name, _label2Index); _labels.Count().Should().Be(2); _labels.Contains(_label1Name).Should().BeTrue(); _labels.GetValue(_label1Name).Should().Be(_label1Index); _labels.Contains(_label2Name).Should().BeTrue(); _labels.GetValue(_label2Name).Should().Be(_label2Index); }
/// <summary> /// Initialise the addresslines list of address lines. Clears any existing lines, further lines can be added through the AddressLine property /// </summary> public LabelCollection SetAddressLines(params string[] lines) { if (AddressLines == null) { AddressLines = new LabelCollection(this); } else { AddressLines.Clear(); } foreach (string line in lines) { AddressLines.Add(line.Trim()); } return(AddressLines); }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: base.IfcParse(propIndex, value); break; case 3: _internalLocation = value.StringVal; break; case 4: if (_addressLines == null) { _addressLines = new LabelCollection(this); } _addressLines.Add(value.StringVal); break; case 5: _postalBox = value.StringVal; break; case 6: _town = value.StringVal; break; case 7: _region = value.StringVal; break; case 8: _postalCode = value.StringVal; break; case 9: _country = value.StringVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public override void IfcParse(int propIndex, IPropertyValue value) { switch (propIndex) { case 0: case 1: case 2: base.IfcParse(propIndex, value); break; case 3: if (_telephoneNumbers == null) { _telephoneNumbers = new LabelCollection(this); } _telephoneNumbers.Add(value.StringVal); break; case 4: if (_facsimileNumbers == null) { _facsimileNumbers = new LabelCollection(this); } _facsimileNumbers.Add(value.StringVal); break; case 5: _pagerNumber = value.StringVal; break; case 6: if (_electronicMailAddresses == null) { _electronicMailAddresses = new LabelCollection(this); } _electronicMailAddresses.Add(value.StringVal); break; case 7: _wwwHomePageUrl = value.StringVal; break; default: this.HandleUnexpectedAttribute(propIndex, value); break; } }
public static TermModel Term(Term term) { List <Lbl> labels = new List <Lbl>(); LabelCollection labelCollection = term.Labels; foreach (var label in labelCollection) { labels.Add(new Lbl() { IsDefaultForLanguage = label.IsDefaultForLanguage, Language = label.Language, Value = label.Value }); } return(new TermModel { Id = term.Id, Name = term.Name, Description = term.Description, Labels = labels }); }
public static void getSubTerms(Term parentTerm, ITATerms parentITATerm, TraceWriter log) { if (parentTerm.TermsCount > 0) { parentITATerm.Terms = new List <ITATerms>(); foreach (var term in parentTerm.Terms) { LabelCollection col = term.Labels; ITATerms itaTerm = new ITATerms(); itaTerm.Name = term.Name != null ? term.Name : ""; itaTerm.Id = term.Id != null ? term.Id : new Guid(); itaTerm.Type = term.GetType().ToString(); if (term.Labels.Count > 0) { itaTerm.Labels = new List <string>(); foreach (var label in term.Labels) { itaTerm.Labels.Add(label.Value); } } if (term.CustomProperties.Count > 0) { itaTerm.CustomProps = new List <ITATermProperty>(); foreach (var prop in term.CustomProperties) { itaTerm.CustomProps.Add(new ITATermProperty() { key = prop.Key, value = prop.Value }); } } log.Info(parentITATerm.Name + " ----- " + term.Name); getSubTerms(term, itaTerm, log); parentITATerm.Terms.Add(itaTerm); } } }
private void InitLabelIdsWithMatchingText(Element element) { labelIdsWithMatchingText = new Dictionary <string, bool>(); DomContainer domContainer = element.DomContainer; LabelCollection labels = domContainer.Labels.Filter(e => { string text = e.Text; if (string.IsNullOrEmpty(text)) { return(false); } return(StringComparer.AreEqual(text.Trim(), labelText)); }); foreach (Label label in labels) { string forElementWithId = label.For; labelIdsWithMatchingText.Add(forElementWithId, true); } }
public Main() { InitializeComponent(); // Timer that dictates how quick the path steps are calculated _pathTimer = new System.Timers.Timer(Delay); _pathTimer.Elapsed += PathTimer_Elapsed; // Sound object _soundManager = new Sounds(Properties.Settings.Default.EnableSounds); _soundManager.LoadSounds(); // Array used to address the statistics labels _labels[0] = new LabelCollection { AlgorithmId = 0, Labels = new[] { lblAlgorithm, lblDijkstraOperations, lblDijkstraUnexplored, lblDijkstraOpen, lblDijkstraClosed, lblDijkstraPathLength } }; _labels[1] = new LabelCollection { AlgorithmId = 1, Labels = new[] { lblAlgorithm, lblAStarOperations, lblAStarUnexplored, lblAStarOpen, lblAStarClosed, lblAStarPathLength } }; _labels[2] = new LabelCollection { AlgorithmId = 2, Labels = new[] { lblAlgorithm, lblBreadthFirstOperations, lblBreadthFirstUnexplored, lblBreadthFirstOpen, lblBreadthFirstClosed, lblBreadthFirstPathLength } }; _labels[3] = new LabelCollection { AlgorithmId = 3, Labels = new[] { lblAlgorithm, lblDepthFirstOperations, lblDepthFirstUnexplored, lblDepthFirstOpen, lblDepthFirstClosed, lblDepthFirstPathLength } }; InitialiseMaze(); }
public override EditResult Write(int address, byte[] data, byte[] oriData, LabelCollection labels) { return(EditResult.NoErrors); }
public BinArgs(byte[] data, LabelCollection labels, double value) { this.data = data; this.labels = labels; this.value = value; }
public abstract EditResult Write(int address, byte[] data, byte[] oriData, LabelCollection labels);
public QuestionOption() { QuestionOptionLabels = new LabelCollection <QuestionOptionLabel>(); }