Example #1
0
            public void HandleAppleEvent(NSAppleEventDescriptor evt, NSAppleEventDescriptor replyEvt)
            {
                var url = evt.ParamDescriptorForKeyword(DirectObject).StringValue;
                var uri = new Uri(url);

                OpenUrl(WebUtils.GetNativeUrl(uri));
            }
Example #2
0
        void GetUrlWithReplyEvent(NSAppleEventDescriptor @event, NSAppleEventDescriptor replyEvent)
        {
            // from /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/Headers/AppleEvents.h
            const uint keyDirectObject = 757935405;  // '----'
            const uint keyErrorNumber  = 1701999214; // 'errn'
            const uint keyErrorString  = 1701999219; // 'errs'

            string errorMessage = null;

            var urlString = @event?.ParamDescriptorForKeyword(keyDirectObject).StringValue;

            if (urlString != null)
            {
                SessionDocumentController
                .SharedDocumentController
                .OpenDocument(new NSUrl(urlString));

                applicationShouldOpenUntitledFile = false;
            }

            replyEvent.SetParamDescriptorforKeyword(
                NSAppleEventDescriptor.DescriptorWithInt32(errorMessage == null ? 0 : 1),
                keyErrorNumber);

            if (errorMessage != null)
            {
                replyEvent.SetParamDescriptorforKeyword(
                    NSAppleEventDescriptor.DescriptorWithString(errorMessage),
                    keyErrorString);
            }
        }
Example #3
0
 public void GetUrl(NSAppleEventDescriptor evt, NSAppleEventDescriptor withReplyEvent)
 {
     passedUrl = evt.ParamDescriptorForKeyword(FourCC("----")).StringValue;
     if (isLoaded)
     {
         invoke.Invoke(LoadPassedUrl);
     }
 }
Example #4
0
        public void MonoApplication_HandleURLEvent(NSAppleEventDescriptor value, NSAppleEventDescriptor reply)
        {
            var url = value.ParamDescriptorForKeyword(AEKeyword.DirectObject)?.StringValue;

            if (url != null)
            {
                TryOpen(new string[] { url }, Msg.WM_OPEN_URLS);
            }
        }
Example #5
0
        private void HandleGetURLEvent(NSAppleEventDescriptor descriptor, NSAppleEventDescriptor replyEvent)
        {
            // Breakpoint here, debug normally and *then* call your URL
            try
            {
                var keyDirectObject = "----";
                var keyword         = (((uint)keyDirectObject[0]) << 24 |
                               ((uint)keyDirectObject[1]) << 16 |
                               ((uint)keyDirectObject[2]) << 8 |
                               ((uint)keyDirectObject[3]));

                var openinArgs = descriptor.ParamDescriptorForKeyword(keyword).StringValue;
                ParseOpeningString(openinArgs);
            }
            catch
            {
            }
        }
Example #6
0
        private void HandleGetURLEvent(NSAppleEventDescriptor descriptor, NSAppleEventDescriptor replyEvent)
        {
            // stackoverflow.com/questions/1945
            // https://forums.xamarin.com/discussion/9774/custom-url-schema-handling
            var keyDirectObject = "----";
            var keyword         =
                (((uint)keyDirectObject[0]) << 24 |
                    ((uint)keyDirectObject[1]) << 16 |
                    ((uint)keyDirectObject[2]) << 8 |
                    ((uint)keyDirectObject[3]));

            var urlString = descriptor.ParamDescriptorForKeyword(keyword).StringValue;

            using (var alert = new NSAlert()){
                alert.MessageText = urlString;
                alert.RunSheetModal(null);
            }
        }
Example #7
0
        void HandleGetUrlEvent(NSAppleEventDescriptor descriptor, NSAppleEventDescriptor reply)
        {
            var openUrlEvent = OpenUrl;

            if (openUrlEvent == null)
            {
                return;
            }

            string keyDirectObjectString = "----";
            uint   keywordDirectObject   = (((uint)keyDirectObjectString [0]) << 24 |
                                        ((uint)keyDirectObjectString [1]) << 16 |
                                        ((uint)keyDirectObjectString [2]) << 8 |
                                        ((uint)keyDirectObjectString [3]));

            string urlString = descriptor.ParamDescriptorForKeyword(keywordDirectObject).ToString();

            openUrlEvent(NSApplication.SharedApplication, new OpenUrlEventArgs(urlString));
        }
Example #8
0
		void HandleGetUrlEvent(NSAppleEventDescriptor descriptor, NSAppleEventDescriptor reply)
		{
			var openUrlEvent = OpenUrl;
			if (openUrlEvent == null)
				return;
			
			string keyDirectObjectString = "----";
			uint keywordDirectObject = (((uint)keyDirectObjectString [0]) << 24 |
				((uint)keyDirectObjectString [1]) << 16 |
				((uint)keyDirectObjectString [2]) << 8 |
				((uint)keyDirectObjectString [3]));
			
			string urlString = descriptor.ParamDescriptorForKeyword (keywordDirectObject).ToString ();
			openUrlEvent (NSApplication.SharedApplication, new OpenUrlEventArgs (urlString));
		}
Example #9
0
		public void UrlHandleEvent (NSAppleEventDescriptor evt, NSAppleEventDescriptor replyEvt)
		{
			var url = evt.ParamDescriptorForKeyword (AppleEventParameters.DirectObject).StringValue;
			SimpleAuth.NativeSafariAuthenticator.ResumeAuth (url);
		}
Example #10
0
        internal virtual void HandleGetURLEvent(NSAppleEventDescriptor ae, NSAppleEventDescriptor aeReply)
        {
            string url = ae.ParamDescriptorForKeyword(AEKeyword.DirectObject).StringValue;

            TryOpenFiles(new string[] { url }, Msg.WM_OPEN_URLS);
        }
Example #11
0
        public void UrlHandleEvent(NSAppleEventDescriptor evt, NSAppleEventDescriptor replyEvt)
        {
            var url = evt.ParamDescriptorForKeyword(AppleEventParameters.DirectObject).StringValue;

            SimpleAuth.NativeSafariAuthenticator.ResumeAuth(url);
        }