public override void ViewDidLoad() { _webView = new UIWebView(View.Bounds); _webView.ScalesPageToFit = true; View.AddSubview(_webView); Uri uri = Lighthouse.GetUriForSignal(_signalId); string Authorization = Lighthouse.GetAuthorizationToken(); NSMutableUrlRequest UrlRequest = new Foundation.NSMutableUrlRequest(uri); var keys = new object[] { "Authorization" }; var values = new object[] { Authorization }; var dict = NSDictionary.FromObjectsAndKeys(values, keys); UrlRequest.Headers = dict; _webView.LoadRequest(UrlRequest); base.ViewDidLoad(); }
private void SetClientCertificate(ClientCertificate certificate) { if (certificate == null) { return; } var bytes = Convert.FromBase64String(certificate.RawData); var options = NSDictionary.FromObjectsAndKeys(new object[] { certificate.Passphrase }, new object[] { "passphrase" }); var status = SecImportExport.ImportPkcs12(bytes, options, out NSDictionary[] items); var identityRef = items[0]["identity"]; var identity = new SecIdentity(identityRef.Handle); SecCertificate[] certs = { identity.Certificate }; this.UrlCredential = new NSUrlCredential(identity, certs, NSUrlCredentialPersistence.ForSession); }
internal void DownloadAssetStream(Asset asset) { // Get the default media selections for the asset's media selection groups. var preferredMediaSelection = asset.UrlAsset.PreferredMediaSelection; ///* // Creates and initializes an AVAggregateAssetDownloadTask to download multiple AVMediaSelections // on an AVURLAsset. // For the initial download, we ask the URLSession for an AVAssetDownloadTask with a minimum bitrate // corresponding with one of the lower bitrate variants in the asset. // */ AVAggregateAssetDownloadTask task = null; try { var dictionary = new NSDictionary <NSString, NSObject>(new NSString("AVAssetDownloadTaskMinimumRequiredMediaBitrateKey"), (NSObject)(new NSNumber(265_000))); task = assetDownloadUrlSession.GetAssetDownloadTask(asset.UrlAsset, new AVMediaSelection[] { preferredMediaSelection }, asset.Stream.Name, null, dictionary); task.TaskDescription = asset.Stream.Name; activeDownloadsMap.Add(task, asset); task.Resume(); var userInfo = new Dictionary <string, object>(); userInfo[Asset.Keys.Name] = asset.Stream.Name; userInfo[Asset.Keys.DownloadState] = AssetDownloadState.Downloading.ToString(); userInfo[Asset.Keys.DownloadSelectionDisplayName] = GetDisplayNamesForSelectedMediaOptions(preferredMediaSelection); var userInfoDictionary = NSDictionary.FromObjectsAndKeys(userInfo.Values.ToArray(), userInfo.Keys.ToArray()); NSNotificationCenter.DefaultCenter.PostNotificationName(AssetPersistenceManager.AssetDownloadStateChanged, null, userInfoDictionary); } catch (Exception ex) { Debug.WriteLine(ex.Message); } }
public static void SaveItem(Item item, GroceryList list) { if (AppData.auth.CurrentUser == null) { return; } object[] itemKeys = { "itemName", "itemTime", "itemPurchased" }; object[] itemValues = { item.ItemName, item.ItemTime.ToString(CultureInfo.InvariantCulture), item.ItemPurchased.ToString() }; var itemDict = NSDictionary.FromObjectsAndKeys(itemValues, itemKeys); AppData.DataNode .GetChild(list.ListOwner.Uid) .GetChild(list.ListName) .GetChild("items") .GetChild(item.ItemName) .SetValue(itemDict); }
void ApplyFilter() { CIVector center = CIVector.Create(Bounds.GetMidX(), Bounds.GetMidY()); CIFilter torus = CIFilter.FromName("CITorusLensDistortion"); var keys = new NSString[] { CIFilterInputKey.Center, CIFilterInputKey.Radius, CIFilterInputKey.Width, CIFilterInputKey.Refraction }; var values = new NSObject[] { center, NSNumber.FromFloat(150), NSNumber.FromFloat(2), NSNumber.FromFloat(1.7f) }; torus.SetValuesForKeysWithDictionary(NSDictionary.FromObjectsAndKeys(values, keys)); controls.BackgroundFilters = new CIFilter[] { torus }; AddAnimationToTorusFilter(); }
private void prepareToRecord() { if (_audioSessionCreated) { //Declare string for application temp path and tack on the file extension _audioFileName = string.Format("{0}{1}.wav", _songName, DateTime.Now.ToString("yyyyMMddHHmmss")); _audioFilePath = Path.Combine(Path.GetTempPath(), _audioFileName); Console.WriteLine("Audio File Path: " + _audioFilePath); _url = NSUrl.FromFilename(_audioFilePath); //set up the NSObject Array of values that will be combined with the keys to make the NSDictionary NSObject[] values = new NSObject[] { NSNumber.FromFloat(44100.0f), //Sample Rate NSNumber.FromInt32((int)AudioToolbox.AudioFormatType.LinearPCM), //AVFormat NSNumber.FromInt32(2), //Channels NSNumber.FromInt32(16), //PCMBitDepth NSNumber.FromBoolean(false), //IsBigEndianKey NSNumber.FromBoolean(false) //IsFloatKey }; //Set up the NSObject Array of keys that will be combined with the values to make the NSDictionary NSObject[] keys = new NSObject[] { AVAudioSettings.AVSampleRateKey, AVAudioSettings.AVFormatIDKey, AVAudioSettings.AVNumberOfChannelsKey, AVAudioSettings.AVLinearPCMBitDepthKey, AVAudioSettings.AVLinearPCMIsBigEndianKey, AVAudioSettings.AVLinearPCMIsFloatKey }; //Set Settings with the Values and Keys to create the NSDictionary _settings = NSDictionary.FromObjectsAndKeys(values, keys); //Set recorder parameters _recorder = AVAudioRecorder.Create(_url, new AudioSettings(_settings), out _error); //Set Recorder to Prepare To Record _recorder.PrepareToRecord(); } }
void AddNewItem() { var value = "foo"; var jsonDate = DateTime.UtcNow.ToString("O"); var vals = NSDictionary.FromObjectsAndKeys( new NSObject[] { new NSString(value), NSNumber.FromBoolean(false), new NSString(jsonDate) }, new NSObject[] { new NSString("text"), new NSString("check"), new NSString("created_at") } ); var doc = database.CreateUntitledDocument(); NSError error; var result = doc.PutProperties(vals); if (result == null) { throw new ApplicationException("failed to put props"); } }
void SetIndicators() { if (Element.ShowIndicators) { pageControl = new UIPageControl(); pageControl.TranslatesAutoresizingMaskIntoConstraints = false; pageControl.Enabled = false; pageController.View.AddSubview(pageControl); var viewsDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { pageControl }, new NSObject[] { new NSString("pageControl") }); if (Element.Orientation == CarouselViewOrientation.Horizontal) { pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:|[pageControl]|", NSLayoutFormatOptions.AlignAllCenterX, new NSDictionary(), viewsDictionary)); if (Element.IndicatorLocation == IndicatorLocation.Bottom) { pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); } else { pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[pageControl]|", NSLayoutFormatOptions.AlignAllTop, new NSDictionary(), viewsDictionary)); } } else { pageControl.Transform = CGAffineTransform.MakeRotation(3.14159265f / 2); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("[pageControl(==36)]", 0, new NSDictionary(), viewsDictionary)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("H:[pageControl]|", 0, new NSDictionary(), viewsDictionary)); pageController.View.AddConstraints(NSLayoutConstraint.FromVisualFormat("V:|[pageControl]|", NSLayoutFormatOptions.AlignAllTop, new NSDictionary(), viewsDictionary)); } pageControl.Pages = Count; pageControl.PageIndicatorTintColor = Element.IndicatorsTintColor.ToUIColor(); pageControl.CurrentPageIndicatorTintColor = Element.CurrentPageIndicatorTintColor.ToUIColor(); pageControl.CurrentPage = Element.Position; SetIndicatorsShape(); } else { CleanUpPageControl(); } }
public IEnumerable <DevTeam> FindAllDevelopmentTeams() { var query = NSDictionary.FromObjectsAndKeys(new object[] { SecClassCertificate, SecMatchLimitAll, new NSNumber(true), new NSNumber(true), new NSNumber(true) }, new object[] { SecClassKey, SecMatchLimit, SecReturnRef, SecMatchTrustedOnly, SecAttrCanSign }); var certificationsRefPtr = IntPtr.Zero; var error = SecItemCopyMatching(query.Handle, ref certificationsRefPtr); if (error != 0) { throw new DevelopmentTeamExtractorFailure("Failed to search for developer identities", error); } var devTeams = new List <DevTeam>(); var certificationsRef = Runtime.GetNSObject <NSArray>(certificationsRefPtr); for (uint i = 0; i < certificationsRef.Count; ++i) { var devTeam = PareDevelopmentTeam(certificationsRef.ValueAt(i)); if (devTeam != null) { devTeams.Add(devTeam); } } return(devTeams); }
public static NSDictionary ListToDict(GroceryList newList) { var allItemsDict = new NSMutableDictionary(); foreach (var item in newList.ListItems) { var eachItemDict = new NSMutableDictionary(); eachItemDict.SetValueForKey((NSString)item.ItemName, (NSString)"itemName"); eachItemDict.SetValueForKey((NSString)item.ItemPurchased.ToString(), (NSString)"itemPurchased"); eachItemDict.SetValueForKey((NSString)item.ItemTime.ToString(), (NSString)"itemTime"); allItemsDict.SetValueForKey(eachItemDict, (NSString)item.ItemName); } object[] listOwnerKeys = { "name", "email", "uid" }; object[] listOwnerValues = { newList.ListOwner.Name, newList.ListOwner.Email, newList.ListOwner.Uid }; var listOwnerDict = NSDictionary.FromObjectsAndKeys(listOwnerValues, listOwnerKeys); var anyListDataDict = new NSMutableDictionary(); anyListDataDict.SetValueForKey(allItemsDict, (NSString)"items"); anyListDataDict.SetValueForKey((NSString)newList.ListName, (NSString)"listName"); anyListDataDict.SetValueForKey(listOwnerDict, (NSString)"listOwner"); if (allItemsDict.Count == 0) { anyListDataDict.Remove((NSString)"items"); } return(anyListDataDict); }
public async Task CompleteTransaction(SKPaymentTransaction transaction) { try { Logger.Log("CompleteTransaction thread: " + System.Threading.Thread.CurrentThread.Name + " ID:" + System.Threading.Thread.CurrentThread.ManagedThreadId); string logMessage = "CompleteTransaction: "; if ((transaction != null) && (transaction.TransactionReceipt != null)) { logMessage += transaction.TransactionReceipt.ToString(); } Logger.Log(logMessage); var verifyResult = await InAppPurchaseVerificationController.Instance.VerifyPurchase(transaction); if (verifyResult.Success) { FinishTransaction(transaction, true); } else { SKReceiptRefreshRequest refreshRequest = new SKReceiptRefreshRequest(); refreshRequest.Delegate = this; refreshRequest.Start(); using (var pool = new NSAutoreleasePool()) { string error = verifyResult.Error; if (error == null) { error = string.Empty; } NSDictionary userInfo = NSDictionary.FromObjectsAndKeys(new NSObject[] { new NSString(error) }, new NSObject[] { new NSString("error") }); NSNotificationCenter.DefaultCenter.PostNotificationName(InAppPurchaseManagerValidationFailedNotification, this, userInfo); } } } catch (Exception ex) { Logger.Log("ERROR: CompleteTransaction: " + ex); } }
public override bool FinishedLaunching(UIApplication app, NSDictionary options) { var docsPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); MeetupManagerDatabase.Root = docsPath; UINavigationBar.Appearance.BarTintColor = UIColor.FromRGB(240, 40, 34); //bar background UINavigationBar.Appearance.TintColor = UIColor.White; //Tint color of button items UINavigationBar.Appearance.SetTitleTextAttributes(new UITextAttributes() { Font = UIFont.FromName("HelveticaNeue-Light", (nfloat)18f), TextColor = UIColor.White }); var dictionary = NSDictionary.FromObjectsAndKeys(new [] { "Mozilla/5.0 (iPhone; CPU iPhone OS 7_1 like Mac OS X) AppleWebKit/537.51.2 (KHTML, like Gecko) Version/7.0 Mobile/11D167 Safari/9537.53" }, new [] { "UserAgent" }); NSUserDefaults.StandardUserDefaults.RegisterDefaults(dictionary); Forms.Init(); #if DEBUG Xamarin.Insights.Initialize(Xamarin.Insights.DebugModeKey); #else Xamarin.Insights.Initialize(Xamarin.Insights.DebugModeKey); Xamarin.Insights.ForceDataTransmission = true; #endif #if UITEST // requires Xamarin Test Cloud Agent Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => { // http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/ if (null != e.View.StyleId) { e.NativeView.AccessibilityIdentifier = e.View.StyleId; } }; #endif ImageCircleRenderer.Init(); //new Syncfusion.SfChart.XForms.iOS.Renderers.SfChartRenderer(); LoadApplication(new App()); return(base.FinishedLaunching(app, options)); }
void SetMatchingMultiple(ICollection <IDictionary <string, ValueType> > matchingDictionaries, Action <IOHIDManagerRef, CFDictionaryRef> matchingFunction) { ThrowIfDisposed(); if (matchingDictionaries == null) { throw new ArgumentNullException("matchingDictionaries"); } var dictonaryPtrs = new IntPtr [matchingDictionaries.Count]; var i = 0; foreach (var dict in matchingDictionaries) { dictonaryPtrs [i++] = NSDictionary.FromObjectsAndKeys(dict.Values.ToArray(), dict.Keys.ToArray()).Handle; } var array = NSArray.FromIntPtrs(dictonaryPtrs); matchingFunction(Handle, array.Handle); }
private void UserSetting() { var dicOptionDefaults = NSDictionary.FromObjectsAndKeys( new object[] { "", "", false, false }, new object[] { "ID", "PW", "isSaveID", "isSavePW" } ); NSUserDefaults.StandardUserDefaults.RegisterDefaults(dicOptionDefaults); this.Edited = false; this.Logined = false; this.UserInfo = new UserInfo(); NSUserDefaults.StandardUserDefaults.SetBool(true, "isSaveID"); NSUserDefaults.StandardUserDefaults.SetBool(true, "isSavePW"); }
public void FinishTransaction(SKPaymentTransaction transaction, bool wasSuccessful) { Console.WriteLine("FinishTransaction " + wasSuccessful); // remove the transaction from the payment queue. SKPaymentQueue.DefaultQueue.FinishTransaction(transaction); // THIS IS IMPORTANT - LET'S APPLE KNOW WE'RE DONE !!!! using (var pool = new NSAutoreleasePool()) { NSDictionary userInfo = NSDictionary.FromObjectsAndKeys(new NSObject[] { transaction }, new NSObject[] { new NSString("transaction") }); if (wasSuccessful) { // send out a notification that we’ve finished the transaction NSNotificationCenter.DefaultCenter.PostNotificationName(InAppPurchaseManagerTransactionSucceededNotification, this, userInfo); } else { // send out a notification for the failed transaction NSNotificationCenter.DefaultCenter.PostNotificationName(InAppPurchaseManagerTransactionFailedNotification, this, userInfo); } } }
static NSAttributedString CreateAttributedString(string text, NSFont font) { NSDictionary dict; if (font != null) { dict = NSDictionary.FromObjectsAndKeys( new object [] { font, new NSNumber(true) }, new object [] { CTStringAttributeKey.Font, CTStringAttributeKey.ForegroundColorFromContext } ); } else { dict = NSDictionary.FromObjectsAndKeys( new object [] { new NSNumber(true) }, new object [] { CTStringAttributeKey.ForegroundColorFromContext } ); } return(new NSAttributedString(text, dict)); }
public static void ScheduleLocalNotification(MoodPrompt prompt) { if (prompt != null) { var keys = new object[] { "PromptId" }; var objects = new object[] { prompt.Id }; var userInfo = NSDictionary.FromObjectsAndKeys(objects, keys); var fireDate = DateTime.SpecifyKind(prompt.ActiveFrom, DateTimeKind.Utc); UILocalNotification notification = new UILocalNotification { FireDate = fireDate.ToLocalTime().ToNSDate(), TimeZone = NSTimeZone.FromName("UTC"), AlertBody = prompt.NotificationText, RepeatInterval = 0, AlertAction = "Set my mood", UserInfo = userInfo }; UIApplication.SharedApplication.ScheduleLocalNotification(notification); } }
private static NSDictionary <NSString, NSObject> ToNsDictionary(IDictionary <string, object> source) { if (source == null) { return(null); } var keys = new object[source.Keys.Count]; var i = 0; foreach (var key in source.Keys) { keys[i] = key; i++; } var objects = new object[source.Values.Count]; source.Values.CopyTo(objects, 0); return(NSDictionary <NSString, NSObject> .FromObjectsAndKeys(objects, keys)); }
/// /// Name AudioRecordStart /// /// <summary> Start the recorder to record the audio. /// </summary> /// public void AudioRecordStart() { try { string fileName = string.Format("Myfile{0}.wav", DateTime.Now.ToString("yyyyMMddHHmmss")); audioFilePath = Path.Combine(Path.GetTempPath(), fileName); url = NSUrl.FromFilename(audioFilePath); //set up the NSObject Array of values that will be combined with the keys to make the NSDictionary NSObject[] values = new NSObject[] { NSNumber.FromFloat (44100.0f), //Sample Rate NSNumber.FromInt32 ((int)AudioToolbox.AudioFormatType.LinearPCM), //AVFormat NSNumber.FromInt32 (2), //Channels NSNumber.FromInt32 (16), //PCMBitDepth NSNumber.FromBoolean (false), //IsBigEndianKey NSNumber.FromBoolean (false) //IsFloatKey }; NSObject[] values = new NSObject[] { NSNumber.FromFloat(44100.0f), NSNumber.FromInt32((int)AudioFormatType.LinearPCM), NSNumber.FromInt32(2), }; NSObject[] keys = new NSObject[] { AVAudioSettings.AVSampleRateKey, AVAudioSettings.AVFormatIDKey, AVAudioSettings.AVNumberOfChannelsKey, }; settings = NSDictionary.FromObjectsAndKeys(values, keys); recorder = AVAudioRecorder.Create(url, new AudioSettings(settings), out error); recorder.PrepareToRecord(); recorder.Record(); AddNewAudioView.Playevent.Invoke(); } catch (Exception ex) { LogTracking.LogTrace(ex.ToString()); } }
static NSImage Render(string value) { NSImage image = null; NSApplication.SharedApplication.InvokeOnMainThread(() => { NSString text = new NSString(string.IsNullOrEmpty(value) ? " " : value); NSFont font = NSFont.FromFontName("Arial", 20); var fontDictionary = NSDictionary.FromObjectsAndKeys(new NSObject[] { font, NSColor.Red }, new NSObject[] { NSStringAttributeKey.Font, NSStringAttributeKey.ForegroundColor }); CGSize size = text.StringSize(fontDictionary); image = new NSImage(new CGSize(size)); image.LockFocus(); text.DrawString(new CGPoint(0, 0), fontDictionary); image.UnlockFocus(); }); return(image); }
private void UserSetting() { var _defaults = NSDictionary.FromObjectsAndKeys( new object[] { "", "", false, false }, new object[] { "login_id", "password", "is_save_loginid", "is_save_password" } ); NSUserDefaults.StandardUserDefaults.RegisterDefaults(_defaults); this.Edited = false; this.Logined = false; this.UserInfo = new UserInfo(); NSUserDefaults.StandardUserDefaults.SetBool(true, "is_save_loginid"); NSUserDefaults.StandardUserDefaults.SetBool(true, "is_save_password"); }
protected virtual NSUrlRequest CreateRequest(TaskConfiguration config) { var url = NSUrl.FromString(config.Uri); var request = new NSMutableUrlRequest(url) { HttpMethod = config.HttpMethod, AllowsCellularAccess = config.UseMeteredConnection }; if (!String.IsNullOrWhiteSpace(config.PostData)) { request.Body = NSData.FromString(config.PostData); } var headerDictionary = NSDictionary.FromObjectsAndKeys(config.Headers.Values.ToArray(), config.Headers.Keys.ToArray()); request.Headers = headerDictionary; return(request); }
static NSAttributedString CreateAttributedString(LayoutInfo li, string overrideText = null) { NSDictionary dict; if (li.Font != null) { dict = NSDictionary.FromObjectsAndKeys( new object[] { li.Font, new NSNumber(true) }, new object[] { CTStringAttributeKey.Font, CTStringAttributeKey.ForegroundColorFromContext } ); } else { dict = NSDictionary.FromObjectsAndKeys( new object[] { new NSNumber(true) }, new object[] { CTStringAttributeKey.ForegroundColorFromContext } ); } return(new NSAttributedString(overrideText ?? li.Text, dict)); }
public static NSDictionary <NSString, NSObject> ToNSDictionaryFromNonGeneric(this IDictionary dictionary) { if (dictionary.Count > 0) { var nsDictionary = new NSMutableDictionary <NSString, NSObject>(); foreach (DictionaryEntry entry in dictionary) { PutIntoNSDictionary(new KeyValuePair <string, object>(entry.Key.ToString(), entry.Value), ref nsDictionary); } return(NSDictionary <NSString, NSObject> .FromObjectsAndKeys( nsDictionary.Values.ToArray(), nsDictionary.Keys.ToArray(), (nint)nsDictionary.Count)); } else { return(new NSDictionary <NSString, NSObject>()); } }
void LOG_TOPIC_SELECTED(Prompt current) { NSString[] keys = { new NSString("TEXT"), new NSString("ID"), new NSString("TIMESTAMP") }; NSObject[] values = { new NSString(current.Text), new NSString(current.ID.ToString()), new NSString(DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString()) }; var parameters = NSDictionary <NSString, NSObject> .FromObjectsAndKeys(values, keys, keys.Length); Logger.LOG_EVENT_WITH_DICT("TOPIC_SELECTED", parameters); }
public void SendEvents() { if (hasListeners) { /* The event body can be any of: https://facebook.github.io/react-native/docs/native-modules-ios#argument-types */ /* Some types they can be instantiated directly, e.g. new NSString("A string"), others require boxing via NSObject.FromObject() or similar. */ /* The below allows constructing objects with arbritrary key-value pairs in a "semi-general" way */ Dictionary <string, object> body = new Dictionary <string, object> { { "name", "An event 123" }, { "time", DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() } }; NSDictionary nsBody = NSDictionary.FromObjectsAndKeys( body.Values.Select(v => FromObject(v)).ToArray(), body.Keys.Select(k => FromObject(k)).ToArray() ); SendEventWithName(AN_EVENT_NAME, nsBody); } }
void LOG_ADD_PARTICIPANT(string name, string email) { // Logging information NSString[] keys = { new NSString("NAME"), new NSString("EMAIL"), new NSString("TIMESTAMP") }; NSObject[] values = { new NSString(name), new NSString(email), new NSString(DateTimeOffset.UtcNow.ToUnixTimeSeconds().ToString()) }; var parameters = NSDictionary <NSString, NSObject> .FromObjectsAndKeys(values, keys, keys.Length); Logger.LOG_EVENT_WITH_DICT("ADD_PARTICIPANT", parameters); }
public void JoinMeeting(string meetingID, string meetingPassword, string displayName = "Zoom Demo") { if (IsInitialized()) { var meetingService = mobileRTC.GetMeetingService(); meetingService.Delegate = new ZoomMeetingEventHandler(); var meetingParamDict = new Dictionary <string, string> { { Constants.kMeetingParam_Username, displayName }, { Constants.kMeetingParam_MeetingNumber, meetingID }, { Constants.kMeetingParam_MeetingPassword, meetingPassword }, }; var nsMeetingParam = NSDictionary.FromObjectsAndKeys(meetingParamDict.Values.ToArray(), meetingParamDict.Keys.ToArray()); var meetingJoinResponse = meetingService.JoinMeetingWithDictionary(nsMeetingParam); Console.WriteLine($"Meeting Joining Response {meetingJoinResponse}"); } }
public void StartRecordingFroMic(string FilePath) { // set some default values for recording settings NSObject[] keys = new NSObject[] { AVAudioSettings.AVSampleRateKey, AVAudioSettings.AVFormatIDKey, AVAudioSettings.AVNumberOfChannelsKey, AVAudioSettings.AVEncoderAudioQualityKey, }; NSObject[] values = new NSObject[] { NSNumber.FromFloat(44100.0f), NSNumber.FromInt32((int)AudioFileType.WAVE), NSNumber.FromInt32(1), NSNumber.FromInt32((int)AVAudioQuality.Max), }; NSDictionary settings = NSDictionary.FromObjectsAndKeys(values, keys); // define a filename and location for the output file string fileName = FilePath; string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal), fileName); outputFileUrl = NSUrl.FromFilename(path); // pass the configured url to the AVAudioRecorder object NSError error = new NSError(); _mic = AVAudioRecorder.ToUrl(outputFileUrl, settings, out error); if (error != null) { // prepare and start recording _mic.PrepareToRecord(); _mic.Record(); } else { throw new Exception("Error loading mic: " + error.ToString()); } }
public Task <OfflinePack> DownloadMap(OfflinePackRegion formsRegion, Dictionary <string, string> packInfo) { var tsc = new TaskCompletionSource <OfflinePack>(); var region = new MGLTilePyramidOfflineRegion( new NSUrl(formsRegion.StyleURL), formsRegion.Bounds.ToCLRegion(), formsRegion.MinimumZoomLevel, formsRegion.MaximumZoomLevel); NSData context = null; if (packInfo != null) { var keys = new List <NSString>(); var values = new List <NSString>(); foreach (string key in packInfo.Keys) { keys.Add((NSString)key); values.Add((NSString)packInfo[key]); } var userInfo = NSDictionary.FromObjectsAndKeys(values.ToArray(), keys.ToArray()); context = NSKeyedArchiver.ArchivedDataWithRootObject(userInfo); } MGLOfflineStorage.SharedOfflineStorage.AddPackForRegion(region, context, (pack, error) => { if (error != null) { System.Diagnostics.Debug.WriteLine("Couldn't create offline pack: " + error.LocalizedFailureReason); tsc.TrySetResult(null); } else { pack.Resume(); var formsPack = pack.ToFormsPack(); tempPacks.Add(pack.GetNativeHash(), formsPack); tsc.TrySetResult(formsPack); } }); return(tsc.Task); }