Esempio n. 1
0
        // ###############################################################################
        // ### M E T H O D S
        // ###############################################################################

        #region Methods

        /// <summary> Run the shell. </summary>
        /// <param name="appContext"> The application context that identifies the application. <see cref="System.IntPtr"/> </param>
        /// <returns> Zero on success, or negative nonzero otherwise. <see cref="System.Int32"/> </returns>
        public int Run(IntPtr appContext)
        {
            if (appContext == IntPtr.Zero)
            {
                Console.WriteLine(CLASS_NAME + "::Run () ERROR: Application context pointer is zero.");
                return(-1);
            }

            try
            {
                bool firstRun = false;

                if (!(Xtlib.XtIsRealized(_shell) != 0))
                {
                    firstRun = true;
                }

                Xtlib.XtPopup(_shell, XtGrabKind.XtGrabExclusive);

                if (firstRun && XtApplicationShell.Instance != null)
                {
                    SetShellIcon(XtApplicationShell.Instance.IconPath);
                }

                // Register a "delete window action" to application context, translate the "delete window action", add/overwrite
                // the shell widget's translation table and set windows manager protocol hook for the shell widget.
                // This must be done *** AFTER *** XtRealizeWidget ().
                RegisterDeleteWindowAction(_toplevelShell.AppContext, this.DeleteWindowAction);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
                Console.WriteLine(e.StackTrace);
            }
            return(0);
        }