Exemple #1
0
        public void Load(WidgetConfig config)
        {
            bool             value;
            WidgetConfigItem item;

            if ((item = config.TryGetItem("Horizontal")) != null)
            {
                if (bool.TryParse(item.Value, out value))
                {
                    _props.Horizontal = value;
                }
            }

            if ((item = config.TryGetItem("Vertical")) != null)
            {
                if (bool.TryParse(item.Value, out value))
                {
                    _props.Vertical = value;
                }
            }
        }
        public void Load(WidgetConfig config)
        {
            WidgetConfigItem item;
            int monitor;

            if ((item = config.TryGetItem("SourceMonitor")) != null)
            {
                if (int.TryParse(item.Value, out monitor) && monitor > 0)
                {
                    _props.SourceMonitor = monitor;
                }
            }

            if ((item = config.TryGetItem("DestinationMonitor")) != null)
            {
                if (int.TryParse(item.Value, out monitor) && monitor > 0)
                {
                    _props.DestinationMonitor = monitor;
                }
            }
        }
Exemple #3
0
            private Color GetConfigColor(WidgetConfig config, string name, Color defVal)
            {
                var item = config.TryGetItem(name);

                if (item == null)
                {
                    return(defVal);
                }

                try
                {
                    return(ColorTranslator.FromHtml(item.Value));
                }
                catch (Exception)
                {
                    return(defVal);
                }
            }
Exemple #4
0
            private bool GetConfigBool(WidgetConfig config, string name, bool defVal)
            {
                var item = config.TryGetItem(name);

                if (item == null)
                {
                    return(defVal);
                }

                bool value;

                if (!bool.TryParse(item.Value, out value))
                {
                    return(defVal);
                }

                return(value);
            }