示例#1
0
    private void InitialMinutesChanged(AbstractProperty property, object _oldValue)
    {
      int oldValue = 0;
      if (_oldValue != null)
        oldValue = (int)_oldValue;

      if (_actSystemState.HasValue)
      {
        property.SetValue(oldValue); // no new value while running
        return;
      }

      int newValue = (int)property.GetValue();

      newValue = Math.Max(0, Math.Min(_maxSleepTimeInMinutes, newValue));
      property.SetValue(newValue);
      TimeText = newValue.ToString();
      UpdateButtonEnabled();
    }
 protected void UpdateForChannel(IChannel channel, ProgramProperties current, ProgramProperties next, AbstractProperty channelNameProperty, AbstractProperty progressProperty)
 {
   channelNameProperty.SetValue(channel.Name);
   IProgram currentProgram;
   IProgram nextProgram;
   if (_tvHandler.ProgramInfo.GetNowNextProgram(channel, out currentProgram, out nextProgram))
   {
     current.SetProgram(currentProgram);
     next.SetProgram(nextProgram);
     double progress = (DateTime.Now - currentProgram.StartTime).TotalSeconds / (currentProgram.EndTime - currentProgram.StartTime).TotalSeconds * 100;
     progressProperty.SetValue(progress);
   }
   else
   {
     current.SetProgram(null);
     next.SetProgram(null);
     progressProperty.SetValue(100d);
   }
 }