Exemple #1
0
 public _Pokemon(_Pokemon pokemon, _Form form)
 {
     id           = pokemon.id;
     name         = pokemon.name;
     date         = form.date;
     availability = form.availability;
     shiny        = form.shiny;
 }
Exemple #2
0
        private void ProcessForm_Load(object sender, EventArgs e)
        {
            t         = null;
            stop      = true;
            this.Text = title;
            switch (title)
            {
            case "复制图片,脚本":
                stop = false;
                CCFile.CheckFolder(path2);
                CCFile.CheckFolder(path2 + "pics");
                CCFile.CheckFolder(path2 + "pics\\field");
                CCFile.CheckFolder(path2 + "pics\\thumbnail");
                CCFile.CheckFolder(path2 + "script");
                NUM = CDB.ids.Count;
                t   = new Thread(Copy);
                break;

            case "裁剪图片":
                stop = false;
                CCFile.CheckFolder(path2);
                NUM = CDB.cards.Count;
                t   = new Thread(Cut);
                break;

            case "图片调整":
                stop = false;
                CCFile.CheckFolder(path2);
                CCFile.CheckFolder(path2 + "pics");
                CCFile.CheckFolder(path2 + "pics\\thumbnail");
                names = CCFile.FindFiles(path1, ex, false);
                NUM   = names.Length;
                t     = new Thread(ReSize);
                break;

            case "提取图片":
                stop               = false;
                label1.Text        = "提取中。。。";
                progressBar1.Style = ProgressBarStyle.Marquee;
                NUM = 1;
                t   = new Thread(Get_setjpg);
                break;
            }
            if (t != null && NUM > 0)
            {
                pb1 = new _ProcessBar1(ProcessADD);
                lb1 = new _Label1(Setlabel);
                fm  = new _Form(closeForm);
                progressBar1.Maximum = NUM;
                t.IsBackground       = true;
                t.Start();
            }
            else
            {
                stop = true;
                this.Close();
            }
        }
Exemple #3
0
 public void Dispose()
 {
     if (menu != null)
     {
         menu.Dispose();
         menu = null;
     }
     if (form != null)
     {
         form.Dispose();
         form = null;
     }
 }
Exemple #4
0
        /// <summary>
        /// Creates image from a user-selected area of screen pixels. Or gets single pixel color, or just rectangle.
        /// Returns false if cancelled.
        /// </summary>
        /// <param name="result">Receives results.</param>
        /// <param name="flags"></param>
        /// <param name="toolWindow">Owner window. Temporarily hides it and its owner windows.</param>
        /// <remarks>
        /// Gets all screen pixels and shows in a full-screen topmost window, where the user can select an area.
        /// </remarks>
        public static bool CaptureUI(out WICResult result, WICFlags flags = 0, AnyWnd toolWindow = default)
        {
            result = default;

            switch (flags & (WICFlags.Image | WICFlags.Color | WICFlags.Rectangle))
            {
            case 0:
            case WICFlags.Image:
            case WICFlags.Color:
            case WICFlags.Rectangle: break;

            default: throw new ArgumentException();
            }

            AWnd[] aw = null; AWnd wTool = default;
            try {
                if (!toolWindow.IsEmpty)
                {
                    wTool = toolWindow.Wnd;
                    aw    = wTool.Get.OwnersAndThis(true);
                    foreach (var w in aw)
                    {
                        w.ShowLL(false);
                    }
                    using (new AInputBlocker(BIEvents.MouseClicks)) ATime.SleepDoEvents(300);                    //time for animations
                }

g1:
                RECT rs = SystemInformation.VirtualScreen;
                //RECT rs = AScreen.Primary.Bounds; //for testing, to see Write output in other screen
                Bitmap bs;
                bool   windowPixels = flags.HasAny(WICFlags.WindowDC | WICFlags.PrintWindow);
                if (windowPixels)
                {
                    if (!_WaitForHotkey("Press F3 to select window from mouse pointer."))
                    {
                        return(false);
                    }
                    var w = AWnd.FromMouse(WXYFlags.NeedWindow);
                    w.GetClientRect(out var rc, inScreen: true);
                    using var bw = Capture(w, w.ClientRect, flags.Has(WICFlags.PrintWindow));
                    bs           = new Bitmap(rs.Width, rs.Height);
                    using var g  = Graphics.FromImage(bs);
                    g.Clear(Color.Black);
                    g.DrawImage(bw, rc.left, rc.top);
                }
                else
                {
                    bs = Capture(rs);
                }

                var f = new _Form(bs, flags);
                f.Bounds = rs;
                switch (f.ShowDialog())
                {
                case DialogResult.OK: break;

                case DialogResult.Retry:
                    if (!windowPixels && !_WaitForHotkey("Press F3 when ready for new screenshot."))
                    {
                        return(false);
                    }
                    goto g1;

                default: return(false);
                }

                var r = f.Result;
                r.wnd  = _WindowFromRect(r);
                result = r;
            }
            finally {
                if (aw != null)
                {
                    foreach (var w in aw)
                    {
                        w.ShowLL(true);
                    }
                    if (wTool.IsAlive)
                    {
                        wTool.ShowNotMinimized();
                        wTool.ActivateLL();
                    }
                }
            }
            return(true);
        }