示例#1
0
        void CommunicateState(AppConst.ActivityState state)
        {
            switch (state)
            {
            case AppConst.ActivityState.connected:
                FindViewById <TextView>(Resource.Id.deviceName).SetTextColor(Android.Graphics.Color.LightGoldenrodYellow);
                break;

            case AppConst.ActivityState.synced:
                FindViewById <TextView>(Resource.Id.deviceName).SetTextColor(Android.Graphics.Color.LightGreen);
                break;

            default:
                FindViewById <TextView>(Resource.Id.deviceName).SetTextColor(Android.Graphics.Color.DimGray);
                break;
            }
        }
            /// <summary>
            /// Update the internal state and report it to the hosting activity
            /// </summary>
            /// <param name="newState">The new internal state</param>
            private void UpdateState(AppConst.ActivityState newState)
            {
                Intent statusIntent;

                try
                {
                    statusIntent = new Intent(ZoomRemote.AppConst.rxIntentName);
                    statusIntent.PutExtra(ZoomRemote.BundleConst.bundleCmdTag, BundleConst.bundleStatusTag);
                    statusIntent.PutExtra(ZoomRemote.BundleConst.bundleValTag, (int)newState);
                    serviceContext.SendBroadcast(statusIntent);
                    serviceContext.serviceState = newState;

                    AppLog.Log("RCS: New state " + newState.ToString());
                }
                catch (Throwable e)
                {
                    AppLog.Log("RCS: New state; exception: " + e.ToString());
                }
            }