Пример #1
0
        public override void Bind()
        {
            base.Bind();
            isRunning = true;

            var roc = record.manifold.GetSensorPropertyOfType <RateOfChangeSensorProperty>();

            rocManager = new RocWidgetManager(roc.manifold, plot, false);
            rocManager.Initialize();

            handler.SendEmptyMessageDelayed(0, 500);
        }
Пример #2
0
        private void LoadManifold()
        {
            var mp = Intent.GetParcelableExtra(EXTRA_MANIFOLD) as ManifoldParcelable;

            if (mp == null)
            {
                // TODO [email protected]: Localize
                Error("US Manifold was not passed to activity");
                Finish();
                return;
            }

            manifold = mp.Get(ion);
            if (manifold == null)
            {
                // TODO [email protected]: Localize
                Error("US Manifold did not load from parcelable");
                Finish();
                return;
            }

            // Primary sensor
            var ps = manifold.primarySensor;

            text1.Text = ps.type.GetSensorTypeName() + " " + ps.name;

            // Secondary sensor
            if (manifold.secondarySensor != null)
            {
                var ss = manifold.secondarySensor;
                text2.Text = ss.type.GetSensorTypeName() + " " + ss.name;
            }
            else
            {
                content2.Visibility = ViewStates.Gone;
            }

            // Title
            var values   = Resources.GetStringArray(Resource.Array.preferences_device_trend_interval_values);
            var entries  = Resources.GetStringArray(Resource.Array.preferences_device_trend_interval_entries);
            var interval = ion.preferences.device.trendInterval;

            var index = -1;

            for (int i = 0; i < values.Length; i++)
            {
                if (values[i].Equals((int)interval.TotalMilliseconds + ""))
                {
                    index = i;
                }
            }

            if (index == -1)
            {
                Log.E(this, "Failed to find text for interval: " + interval);
            }
            else
            {
                title.Text = string.Format(GetString(Resource.String.trend_update_1arg), entries[index]);
            }

            roc = manifold.GetSensorPropertyOfType <RateOfChangeSensorProperty>();
            if (roc == null)
            {
                Error("How did you get here if the manifold doesn't have a RateOfChangeSensorProperty");
                Finish();
                return;
            }

            rocManager = new RocWidgetManager(roc.manifold, plot, true);
            rocManager.Initialize();
        }