Exemplo n.º 1
0
		public DialogBase()
		{
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
			this.ShowInTaskbar = false;
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;

			if (Env.ClientConfig != null)
			{
				this.Icon = this.GetThemeIcon();

				if (Environment.OSVersion.Version.Major < 5)
				{
					FadeEffectComponent fec = new FadeEffectComponent()
					{
						ParentForm = this
					};
				}
			}
		}
Exemplo n.º 2
0
        public WaitingDialog()
        {
            InitializeComponent();

            bgw = new BackgroundWorker();
            bgw.RunWorkerCompleted += (s, e) =>
            {
                WorkingResult = e;
                if (WorkComplete != null)
                {
                    WorkComplete(this, e);
                }
                if (AutoClose)
                {
                    Close();
                }
            };
            bgw.DoWork += (s, e) =>
            {
                Progress.WorkingData = e;
                if (ThreadWorker != null)
                {
                    ThreadWorker(Progress);
                }
                if (CloseDelay > 0)
                {
                    System.Threading.Thread.Sleep(CloseDelay);
                }
            };

            Progress = new ProgressIdentifier()
            {
                WorkerManager = bgw
            };

            Progress.CurrentValueChanged += (s, e) => { pgUpdate.Value = Progress.CurrentValue; };
            Progress.MaxValueChanged     += (s, e) =>
            {
                pgUpdate.Style   = Progress.MaxValue == 0 ? ProgressBarStyle.Marquee : ProgressBarStyle.Continuous;
                pgUpdate.Maximum = Progress.MaxValue;
            };
            Progress.StateMessageChanged += (s, e) =>
            {
                if (!string.IsNullOrEmpty(Progress.StateMessage))
                {
                    lblMessage.Text = Progress.StateMessage;
                    if (ShowLog)
                    {
                        var lvi = new ListViewItem(DateTime.Now.ToShortTimeString());
                        lvi.SubItems.Add(Progress.StateMessage);
                        logList.Items.Add(lvi);
                        lvi.EnsureVisible();
                    }
                }
            };
            Progress.StateObjChanged += (s, e) =>
            {
                if (!ShowLog || Progress.StateObject == null)
                {
                    return;
                }

                if (Progress.StateObject is ProgressIdentifier.ProgressIdentifierEventEntry)
                {
                    ProgressIdentifier.ProgressIdentifierEventEntry piee = Progress.StateObject as ProgressIdentifier.ProgressIdentifierEventEntry;
                    if (!piee.IsValid)
                    {
                        return;
                    }

                    var lvi = new ListViewItem(DateTime.Now.ToShortTimeString());
                    lvi.SubItems.Add(Progress.StateMessage);
                    logList.Items.Add(lvi);
                    lvi.EnsureVisible();
                }
            };



            AutoClose  = true;
            CloseDelay = 1000;

            var fader = new FadeEffectComponent()
            {
                ParentForm = this
            };

            fader.FadeFinished += (s, e) =>
            {
                if (e.Direct != FadeEffectComponent.FadeDirection.FadeIn)
                {
                    return;
                }
                RunWorker();
            };

            this.StartPosition = FormStartPosition.CenterScreen;
        }
Exemplo n.º 3
0
		public WaitingDialog()
		{
			InitializeComponent();

			bgw = new BackgroundWorker();
			bgw.RunWorkerCompleted += (s, e) =>
			{
				WorkingResult = e;
				if (WorkComplete != null) WorkComplete(this, e);
				if (AutoClose) Close();
			};
			bgw.DoWork += (s, e) =>
			{
				Progress.WorkingData = e;
				if (ThreadWorker != null) ThreadWorker(Progress);
				if (CloseDelay > 0) System.Threading.Thread.Sleep(CloseDelay);
			};

			Progress = new ProgressIdentifier()
			{
				WorkerManager = bgw
			};

			Progress.CurrentValueChanged += (s, e) => { pgUpdate.Value = Progress.CurrentValue; };
			Progress.MaxValueChanged += (s, e) =>
			{
				pgUpdate.Style = Progress.MaxValue == 0 ? ProgressBarStyle.Marquee : ProgressBarStyle.Continuous;
				pgUpdate.Maximum = Progress.MaxValue;
			};
			Progress.StateMessageChanged += (s, e) =>
			{
				if (!string.IsNullOrEmpty(Progress.StateMessage))
				{
					lblMessage.Text = Progress.StateMessage;
					if (ShowLog)
					{
						var lvi = new ListViewItem(DateTime.Now.ToShortTimeString());
						lvi.SubItems.Add(Progress.StateMessage);
						logList.Items.Add(lvi);
						lvi.EnsureVisible();
					}
				}
			};
			Progress.StateObjChanged += (s, e) =>
			{
				if (!ShowLog || Progress.StateObject == null) return;

				if (Progress.StateObject is ProgressIdentifier.ProgressIdentifierEventEntry)
				{
					ProgressIdentifier.ProgressIdentifierEventEntry piee = Progress.StateObject as ProgressIdentifier.ProgressIdentifierEventEntry;
					if (!piee.IsValid) return;

					var lvi = new ListViewItem(DateTime.Now.ToShortTimeString());
					lvi.SubItems.Add(Progress.StateMessage);
					logList.Items.Add(lvi);
					lvi.EnsureVisible();
				}
			};



			AutoClose = true;
			CloseDelay = 1000;

			var fader = new FadeEffectComponent()
			{
				ParentForm = this
			};
			fader.FadeFinished += (s, e) =>
			{
				if (e.Direct != FadeEffectComponent.FadeDirection.FadeIn) return;
				RunWorker();
			};

			this.StartPosition = FormStartPosition.CenterScreen;
		}