//using System;
|
//namespace Shared.SimpleControl.Phone
|
//{
|
// public class UserSensorSettingTempPushDialog
|
// {
|
// string TriggerTemp = "";
|
// public UserSensorSettingTempPushDialog ()
|
// {
|
// TriggerTemp = Language.StringByID (R.MyInternationalizationString.TriggerTemp);
|
// }
|
|
|
// public void ShowSettingTempPushDialog (Sensor device, byte targetPushLoopId, byte [] pushEnableRevertBytes, Button btn)
|
// {
|
// MainPage.Loading.Start ("Loading...");
|
// System.Threading.Tasks.Task.Run (() => {
|
// try {
|
// var pushRevertBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorPushMessage, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, device.LoopID, 255 });
|
// System.Collections.Generic.List<byte []> pushTempList = new System.Collections.Generic.List<byte []> ();
|
// Application.RunOnMainThread (() => {
|
// if (pushRevertBytes == null) {
|
// new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
|
// pushRevertBytes = new byte [27];
|
// return;
|
// }
|
// Dialog dialog = new Dialog ();
|
|
// FrameLayout bodyView = new FrameLayout () {
|
// BackgroundColor = SkinStyle.Current.DialogColor,
|
// Gravity = Gravity.Center,
|
// Width = Application.GetRealWidth (550),
|
// Height = Application.GetRealHeight (450),
|
// };
|
// dialog.AddChidren (bodyView);
|
|
// Button btnDialogTitle = new Button () {
|
// Height = Application.GetRealHeight (100),
|
// TextID = R.MyInternationalizationString.Overheat,
|
// TextColor = SkinStyle.Current.TextColor1,
|
// BackgroundColor = SkinStyle.Current.DialogTitle,
|
// TextAlignment = TextAlignment.Center,
|
// };
|
// bodyView.AddChidren (btnDialogTitle);
|
// if (targetPushLoopId == 1) {
|
// btnDialogTitle.TextID = R.MyInternationalizationString.Overcooling;
|
// }
|
|
|
// //for (int i = targetPushLoopId; i < targetPushLoopId + 4; i++) {
|
// int pushTemp = 0;
|
// var pushValuesRevertBytes = Control.ControlBytesSendHasReturn (Command.ReadSensorPushValues, device.SubnetID, device.DeviceID, new byte [] { device.DevicePushType, (byte)targetPushLoopId });
|
// if (pushValuesRevertBytes == null) {
|
// pushValuesRevertBytes = new byte [] { device.DevicePushType, (byte)targetPushLoopId, 0, 0, 0, 255 };
|
// }
|
// if (targetPushLoopId == 0) {
|
// pushTemp = pushValuesRevertBytes [4] * 256 + pushValuesRevertBytes [5];
|
// } else {
|
// pushTemp = pushValuesRevertBytes [2] * 256 + pushValuesRevertBytes [3];
|
// }
|
// pushTempList.Add (pushValuesRevertBytes);
|
|
// FrameLayout setTargetTemp1View = new FrameLayout () {
|
// Y = Application.GetRealHeight (140),
|
// BackgroundColor = SkinStyle.Current.DialogColor,
|
// Height = Application.GetRealHeight (200),
|
// };
|
// bodyView.AddChidren (setTargetTemp1View);//40448
|
// string setTemp = (pushTemp > 32768 ? ((32768 - pushTemp) / 10).ToString () : ((pushTemp / 10).ToString ())) + "°";
|
// Button btnTip = new Button () {
|
// X = Application.GetRealWidth (30),
|
// Width = Application.GetRealWidth (300),
|
// Height = Application.GetRealHeight (80),
|
// TextColor = SkinStyle.Current.TextColor,
|
// TextAlignment = TextAlignment.CenterLeft,
|
// };
|
// setTargetTemp1View.AddChidren (btnTip);
|
// if (targetPushLoopId == 0) {
|
// btnTip.Text = TriggerTemp + ":> " + setTemp;
|
// } else {
|
// btnTip.Text = TriggerTemp + ":< " + setTemp;
|
// }
|
|
// Button btnMin = new Button () {
|
// X = Application.GetRealWidth (25),
|
// Gravity = Gravity.CenterVertical,
|
// Width = Application.GetRealWidth (60),
|
// Text = "-20",
|
// TextColor = SkinStyle.Current.TextColor,
|
// TextAlignment = TextAlignment.CenterLeft
|
// };
|
// setTargetTemp1View.AddChidren (btnMin);
|
|
// var tempSeekBarFrame = new FrameLayout () {
|
// Width = Application.GetRealWidth (550 - 160),
|
// Height = Application.GetRealHeight (80),
|
// X = Application.GetRealWidth (10) + btnMin.Right,
|
// Gravity = Gravity.CenterVertical
|
// };
|
// setTargetTemp1View.AddChidren (tempSeekBarFrame);
|
// var horizontalSeekBar = new HorizontalSeekBar () {
|
// ThumbColor = SkinStyle.Current.SelectedColor,
|
// Max = 60,
|
// Progress = (pushTemp > 32768 ? ((pushTemp - 32768) / 10) : ((pushTemp / 10))) + 20,
|
// };
|
// tempSeekBarFrame.AddChidren (horizontalSeekBar);
|
// Button btnMax = new Button () {
|
// Width = Application.GetRealWidth (90),
|
// Height = Application.GetRealHeight (80),
|
// X = tempSeekBarFrame.Right + Application.GetRealWidth (10),
|
// Gravity = Gravity.CenterVertical,
|
// Text = "40",
|
// TextAlignment = TextAlignment.CenterLeft,
|
// TextColor = SkinStyle.Current.TextColor
|
// };
|
// setTargetTemp1View.AddChidren (btnMax);
|
// if (targetPushLoopId == 0) {
|
// horizontalSeekBar.ProgressColor = 0xFFCADBE1;
|
// horizontalSeekBar.BackgroundColor = 0xFFFF0000;
|
// } else {
|
// horizontalSeekBar.BackgroundColor = 0xFFCADBE1;
|
// horizontalSeekBar.ProgressColor = 0xFF6BDFFE;
|
// }
|
// horizontalSeekBar.ProgressChanged += (sender22, e4) => {
|
// if (targetPushLoopId == 0) {
|
// btnTip.Text = TriggerTemp + ":> " + (horizontalSeekBar.Progress - 20) + "°";
|
// } else {
|
// btnTip.Text = TriggerTemp + ":< " + (horizontalSeekBar.Progress - 20) + "°";
|
// }
|
// if (20 > e4) {
|
// pushTemp = (20 - e4) * 10 + 32768;
|
// } else {
|
// pushTemp = (e4 - 20) * 10;
|
// }
|
// };
|
// horizontalSeekBar.MouseUpEventHandler += (asss, ddd) => {
|
// if (targetPushLoopId == 0) {
|
// pushValuesRevertBytes [2] = 32768 / 256;
|
// pushValuesRevertBytes [3] = 32768 % 256;
|
// pushValuesRevertBytes [4] = (byte)(pushTemp / 256);
|
// pushValuesRevertBytes [5] = (byte)(pushTemp % 256);
|
// } else {
|
// pushValuesRevertBytes [2] = (byte)(pushTemp / 256);
|
// pushValuesRevertBytes [3] = (byte)(pushTemp % 256);
|
// pushValuesRevertBytes [4] = 1250 / 256;
|
// pushValuesRevertBytes [5] = 1250 % 256;
|
// }
|
// };
|
|
// Button btnClose = new Button () {
|
// Y = bodyView.Height - Application.GetRealHeight (110),
|
// Width = Application.GetRealWidth (275),
|
// Height = Application.GetRealHeight (110),
|
// TextID = R.MyInternationalizationString.Close,
|
// TextColor = SkinStyle.Current.TextColor1,
|
// BackgroundColor = SkinStyle.Current.DialogTitle,
|
// };
|
// bodyView.AddChidren (btnClose);
|
// btnClose.MouseUpEventHandler += (kkk, ddd) => {
|
// dialog.Close ();
|
// };
|
|
// Button btnSave = new Button () {
|
// Y = btnClose.Y,
|
// X = btnClose.Right + 1,
|
// Width = Application.GetRealWidth (280),
|
// Height = btnClose.Height,
|
// TextID = R.MyInternationalizationString.SAVE,
|
// TextColor = SkinStyle.Current.TextColor1,
|
// BackgroundColor = SkinStyle.Current.DialogTitle,
|
// };
|
// bodyView.AddChidren (btnSave);
|
// btnSave.MouseUpEventHandler += (kkk, ddd) => {
|
// MainPage.Loading.Start ("Saving...");
|
// System.Threading.Tasks.Task.Run (() => {
|
// try {
|
// foreach (var sendPushBytes in pushTempList) {
|
// var setPushValuesACK = Control.ControlBytesSendHasReturn (Command.SetSensorPushValues, device.SubnetID, device.DeviceID, sendPushBytes);
|
// if (setPushValuesACK == null) {
|
// Application.RunOnMainThread (() => {
|
// new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TargetsSetFail), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
|
// });
|
// } else {
|
// Application.RunOnMainThread (() => {
|
// dialog.Close ();
|
// });
|
// }
|
// }
|
// } catch { } finally {
|
// Application.RunOnMainThread (() => {
|
// setTemp = (pushTemp > 32768 ? ((32768 - pushTemp) / 10).ToString () : ((pushTemp / 10).ToString ())) + "°";
|
// if (targetPushLoopId == 0) {
|
// btn.Text = Language.StringByID (R.MyInternationalizationString.TriggerTemp) + ":> " + setTemp;
|
// } else {
|
// btn.Text = Language.StringByID (R.MyInternationalizationString.TriggerTemp) + ":< " + setTemp;
|
// }
|
// MainPage.Loading.Hide ();
|
// });
|
// }
|
// });
|
// };
|
|
// dialog.Show ();
|
// });
|
// } catch { } finally {
|
// Application.RunOnMainThread (() => {
|
// MainPage.Loading.Hide ();
|
// });
|
// }
|
// });
|
// }
|
// }
|
//}
|