示例#1
0
        async public static Task <bool> SendErrorServer()
        {
            var dir = GetErrorDir();

            if (Directory.Exists(dir))
            {
                var files = Directory.EnumerateFiles(dir).Where(q => !q.Contains(GetLastErrorFile())).OrderBy(q => q).ToArray();
                if (files.Length > 0)
                {
                    var arg = new PushErrorLogArgument
                    {
                        UserRowId     = UserOptions.GetUserRowId(),
                        UserName      = UserOptions.GetUser(),
                        LogFiles      = new List <PushErrorLogArgumentFile>(),
                        BusinessRowId = UserOptions.GetBusinessRowId(),
                    };

                    foreach (var file in files)
                    {
                        var errtext = File.ReadAllText(file);
                        arg.LogFiles.Add(new PushErrorLogArgumentFile {
                            ErrorFile = file, ErrorText = errtext
                        });
                    }

                    UIFunc.ShowLoading("Send error log...");
                    var ret = await WebServiceFunc.PushErrorLog(arg);

                    if (!string.IsNullOrEmpty(ret))
                    {
                        UIFunc.HideLoading();
                        return(false);
                    }

                    foreach (var file in files)
                    {
                        File.Delete(file);
                    }
                }
            }

            UIFunc.HideLoading();
            return(true);
        }
示例#2
0
 void AddContentHeaders(HttpHeaders content)
 {
     content.Add("UserRowId", UserOptions.GetUserRowId().ToString());
     content.Add("DeviceId", UserOptions.GetDeviceId().ToString());
     content.Add("Password", UserOptions.GetPassword());
 }