public void InvokeDiscoverCallback(DataNode node)
 {
     if (_sender != null && DiscoverCallback != null)
     {
         _sender.BeginInvokeOnMainThread(delegate { DiscoverCallback(node); });
     }
     //_sender.BeginInvokeOnMainThread(DiscoverCallback, new object[] { node });
 }
Exemple #2
0
        /// <summary>
        /// Shows the dialog asyncronously
        /// </summary>
        /// <returns>The dialog async.</returns>
        /// <param name="owner">Owner.</param>
        public Task <AuthorizationCodeResponseUrl> ShowDialogAsync(NSWindow owner)
        {
            mTask = new TaskCompletionSource <AuthorizationCodeResponseUrl> ();

            owner.BeginInvokeOnMainThread(() => {
                this.ParentWindow = owner;
                this.MakeKeyAndOrderFront(owner);
                this.Center();
            });

            return(mTask.Task);
        }
        /// <summary>
        /// Shows a modal dialog, optionally as a sheet.
        /// </summary>
        /// <param name="window">The dialog to show.</param>
        /// <param name="asSheet">If <c>true</c>, attempt to show the dialog as a sheet.</param>
        /// <returns>A value indicating whether the dialog was cancelled (<c>false</c>), aborted (<c>null</c>) or approved (<c>true</c>).</returns>
        /// <remarks>This function also handles the close button of the dialog, treating it as a 'cancel' operation.</remarks>
        public static bool?ShowDialog(this NSWindow window, bool asSheet)
        {
            window.WillClose += HandleWillClose;
            window.BeginInvokeOnMainThread(INTV.Shared.ComponentModel.CommandManager.InvalidateRequerySuggested);
            if (asSheet)
            {
                var sheetOwner = INTV.Shared.Utility.SingleInstanceApplication.Current.MainWindow;
                INTV.Shared.Utility.SingleInstanceApplication.Current.BeginSheet(window, sheetOwner);
            }
            var result   = INTV.Shared.Utility.SingleInstanceApplication.Current.RunModalForWindow(window);
            var accepted = result == (int)NSRunResponse.Stopped;

            return(accepted);
        }
		/// <summary>
		/// Shows the dialog asyncronously
		/// </summary>
		/// <returns>The dialog async.</returns>
		/// <param name="owner">Owner.</param>
		public Task<AuthorizationCodeResponseUrl> ShowDialogAsync (NSWindow owner)
		{
			mTask = new TaskCompletionSource<AuthorizationCodeResponseUrl> ();

			owner.BeginInvokeOnMainThread (() => {

				this.ParentWindow = owner;
				this.MakeKeyAndOrderFront(owner);
				this.Center ();

			});

			return mTask.Task;
		}