本文整理汇总了C#中Windows.GetActiveDutyCyclePercentage方法的典型用法代码示例。如果您正苦于以下问题:C# Windows.GetActiveDutyCyclePercentage方法的具体用法?C# Windows.GetActiveDutyCyclePercentage怎么用?C# Windows.GetActiveDutyCyclePercentage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows
的用法示例。
在下文中一共展示了Windows.GetActiveDutyCyclePercentage方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PwmPin
internal PwmPin(
Pwm pwm,
string id,
int number,
Windows.Devices.Pwm.PwmPin pin
)
: base(pwm.Environment,
id,
string.Format($"Pin {number + 1}"),
new ObjectType("PWM pin", "PWM pin", "Pulse width modulation pin"),
parent: pwm)
{
pwm.ValidateNonNull(nameof(pwm));
number.ValidateIn(0, pwm.PinCount.Value);
pin.ValidateNonNull(nameof(pin));
Pwm = pwm;
Pin = pin;
Number = new Property<int>(this,
nameof(Number), "Number", number);
Items.Add(Number);
DelegateCommand command;
command = new DelegateCommand(this,
nameof(Close), "Close",
() => Close()
);
Items.Add(command);
IsStarted = new Property<bool>(this,
nameof(IsStarted), "Is started", false);
Items.Add(IsStarted);
command = new DelegateCommand(this,
nameof(Start), "Start",
() => Start(),
() => CanStart
);
Items.Add(command);
command = new DelegateCommand(this,
nameof(Stop), "Stop",
() => Stop(),
() => CanStop
);
Items.Add(command);
DutyCyclePercentage = new PhysicalProperty<double>(this,
nameof(DutyCyclePercentage), "Duty cycle", pin.GetActiveDutyCyclePercentage(), Units.Percentage
);
Items.Add(DutyCyclePercentage);
command = new DelegateCommand<double>(this,
nameof(SetDutyCyclePercentage), "Set duty cycle",
p => SetDutyCyclePercentage(p),
p => CanSetDutyCyclePercentage(p),
parameters: new CommandPhysicalParameterInfo<double>(DutyCyclePercentage)
);
Items.Add(command);
Polarity = new Property<PwmPulsePolarity>(this, nameof(Polarity), "Polarity", pin.Polarity);
Items.Add(Polarity);
command = new DelegateCommand<PwmPulsePolarity>(this,
nameof(SetPolarity), "Set polarity",
p => SetPolarity(p),
parameters: new CommandParameterInfo<PwmPulsePolarity>(Polarity)
);
Items.Add(command);
}