Exemplo n.º 1
0
        private async void setGoal(string StepsGoalS)
        {
            if (MiBand.Ready)
            {
                var   loader    = new Windows.ApplicationModel.Resources.ResourceLoader();
                Int32 StepsGoal = 0;
                if (Int32.TryParse(StepsGoalS, out StepsGoal))
                {
                    bool ret = await band.SetGoal(StepsGoal);

                    if (ret)
                    {
                        properties.Goal = StepsGoal;
                    }
                    else
                    {
                        MessageDialog dialog = new MessageDialog(loader.GetString("SetGoalError"), loader.GetString("ErrorTitle"));
                        await dialog.ShowAsync();
                    }
                }
                else
                {
                    MessageDialog dialog = new MessageDialog(loader.GetString("SetGoalInvalid"), loader.GetString("ErrorTitle"));
                    await dialog.ShowAsync();
                }
            }
        }