示例#1
0
        private void Manager_TrainChangeEvent(object sender, TrainChangeEventArgs e)
        {
            RunOnUiThread(() =>
            {
                switch (e.State)
                {
                case Utils.State.Work:
                    _commandTextView.Text = "Work It!";
                    _mainLayout.SetBackgroundColor(Color.ParseColor("#1fb94d"));
                    currentBackgroundColor = "#1fb94d";
                    if (_trainingInfo.IsNotificationsEnabled)
                    {
                        SendNotification("Work it!");
                    }
                    break;

                case Utils.State.Rest:
                    _commandTextView.Text = "Rest";
                    _mainLayout.SetBackgroundColor(Color.ParseColor("#5c9ddf"));
                    currentBackgroundColor = "#1fb94d";
                    if (_trainingInfo.IsNotificationsEnabled)
                    {
                        SendNotification("Rest!");
                    }
                    break;

                case Utils.State.LongRest:
                    _commandTextView.Text = "Long Rest";
                    _mainLayout.SetBackgroundColor(Color.ParseColor("#e2ce42"));
                    currentBackgroundColor = "#1fb94d";
                    if (_trainingInfo.IsNotificationsEnabled)
                    {
                        SendNotification("Long Rest!");
                    }
                    break;
                }
                DateTime time = new DateTime(2016, 10, 10, 0, e.MinutesToNextMessage, e.SecondsToNextMessage);

                _timeTextView.Text = time.ToString("mm:ss", CultureInfo.InvariantCulture);

                if (e.State == Utils.State.Rest || e.State == Utils.State.LongRest)
                {
                    if ((int.Parse(_setsCountTextView.Text)) > 1)
                    {
                        _setsCountTextView.Text = (int.Parse(_setsCountTextView.Text) - 1).ToString();
                    }
                    else
                    {
                        _setsCountTextView.Text      = _trainingInfo.SetsNumber.ToString();
                        _exercisesCountTextView.Text = (int.Parse(_exercisesCountTextView.Text) - 1).ToString();
                    }
                }
            });
        }
示例#2
0
        private void _manager_TickEvent(object sender, TrainChangeEventArgs e)
        {
            int seconds = 10 * int.Parse(_timeTextView.Text[3].ToString()) + int.Parse(_timeTextView.Text[4].ToString());
            int minutes = 10 * int.Parse(_timeTextView.Text[0].ToString()) + int.Parse(_timeTextView.Text[1].ToString());

            --seconds;
            if (seconds < 0)
            {
                --minutes;
                seconds = 59;
            }
            RunOnUiThread(() =>
            {
                if (minutes > 0 && seconds > 0)
                {
                    DateTime time      = new DateTime(2016, 10, 10, 0, minutes, seconds);
                    _timeTextView.Text = time.ToString("mm:ss", CultureInfo.InvariantCulture);
                }
            });
        }