Beispiel #1
0
        /**
         * Update showed TextViews with Cradle State Info if the device is into the Cradle, otherwise
         * show an error message.
         */
        public void updateContent()
        {
            bool inCradle = jtCradle.IsDeviceInCradle;

            if (inCradle)
            {
                StateInfo state = new StateInfo();
                if (jtCradle.GetCradleState(state))
                {
                    textDeviceInCradle.SetTextColor(Color.Blue);
                    textDeviceInCradle.SetText(Resource.String.device_in_cradle);

                    textState.Text = "";
                    textState.Text = "Application version: " + state.ApplVersion + "\n"
                                     + "Bootloader version: " + state.BtldrVersion + "\n"
                                     + "Insertion count: " + state.InsertionCount + "\n"
                                     + "Slot index: " + state.SlotIndex + "\n"
                                     + "Fast charge available: " + state.IsFastChargeAvailable + "\n";
                }
                else
                {
                    textDeviceInCradle.SetTextColor(Color.Red);
                    textDeviceInCradle.SetText(Resource.String.get_cradle_state_failed);

                    textState.Text = "";
                }
            }
            else
            {
                textDeviceInCradle.SetTextColor(Color.Red);
                textDeviceInCradle.SetText(Resource.String.device_not_in_cradle);
                textState.Text = "";
            }
        }