Наследование: IDisposable
Пример #1
0
        /// <summary>
        ///   Runs the main loop for the created dialog
        /// </summary>
        /// <remarks>
        ///   Use the wait parameter to control whether this is a
        ///   blocking or non-blocking call.
        /// </remarks>
        public static void RunLoop(RunState state, bool wait)
        {
            if (state == null)
                throw new ArgumentNullException ("state");
            if (state.Container == null)
                throw new ObjectDisposedException ("state");

            for (state.Container.Running = true; state.Container.Running; ){
                if (mainloop.EventsPending (wait)){
                    mainloop.MainIteration ();
                    if (Iteration != null)
                        Iteration (null, EventArgs.Empty);
                } else if (wait == false)
                    return;
            }
        }
Пример #2
0
 /// <summary>
 ///   Runs the main loop for the created dialog
 /// </summary>
 /// <remarks>
 ///   Calling this method will block until the
 ///   dialog has completed execution.
 /// </remarks>
 public static void RunLoop(RunState state)
 {
     RunLoop (state, true);
 }
Пример #3
0
        /// <summary>
        ///   Starts running a new container or dialog box.
        /// </summary>
        /// <remarks>
        ///   Use this method if you want to start the dialog, but
        ///   you want to control the main loop execution manually
        ///   by calling the RunLoop method (for example, to start
        ///   the dialog, but continuing to process events).
        ///
        ///    Use the returned value as the argument to RunLoop
        ///    and later to the End method to remove the container
        ///    from the screen.
        /// </remarks>
        public static RunState Begin(Container container)
        {
            if (container == null)
                throw new ArgumentNullException ("container");
            var rs = new RunState (container);

            Init (false);

            Curses.timeout (-1);

            toplevels.Add (container);

            container.Prepare ();
            container.SizeChanged ();
            container.FocusFirst ();
            Redraw (container);
            container.PositionCursor ();
            Curses.refresh ();

            return rs;
        }
Пример #4
0
 /// <summary>
 ///   Use this method to complete an execution started with Begin
 /// </summary>
 public static void End(RunState state)
 {
     if (state == null)
         throw new ArgumentNullException ("state");
     state.Dispose ();
 }
Пример #5
0
 /// <summary>
 ///   Use this method to complete an execution started with Begin
 /// </summary>
 public static void End(RunState state)
 {
     if (state == null)
         throw new ArgumentNullException ("state");
     toplevels.Remove (state.Container);
     if (toplevels.Count == 0)
         Shutdown ();
     else
         Refresh ();
     state.Container = null;
 }