public AlertActionResult Action(Alert Alert, ScreenshotResult ScreenshotResult, string Message) { try { List <WebhookItem> Webhooks = WebhookItem.ParseWebhookInfo(Alert.WebhookURL, Alert.WebhookMessage, Alert.WebhookJSON); foreach (WebhookItem wh in Webhooks) { if (wh.IsJSON) { Task.Run(() => WebRequest.POST(wh.URL, "", true, wh.Message)); } else { Task.Run(() => WebRequest.POST(wh.URL, wh.Message)); } } AlertActionResult AAR = new AlertActionResult(); AAR.Succeeded = true; AAR.ErrorMessage = ""; return(AAR); } catch (Exception ex) { return(new AlertActionResult()); } }
public Task GetJpegScreenshot() { return(Utils.OnMainThread(async() => { await Task.Delay(100); ScreenshotResult mediaFile = await Screenshot.CaptureAsync(); var png = await mediaFile.OpenReadAsync(ScreenshotFormat.Jpeg); Assert.True(png.Length > 0); })); }
private async void SalvarQr(object sender, EventArgs e) { if (await Permisos.EnsurePermission <Permissions.StorageWrite>("Permita el acceso") == PermissionStatus.Granted) { ScreenshotResult screenshot = await Screenshot.CaptureAsync(); using (Stream stream = await screenshot.OpenReadAsync()) { string app_name = Application.Current.GetType().Namespace; await DependencyService.Get <IGalleryService>() .SaveImageToGallery(stream, $"{TxtTitle.Text}_{Guid.NewGuid():N}.png", app_name); } Acr.UserDialogs.UserDialogs.Instance.Alert("La cadena ha sido salvada en su galeria"); } }
public AlertActionResult Action(Alert Alert, ScreenshotResult ScreenshotResult, string Message) { // TODO: figure out how to have custom HTML, titles, tags/categories, etc... // TODO: have it actually post try { if (Properties.Settings.Default.WordPressAlertsUseScreenshot) { if (ScreenshotResult != null) { if (ScreenshotResult.Succeeded) { //Task.Run(() => WordPress.SendFile(ScreenshotResult.ImageFilePath, Message, Properties.Settings.Default.WordPressAlertTagHere, Properties.Settings.Default.WordPressAlertTagEveryone)); } else { //still send message here //Task.Run(() => WordPress.SendMessage(Message, Properties.Settings.Default.WordPressAlertTagHere, Properties.Settings.Default.WordPressAlertTagEveryone)); } } else { //still send message here //Task.Run(() => WordPress.SendMessage(Message, Properties.Settings.Default.WordPressAlertTagHere, Properties.Settings.Default.WordPressAlertTagEveryone)); } } else { //still send message here //Task.Run(() => WordPress.SendMessage(Message, Properties.Settings.Default.WordPressAlertTagHere, Properties.Settings.Default.WordPressAlertTagEveryone)); } AlertActionResult AAR = new AlertActionResult(); AAR.Succeeded = true; AAR.ErrorMessage = ""; return(AAR); } catch (Exception ex) { return(new AlertActionResult()); } }
public AlertActionResult Action(Alert Alert, ScreenshotResult ScreenshotResult, string Message) { try { if (Properties.Settings.Default.TwitterAlertsUseScreenshot) { if (ScreenshotResult != null) { if (ScreenshotResult.Succeeded) { Task.Run(() => Twitter.TweetWithPngImage(Message, ScreenshotResult.ImageFilePath)); } else { //still send message here Task.Run(() => Twitter.Tweet(Message)); } } else { //still send message here Task.Run(() => Twitter.Tweet(Message)); } } else { //still send message here Task.Run(() => Twitter.Tweet(Message)); } AlertActionResult AAR = new AlertActionResult(); AAR.Succeeded = true; AAR.ErrorMessage = ""; return(AAR); } catch (Exception ex) { return(new AlertActionResult()); } }
public AlertActionResult Action(Alert Alert, ScreenshotResult ScreenshotResult, string Message) { try { if (Properties.Settings.Default.DiscordAlertsUseScreenshot) { if (ScreenshotResult != null) { if (ScreenshotResult.Succeeded) { Task.Run(() => Discord.SendFile(ScreenshotResult.ImageFilePath, Message, Properties.Settings.Default.DiscordAlertTagHere, Properties.Settings.Default.DiscordAlertTagEveryone)); } else { //still send message here Task.Run(() => Discord.SendMessage(Message, Properties.Settings.Default.DiscordAlertTagHere, Properties.Settings.Default.DiscordAlertTagEveryone)); } } else { //still send message here Task.Run(() => Discord.SendMessage(Message, Properties.Settings.Default.DiscordAlertTagHere, Properties.Settings.Default.DiscordAlertTagEveryone)); } } else { //still send message here Task.Run(() => Discord.SendMessage(Message, Properties.Settings.Default.DiscordAlertTagHere, Properties.Settings.Default.DiscordAlertTagEveryone)); } AlertActionResult AAR = new AlertActionResult(); AAR.Succeeded = true; AAR.ErrorMessage = ""; return(AAR); } catch (Exception ex) { return(new AlertActionResult()); } }