Ejemplo n.º 1
0
 private string ConvertNightMode(NightMode mode)
 {
     return(mode == NightMode.Scheduled
         ? Strings.Resources.AutoNightScheduled
         : mode == NightMode.Automatic
         ? Strings.Resources.AutoNightAutomatic
         : Strings.Resources.AutoNightDisabled);
 }
Ejemplo n.º 2
0
        public void SetNight(NightMode mode)
        {
            movement.SaveParameter(FlashParameters.NightMode, (byte)mode);

            RovioResponse response = this.Request("/debug.cgi",
                                                  new RequestItem("action", "write_i2c"),
                                                  new RequestItem("address", "0x14"),
                                                  new RequestItem("value", "0x" + ((int)mode).ToString("X2")));
        }
Ejemplo n.º 3
0
        public void SetNightMode(NightMode mode)
        {
            this.NightMode = mode;

            RovioAPI           api      = rovio.API;
            MovementController movement = api.Movement;

            api.SetNight(this.NightMode);
        }
Ejemplo n.º 4
0
 private Visibility ConvertModeVisibility(NightMode current, NightMode expected)
 {
     return(current == expected ? Visibility.Visible : Visibility.Collapsed);
 }
Ejemplo n.º 5
0
        //private const float MAXIMUM_LUX_BREAKPOINT = 500.0f;

        //private void LightSensor_ReadingChanged(LightSensor sender, LightSensorReadingChangedEventArgs args)
        //{
        //    var lux = args.Reading.IlluminanceInLux;
        //    if (lux <= 0)
        //    {
        //        lux = 0.1f;
        //    }

        //    var last = lux;
        //    if (lux > MAXIMUM_LUX_BREAKPOINT)
        //    {
        //        last = 1.0f;
        //    }
        //    else
        //    {
        //        last = (float)Math.Ceiling(9.9323f * Math.Log(lux) + 27.059f) / 100.0f;
        //    }

        //    this.BeginOnUIThread(() =>
        //    {
        //        Lux.Value = last * 100;
        //    });
        //}

        #region Binding

        private int ConvertMode(NightMode mode)
        {
            return((int)mode);
        }
Ejemplo n.º 6
0
 public void ToggleNightMode(object sender, RoutedEventArgs e)
 {
     NightMode = !NightMode;
     AddUpdateAppSettings("NightMode", NightMode.ToString());
 }
Ejemplo n.º 7
0
        public void SetNightMode(NightMode mode)
        {
            this.NightMode = mode;

            RovioAPI api = rovio.API;
            MovementController movement = api.Movement;
            api.SetNight(this.NightMode);
        }
Ejemplo n.º 8
0
 private Visibility ConvertNightModeVisibility(NightMode mode)
 {
     return(mode == NightMode.Disabled ? Visibility.Collapsed : Visibility.Visible);
 }
Ejemplo n.º 9
0
 public SetNightMode(NightMode mode)
 {
     this.mode = mode;
 }
Ejemplo n.º 10
0
        public void SetNight(NightMode mode)
        {
            movement.SaveParameter(FlashParameters.NightMode, (byte)mode);

            RovioResponse response = this.Request("/debug.cgi",
                new RequestItem("action", "write_i2c"),
                new RequestItem("address", "0x14"),
                new RequestItem("value", "0x" + ((int)mode).ToString("X2")));
        }
Ejemplo n.º 11
0
        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (Units != null)
                {
                    hash = hash * 59 + Units.GetHashCode();
                }

                if (TimeFormat != null)
                {
                    hash = hash * 59 + TimeFormat.GetHashCode();
                }

                if (CustomTitle != null)
                {
                    hash = hash * 59 + CustomTitle.GetHashCode();
                }

                if (NightMode != null)
                {
                    hash = hash * 59 + NightMode.GetHashCode();
                }

                if (Theme != null)
                {
                    hash = hash * 59 + Theme.GetHashCode();
                }

                if (Language != null)
                {
                    hash = hash * 59 + Language.GetHashCode();
                }

                if (ShowPlugins != null)
                {
                    hash = hash * 59 + ShowPlugins.GetHashCode();
                }

                if (ShowRawbg != null)
                {
                    hash = hash * 59 + ShowRawbg.GetHashCode();
                }

                if (AlarmTypes != null)
                {
                    hash = hash * 59 + AlarmTypes.GetHashCode();
                }

                if (AlarmUrgentHigh != null)
                {
                    hash = hash * 59 + AlarmUrgentHigh.GetHashCode();
                }

                if (AlarmHigh != null)
                {
                    hash = hash * 59 + AlarmHigh.GetHashCode();
                }

                if (AlarmLow != null)
                {
                    hash = hash * 59 + AlarmLow.GetHashCode();
                }

                if (AlarmUrgentLow != null)
                {
                    hash = hash * 59 + AlarmUrgentLow.GetHashCode();
                }

                if (AlarmTimeagoWarn != null)
                {
                    hash = hash * 59 + AlarmTimeagoWarn.GetHashCode();
                }

                if (AlarmTimeagoWarnMins != null)
                {
                    hash = hash * 59 + AlarmTimeagoWarnMins.GetHashCode();
                }

                if (AlarmTimeagoUrgent != null)
                {
                    hash = hash * 59 + AlarmTimeagoUrgent.GetHashCode();
                }

                if (AlarmTimeagoUrgentMins != null)
                {
                    hash = hash * 59 + AlarmTimeagoUrgentMins.GetHashCode();
                }

                if (Enable != null)
                {
                    hash = hash * 59 + Enable.GetHashCode();
                }

                if (Thresholds != null)
                {
                    hash = hash * 59 + Thresholds.GetHashCode();
                }

                return(hash);
            }
        }
Ejemplo n.º 12
0
        /// <summary>
        /// Returns true if Settings instances are equal
        /// </summary>
        /// <param name="other">Instance of Settings to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(Settings other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Units == other.Units ||
                     Units != null &&
                     Units.Equals(other.Units)
                     ) &&
                 (
                     TimeFormat == other.TimeFormat ||
                     TimeFormat != null &&
                     TimeFormat.Equals(other.TimeFormat)
                 ) &&
                 (
                     CustomTitle == other.CustomTitle ||
                     CustomTitle != null &&
                     CustomTitle.Equals(other.CustomTitle)
                 ) &&
                 (
                     NightMode == other.NightMode ||
                     NightMode != null &&
                     NightMode.Equals(other.NightMode)
                 ) &&
                 (
                     Theme == other.Theme ||
                     Theme != null &&
                     Theme.Equals(other.Theme)
                 ) &&
                 (
                     Language == other.Language ||
                     Language != null &&
                     Language.Equals(other.Language)
                 ) &&
                 (
                     ShowPlugins == other.ShowPlugins ||
                     ShowPlugins != null &&
                     ShowPlugins.Equals(other.ShowPlugins)
                 ) &&
                 (
                     ShowRawbg == other.ShowRawbg ||
                     ShowRawbg != null &&
                     ShowRawbg.Equals(other.ShowRawbg)
                 ) &&
                 (
                     AlarmTypes == other.AlarmTypes ||
                     AlarmTypes != null &&
                     AlarmTypes.SequenceEqual(other.AlarmTypes)
                 ) &&
                 (
                     AlarmUrgentHigh == other.AlarmUrgentHigh ||
                     AlarmUrgentHigh != null &&
                     AlarmUrgentHigh.Equals(other.AlarmUrgentHigh)
                 ) &&
                 (
                     AlarmHigh == other.AlarmHigh ||
                     AlarmHigh != null &&
                     AlarmHigh.Equals(other.AlarmHigh)
                 ) &&
                 (
                     AlarmLow == other.AlarmLow ||
                     AlarmLow != null &&
                     AlarmLow.Equals(other.AlarmLow)
                 ) &&
                 (
                     AlarmUrgentLow == other.AlarmUrgentLow ||
                     AlarmUrgentLow != null &&
                     AlarmUrgentLow.Equals(other.AlarmUrgentLow)
                 ) &&
                 (
                     AlarmTimeagoWarn == other.AlarmTimeagoWarn ||
                     AlarmTimeagoWarn != null &&
                     AlarmTimeagoWarn.Equals(other.AlarmTimeagoWarn)
                 ) &&
                 (
                     AlarmTimeagoWarnMins == other.AlarmTimeagoWarnMins ||
                     AlarmTimeagoWarnMins != null &&
                     AlarmTimeagoWarnMins.Equals(other.AlarmTimeagoWarnMins)
                 ) &&
                 (
                     AlarmTimeagoUrgent == other.AlarmTimeagoUrgent ||
                     AlarmTimeagoUrgent != null &&
                     AlarmTimeagoUrgent.Equals(other.AlarmTimeagoUrgent)
                 ) &&
                 (
                     AlarmTimeagoUrgentMins == other.AlarmTimeagoUrgentMins ||
                     AlarmTimeagoUrgentMins != null &&
                     AlarmTimeagoUrgentMins.Equals(other.AlarmTimeagoUrgentMins)
                 ) &&
                 (
                     Enable == other.Enable ||
                     Enable != null &&
                     Enable.SequenceEqual(other.Enable)
                 ) &&
                 (
                     Thresholds == other.Thresholds ||
                     Thresholds != null &&
                     Thresholds.Equals(other.Thresholds)
                 ));
        }
Ejemplo n.º 13
0
 public SetNightMode(NightMode mode)
 {
     this.mode = mode;
 }