Пример #1
0
        private void SetupScreenActions()
        {
            project = new Project();
            project.Name = "TestProj";
            project.ProjectFolder = @"C:\TestGhProj\" + project.Name;

            ProjectManager.CurrentProject = project;

            XmlFileWriter fileWriter = new XmlFileWriter();

            fileWriter.SaveProject();

            AppProcess process = new AppProcess{Name = "Process1"};
            AppWindow window = new AppWindow{Name="Window1"};
            AppWindow window2 = new AppWindow{Name="Window2"};
            AppControl control = new AppControl();
            AppControl control2 = new AppControl();

            process.Children.Add(window);
            process.Children.Add(window2);
            window.Children.Add(control);
            window2.Children.Add(control2);

            control.WindowId = window.Id;
            control2.WindowId = window2.Id;

            window.ProcessId = process.Id;
            window2.ProcessId = process.Id;

            OnScreenAction action1 = new OnScreenAction();
            action1.Operation = new ClickOperation();
            action1.Operation.Parameters[0].Value.DisplayValue = "1";
            action1.Operation.Parameters[1].Value.DisplayValue = "2";
            action1.ControlId = control.Id;
            action1.WindowId = window.Id;

            Screenshot screenShot = new Screenshot();
            screenShot.ImageFile = @"screenshot1.png";
            screenShot.Adornments.Add(new ScreenshotClickAdornment { ClickX = 100, ClickY = 100 });

            action1.Screenshot = screenShot;

            OnScreenAction action2 = new OnScreenAction();
            action2.Operation = new ClickOperation();
            action2.ControlId = control.Id;
            action2.WindowId = window.Id;

            OnScreenAction action3 = new OnScreenAction();
            action3.Operation = new ClickOperation();
            action3.ControlId = control.Id;
            action3.WindowId = window.Id;

            OnScreenAction action4 = new OnScreenAction();
            action4.Operation = new ClickOperation();
            action4.ControlId = control2.Id;
            action4.WindowId = window2.Id;

            OnScreenAction action5 = new OnScreenAction();
            action5.Operation = new ClickOperation();
            action5.ControlId = control2.Id;
            action5.WindowId = window2.Id;

            Screenshot screenShot2 = new Screenshot();
            screenShot2.ImageFile = @"screenshot2.png";
            screenShot2.Adornments.Add(new ScreenshotClickAdornment { ClickX = 300, ClickY = 250 });

            action5.Screenshot = screenShot2;

            OnScreenAction action6 = new OnScreenAction();
            action6.Operation = new ClickOperation();
            action6.ControlId = control2.Id;
            action6.WindowId = window2.Id;

            Test test = new Test();
            test.Name = "Test1";

            for (int i = 0; i < 50; i++)
            {
                test.TestItems.Add(action1);
                test.TestItems.Add(action2);
                test.TestItems.Add(action3);
                test.TestItems.Add(action4);
                test.TestItems.Add(action5);
                test.TestItems.Add(action6);
            }

            Stopwatch stopWatch = new Stopwatch();
            stopWatch.Start();
            fileWriter.Write(test);
            stopWatch.Stop();
            AppManager appManager = new AppManager();
            appManager.Processes.Add(process);

            fileWriter.Write(appManager);
        }
 public OnScreenActionViewModel(OnScreenAction onScreenAction)
 {
     this.onScreenAction = onScreenAction;
     TestItem = onScreenAction;
 }