JLChen
2020-04-03 be95e839f40eb3ddf64706b60cba6dfcf4fad5e5
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using Shared.SimpleControl;
using Shared.SimpleControl.Phone;
 
namespace Shared
{
    public class Utlis
    {
 
        ///// <summary>
        ///// 将int数值转换为占四个字节的byte数组
        ///// </summary>
        ///// <param name="value"></param>
        ///// <returns></returns>
        //public static byte [] IntToByteArray (int i)
        //{
        //    byte [] result = new byte [4];
        //    // 由高位到低位  
        //    result [0] = (byte)((i >> 24) & 0xFF);
        //    result [1] = (byte)((i >> 16) & 0xFF);
        //    result [2] = (byte)((i >> 8) & 0xFF);
        //    result [3] = (byte)(i & 0xFF);
        //    return result;
        //}
 
        ///// <summary>
        ///// byte[]转int 
        ///// </summary>
        ///// <param name="bytes"></param>
        ///// <returns></returns>
        //public static int ByteArrayToInt (byte [] bytes)
        //{
        //    int value = 0;
        //    // 由高位到低位  
        //    for (int i = 0; i < 4; i++) {
        //        int shift = (4 - 1 - i) * 8;
        //        value += (bytes [i] & 0x000000FF) << shift;// 往高位游  
        //    }
        //    return value;
        //}
 
        /// <summary>
        /// 全局打印
        /// </summary>
        public static void WriteLine (object mes)
        {
#if DEBUG
            Utlis.WriteLine (mes);
#endif
        }
 
        public static int StringToInt (string mStr) {
            try {
                return int.Parse (mStr);
            } catch {
                return 0;
            }
        }
 
        public static void ShowAppLinkStatus (AppLinkStatus mStatus) {
 
            switch (mStatus) {
            case AppLinkStatus.CloudLink:
                MainPage.WiFiStatus = "CrabtreeAdd/CloudLink.png";
                break;
            case AppLinkStatus.CloudUnlink:
                MainPage.WiFiStatus = "CrabtreeAdd/CloudUnlink.png";
                break;
            case AppLinkStatus.CloudOffline:
                MainPage.WiFiStatus = "CrabtreeAdd/CloudOffline.png";
                break;
            case AppLinkStatus.WiFi:
                MainPage.WiFiStatus = "CrabtreeAdd/WiFi.png";
                break;
            case AppLinkStatus.WiFiUnlink:
                MainPage.WiFiStatus = "CrabtreeAdd/WiFiUnlink.png";
                break;
            case AppLinkStatus.WiFiOffline:
                MainPage.WiFiStatus = "CrabtreeAdd/WiFiOffline.png";
                break;
            default:
 
 
                break;
            }
            
            Shared.Application.RunOnMainThread (() => {
                UserMiddle.btnLinkStatus.UnSelectedImagePath = MainPage.WiFiStatus;
            });
            
        }
 
}
}