Пример #1
0
        private void ShowTooltip(Control control, string message)
        {
            if (tooltip == null)
                tooltip = new formAccountTooltip();

            tooltip.AttachTo(control, null, -8);
            tooltip.Show(this, message, 1000);
            tooltip.Tag = control;
        }
Пример #2
0
        private async void ShowCloseTooltip(Process p)
        {
            //gw2 will automatically close once the update is complete, so this isn't really needed
            return;

            while (!p.HasExited)
            {
                try
                {
                    double ms = DateTime.Now.Subtract(p.StartTime).TotalMilliseconds;
                    if (ms > 3000)
                        break;
                    else
                    {
                        await Task.Delay(3001 - (int)ms);
                    }
                }
                catch 
                {
                    return;
                }
            }

            using (formAccountTooltip t = new formAccountTooltip())
            {
                t.Show(null, "Close Guild Wars 2 once the update is complete", 0);

                bool setOwner = false;

                while (p != null && t != null && !t.IsDisposed)
                {
                    if (t.Visible && t.WindowState == FormWindowState.Normal)
                    {
                        try
                        {
                            Rectangle r = Windows.WindowSize.GetWindowRect(p);

                            if (!setOwner)
                            {
                                try
                                {
                                    int h = p.MainWindowHandle.ToInt32();
                                    if (h != 0)
                                    {
                                        SetWindowLong(t.Handle, -8, h);
                                        setOwner = true;
                                    }
                                }
                                catch { }
                            }

                            if (r.X != lastPosition.X || r.Y != lastPosition.Y)
                            {
                                lastPosition = new Point(r.X, r.Y);
                                t.AttachTo(new Rectangle(r.Right - 211, r.Y + 176, 17, 17), 5, AnchorStyles.Right);
                                t.BringToFront();
                            }
                        }
                        catch
                        {
                            return;
                        }
                    }
                    await Task.Delay(100);
                }
            }
        }