コード例 #1
0
ファイル: FlipImage.cs プロジェクト: jeason0813/wallswitch
        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;
                }
            }
        }
コード例 #2
0
ファイル: ScreenReplicate.cs プロジェクト: cmrazek/WallSwitch
        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;
                }
            }
        }
コード例 #3
0
ファイル: SysInfo.cs プロジェクト: jeason0813/wallswitch
            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);
                }
            }
コード例 #4
0
ファイル: SysInfo.cs プロジェクト: jeason0813/wallswitch
            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);
            }