public override void ComputeScroll() { // if (IsAttachedToWindow) { // TODO [email protected]: This bug causes an exception to be thrown when the scroller is disposes. // this usually happens when starting a remote view // L.E(this, "Tried to compute scroll while swipe menu was not attached to the a window."); // return; // } try { if (isOpen) { if (openScroller.ComputeScrollOffset()) { Swipe(openScroller.CurrX * (int)recyclerView.swipeDirection); PostInvalidate(); } } else { if (closeScroller.ComputeScrollOffset()) { Swipe((int)((baseX - closeScroller.CurrX) * (int)recyclerView.swipeDirection)); PostInvalidate(); } } } catch (Exception e) { L.E(this, "Tried to compute scroll while swipe menu was not attached to a window", e); } }
/// <summary> /// Views the in superheat subcool activity. /// </summary> /// <param name="">.</param> private void ViewInSuperheatSubcoolActivity(Manifold manifold, ISensorProperty sensorProperty) { var side = Analyzer.ESide.Low; if (!analyzer.GetSideOfManifold(manifold, out side)) { Error(GetString(Resource.String.analyzer_error_failed_to_launch_shsc_missing_manifold)); return; } // If the manifold does not have a secondary sensor, then we will need to query whether or not the analyzer has // space to accept the returned sensor. If it does not, then we cannot open the activity safely. if (manifold.secondarySensor == null && !analyzer.CanAddSensorToSide(side)) { var adb = new IONAlertDialog(Activity, Resource.String.error); adb.SetMessage(string.Format(GetString(Resource.String.analyzer_error_failed_to_launch_shsc_analyzer_full_1sarg), side.ToLocalizedString(Activity))); adb.SetNegativeButton(Resource.String.ok, (obj, args) => { var dialog = obj as Android.App.Dialog; dialog.Dismiss(); }); adb.Show(); return; } var sensor = sensorProperty.sensor; var i = new Intent(Activity, typeof(SuperheatSubcoolActivity)); i.SetAction(Intent.ActionPick); i.PutExtra(SuperheatSubcoolActivity.EXTRA_LOCK_FLUID, true); i.PutExtra(SuperheatSubcoolActivity.EXTRA_FLUID_NAME, manifold.ptChart.fluid.name); i.PutExtra(SuperheatSubcoolActivity.EXTRA_FLUID_STATE, (int)analyzer.SideAsFluidState(side)); switch (sensor.type) { case ESensorType.Pressure: i.PutExtra(SuperheatSubcoolActivity.EXTRA_ANALYZER_MANIFOLD, (int)side); if (ion is RemoteION) { StartActivity(i); } else { StartActivityForResult(i, EncodeSuperheatSubcoolRequest(side)); } break; case ESensorType.Temperature: i.PutExtra(SuperheatSubcoolActivity.EXTRA_ANALYZER_MANIFOLD, (int)side); if (ion is RemoteION) { StartActivity(i); } else { StartActivityForResult(i, EncodeSuperheatSubcoolRequest(side)); } break; default: var msg = string.Format(GetString(Resource.String.analyzer_error_invalid_sensor_type), sensor.type.GetTypeString()); L.E(this, msg); Alert(msg); break; } }
/// <Docs>The integer request code originally supplied to /// startActivityForResult(), allowing you to identify who this /// result came from.</Docs> /// <param name="data">An Intent, which can return result data to the caller /// (various data can be attached to Intent "extras").</param> /// <summary> /// Raises the activity result event. /// </summary> /// <param name="requestCode">Request code.</param> /// <param name="resultCode">Result code.</param> public override void OnActivityResult(int requestCode, Result resultCode, Intent data) { if (Result.Ok != resultCode) { return; } var request = requestCode & MASK_REQUEST; switch (request) { case REQUEST_SHOW_SUPERHEAT_SUBCOOL: { var side = (Analyzer.ESide) unchecked ((requestCode & MASK_SIDE) >> 8); var manifold = analyzer.GetManifoldFromSide(side); if (analyzer.HasSensor(manifold.secondarySensor)) { // TODO [email protected]: Is this right? Analyzer.ESide ss; if (!analyzer.GetSideOfSensor(manifold.secondarySensor, out ss)) { Appion.Commons.Util.Log.E(this, "Failed to get side of sensor"); return; } // The user returned from the SHSC activity with a sensor. if (ss != side) { // The sensor that the user returned with is not on the side of the manifold. if (analyzer.IsSideFull(side)) { // We cannot swap the side of the sensor; the side is full. L.E(this, "Tried to add sensor from opposite side to this side."); Toast.MakeText(Activity, Resource.String.analyzer_error_failed_to_link_sensors, ToastLength.Long).Show(); manifold.SetSecondarySensor(null); } else { analyzer.SwapSensors(analyzer.IndexOfSensor(manifold.secondarySensor), analyzer.NextEmptySensorIndex(side), true); } } else if (!analyzer.HasSensor(manifold.secondarySensor) && analyzer.IsSideFull(side)) { Toast.MakeText(Activity, string.Format(GetString(Resource.String.analyzer_side_full_1sarg), side), ToastLength.Long).Show(); manifold.SetSecondarySensor(null); } else { if (!analyzer.IsSensorOnSide(manifold.secondarySensor, side)) { var si = analyzer.IndexOfSensor(manifold.secondarySensor); var di = analyzer.NextEmptySensorIndex(side); // analyzerView.SwapSensorMounts(di, si); analyzer.SwapSensors(di, si, true); } } } else { analyzer.AddSensorToSide(side, manifold.secondarySensor); } } break; case REQUEST_MANIFOLD_ON_SIDE: { Toast.MakeText(Activity, "DEVICE MANAGER WAS REMOVED! IMPLEMENT DEVICE SELECTION LIST", ToastLength.Short).Show(); /* * var mside = (Analyzer.ESide)unchecked((requestCode & MASK_SIDE) >> 8); * var msp = data.GetParcelableExtra(DeviceManagerActivity.EXTRA_SENSOR) as SensorParcelable; * var s = msp.Get(ion); * * TrySetManifold(mside, s); */ } break; default: L.D(this, "Unknown request: " + request); break; } }