예제 #1
0
        /// <summary>
        /// Post Progress message for display at next timer tick
        /// </summary>
        /// <param name="caption"></param>
        /// <param name="title"></param>
        /// <param name="allowCancel"></param>
        /// <param name="cancellingMessage"></param>

        public static void Show(
            string caption,
            string title,
            bool allowCancel,
            string cancellingMessage)
        {
            VerifyFormExistence();

            PendingCaption           = caption;
            PendingTitle             = title;
            PendingAllowCancel       = allowCancel;
            PendingCancellingMessage = cancellingMessage;
            PendingShow = true;
            PendingHide = false;
            //if (Instance != null) Instance.ProgressTimer.Enabled = true;

            PerShowCancelRequestedFlag = false;

            if (Debug)
            {
                ClientLog.Message("Progress - Posting Show: " + caption);
            }
            //if (Lex.Contains(caption, "Retrieving data")) caption = caption; // debug

            if (SS.I.LocalServiceMode)             // if local service mode try to show message now since timer ticks may not be processed if in CPU intensive task
            {
                //while (PendingShow)
                {
                    Thread.Sleep(10);
                    UIMisc.DoEvents();

                    string stackTrace = new System.Diagnostics.StackTrace(true).ToString();
                    if (Lex.Contains(stackTrace, "_tick"))                     // if in a timer tick process immediately
                    {
                        Instance.ProgressTimer_Tick(null, null);
                    }
                }
            }

            return;
        }