public static ImageSource GetLogo(string sid) { try { if (App.Settings.Vendor.BuildType == AppBuildType.Embedded) { return(ImageSource.FromFile(App.Settings.Vendor.Logo)); } else { INativeHelper helper = DependencyService.Get <INativeHelper>(); byte[] bytes = helper.GetFile($"{App.Settings.AppDirectory}/{sid.ToUpper()}/logo.png"); if (bytes != null) { return(ImageSource.FromStream(() => new MemoryStream(bytes))); } } } catch (Exception ex) { EbLog.Error("GetLogo" + ex.Message); } return(null); }
public static List <FileWrapper> GetFilesByPattern(string Patten, string ControlName = null) { List <FileWrapper> Files = new List <FileWrapper>(); try { INativeHelper helper = DependencyService.Get <INativeHelper>(); string sid = App.Settings.Sid.ToUpper(); string root = App.Settings.AppDirectory; string[] filenames = helper.GetFiles($"{root}/{sid}/FILES", Patten); foreach (string filepath in filenames) { string filename = Path.GetFileName(filepath); var bytes = helper.GetFile($"{root}/{sid}/FILES/{filename}"); Files.Add(new FileWrapper { Name = Path.GetFileNameWithoutExtension(filename), Bytea = bytes, FileName = filename, ControlName = ControlName }); } } catch (Exception ex) { Console.WriteLine(ex.Message); } return(Files); }
public void SetLogo() { INativeHelper helper = DependencyService.Get <INativeHelper>(); try { byte[] bytes = helper.GetFile($"{App.Settings.AppDirectory}/{this.SolutionName}/logo.png"); if (bytes != null) { this.Logo = ImageSource.FromStream(() => new MemoryStream(bytes)); } } catch (Exception ex) { EbLog.Error("Login_SetLogo" + ex.Message); } }
public byte[] GetLocalFile(string filename) { try { INativeHelper helper = DependencyService.Get <INativeHelper>(); byte[] bytes = helper.GetFile($"{App.Settings.AppDirectory}/{App.Settings.Sid.ToUpper()}/FILES/{filename}"); if (bytes != null) { return(bytes); } } catch (Exception ex) { EbLog.Error("GetLocalFile in Dataservice got some error :: " + ex.Message); } return(null); }