public void SetMemento(IXmlConvertable memento) { IProperties properties = (IProperties)memento; string[] bookMarks = properties.GetProperty("Bookmarks").ToString().Split(','); foreach (string mark in bookMarks) { if (mark != null && mark.Length > 0) { textEditorControl.Document.BookmarkManager.Marks.Add(Int32.Parse(mark)); } } textEditorControl.ActiveTextAreaControl.Caret.Position = ((TextEditorControl)this.Control).Document.OffsetToPosition(Math.Min(((TextEditorControl)this.Control).Document.TextLength, Math.Max(0, properties.GetProperty("CaretOffset", ((TextEditorControl)this.Control).ActiveTextAreaControl.Caret.Offset)))); if (((TextEditorControl)this.Control).Document.HighlightingStrategy.Name != properties.GetProperty("HighlightingLanguage", ((TextEditorControl)this.Control).Document.HighlightingStrategy.Name)) { IHighlightingStrategy highlightingStrategy = HighlightingManager.Manager.FindHighlighterByName(properties.GetProperty("HighlightingLanguage", ((TextEditorControl)this.Control).Document.HighlightingStrategy.Name)); if (highlightingStrategy != null) { textEditorControl.Document.HighlightingStrategy = highlightingStrategy; } } textEditorControl.ActiveTextAreaControl.TextArea.TextViewMargin.FirstVisibleLine = properties.GetProperty("VisibleLine", 0); textEditorControl.Document.FoldingManager.DeserializeFromString(properties.GetProperty("Foldings", "")); }
public void ShowPad(IPadContent content) { if (contentHash[content] == null) { IProperties properties = (IProperties)propertyService.GetProperty("Workspace.ViewMementos", new DefaultProperties()); string type = content.GetType().ToString(); content.Control.Dock = DockStyle.None; Content c1; if (content.Icon != null) { ImageList imgList = new ImageList(); imgList.Images.Add(content.Icon); c1 = dockManager.Contents.Add(content.Control, content.Title, imgList, 0); } else { c1 = dockManager.Contents.Add(content.Control, content.Title); } c1.DisplaySize = new Size(270, 200); contentHash[content] = c1; if (properties.GetProperty(type, "Left") == "Left") { if (leftContent == null) { leftContent = dockManager.AddContentWithState(c1, State.DockLeft); } else { dockManager.AddContentToWindowContent(c1, leftContent); } } else if (properties.GetProperty(type, "Left") == "Bottom") { if (bottomContent == null) { bottomContent = dockManager.AddContentWithState(c1, State.DockBottom); } else { dockManager.AddContentToWindowContent(c1, bottomContent); } } } else { Content c = (Content)contentHash[content]; if (c != null) { dockManager.ShowContent(c); } } }
public void GetProperty_will_throw_on_invalid_property_name(IProperties pp) { Assert.Throws <ArgumentException>(() => pp.GetProperty("")); Assert.Throws <ArgumentException>(() => pp.GetProperty(null)); Assert.Throws <ArgumentException>(() => pp.GetPropertyType("")); Assert.Throws <ArgumentException>(() => pp.GetPropertyType(null)); Assert.Throws <ArgumentException>(() => pp.TryGetProperty("", typeof(object), out _)); Assert.Throws <ArgumentException>(() => pp.TryGetProperty(null, typeof(object), out _)); }
public DefaultTextEditorProperties() { properties = ((IProperties)propertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties())); FontContainer.DefaultFont = FontContainer.ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString())); properties.PropertyChanged += new PropertyEventHandler(CheckFontChange); }
public Expression <Func <T, bool> > GetExpression <T>(WhereExpression where) where T : class { var property = properties.GetProperty <T>(where.Field); Expression <Func <T, bool> > expression = null; switch (where.Expression) { case Where.Expression.Equals: expression = func => func.GetPropertyValue(property.Name).ToString() == where.Value; break; case Where.Expression.Contains: expression = func => func.GetPropertyValue(property.Name).ToString().Contains(where.Value); break; case Where.Expression.Diff: expression = func => func.GetPropertyValue(property.Name).ToString() != where.Value; break; default: break; } return(expression); }
public object this[string property] { get { return(_underlying.GetProperty(property)); } set { _underlying.SetProperty(property, value); } }
public override void LoadSettings() { DigitsNode node = (DigitsNode)parentNode; IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties())); sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString())); color = node.HighlightColor; PreviewUpdate(sampleLabel, color); }
public void testGetProperty() { //returns null on no data from server Assert.IsNull(properties.GetProperty("stamina")); mockFetch(userView, null); //returns Hashtable of property if exists Roar.DomainObjects.PlayerAttribute staminaProperty = properties.GetProperty("stamina"); Assert.IsNotNull(staminaProperty); StringAssert.IsMatch("5", staminaProperty.value); StringAssert.IsMatch("resource", staminaProperty.type); StringAssert.IsMatch("123", staminaProperty.max); StringAssert.IsMatch("0", staminaProperty.min); StringAssert.IsMatch("1000", staminaProperty.regen_every); StringAssert.IsMatch("Stamina", staminaProperty.label); //returns null on property not existing Assert.IsNull(properties.GetProperty("doesnotexist")); }
/// <summary> /// Evaluates the given property name. /// </summary> /// <remarks> /// If <c>propValue</c> is <see langword="null" />, or equal to the character string <c>"*"</c>, will return <see langword="true"/> /// if the resolved property value is not equal to (ignoring case) <c>"false"</c>. If <c>propValue</c> is given, will return /// <see langword="true" /> if the resolved property value is equal to (considering case) <c>propValue</c>. If <c>negate</c> /// is <see langword="true"/>, the return value will be negated. /// </remarks> /// <param name="propName">Property name to resolve.</param> /// <param name="propValue">Property value to test against. Pass <see langword="null" /> or <c>"*"</c> to only test whether /// the property is defined.</param> /// <param name="negate"><see langword="true"/> to negate the result.</param> /// <returns><see langword="true"/> if the given <c>propName</c> is defined, and equal to <c>propValue</c>, if applicable. If /// <c>propValue</c> is not given or <c>"*"</c>, will return <see langword="true"/> if <c>propName</c> is defined.</returns> protected bool Eval(string propName, string propValue, bool negate) { var value = properties.GetProperty(propName); if (value is null) { return(negate); } var result = propValue is null || propValue == "*" ? value.ToLower() != "false" : value == propValue; return(negate ? !result : result); }
public override void LoadSettings() { MarkerNode node = (MarkerNode)parentNode; PropertyService propertyService = (PropertyService)ServiceManager.Services.GetService(typeof(PropertyService)); IProperties properties = ((IProperties)propertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties())); sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString())); color = node.HighlightColor; nameBox.Text = node.What; checkBox.Checked = node.MarkMarker; PreviewUpdate(sampleLabel, color); }
public EnvironmentItem(int index, string name, EditorHighlightColor color, Font listFont) : base(new string[] { name, "Sample" }) { Name = name; Color = color; arrayIndex = index; this.UseItemStyleForSubItems = false; IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties())); basefont = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString())); listfont = listFont; ColorUpdate(); }
public override void LoadSettings() { KeywordListNode node = (KeywordListNode)parentNode; listBox.Items.Clear(); foreach (string word in node.Words) { listBox.Items.Add(word); } IProperties properties = ((IProperties)PropertyService.GetProperty("NetFocus.DataStructure.TextEditor.Document.DefaultDocumentProperties", new DefaultProperties())); sampleLabel.Font = ParseFont(properties.GetProperty("DefaultFont", new Font("Courier New", 10).ToString())); color = node.HighlightColor; nameBox.Text = node.Name; PreviewUpdate(sampleLabel, color); }
public static object ApplyProperties(this MethodInfo method, object thisArg, IProperties properties) { if (method == null) { throw new ArgumentNullException(nameof(method)); } properties = properties ?? Properties.Empty; var methodParameters = method.GetParameters(); var parms = new object[methodParameters.Length]; int paramIndex = 0; if (method.IsStatic) { if (methodParameters.Length == 0) { throw RuntimeFailure.ApplyPropertiesStaticMethodRequiresArg("method"); } if (thisArg == null) { throw new ArgumentNullException(nameof(thisArg)); } parms[0] = thisArg; paramIndex = 1; if (!methodParameters[0].ParameterType.IsInstanceOfType(thisArg)) { throw RuntimeFailure.ThisArgumentIncorrectType(thisArg.GetType()); } } for (; paramIndex < methodParameters.Length; paramIndex++) { var pi = methodParameters[paramIndex]; parms[paramIndex] = properties.GetProperty(pi.Name); } return(method.Invoke(thisArg, parms)); }
/// <summary> /// Retrieves the value of a property from the current process. /// </summary> /// <param name="key">The name of the property.</param> /// <returns>The property value.</returns> public static string GetProperty(string key) { return(properties.GetProperty(key)); }
public void ReadOnlyAdapters_should_apply_GetProperty(IProperties p) { Assert.Equal("bc123", p.GetProperty("a")); Assert.Equal(typeof(string), p.GetPropertyType("a")); }