| | |
| | | /// 进度值 |
| | | /// </summary> |
| | | Button btnProgress; |
| | | /// <summary> |
| | | /// 角度控件集 |
| | | /// </summary> |
| | | List<Button> buttons; |
| | | /// <summary> |
| | | /// 角度文本按钮 |
| | | /// </summary> |
| | | Button btnAngle; |
| | | /// <summary> |
| | | /// 角度滑动控件 |
| | | /// </summary> |
| | | DiyImageSeekBar angleBar; |
| | | |
| | | |
| | | /// <summary> |
| | |
| | | controlView.AddChidren(curtainSeekBar); |
| | | |
| | | |
| | | int angleValut = Convert.ToInt32(function.GetAttrState("angle")); |
| | | int angleValut = Convert.ToInt32(function.GetAttrState("angle")) - 90; |
| | | var angleView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | |
| | | }; |
| | | controlView.AddChidren(angleView); |
| | | |
| | | List<Button> buttons = new List<Button>(); |
| | | buttons = new List<Button>(); |
| | | for (int i = 0; i < 18; i++) |
| | | { |
| | | var btn = new Button() |
| | |
| | | buttons.Add(btn); |
| | | }; |
| | | |
| | | var btnAngle = new Button() |
| | | btnAngle = new Button() |
| | | { |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | |
| | | }; |
| | | angleView.AddChidren(btnAngle); |
| | | |
| | | var angleBar = new DiyImageSeekBar() |
| | | angleBar = new DiyImageSeekBar() |
| | | { |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(30), |
| | | SeekBarViewHeight = Application.GetRealHeight(0), |
| | | SeekBarViewHeight = Application.GetRealHeight(20), |
| | | SeekBarBackgroundColor = 0x00000000, |
| | | ThumbImagePath = "Public/ThumbImage2.png", |
| | | ThumbImageHeight = Application.GetRealHeight(20), |
| | | ThumbImageHeight = Application.GetRealHeight(40), |
| | | ProgressBarColor = 0x00000000, |
| | | ProgressTextColor = 0x00000000, |
| | | ProgressTextSize = 0, |
| | |
| | | angleBar.OnProgressChangedEvent = (sender, e) => |
| | | { |
| | | float angle = (e - 90); |
| | | btnAngle.Text = angle + "°"; |
| | | btnAngle.Text = e + "°"; |
| | | foreach (var btn in buttons) |
| | | { |
| | | btn.SetRotation(angle); Console.WriteLine(angle); |
| | | btn.SetRotation(angle); |
| | | } |
| | | //if (100 < (DateTime.Now - function.refreshTime).TotalMilliseconds) |
| | | //{ |
| | | // function.refreshTime = DateTime.Now; |
| | | // foreach (var btn in buttons) |
| | | // { |
| | | // new System.Threading.Thread(() => |
| | | // { |
| | | // Application.RunOnMainThread(() => |
| | | // { |
| | | // btn.SetRotation(angle); Console.WriteLine(angle); |
| | | // }); |
| | | // }); |
| | | // } |
| | | //} |
| | | }; |
| | | angleBar.OnStopTrackingTouchEvent = (sende, e) => |
| | | { |
| | |
| | | { |
| | | if (!bodyView.onCurtainAnimation) |
| | | { |
| | | bodyView.CurtainAnimation(Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent))); |
| | | var percent = Convert.ToInt32(updateTemp.GetAttrState(FunctionAttributeKey.Percent)); |
| | | bodyView.CurtainAnimation(percent); |
| | | bodyView.btnProgress.Text = percent + "%"; |
| | | |
| | | var e = Convert.ToInt32( updateTemp.GetAttrState(FunctionAttributeKey.Angle)); |
| | | bodyView.angleBar.Progress = e; |
| | | float angle = e - 90; |
| | | bodyView.btnAngle.Text = (e - 0) + "°"; |
| | | foreach (var btn in bodyView.buttons) |
| | | { |
| | | btn.SetRotation(angle); |
| | | } |
| | | |
| | | |
| | | } |
| | | } |
| | | catch { } |
| | |
| | | { |
| | | btnCurtainClose.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!function.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | if (!function.online) |
| | | { |
| | | btnCurtainClose.IsSelected = false; |
| | | }); |
| | | }) |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | | { |
| | | btnCurtainClose.IsSelected = false; |
| | | }); |
| | | }) |
| | | { IsBackground = true }.Start(); |
| | | function.trait_on_off.curValue = "off"; |
| | | function.SetAttrState(FunctionAttributeKey.Percent, 0); |
| | |
| | | |
| | | btnCurtainStop.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!function.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | onCurtainAnimation = false; |
| | | if (!function.online) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | onCurtainAnimation = false; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | |
| | | |
| | | btnCurtainOpen.MouseUpEventHandler = (sender, e) => |
| | | { |
| | | //if (!function.online) |
| | | //{ |
| | | // new Tip() |
| | | // { |
| | | // CloseTime = 1, |
| | | // Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | // Direction = AMPopTipDirection.None, |
| | | // }.Show(MainPage.BaseView); |
| | | // return; |
| | | //} |
| | | new System.Threading.Thread(() => |
| | | if (!function.online) |
| | | { |
| | | new Tip() |
| | | { |
| | | CloseTime = 1, |
| | | Text = Language.StringByID(StringId.DeviceOfflineCannotOption), |
| | | Direction = AMPopTipDirection.None, |
| | | }.Show(MainPage.BaseView); |
| | | return; |
| | | } |
| | | new System.Threading.Thread(() => |
| | | { |
| | | System.Threading.Thread.Sleep(2000); |
| | | Application.RunOnMainThread(() => |
| | |
| | | CurtainAnimation(100); |
| | | }; |
| | | |
| | | //if (function.online) |
| | | if (function.online) |
| | | { |
| | | btnCurtainStop.MouseDownEventHandler = (sender, e) => |
| | | { |