Esempio n. 1
0
        public virtual void ShowStatus(string status, bool waitCursor, bool useStack = true)
        {
            //Console.WriteLine ("ShowStatus {0}", status);

            if (DefaultPanel == null)
            {
                return;
            }
            try
            {
                if (useStack)
                {
                    if (!String.IsNullOrEmpty(status))
                    {
                        m_StatusCount++;
                    }
                    else
                    {
                        m_StatusCount--;
                    }

                    lock (LockShowStatus)
                    {
                        if (String.IsNullOrEmpty(status))
                        {
                            if (StatusStack.Count > 0)
                            {
                                StatusStack.Pop();
                            }

                            if (StatusStack.Count > 0)
                            {
                                waitCursor = StatusStack.Peek().WaitCursor;
                                status     = StatusStack.Pop().Status;
                            }
                            else
                            {
                                waitCursor = false;
                            }
                        }
                        else
                        {
                            StatusStack.Push(new StatusMessageItem(status, waitCursor));
                        }
                    }
                }

                if (String.IsNullOrEmpty(status))
                {
                    status = ReadyStatusString;
                }

                DefaultPanel.Text = status;

                if (waitCursor)
                {
                    ParentWindow.Do(p => p.ShowWaitCursor());
                    DefaultPanel.Icon = (char)FontAwesomeIcons.fa_hourglass_2;
                }
                else
                {
                    ParentWindow.Do(p => p.RestoreCursor());
                    DefaultPanel.Icon = (char)FontAwesomeIcons.None;
                }

                Update(true);
            }
            catch (Exception ex)
            {
                ex.LogError();
            }
        }