コード例 #1
0
        public ViewModels(ModelsEx models)
        {
            this.models = models;

            // view models
            Display    = new DisplayViewModel(models);
            Progress   = new ProgressViewModel(models);
            Images     = new ImagesViewModel(models);
            Equations  = new EquationsViewModel(models);
            Filter     = new FiltersViewModel(models);
            Statistics = new StatisticsViewModel(models);

            // commands
            OpenCommand   = new OpenCommand(models);
            ImportCommand = new ImportCommand(models);
            ImportEquationImageCommand = new ImportEquationImageCommand(models);
            ExportCommand = new ExportCommand(models);

            ShowPixelDisplayCommand = new ShowPixelDisplayCommand(models);
            ShowPixelColorCommand   = new ShowPixelColorCommand(models);
            ShowScaleCommand        = new ShowScaleCommand(models);
            GenerateMipmapsCommand  = new GenerateMipmapsCommand(models);
            DeleteMipmapsCommand    = new DeleteMipmapsCommand(models);
            HelpCommand             = new HelpDialogCommand(models);
            GifExportCommand        = new GifExportCommand(models);
            ImportArrayCommand      = new ImportArrayCommand(models);
            LatLongToCubemapCommand = new LatLongToCubemapCommand(models);
            CubemapToLatLongCommand = new CubemapToLatLongCommand(models);

            ResizeCommand   = new ResizeWindowCommand(models);
            SetThemeCommand = new SetThemeCommand(models);

            AddFilterCommand = new AddFilterCommand(models, Filter);

            // key input
            models.Window.Window.KeyUp += WindowOnKeyUp;
        }
コード例 #2
0
        public WindowViewModel(App app, MainWindow window)
        {
            this.models = new Models.Models(app, window, this);

            // controller
            this.paintController = new PaintController(models);

            // model views
            Images     = new ImagesViewModel(models, this);
            Display    = new DisplayViewModel(models);
            Equations  = new EquationsViewModel(models);
            Progress   = new ProgressViewModel(models);
            Filter     = new FiltersViewModel(models);
            Statistics = new StatisticsViewModel(models);

            // commands
            var import = new ImportImageCommand(models, this);

            ImportCommand = import;
            ResizeCommand = new ResizeWindowCommand(models);
            ImportEquationImageCommand = new ImportEquationImageCommand(models);
            OpenCommand             = new OpenImageCommand(models, import);
            ExportCommand           = new ExportImageCommand(models);
            AddFilterCommand        = new AddFilterCommand(models, Filter);
            ShowPixelDisplayCommand = new ShowPixelDialogCommand(models);
            ShowPixelColorCommand   = new ShowPixelColorCommand(models);
            GenerateMipmapsCommand  = new GenerateMipmapsCommand(models);
            DeleteMipmapsCommand    = new DeleteMipmapsCommand(models);

            window.KeyUp += WindowOnKeyUp;
            models.GlContext.GlControl.DragDrop += GlControlOnDragDrop;

            HelpAboutCommand        = new HelpCommand("help\\about.md");
            HelpEquationCommand     = new HelpCommand("help\\equation.md");
            HelpFilterManualCommand = new HelpCommand("help\\filter_manual.md");
        }
コード例 #3
0
            //build window command
            private static void BuildWindowCommand(IntPtr hWinEventHook, SystemEvents @event, IntPtr hwnd, int idObject, int idChild, uint dwEventThread, uint dwmsEventTime)
            {
                switch (@event)
                {
                case SystemEvents.EVENT_MIN:
                    return;

                case SystemEvents.EVENT_MAX:
                    return;

                case SystemEvents.EVENT_SYSTEM_FOREGROUND:
                    break;

                case SystemEvents.MINIMIZE_END:
                    return;

                case SystemEvents.MINIMIZE_START:
                    return;

                default:
                    return;
                }


                int length     = GetWindowText(hwnd, _Buffer, _Buffer.Capacity);
                var windowName = _Buffer.ToString();



                //bypass screen recorder and Cortana (Win10) which throws errors
                if ((windowName == "Screen Recorder") || (windowName == "Cortana"))
                {
                    return;
                }



                if (length > 0)
                {
                    //wait additional for window to initialize
                    //System.Threading.Thread.Sleep(250);
                    windowName = _Buffer.ToString();

                    Automation.Commands.ActivateWindowCommand activateWindowCommand = new ActivateWindowCommand
                    {
                        v_WindowName = windowName,
                        v_Comment    = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                    };

                    generatedCommands.Add(activateWindowCommand);

                    //detect if tracking window open location or activate windows to top left
                    if (trackWindowOpenLocations)
                    {
                        GetWindowRect(hwnd, out RECT windowRect);


                        Automation.Commands.MoveWindowCommand moveWindowCommand = new MoveWindowCommand
                        {
                            v_WindowName      = windowName,
                            v_XWindowPosition = windowRect.left.ToString(),
                            v_YWindowPosition = windowRect.top.ToString(),
                            v_Comment         = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                        };

                        generatedCommands.Add(moveWindowCommand);
                    }
                    else if (activateWindowTopLeft)
                    {
                        //generate command to set window position
                        Automation.Commands.MoveWindowCommand moveWindowCommand = new MoveWindowCommand
                        {
                            v_WindowName      = windowName,
                            v_XWindowPosition = "0",
                            v_YWindowPosition = "0",
                            v_Comment         = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                        };

                        SetWindowPosition(hwnd, 0, 0);

                        generatedCommands.Add(moveWindowCommand);
                    }

                    //if tracking window sizes is set
                    if (trackActivatedWindowSizes)
                    {
                        //create rectangle from hwnd
                        GetWindowRect(hwnd, out RECT windowRect);

                        //do math to get height, etc
                        var width  = windowRect.right - windowRect.left;
                        var height = windowRect.bottom - windowRect.top;

                        //generate command to set window position
                        Automation.Commands.ResizeWindowCommand reszWindowCommand = new ResizeWindowCommand
                        {
                            v_WindowName  = windowName,
                            v_XWindowSize = width.ToString(),
                            v_YWindowSize = height.ToString(),
                            v_Comment     = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                        };


                        //add to list
                        generatedCommands.Add(reszWindowCommand);
                    }
                }
            }
コード例 #4
0
        //build window command
        private static void BuildWindowCommand(IntPtr hWinEventHook, _systemEvents @event,
                                               IntPtr hwnd, int idObject, int idChild,
                                               uint dwEventThread, uint dwmsEventTime)
        {
            switch (@event)
            {
            case _systemEvents.EventMin:
                return;

            case _systemEvents.EventMax:
                return;

            case _systemEvents.EventSystemForeGround:
                break;

            case _systemEvents.MinimizeEnd:
                return;

            case _systemEvents.MinimizeStart:
                return;

            default:
                return;
            }

            int length     = GetWindowText(hwnd, _buffer, _buffer.Capacity);
            var windowName = _buffer.ToString();

            //bypass screen recorder and Cortana (Win10) which throws errors
            if ((windowName == "Screen Recorder") || (windowName == "Cortana"))
            {
                return;
            }

            if (length > 0)
            {
                //wait additional for window to initialize
                //System.Threading.Thread.Sleep(250);
                windowName = _buffer.ToString();

                ActivateWindowCommand activateWindowCommand = new ActivateWindowCommand
                {
                    v_WindowName = windowName,
                    v_Comment    = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                };

                GeneratedCommands.Add(activateWindowCommand);

                //detect if tracking window open location or activate windows to top left
                if (_trackWindowOpenLocations)
                {
                    User32Functions.GetWindowRect(hwnd, out Rect windowRect);

                    MoveWindowCommand moveWindowCommand = new MoveWindowCommand
                    {
                        v_WindowName     = windowName,
                        v_XMousePosition = windowRect.left.ToString(),
                        v_YMousePosition = windowRect.top.ToString(),
                        v_Comment        = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                    };

                    GeneratedCommands.Add(moveWindowCommand);
                }
                else if (_activateWindowTopLeft)
                {
                    //generate command to set window position
                    MoveWindowCommand moveWindowCommand = new MoveWindowCommand
                    {
                        v_WindowName     = windowName,
                        v_XMousePosition = "0",
                        v_YMousePosition = "0",
                        v_Comment        = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                    };

                    User32Functions.SetWindowPosition(hwnd, 0, 0);
                    GeneratedCommands.Add(moveWindowCommand);
                }

                //if tracking window sizes is set
                if (_trackActivatedWindowSizes)
                {
                    //create rectangle from hwnd
                    User32Functions.GetWindowRect(hwnd, out Rect windowRect);

                    //do math to get height, etc
                    var width  = windowRect.right - windowRect.left;
                    var height = windowRect.bottom - windowRect.top;

                    //generate command to set window position
                    ResizeWindowCommand reszWindowCommand = new ResizeWindowCommand
                    {
                        v_WindowName  = windowName,
                        v_XWindowSize = width.ToString(),
                        v_YWindowSize = height.ToString(),
                        v_Comment     = "Generated by Screen Recorder @ " + DateTime.Now.ToString()
                    };

                    //add to list
                    GeneratedCommands.Add(reszWindowCommand);
                }
            }
        }