/// <summary> /// Bildet Home Seite und gibt diese zurück /// </summary> /// <returns></returns> public static async Task <byte[]> BuildQuote() { string page = string.Empty; try { IEnumerable <string> file = await FileHelperClass.LoadFileFromStorage("SmartMirrorServer\\Websites\\quote.html"); Api.Quote.Quote result = DataAccess.DeserializeModuleData(typeof(Api.Quote.Quote), await DataAccess.GetModuleData(Modules.Quote)); foreach (string line in file) { string tag = line; if (tag.Contains("quote") || tag.Contains("author")) { tag = tag.Replace("quote", result.Text); tag = tag.Replace("author", result.Author); } page += tag; } } catch (Exception exception) { if (Application.Notifications.ExceptionNotifications) { Notification.Notification.SendPushNotification("Fehler aufgetreten.", $"{exception.StackTrace}"); } } return(Encoding.UTF8.GetBytes(page)); }
private static async Task <string> getQuoteModul(Modules modules) { Api.Quote.Quote result = DataAccess.DeserializeModuleData(typeof(Api.Quote.Quote), await DataAccess.GetModuleData(modules)); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<table style=\"width: 100%; height: 60%; padding: 2.5%;\">"); stringBuilder.Append($" <tr> <td> <label style=\"font-size: 1.5em; text-align: left; display: block;\">{result.Text}</label> <label style=\"font-size: 1.25em; text-align: center; display: block; padding-top: 5%;\">- {result.Author} -</label></td> </tr>"); stringBuilder.Append(" </table>"); return(stringBuilder.ToString()); }