Esempio n. 1
0
        static void Main(string[] args)
        {
            AlcoolEmGel alcool = new AlcoolEmGel();

            alcool.CadastrarAlcool();

            alcool.ListarAlcool();

            CelularModel celular = new CelularModel();

            celular.CadastrarCelular();

            celular.ListarCelular();

            ContaBancariaModel conta = new ContaBancariaModel();

            conta.CadastrarConta();

            conta.ListarConta();

            MesaModel mesa = new MesaModel();

            mesa.CadastrarMesa();

            mesa.ListarMesa();

            MouseModel mouse = new MouseModel();

            mouse.CadastrarMouse();

            mouse.ListarMouse();
        }
Esempio n. 2
0
        static void Main(string[] args)
        {
            MouseModel mouse1 = new MouseModel();

            mouse1.CadastrarProduto();

            mouse1.ListarProdutos();
        }
Esempio n. 3
0
        public void RenderBitmaps()
        {
            var visual = new DrawingVisual();

            using (var c = visual.RenderOpen())
            {
                c.PushClip(new RectangleGeometry(_rect));
                c.DrawRectangle(new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), null, _rect);

                if (MouseModel != null)
                {
                    MouseModel.CloseDrawingContext();
                    c.DrawRectangle(new VisualBrush(MouseModel), new Pen(), MouseModel.RelativeRect);
                }
                if (HeadsetModel != null)
                {
                    HeadsetModel.CloseDrawingContext();
                    c.DrawRectangle(new VisualBrush(HeadsetModel), new Pen(), HeadsetModel.RelativeRect);
                }
                if (GenericModel != null)
                {
                    GenericModel.CloseDrawingContext();
                    c.DrawRectangle(new VisualBrush(GenericModel), new Pen(), GenericModel.RelativeRect);
                }
                if (MousematModel != null)
                {
                    MousematModel.CloseDrawingContext();
                    c.DrawRectangle(new VisualBrush(MousematModel), new Pen(), MousematModel.RelativeRect);
                }
                KeyboardModel.CloseDrawingContext();
                c.DrawRectangle(new VisualBrush(KeyboardModel), new Pen(), KeyboardModel.RelativeRect);

                c.Pop();
            }

            var frameBitmap = ImageUtilities.DrawingVisualToBitmap(visual, _rect);

            if (MouseModel != null)
            {
                MouseBitmap = MouseModel.GetBitmapFromFrame(frameBitmap);
            }
            if (HeadsetModel != null)
            {
                HeadsetBitmap = HeadsetModel.GetBitmapFromFrame(frameBitmap);
            }
            if (GenericModel != null)
            {
                GenericBitmap = GenericModel.GetBitmapFromFrame(frameBitmap);
            }
            if (MousematModel != null)
            {
                MousematBitmap = MousematModel.GetBitmapFromFrame(frameBitmap);
            }
            KeyboardBitmap = KeyboardModel.GetBitmapFromFrame(frameBitmap);
        }
Esempio n. 4
0
        private void OnTimeElapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            var mouse  = new MouseModel();
            var window = WindowModel.FindByPositionOrNull(mouse.Position.X, mouse.Position.Y);

            if (window != null)
            {
                var rect = window.GetRectangle();

                var clearBeforeDraw = !window.Equals(prevWindow);
                WindowModel.DrawRect(rect.X, rect.Y, rect.Width, rect.Height, clearBeforeDraw);

                prevWindow = window;
            }
        }
Esempio n. 5
0
        private void DoAction(WindowModel window, Rectangle matchingRect)
        {
            MouseModel.MouseActionType action;
            switch (Action)
            {
            case "Nothing":
                action = MouseModel.MouseActionType.None;
                break;

            case "LeftClick":
                action = MouseModel.MouseActionType.LeftClick;
                break;

            case "RightClick":
                action = MouseModel.MouseActionType.RightClick;
                break;

            case "DoubleLeftClick":
                action = MouseModel.MouseActionType.DoubleLeftClick;
                break;

            case "Drag":
                action = MouseModel.MouseActionType.Drag;
                break;

            default:
                throw new Exception($"Unknown action {Action}");
            }

            var mouse = new MouseModel();

            // Move cursor to matching area and do action
            var windowRect = window.GetRectangle();

            mouse.Move(
                windowRect.X + matchingRect.X + ActionPos[0],
                windowRect.Y + matchingRect.Y + ActionPos[1],
                action
                );
        }
Esempio n. 6
0
        private void OnHotKeyPush(object sender, EventArgs e)
        {
            timer.Enabled = false;
            WindowModel.ClearRect();

            var mouse = new MouseModel();
            int x     = mouse.Position.X;
            int y     = mouse.Position.Y;

            // Capture window where cursor points
            WindowModel w   = WindowModel.FindByPosition(x, y);
            Bitmap      bmp = w.CaptureWindow();

            // Send capture image to server
            using (var stream = new MemoryStream())
            {
                // Make http content object from capture image
                bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png);
                stream.Position = 0;
                HttpContent content = new StreamContent(stream);

                using (var client = new HttpClient())
                    using (var formData = new MultipartFormDataContent())
                    {
                        formData.Add(content, "screenshot", "screenshot.png");
                        formData.Add(new StringContent(w.WindowTitle), "title");

                        var response = client.PostAsync(this.CaptureUploadUrl, formData).Result;
                        if (!response.IsSuccessStatusCode)
                        {
                            throw new Exception("Sending captured image failed");
                        }
                    }
            }

            Finish();
        }