Пример #1
0
        public static void WrapAction(Action work, string msg)
        {
            ConsoleSpinner cs = new ConsoleSpinner();

            try
            {
                cs.Start(msg);
                work();
                cs.Stop();
            }
            catch
            {
                if (cs.started)
                {
                    cs.Stop();
                }
                try { cs = null; }
                catch { }
                throw;
            }
        }
Пример #2
0
        public static T Wrap <T>(Func <T> work, string msg)
        {
            //return work();
            T ret;
            ConsoleSpinner cs = new ConsoleSpinner();

            try
            {
                cs.Start(msg);
                ret = work();
                cs.Stop();
            }
            catch
            {
                if (cs.started)
                {
                    cs.Stop();
                }
                try { cs = null; }
                catch { }
                throw;
            }
            return(ret);
        }