This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Microsoft.Owin.Hosting; | |
using System; | |
using Twilio; | |
using Twilio.Rest.Fax.V1; | |
namespace FaxApp | |
{ | |
class Program | |
{ | |
static IDisposable _app = null; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Net.Http; | |
using System.Threading.Tasks; | |
namespace FaxApp | |
{ | |
public class Util | |
{ | |
public async Task<string> DownloadFile(string url) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
using System.Linq; | |
using System.Net; | |
using System.Net.Http; | |
using System.Net.Http.Headers; | |
using System.Text; | |
using System.Threading.Tasks; | |
using System.Web; | |
using System.Web.Http; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Owin; | |
using System.Web.Http; | |
namespace FaxApp | |
{ | |
class Startup | |
{ | |
public void Configuration(IAppBuilder appBuilder) | |
{ | |
// Configure Web API for self-host. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
UIApplication.SharedApplication.OpenUrl(new NSUrl("itms-apps://itunes.apple.com/app/idAPP_ID")) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void ReplaceText(string sourcePDF, string destinationPDF, string textPhrase, string replacementText) | |
{ | |
// Open document | |
using (Document pdfDocument = new Document(sourcePDF)) | |
{ | |
// Create TextAbsorber object to find all instances of the input search phrase | |
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(textPhrase); | |
// Accept the absorber for all the pages | |
pdfDocument.Pages.Accept(textFragmentAbsorber); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await AlertAsync(this, "My Title", "My Message", "Yes", "No"); | |
public Task<bool> AlertAsync(Context context, string title, string message, string positiveButton, string negativeButton) | |
{ | |
var tcs = new TaskCompletionSource<bool>(); | |
using (var db = new AlertDialog.Builder(context)) | |
{ | |
db.SetTitle(title); | |
db.SetMessage(message); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Task<bool> AlertAsync(Context context, string title, string message, string positiveButton, string negativeButton) | |
{ | |
var tcs = new TaskCompletionSource<bool>(); | |
using (var db = new AlertDialog.Builder(context)) | |
{ | |
db.SetTitle(title); | |
db.SetMessage(message); | |
db.SetPositiveButton(positiveButton, (sender, args) => { tcs.TrySetResult(true); }); | |
db.SetNegativeButton(negativeButton, (sender, args) => { tcs.TrySetResult(false); }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void ReceivedRemoteNotification (UIApplication application, NSDictionary userInfo) | |
{ | |
processNotification(userInfo, false); | |
} | |
void processNotification(NSDictionary options, bool fromFinishedLaunching) | |
{ | |
//Check to see if the dictionary has the aps key. This is the notification payload you would have sent | |
if (null != options && options.ContainsKey(new NSString("aps"))) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.IO; | |
public void WriteWavHeader(string filePath, int sampleRate, short bitsPerSample, short channels) | |
{ | |
using (var fs = File.Open(filePath, FileMode.Open, FileAccess.ReadWrite)) | |
{ | |
using (BinaryWriter writer = new BinaryWriter(fs, System.Text.Encoding.UTF8)) | |
{ | |
writer.Seek(0, SeekOrigin.Begin); |