| | |
| | | //public static Button LogoButton = new Button (); |
| | | |
| | | |
| | | public static string RequestVersion = "2.601071"; |
| | | public static string RequestVersion = "2.603031"; |
| | | public static UserInfo LoginUser; |
| | | /// <summary> |
| | | /// 是否是管理员权限(变更了,成员的时候,这个也为ture。为什么会声明这样变量,因为有些接口必须使用原来的Token) |
| | |
| | | Application.DesignHeight = 1136; |
| | | } |
| | | //印度客户定制APP默认使用英文 |
| | | Language.CurrentLanguage = "English"; |
| | | //Language.CurrentLanguage = "English"; |
| | | Language.CurrentLanguage = "Chinese"; |
| | | |
| | | |
| | | Shared.BusSocket.Start (6000); |
| | | CommonPage.InitReceiveEvent (); |
| | |
| | | |
| | | //} |
| | | |
| | | /// <summary> |
| | | /// 请求服务器方法 |
| | | /// </summary> |
| | | /// <returns>The https.</returns> |
| | | /// <param name="methodType">请求方法.</param> |
| | | /// <param name="dataStringJson">请求的参数.</param> |
| | | /// <param name="needHeaders">是否需要包头.</param> |
| | | public static byte [] RequestHttpsReturnByte (string methodType, string dataStringJson, bool needHeaders = false, string urlHead = "") |
| | | { |
| | | ResponsePack revertObj = null; |
| | | try { |
| | | ///// <summary> |
| | | ///// 请求服务器方法 |
| | | ///// </summary> |
| | | ///// <returns>The https.</returns> |
| | | ///// <param name="methodType">请求方法.</param> |
| | | ///// <param name="dataStringJson">请求的参数.</param> |
| | | ///// <param name="needHeaders">是否需要包头.</param> |
| | | //public static byte [] RequestHttpsReturnByte (string methodType, string dataStringJson, bool needHeaders = false, string urlHead = "") |
| | | //{ |
| | | // ResponsePack revertObj = null; |
| | | // try { |
| | | |
| | | ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => { |
| | | return true; |
| | | }; |
| | | // ServicePointManager.ServerCertificateValidationCallback += (sender, cert, chain, error) => { |
| | | // return true; |
| | | // }; |
| | | |
| | | #region |
| | | var webClient = new WebClient (); |
| | | if (urlHead == "") { |
| | | urlHead = RequestHttpsHost; |
| | | } |
| | | //else { |
| | | // webClient.Headers.Add ("CONTENT-TYPE", "application/json"); |
| | | //} |
| | | webClient.Headers.Add ("CONTENT-TYPE", "application/json"); |
| | | string url = urlHead + methodType; |
| | | if (needHeaders && LoginUser != null) {/* 如果不需要验证Token可以不用传入 */ |
| | | webClient.Headers.Add ("Authorization", LoginUser.LoginTokenString); |
| | | } |
| | | byte [] bytes = null; |
| | | try { |
| | | bytes = webClient.UploadData (url, Encoding.UTF8.GetBytes (dataStringJson)); |
| | | } catch (System.Net.WebException webEx) { |
| | | return bytes; |
| | | } |
| | | // #region |
| | | // var webClient = new WebClient (); |
| | | // if (urlHead == "") { |
| | | // urlHead = RequestHttpsHost; |
| | | // } |
| | | // //else { |
| | | // // webClient.Headers.Add ("CONTENT-TYPE", "application/json"); |
| | | // //} |
| | | // webClient.Headers.Add ("CONTENT-TYPE", "application/json"); |
| | | // string url = urlHead + methodType; |
| | | // if (needHeaders && LoginUser != null) {/* 如果不需要验证Token可以不用传入 */ |
| | | // webClient.Headers.Add ("Authorization", LoginUser.LoginTokenString); |
| | | // } |
| | | // byte [] bytes = null; |
| | | // try { |
| | | // bytes = webClient.UploadData (url, Encoding.UTF8.GetBytes (dataStringJson)); |
| | | // } catch (System.Net.WebException webEx) { |
| | | // return bytes; |
| | | // } |
| | | |
| | | |
| | | return bytes; |
| | | #endregion |
| | | } catch (Exception ex) { |
| | | Utlis.WriteLine (ex.Message); |
| | | return null; |
| | | } finally { |
| | | //requesTime = requesTime.AddDays(1); |
| | | } |
| | | } |
| | | // return bytes; |
| | | // #endregion |
| | | // } catch (Exception ex) { |
| | | // Utlis.WriteLine (ex.Message); |
| | | // return null; |
| | | // } finally { |
| | | // //requesTime = requesTime.AddDays(1); |
| | | // } |
| | | //} |
| | | |
| | | |
| | | /// <summary> |