Ejemplo n.º 1
0
        private async void ShareLog_Clicked(object sender, EventArgs e)
        {
            try
            {
                EmailMessage message = new EmailMessage()
                {
                    Subject = "Application Log File",
                    To      = new List <string> {
                        "*****@*****.**"
                    }
                };

                if (nativeHelper.Exist(logPath, SysContentType.File))
                {
                    message.Attachments.Add(new EmailAttachment($"{nativeHelper.NativeRoot}/{logPath}"));
                    await Email.ComposeAsync(message);
                }
                else
                {
                    Utils.Toast("logs.txt not found!");
                }
            }
            catch (FeatureNotSupportedException)
            {
                EbLog.Error("Email is not supported on this device");
            }
            catch (Exception ex)
            {
                EbLog.Error("Unknown exception while sharing log.txt, " + ex.Message);
            }
        }
        public void SaveLogo(string solutionname, byte[] imageByte)
        {
            try
            {
                INativeHelper helper = DependencyService.Get <INativeHelper>();
                string        root   = App.Settings.AppDirectory;

                if (!helper.Exist($"{root}/{solutionname}/logo.png", SysContentType.File))
                {
                    File.WriteAllBytes(helper.NativeRoot + $"/{root}/{solutionname}/logo.png", imageByte);
                }
            }
            catch (Exception ex)
            {
                EbLog.Info($"Unable to create logo for solution '{solutionname}'");
                EbLog.Error(ex.Message);
            }
        }
Ejemplo n.º 3
0
        public static void WriteFilesLocal(string filename, byte[] fileBytea)
        {
            try
            {
                INativeHelper helper = DependencyService.Get <INativeHelper>();

                string path = $"{App.Settings.AppDirectory}/{App.Settings.Sid.ToUpper()}/FILES/{filename}";

                if (!helper.Exist(path, SysContentType.File))
                {
                    File.WriteAllBytes(helper.NativeRoot + $"/{path}", fileBytea);
                }
            }
            catch (Exception ex)
            {
                EbLog.Error(ex.Message);
                EbLog.Error(ex.StackTrace);
            }
        }
Ejemplo n.º 4
0
        private static string CreatePlatFormDir(string FolderName)
        {
            string sid  = App.Settings.Sid.ToUpper();
            string root = App.Settings.AppDirectory;

            try
            {
                INativeHelper helper = DependencyService.Get <INativeHelper>();

                if (helper.Exist(root, SysContentType.Directory))
                {
                    if (!helper.Exist($"{root}/{sid}", SysContentType.Directory))
                    {
                        helper.Create($"{root}/{sid}", SysContentType.Directory);

                        if (FolderName != null)
                        {
                            helper.Create($"{root}/{sid}/{FolderName}", SysContentType.Directory);
                        }
                    }
                    else
                    {
                        if (FolderName != null)
                        {
                            helper.Create($"{root}/{sid}/{FolderName}", SysContentType.Directory);
                        }
                    }

                    if (!helper.Exist($"{root}/{AppConst.SHARED_MEDIA}", SysContentType.Directory))
                    {
                        helper.Create($"{root}/{AppConst.SHARED_MEDIA}", SysContentType.Directory);
                        helper.Create($"{root}/{AppConst.SHARED_MEDIA}/{sid}", SysContentType.Directory);
                    }
                    else if (!helper.Exist($"{root}/{AppConst.SHARED_MEDIA}/{sid}", SysContentType.Directory))
                    {
                        helper.Create($"{root}/{AppConst.SHARED_MEDIA}/{sid}", SysContentType.Directory);
                    }
                    else
                    {
                        helper.Delete($"{root}/{AppConst.SHARED_MEDIA}/{sid}", SysContentType.Directory);
                        helper.Create($"{root}/{AppConst.SHARED_MEDIA}/{sid}", SysContentType.Directory);
                    }
                }
                else
                {
                    helper.Create(root, SysContentType.Directory);
                    helper.Create($"{root}/{sid}", SysContentType.Directory);
                    helper.Create($"{root}/{AppConst.SHARED_MEDIA}", SysContentType.Directory);
                    helper.Create($"{root}/{AppConst.SHARED_MEDIA}/{sid}", SysContentType.Directory);

                    if (FolderName != null)
                    {
                        return(helper.Create($"{root}/{sid}/{FolderName}", SysContentType.Directory));
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
            }
            return(null);
        }