Пример #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
 async public static Task AlertError(string message)
 {
     UIFunc.HideLoading();
     await NavFunc.CurrentPage.DisplayAlert("Error", message, "Close");
 }