当前位置: 首页>>代码示例>>C#>>正文


C# IData.TryGetValue方法代码示例

本文整理汇总了C#中IData.TryGetValue方法的典型用法代码示例。如果您正苦于以下问题:C# IData.TryGetValue方法的具体用法?C# IData.TryGetValue怎么用?C# IData.TryGetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IData的用法示例。


在下文中一共展示了IData.TryGetValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SetFromIData

        protected override void SetFromIData(ILogicalDevice logicalDevice, IData data)
        {
            base.SetFromIData(logicalDevice, data);

            object value;
            if (data.TryGetValue(DataElements.Pan, out value))
                this.pan = ((double)value).Limit(0, 540);

            if (data.TryGetValue(DataElements.Tilt, out value))
                this.tilt = ((double)value).Limit(0, 270);
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:11,代码来源:MonopriceMovingHeadLight12chn.cs

示例2: SetFromIData

        protected override void SetFromIData(ILogicalDevice logicalDevice, IData data)
        {
            base.SetFromIData(logicalDevice, data);

            object value;
            if (data.TryGetValue(DataElements.StrobeSpeed, out value))
                this.strobeSpeed = (double)value;
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:8,代码来源:BaseStrobeLight.cs

示例3: SetFromIData

        protected override void SetFromIData(ILogicalDevice logicalDevice, IData data)
        {
            base.SetFromIData(logicalDevice, data);

            if (data.ContainsKey(DataElements.ColorRGB) ||
                data.ContainsKey(DataElements.ColorWhite))
            {
                object value;

                componentMaster = (this.colorBrightness.Brightness * (1 - Executor.Current.Blackout.Value)).GetByteScale();

                Color colorRGB;
                if (data.TryGetValue(DataElements.ColorRGB, out value))
                    colorRGB = (Color)value;
                else
                    colorRGB = this.colorBrightness.Color;

                componentRed = colorRGB.R;
                componentGreen = colorRGB.G;
                componentBlue = colorRGB.B;

                //TODO: WhiteOut
                if (data.TryGetValue(DataElements.ColorWhite, out value))
                    componentWhite = ((double)value).GetByteScale();
            }
            else
            {
                var rgbw = RgbConverter.GetRGBW(this.colorBrightness.Color);

                componentMaster = this.colorBrightness.Brightness.GetByteScale();
                componentRed = rgbw.R;
                componentGreen = rgbw.G;
                componentBlue = rgbw.B;
                componentWhite = rgbw.W;
            }
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:36,代码来源:MFL7x10WPar.cs

示例4: PreprocessPushData

        protected override IData PreprocessPushData(IData data)
        {
            object value;
            if (data.TryGetValue(DataElements.Color, out value))
            {
                Color allColor = (Color)value;

                if (allColor != Color.Transparent)
                {
                    var bitmap = (Bitmap)data[DataElements.PixelBitmap];
                    using (var g = Graphics.FromImage(bitmap))
                    using (var allColorBrush = new SolidBrush(allColor))
                    {
                        g.FillRectangle(allColorBrush, 0, 0, bitmap.Width, bitmap.Height);
                    }
                }

                data.Remove(DataElements.Color);
            }

            return base.PreprocessPushData(data);
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:22,代码来源:VirtualPixel1D3.cs

示例5: SetFromIData

        protected override void SetFromIData(ILogicalDevice logicalDevice, IData data)
        {
            base.SetFromIData(logicalDevice, data);

            object value;
            if (data.TryGetValue(DataElements.Pan, out value))
                this.pan = ((double)value).Limit(0, 540);

            if (data.TryGetValue(DataElements.Tilt, out value))
                this.tilt = ((double)value).Limit(0, 270);

            #if TRACE_IDATA
            int id = 0;
            foreach (var kvp in data)
            {
                id++;
                log.Trace("{3} {0}. {1} = {2}", id, kvp.Key, kvp.Value, this.Name);
            }
            #endif
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:20,代码来源:TestLight.cs

示例6: SetFromIData

        protected virtual void SetFromIData(ILogicalDevice logicalDevice, IData data)
        {
            object value;
            bool masterPower = true;
            var masterPowerDevice = logicalDevice as IHasMasterPower;
            if (masterPowerDevice != null)
                masterPower = masterPowerDevice.MasterPower;

            if (data.TryGetValue(DataElements.Brightness, out value))
                this.colorBrightness.Brightness = (double)value * (masterPower ? 1 : 0);
            else
            {
                bool? power = data.GetValue<bool>(DataElements.Power);
                if (power.HasValue)
                    this.colorBrightness.Brightness = (power.Value && masterPower) ? 1 : 0;
            }

            if (data.TryGetValue(DataElements.Color, out value))
                this.colorBrightness.Color = (Color)value;
        }
开发者ID:HakanL,项目名称:animatroller,代码行数:20,代码来源:BaseLight.cs


注:本文中的IData.TryGetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。