コード例 #1
0
ファイル: ConsoleForm.cs プロジェクト: KillerGoldFisch/GCore
        /// <summary>
        /// Releases all resources used by this <see cref="ConsoleForm">ConsoleForm</see>
        /// object.
        /// </summary>
        void IDisposable.Dispose()
        {
            ((IDisposable)_labels).Dispose();
            ((IDisposable)_textboxes).Dispose();
            ((IDisposable)_lines).Dispose();

            // Unwire any listening events.
            _keyPressEvent     = null;
            _formCompleteEvent = null;
            FormCancelled      = null;

            // Terminate the keypress loop.
            _keyThread.Abort();
            _keyThread = null;

            GC.SuppressFinalize(this);
        }
コード例 #2
0
ファイル: ConsoleForm.cs プロジェクト: KillerGoldFisch/GCore
        /// <summary>
        /// Method to be called when a new console form is needed to be
        /// deserialized from disk, and the functions to be called on
        /// completion and on cancellation are known.
        /// </summary>
        /// <param name="path">A string with the fully qualified path to the
        /// form definition file on disk.</param>
        /// <param name="formComplete">Delegate to a function to be
        /// called when the form is completed.</param>
        /// <param name="formCancelled">Delegate to a function to be called
        /// when the form is cancelled.  Can be null.</param>
        /// <returns>A new instance of a console form with properties set and
        /// appropriate events wired up.  Can be null.</returns>
        public static ConsoleForm GetFormInstance
            (string path,
            onFormComplete formComplete,
            onFormCancelled formCancelled)
        {
            // Call the other static factory method to get a new console form.
            ConsoleForm form = ConsoleForm.GetFormInstance(path);

            if (formComplete != null)
            {
                form.FormComplete += formComplete;
            }

            if (formCancelled != null)
            {
                form.FormCancelled += formCancelled;
            }

            return(form);
        }
コード例 #3
0
        /// <summary>
        /// Releases all resources used by this <see cref="ConsoleForm">ConsoleForm</see>
        /// object.
        /// </summary>
        void IDisposable.Dispose() {
            ((IDisposable)_labels).Dispose();
            ((IDisposable)_textboxes).Dispose();
            ((IDisposable)_lines).Dispose();

            // Unwire any listening events.
            _keyPressEvent = null;
            _formCompleteEvent = null;
            FormCancelled = null;

            // Terminate the keypress loop.
            _keyThread.Abort();
            _keyThread = null;

            GC.SuppressFinalize(this);
        }
コード例 #4
0
        /// <summary>
        /// Method to be called when a new console form is needed to be 
        /// deserialized from disk, and the functions to be called on
        /// completion and on cancellation are known.
        /// </summary>
        /// <param name="path">A string with the fully qualified path to the 
        /// form definition file on disk.</param>
        /// <param name="formComplete">Delegate to a function to be
        /// called when the form is completed.</param>
        /// <param name="formCancelled">Delegate to a function to be called
        /// when the form is cancelled.  Can be null.</param>
        /// <returns>A new instance of a console form with properties set and
        /// appropriate events wired up.  Can be null.</returns>
        public static  ConsoleForm GetFormInstance
                                    (string            path, 
                                    onFormComplete    formComplete, 
                                    onFormCancelled   formCancelled) {
            // Call the other static factory method to get a new console form.
            ConsoleForm       form     = ConsoleForm.GetFormInstance(path);

            if (formComplete != null)
                form.FormComplete += formComplete;

            if (formCancelled != null)
                form.FormCancelled += formCancelled;

            return form;
        }