| | |
| | | |
| | | btnProgress = new Button() |
| | | { |
| | | X = Application.GetRealWidth(80), |
| | | Y = Application.GetRealHeight(80), |
| | | Width = Application.GetRealWidth(170), |
| | | Height = Application.GetRealHeight(50), |
| | | TextSize = CSS_FontSize.TextFontSize, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | Text = curtainTemp.GetPercent(function).ToString() + "%", |
| | | }; |
| | | controlView.AddChidren(btnProgress); |
| | | //controlView.AddChidren(btnProgress); |
| | | |
| | | curtainSeekBar = new CurtainRollSeekBarOn() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | X = Application.GetRealWidth(40), |
| | | Y = Application.GetRealHeight(130), |
| | | Width = Application.GetRealWidth(170), |
| | | Height = Application.GetRealWidth(210), |
| | |
| | | int angleValut = Convert.ToInt32(function.GetAttrState("angle")) - 90; |
| | | var angleView = new FrameLayout() |
| | | { |
| | | Gravity = Gravity.CenterHorizontal, |
| | | Y = Application.GetRealHeight(300),//414,设计数据 |
| | | Width = Application.GetRealWidth(250), |
| | | Height = Application.GetRealWidth(30), |
| | | X = Application.GetRealWidth(240), |
| | | Y = Application.GetRealHeight(145), |
| | | Width = Application.GetRealWidth(40), |
| | | Height = Application.GetRealWidth(220), |
| | | BackgroundColor = 0x00ff0000 |
| | | }; |
| | | controlView.AddChidren(angleView); |
| | |
| | | { |
| | | var btn = new Button() |
| | | { |
| | | X = Application.GetRealWidth(12 * i + 4), |
| | | Y = Application.GetRealHeight(5), |
| | | Width = Application.GetRealWidth(4), |
| | | Height = Application.GetRealHeight(20), |
| | | X = Application.GetRealWidth(5), |
| | | Y = Application.GetRealHeight(8 * i + 4), |
| | | Width = Application.GetRealWidth(25), |
| | | Height = Application.GetRealHeight(3), |
| | | BackgroundColor = 0xFFDFE1E6, |
| | | }; |
| | | btn.SetRotation(angleValut); |
| | |
| | | |
| | | var btnAngle = new Button() |
| | | { |
| | | TextAlignment = TextAlignment.CenterRight, |
| | | Y = Application.GetRealHeight(8 * 17 + 14), |
| | | Height = Application.GetRealHeight(20), |
| | | TextAlignment = TextAlignment.Center, |
| | | TextSize = CSS_FontSize.PromptFontSize_FirstLevel, |
| | | TextColor = CSS_Color.PromptingColor1, |
| | | Text = function.GetAttrState("angle") + "°" |
| | | }; |
| | | angleView.AddChidren(btnAngle); |
| | | |
| | | var angleBar = new DiyImageSeekBar() |
| | | { |
| | | Width = Application.GetRealWidth(220), |
| | | Height = Application.GetRealHeight(30), |
| | | SeekBarViewHeight = Application.GetRealHeight(20), |
| | | SeekBarBackgroundColor = 0x00000000, |
| | | ThumbImagePath = "Public/ThumbImage2.png", |
| | | ThumbImageHeight = Application.GetRealHeight(40), |
| | | ProgressBarColor = 0x00000000, |
| | | ProgressTextColor = 0x00000000, |
| | | ProgressTextSize = 0, |
| | | MaxValue = 180, |
| | | Progress = 90, |
| | | ProgressChangeDelayTime = 0 |
| | | var angleBar = new Button() { |
| | | Height = Application.GetRealHeight(8 * 18 + 14), |
| | | }; |
| | | angleView.AddChidren(angleBar); |
| | | angleBar.OnProgressChangedEvent = (sender, e) => |
| | | float angle = 0; |
| | | angleBar.MouseMoveEventHandler = (sender, e) => |
| | | { |
| | | float angle = (e - 90); |
| | | btnAngle.Text = e + "°"; |
| | | int data = angleBar.Height / 180; |
| | | int data1 = Convert.ToInt32(e.Y / data); |
| | | angle = (90 - data1); |
| | | |
| | | Console.WriteLine($"angle:: {angle}"); |
| | | if (angle > 90) |
| | | { |
| | | angle = 90; |
| | | } |
| | | else if (angle < -90) |
| | | { |
| | | angle = -90; |
| | | } |
| | | btnAngle.Text = angle + "°"; |
| | | foreach (var btn in buttons) |
| | | { |
| | | btn.SetRotation(angle); |
| | | } |
| | | |
| | | if (angle == 90 || angle == -90) |
| | | { |
| | | curtainSeekBar.SetBlindsType(false); |
| | | } |
| | | else |
| | | { |
| | | curtainSeekBar.SetBlindsType(true); |
| | | } |
| | | }; |
| | | angleBar.OnStopTrackingTouchEvent = (sende, e) => |
| | | angleBar.MouseUpEventHandler = (sende, e) => |
| | | { |
| | | function.refreshTime = DateTime.Now; |
| | | new System.Threading.Thread(() => |
| | | { |
| | | Dictionary<string, string> dic = new Dictionary<string, string>(); |
| | | dic.Add("angle", e.ToString()); |
| | | dic.Add("angle", angle.ToString()); |
| | | Control.Ins.SendWriteCommand(function, dic); |
| | | }) |
| | | { IsBackground = true }.Start(); |