Пример #1
0
        public async Task <bool> SetUnconfigurables()
        {
            bool ret = true;

            ret = ret & (await this.SetGoal((int)SettingGet("DailyGoal")));
            ret = ret & (await this.SetAlarm(Alarm.FromSetting((ApplicationDataCompositeValue)SettingGet("Alarm1"))));
            ret = ret & (await this.SetAlarm(Alarm.FromSetting((ApplicationDataCompositeValue)SettingGet("Alarm2"))));
            ret = ret & (await this.SetAlarm(Alarm.FromSetting((ApplicationDataCompositeValue)SettingGet("Alarm3"))));
            ret = ret & (await this.SetWearLocation((WearLocation)SettingGet("WearLocation")));
            ret = ret & (await this.SetColorTheme(ColorTheme.FromInt32((int)SettingGet("ColorTheme")), true));
            return(ret);
        }
Пример #2
0
        public async Task <bool> ConfigureAsSettings()
        {
            bool ret = true;

            ret = ret & (await this.SetUserInfo(UserInfo.FromSetting((ApplicationDataCompositeValue)SettingGet("UserInfo")), DataMode.Normal));
            ret = ret & (await this.SetDateTime(DateTime.Now));
            ret = ret & (await this.SetName((string)SettingGet("Name")));
            ret = ret & (await this.SetGoal((int)SettingGet("DailyGoal")));
            ret = ret & (await this.SetCurrentSteps((int)SettingGet("CurrentSteps")));
            ret = ret & (await this.SetAlarm(Alarm.FromSetting((ApplicationDataCompositeValue)SettingGet("Alarm1"))));
            ret = ret & (await this.SetAlarm(Alarm.FromSetting((ApplicationDataCompositeValue)SettingGet("Alarm2"))));
            ret = ret & (await this.SetAlarm(Alarm.FromSetting((ApplicationDataCompositeValue)SettingGet("Alarm3"))));
            ret = ret & (await this.SetWearLocation((WearLocation)SettingGet("WearLocation")));
            ret = ret & (await this.SetColorTheme(ColorTheme.FromInt32((int)SettingGet("ColorTheme")), true));
            return(ret);
        }
Пример #3
0
        public async Task <bool> SetColorTheme(ColorTheme Theme, bool Advertise)
        {
            Debug.WriteLine("[miband] cambiando esquema de color");
            Byte[] buffer = new Byte[] { MiBand.CP_SET_THEME, Theme.R, Theme.G, Theme.B, (byte)(Advertise ? 0x01 : 0x00) };
            bool   ret    = await writeToCharacteristic(MiBand.UUID_CHAR_CONTROL_POINT, buffer.AsBuffer());

            if (ret)
            {
                SettingSet("ColorTheme", Theme.ToInt32());
                Debug.WriteLine("[miband] esquema de color cambiado");
            }
            else
            {
                Debug.WriteLine("[miband] error al cambiar esquema de color");
            }
            return(ret);
        }