Пример #1
0
 public static bool TrySetGlobalProperty <T>(ref GlobalStyle style, string name, T value)
 {
     if (style == null)
     {
         style = new GlobalStyle();
     }
     return(TrySetGlobalProperty(style, name, value));
 }
Пример #2
0
        public void TestGlobalStyle()
        {
            var obj = new _GlobalStyleFrontEndExample();

            Assert.IsTrue(GlobalStyle.TrySetGlobalProperty(obj, GlobalStyle.COLOR, ColorStyle.Red));
            Assert.IsTrue(GlobalStyle.TryGetGlobalProperty <ColorStyle>(obj, GlobalStyle.COLOR, out var color));

            Assert.AreEqual(ColorStyle.Red, color);
        }
Пример #3
0
        public GlobalStyle Clone()
        {
            var clone = new GlobalStyle();

            if (this._Properties == null)
            {
                return(clone);
            }

            clone._Properties = new Dictionary <string, object>();

            foreach (var kvp in this._Properties)
            {
                clone._Properties[kvp.Key] = kvp.Value;
            }

            return(clone);
        }
Пример #4
0
 bool GlobalStyle.ISource.TryGetGlobalProperty <T>(string name, out T value)
 {
     return(GlobalStyle.TryGetGlobalProperty(_GlobalStyles, name, out value));
 }
Пример #5
0
 bool GlobalStyle.ISource.TrySetGlobalProperty <T>(string name, T value)
 {
     return(GlobalStyle.TrySetGlobalProperty(ref _GlobalStyles, name, value));
 }