public static void ShowLoading(IWin32Window owner, string text, Image loadingImage) { CloseLoading(); LoadingBoxArgs args = new LoadingBoxArgs(owner, text, loadingImage); form = new MessageIconForm(); form.ShowLoading(args); }
public static void Notify(IWin32Window owner, string text, NotifyBoxIcon icon, int interval) { CloseForm(); var img = GetImage(icon); LoadingBoxArgs args = new LoadingBoxArgs(owner, text, img); form = new MessageIconForm(); form.Special = false; form.SkinOpacity = 1; form.ShowLoading(args); StartTimer(interval); }
public void ShowLoading(LoadingBoxArgs loadingBoxArgs) { if (loadingBoxArgs == null) { throw new ArgumentNullException("loadingBoxArgs"); } this.loadingBoxArgs = loadingBoxArgs; var ownerForm = loadingBoxArgs.Owner; if (this.loadingBoxArgs.LoadingImage != null) { this.pic_loading.Size = new Size(loadingBoxArgs.LoadingImage.Width, loadingBoxArgs.LoadingImage.Height); this.pic_loading.Image = loadingBoxArgs.LoadingImage; this.pic_loading.Visible = true; if (this.pic_loading.Width > MAX_SIZE.Width) { this.pic_loading.Width = MAX_SIZE.Width; } if (this.pic_loading.Height > MAX_SIZE.Height) { this.pic_loading.Height = MAX_SIZE.Height; } } else { this.pic_loading.Visible = false; } this.CalcFinalSizes(); this.CalcBounds(); if (ownerForm == null) { Form activeForm = Form.ActiveForm; if (activeForm != null && !activeForm.InvokeRequired) { ownerForm = activeForm; } } if (ownerForm == null) { this.StartPosition = FormStartPosition.CenterScreen; } else { this.StartPosition = FormStartPosition.Manual; var ctrl = ownerForm as Control; var left = (ctrl.Width - this.Width) / 2 + ctrl.Location.X; var top = (ctrl.Height - this.Height) / 2 + ctrl.Location.Y; this.Location = new Point(left, top); } this.TopMost = true; this.Show(ownerForm); }
public void ShowLoading(LoadingBoxArgs loadingBoxArgs) { if (loadingBoxArgs == null) throw new ArgumentNullException("loadingBoxArgs"); this.loadingBoxArgs = loadingBoxArgs; var ownerForm = loadingBoxArgs.Owner; if (this.loadingBoxArgs.LoadingImage != null) { this.pic_loading.Size = new Size(loadingBoxArgs.LoadingImage.Width, loadingBoxArgs.LoadingImage.Height); this.pic_loading.Image = loadingBoxArgs.LoadingImage; this.pic_loading.Visible = true; if (this.pic_loading.Width > MAX_SIZE.Width) { this.pic_loading.Width = MAX_SIZE.Width; } if (this.pic_loading.Height > MAX_SIZE.Height) { this.pic_loading.Height = MAX_SIZE.Height; } } else { this.pic_loading.Visible = false; } this.CalcFinalSizes(); this.CalcBounds(); if (ownerForm == null) { Form activeForm = Form.ActiveForm; if (activeForm != null && !activeForm.InvokeRequired) { ownerForm = activeForm; } } if (ownerForm == null) { this.StartPosition = FormStartPosition.CenterScreen; } else { this.StartPosition = FormStartPosition.Manual; var ctrl = ownerForm as Control; var left = (ctrl.Width - this.Width) / 2 + ctrl.Location.X; var top = (ctrl.Height - this.Height) / 2 + ctrl.Location.Y; this.Location = new Point(left, top); } this.TopMost = true; this.Show(ownerForm); }