Inheritance: System.Windows.Forms.Form, IStatusLogger
Exemplo n.º 1
0
		public static void DestroyEx(StatusProgressForm dlg)
		{
			if(dlg == null) { Debug.Assert(false); return; }

			dlg.EndLogging();
			dlg.Close();
			UIUtil.DestroyForm(dlg);
		}
Exemplo n.º 2
0
			public void EndLogging()
			{
				if(m_dlg == null) { Debug.Assert(false); return; }

				m_dlg.EndLogging();
				m_dlg.Close();
				UIUtil.DestroyForm(m_dlg);
				m_dlg = null;
			}
Exemplo n.º 3
0
			public StatusProgressFormWrapper(Form fParent, string strTitle,
				bool bCanCancel, bool bMarqueeProgress)
			{
				m_dlg = new StatusProgressForm();
				m_dlg.InitEx(strTitle, bCanCancel, bMarqueeProgress, fParent);

				if(fParent != null) m_dlg.Show(fParent);
				else m_dlg.Show();
			}
Exemplo n.º 4
0
        public void EndLogging()
        {
            lock(m_objSync) { m_bTerminate = true; }
            m_th = null;

            if(m_dlgModal != null)
            {
                DestroyStatusDialog(m_dlgModal);
                m_dlgModal = null;
            }
        }
Exemplo n.º 5
0
        public static void DestroyEx(StatusProgressForm dlg)
        {
            if (dlg == null)
            {
                Debug.Assert(false); return;
            }

            dlg.EndLogging();
            dlg.Close();
            UIUtil.DestroyForm(dlg);
        }
        public static StatusProgressForm ConstructEx(string strTitle,
            bool bCanCancel, bool bMarqueeProgress, Form fOwner,
            string strInitialOp)
        {
            StatusProgressForm dlg = new StatusProgressForm();
            dlg.InitEx(strTitle, bCanCancel, bMarqueeProgress, fOwner);

            if(fOwner != null) dlg.Show(fOwner);
            else dlg.Show();

            dlg.StartLogging(strInitialOp, false);

            return dlg;
        }
Exemplo n.º 7
0
        public static StatusProgressForm ConstructEx(string strTitle,
                                                     bool bCanCancel, bool bMarqueeProgress, Form fOwner,
                                                     string strInitialOp)
        {
            StatusProgressForm dlg = new StatusProgressForm();

            dlg.InitEx(strTitle, bCanCancel, bMarqueeProgress, fOwner);

            if (fOwner != null)
            {
                dlg.Show(fOwner);
            }
            else
            {
                dlg.Show();
            }

            dlg.StartLogging(strInitialOp, false);

            return(dlg);
        }
Exemplo n.º 8
0
        public bool SetText(string strNewText, LogStatusType lsType)
        {
            if(strNewText == null) return true;
            if(lsType != LogStatusType.Info) return true;

            if(m_bUseThread && (m_th == null))
            {
                ThreadStart ts = new ThreadStart(this.GuiThread);
                m_th = new Thread(ts);
                m_th.Start();
            }
            if(!m_bUseThread && (m_dlgModal == null))
                m_dlgModal = ConstructStatusDialog();

            lock(m_objSync) { m_strProgress = strNewText; }
            return ((m_dlgModal != null) ? m_dlgModal.SetText(strNewText, lsType) : true);
        }
Exemplo n.º 9
0
        private void DestroyStatusDialog(StatusProgressForm dlg)
        {
            if(dlg != null)
            {
                MainForm mfOwner = ((m_fOwner != null) ? (m_fOwner as MainForm) : null);
                if((m_bUseThread == false) && (mfOwner != null))
                {
                    // mfOwner.RedirectActivationPop();
                    mfOwner.UIBlockInteraction(false);
                }

                StatusProgressForm.DestroyEx(dlg);

                // Conflict with 3116455
                // if(mfOwner != null) mfOwner.Activate(); // Prevent disappearing
            }
        }
        /// <summary>
        /// Downloads some favicons.
        /// </summary>
        /// <param name="entries">The entries.</param>
        private void downloadSomeFavicons(KeePassLib.Collections.PwObjectList<PwEntry> entries)
        {
            StatusProgressForm progressForm = new StatusProgressForm();

            progressForm.InitEx("Downloading Favicons", true, false, m_host.MainWindow);
            progressForm.Show();
            progressForm.SetProgress(0);

            float progress = 0;
            float outputLength = (float)entries.UCount;
            int downloadsCompleted = 0;
            string errorMessage = "";
            int errorCount = 0;

            foreach (PwEntry pwe in entries)
            {
                string message = "";
                downloadOneFavicon(pwe, ref message);
                if (message != "")
                {
                    errorMessage = message;
                    errorCount++;
                }

                downloadsCompleted++;
                progress = (downloadsCompleted / outputLength) * 100;
                progressForm.SetProgress((uint)Math.Floor(progress));
                System.Threading.Thread.Sleep(100);
                if (progressForm.UserCancelled)
                    break;
            }

            progressForm.Hide();
            progressForm.Close();

            if (errorMessage != "")
            {
                if (errorCount == 1)
                    MessageBox.Show(errorMessage, "Download error");
                else
                    MessageBox.Show(errorCount + " errors occurred. The last error message is shown here. To see the other messages, select a smaller group of entries and use the right click menu to start the download. " + errorMessage, "Download errors");
            }

            m_host.MainWindow.UpdateUI(false, null, false, null,
                true, null, true);
            m_host.MainWindow.UpdateTrayIcon();
        }
Exemplo n.º 11
0
		private void DestroyStatusDialog(StatusProgressForm dlg)
		{
			if(dlg != null)
			{
				MainForm mfOwner = ((m_fOwner != null) ? (m_fOwner as MainForm) : null);
				if((m_bUseThread == false) && (mfOwner != null))
				{
					mfOwner.RedirectActivationPop();
					mfOwner.UIBlockInteraction(false);
				}

				dlg.EndLogging();
				dlg.Close();
				dlg.Dispose();

				if(mfOwner != null) mfOwner.Activate(); // Prevent disappearing
			}
		}
Exemplo n.º 12
0
		private StatusProgressForm ConstructStatusDialog()
		{
			StatusProgressForm dlg = new StatusProgressForm();
			dlg.InitEx(m_strTitle, false, true, m_bUseThread ? null : m_fOwner);
			dlg.Show();
			dlg.StartLogging(null, false);
			dlg.SetProgress(m_uProgress);

			MainForm mfOwner = ((m_fOwner != null) ? (m_fOwner as MainForm) : null);
			if((m_bUseThread == false) && (mfOwner != null))
			{
				mfOwner.RedirectActivationPush(dlg);
				mfOwner.UIBlockInteraction(true);
			}

			return dlg;
		}
Exemplo n.º 13
0
        private static void EndStatusDialog(StatusProgressForm dlg)
        {
            if(dlg == null) { Debug.Assert(false); return; }

            dlg.EndLogging();
            dlg.Close();
            UIUtil.DestroyForm(dlg);
        }
Exemplo n.º 14
0
        private static StatusProgressForm BeginStatusDialog(string strText)
        {
            StatusProgressForm dlg = new StatusProgressForm();
            dlg.InitEx(PwDefs.ShortProductName, false, true, null);
            dlg.Show();
            dlg.StartLogging(strText ?? string.Empty, false);

            return dlg;
        }