Inheritance: NSObject
示例#1
0
        public static AVAudioRecorder ToUrl(NSUrl url, AVAudioRecorderSettings settings, out NSError error)
        {
            if (settings == null)
                throw new ArgumentNullException ("settings");

            return ToUrl (url, settings.ToDictionary (), out error);
        }
示例#2
0
        public static unsafe NSData SendSynchronousRequest(NSUrlRequest request, out NSUrlResponse response, out NSError error)
        {
            IntPtr responseStorage = IntPtr.Zero;
            IntPtr errorStorage = IntPtr.Zero;

            void *resp = &responseStorage;
            void *errp = &errorStorage;
            IntPtr rhandle = (IntPtr) resp;
            IntPtr ehandle = (IntPtr) errp;

            var res = Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_IntPtr (
                class_ptr,
                selSendSynchronousRequestReturningResponseError.Handle,
                request.Handle,
                rhandle,
                ehandle);

            if (responseStorage != IntPtr.Zero)
                response = (NSUrlResponse) Runtime.GetNSObject (responseStorage);
            else
                response = null;

            if (errorStorage != IntPtr.Zero)
                error = (NSError) Runtime.GetNSObject (errorStorage);
            else
                error = null;

            return (NSData) Runtime.GetNSObject (res);
        }
 public override void FailedWithError(NSUrlConnection connection, NSError error)
 {
     if (stream != null)
     {
         stream.Complete();
     }
     waitEvent.Set();
 }
示例#4
0
		public NSErrorException (NSError error)
			: base (error.LocalizedDescription,
			        error.UserInfo == null
			        	? null
			        	: error.UserInfo.ContainsKey (NSError.UnderlyingErrorKey)
			        		? new NSErrorException ((NSError)error.UserInfo[NSError.UnderlyingErrorKey])
			        		: null)
		{
			this.error = error;
			HResult = error.Code;
		}
		public static NSError RegisterFontsForUrl (NSUrl fontUrl, CTFontManagerScope scope)
		{
			if (fontUrl == null)
				throw new ArgumentNullException ("fontUrl");
			
			NSError e = new NSError (ErrorDomain, 0);

			if (CTFontManagerRegisterFontsForURL (fontUrl.Handle, scope, e.Handle))
				return null;
			else
				return e;
		}
示例#6
0
        public static AVAudioPlayer FromUrl(NSUrl url, out NSError error)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr) (&errhandle);

                var ap = new AVAudioPlayer (url, ptrtohandle);
                if (ap.Handle == IntPtr.Zero){
                    error = (NSError) Runtime.GetNSObject (errhandle);
                    return null;
                } else
                    error = null;
                return ap;
            }
        }
示例#7
0
		public override bool ReadFromUrl (NSUrl url, string typeName, out NSError outError)
		{
			Console.WriteLine ("ReadFromUrl : {0}", url.ToString ());
			outError = null;

			// if scheme is not right, we ignore the url
			if (url.Scheme != "monodoc" && url.Scheme != "mdoc")
				return true;
			
			// ResourceSpecifier is e.g. "//T:System.String"
			initialLoadFromUrl = Uri.UnescapeDataString (url.ResourceSpecifier.Substring (2));
			this.FileUrl = url;
			
			return true;
		}
示例#8
0
        public bool SetActive(bool beActive, out NSError outError)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr) (&errhandle);

                if (SetActive (beActive, ptrtohandle)){
                    outError = null;
                    return true;
                } else {
                    outError = (NSError) Runtime.GetNSObject (errhandle);
                    return false;
                }
            }
        }
示例#9
0
        public bool SetCategory(NSString theCategory, out NSError outError)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr) (&errhandle);

                if (SetCategory (theCategory, ptrtohandle)){
                    outError = null;
                    return true;
                } else {
                    outError = (NSError) Runtime.GetNSObject (errhandle);
                    return false;
                }
            }
        }
示例#10
0
        public static AVAudioRecorder ToUrl(NSUrl url, NSDictionary settings, out NSError error)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr) (&errhandle);

                var ap = new AVAudioRecorder (url, settings, ptrtohandle);
                if (ap.Handle == IntPtr.Zero){
                    error = (NSError) Runtime.GetNSObject (errhandle);
                    return null;
                } else
                    error = null;
                return ap;
            }
        }
示例#11
0
        public bool SetActive(bool beActive, AVAudioSessionFlags flags, out NSError outError)
        {
            unsafe {
                IntPtr errhandle;
                IntPtr ptrtohandle = (IntPtr) (&errhandle);

                if (_SetActive (beActive, (int) flags, ptrtohandle)){
                    outError = null;
                    return true;
                } else {
                    outError = (NSError) Runtime.GetNSObject (errhandle);
                    return false;
                }
            }
        }
示例#12
0
        private void PlatformInitialize()
        {
            var err = new NSError();

            _mMovie = new QTMovie(FileName, out err);
            if (_mMovie != null)
            {
                MovieView = new QTMovieView();
                MovieView.Movie = _mMovie;

                MovieView.IsControllerVisible = false;
            }
            else
                Console.WriteLine(err);
        }
示例#13
0
		public override bool ReadFromUrl (NSUrl url, string typeName, out NSError outError)
		{
			Console.WriteLine ("ReadFromUrl : {0}", url.ToString ());
			outError = null;
			const int NSServiceMiscellaneousError = 66800;
			if (url.Scheme != "monodoc" && url.Scheme != "mdoc") {
				outError = new NSError (NSError.CocoaErrorDomain,
				                       	NSServiceMiscellaneousError,
				                      	NSDictionary.FromObjectAndKey (NSError.LocalizedFailureReasonErrorKey, new NSString (string.Format ("Scheme {0} isn't supported", url.Scheme))));
				return false;
			}
			
			// ResourceSpecifier is e.g. "//T:System.String"
			initialLoadFromUrl = Uri.UnescapeDataString (url.ResourceSpecifier.Substring (2));
			this.FileUrl = url;
			
			return true;
		}
示例#14
0
        static unsafe NSData SendSynchronousRequest(NSUrlRequest request, out NSUrlResponse response, NSError error)
        {
            IntPtr storage = IntPtr.Zero;

            void *p = &storage;
            IntPtr handle = (IntPtr) p;

            var res = Messaging.IntPtr_objc_msgSend_IntPtr_IntPtr_IntPtr (
                class_ptr,
                selSendSynchronousRequestReturningResponseError.Handle,
                request.Handle,
                handle,
                error != null ? error.Handle : IntPtr.Zero);

            if (storage != IntPtr.Zero)
                response = (NSUrlResponse) Runtime.GetNSObject (storage);
            else
                response = null;

            return (NSData) Runtime.GetNSObject (res);
        }
示例#15
0
		public override bool ReadFromUrl (NSUrl url, string typeName, out NSError outError)
		{
			fsEvents = new FSEventStream (new [] { Path.GetDirectoryName (url.Path) },
				TimeSpan.FromSeconds (0), FSEventStreamCreateFlags.FileEvents);

			fsEvents.Events += (sender, e) => {
				foreach (var evnt in e.Events) {
					if (evnt.Path == url.Path && (evnt.Flags & FSEventStreamEventFlags.ItemModified) != 0) {
						ReloadDocument ();
						break;
					}
				}
			};

			fsEvents.ScheduleWithRunLoop (NSRunLoop.Current);
			fsEvents.Start ();

			documentUrl = url;
			outError = null;
			return true;
		}
示例#16
0
		public bool SetResource (string key, NSObject value, out NSError error)
		{
			return SetResourceValue (value, key, out error);
		}
示例#17
0
		public bool TryGetResource (string key, out NSObject value, out NSError error)
		{
			return GetResourceValue (out value, key, out error);
		}
示例#18
0
		public override bool ReadFromUrl (NSUrl absoluteUrl, string typeName, out NSError outError)
		{
			var loaded = QTMovie.FromUrl (absoluteUrl, out outError);
			if (loaded != null){
				loaded.SetAttribute (NSNumber.FromBoolean (true), QTMovie.EditableAttribute);
				
				if (movie != null)
					movie.Dispose ();
				movie = loaded;
			}
			return loaded != null;
		}
示例#19
0
		public override bool WriteToUrl (NSUrl absoluteUrl, string typeName, NSSaveOperationType saveOperation, NSUrl absoluteOriginalContentsUrl, out NSError outError)
		{
			var saveOptions = new QTMovieSaveOptions () {
				Flatten = true
			};
			return movie.SaveTo (absoluteUrl.Path, new QTMovieSaveOptions () { Flatten = true }, out outError);
		}
示例#20
0
        public bool CreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes, out NSError error)
        {
            var dict = attributes == null ? null : attributes.ToDictionary();

            return(CreateDirectory(path, createIntermediates, dict, out error));
        }
示例#21
0
 public NSFileSystemAttributes GetFileSystemAttributes(string path, out NSError error)
 {
     return NSFileSystemAttributes.FromDict (_GetFileSystemAttributes (path, out error));
 }
示例#22
0
 public override void EncoderError(AVAudioRecorder recorder, NSError error)
 {
     if (cbEncoderError != null)
         cbEncoderError (recorder, new AVErrorEventArgs (error));
 }
示例#23
0
 public AVErrorEventArgs(NSError error)
 {
     Error = error;
 }
示例#24
0
//		public NSTextView CSharpTextBox;
//		public NSTextView ConsoleTextBox;
//		public NSTextView IntermediateTextBox;
//		public NSTextView CPPTextBox;




		
		//
		// Save support:
		//    Override one of GetAsData, GetAsFileWrapper, or WriteToUrl.
		//
		
		// This method should store the contents of the document using the given typeName
		// on the return NSData value.
		public override NSData GetAsData (string documentType, out NSError outError)
		{
			outError = NSError.FromDomain (NSError.OsStatusErrorDomain, -4);
			return null;
		}
 public bool SetAttributes(NSFileAttributes attributes, string path, out NSError error)
 {
     return(SetAttributes(attributes.ToDictionary(), path, out error));
 }
 public NSFileSystemAttributes GetFileSystemAttributes(string path, out NSError error)
 {
     return(NSFileSystemAttributes.FromDict(_GetFileSystemAttributes(path, out error)));
 }
 public bool CreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes, out NSError error)
 {
     return(CreateDirectory(path, createIntermediates, attributes.ToDictionary(), out error));
 }
示例#28
0
		//
		// Load support:
		//    Override one of ReadFromData, ReadFromFileWrapper or ReadFromUrl
		//
		public override bool ReadFromData (NSData data, string typeName, out NSError outError)
		{
			outError = NSError.FromDomain (NSError.OsStatusErrorDomain, -4);
			return false;
		}
示例#29
0
 public bool SetResource(string key, NSObject value, out NSError error)
 {
     return(SetResourceValue(value, key, out error));
 }
示例#30
0
 public override void DecoderError(AVAudioPlayer player, NSError  error)
 {
     if (cbDecoderError != null)
         cbDecoderError (player, new AVErrorEventArgs (error));
 }
		public bool SetPreferredHardwareSampleRate (double sampleRate, NSError outError)
		{
			// Effectively discarded due to original binding error
			return SetPreferredHardwareSampleRate (sampleRate, out outError);
		}
示例#32
0
 public bool CreateDirectory(string path, bool createIntermediates, NSFileAttributes attributes, out NSError error)
 {
     return CreateDirectory (path, createIntermediates, attributes.ToDictionary (), out error);
 }
		public bool SetPreferredIOBufferDuration (double duration, NSError outError)
		{
			// Effectively discarded due to original binding error
			return SetPreferredIOBufferDuration (duration, out outError);
		}
示例#34
0
 public bool SetAttributes(NSFileAttributes attributes, string path, out NSError error)
 {
     return SetAttributes (attributes.ToDictionary (), path, out error);
 }
示例#35
0
 public NSErrorEventArgs(NSError error)
 {
     Error = error;
 }
示例#36
0
		public override NSPrintOperation PrintOperation (NSDictionary printSettings, out NSError outError)
		{
			outError = null;
			return webView.MainFrame.FrameView.GetPrintOperation (new NSPrintInfo (printSettings));
		}
示例#37
0
 public bool TryGetResource(string key, out NSObject value, out NSError error)
 {
     return(GetResourceValue(out value, key, out error));
 }