CrabtreeOn,印度客户定制APP,迁移2.0平台版本
JLChen
2022-01-12 407fae6f07a2a982a2a814c2f145c40733c966cb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using Shared.SimpleControl.Phone;
using System;
namespace Shared.SimpleControl.Pad
{
    public class ACMethod
    {
        public ACMethod ()
        {
        }
 
        public void SystemACHostEditRemark (HVAC acHost)
        {
            //MainPage.Loading.Start ();
            //editor.IsSelected = textButton.IsSelected = textButton.Enable = false;
            byte [] remakeBytes = CommonPage.MyEncodingGB2312.GetBytes (acHost.Name);
            System.Threading.Tasks.Task.Run (() => {
                byte [] updateBytes = Control.ControlBytesSendHasReturn (Command.ReadDeviceLoopInfo, acHost.SubnetID, acHost.DeviceID, new byte [] {
                        acHost.BigClass,acHost.MinClass,acHost.LoopID});
                if (updateBytes == null) {
                    Application.RunOnMainThread (() => {
                        new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                        MainPage.Loading.Hide ();
                    });
                    return;
                }
                byte [] uBytes = new byte [20];
                Array.Copy (remakeBytes, 0, uBytes, 0, remakeBytes.Length < 20 ? remakeBytes.Length : 20);
                Array.Copy (uBytes, 0, updateBytes, 3, 20 < uBytes.Length ? 20 : uBytes.Length);
                var reBytes = Control.ControlBytesSendHasReturn (Command.SetDeviceLoopInfo, acHost.SubnetID, acHost.DeviceID, updateBytes);
                if (reBytes != null) {
                    Application.RunOnMainThread (() => {
                        //acHost.Name = textButton.Text.Trim ();
                        IO.FileUtils.SaveEquipmentMessage (acHost, acHost.LoopID.ToString ());
                        MainPage.Loading.Hide ();
                    });
                } else {
                    Application.RunOnMainThread (() => {
                        new Alert (Language.StringByID (R.MyInternationalizationString.Tip), Language.StringByID (R.MyInternationalizationString.TipEquipmentNotOnline), Language.StringByID (R.MyInternationalizationString.Close)).Show ();
                        MainPage.Loading.Hide ();
                    });
                }
            });
        }
    }
}