public void ShowScreenShot()
        {
            if (mWinExplorer == null)
            {
                Reporter.ToUser(eUserMsgKey.POMAgentIsNotRunning);
                return;
            }

            mWinExplorer.UnHighLightElements();
            Bitmap ScreenShotBitmap = ((IVisualTestingDriver)mAgent.Driver).GetScreenShot(new Tuple <int, int>(ApplicationPOMModel.cLearnScreenWidth, ApplicationPOMModel.cLearnScreenHeight));

            mPOM.ScreenShotImage     = Ginger.General.BitmapToBase64(ScreenShotBitmap);
            mScreenShotViewPage      = new ScreenShotViewPage(mPOM.Name, ScreenShotBitmap);
            xScreenShotFrame.Content = mScreenShotViewPage;
        }
Exemple #2
0
        private void ShowCompareResult()
        {
            if (mAct.CompareResult is BitmapImage)
            {
                ScreenShotViewPage p = new ScreenShotViewPage("Compare Result", (BitmapImage)mAct.CompareResult);
                xDiffrenceImageFrame.Content = p;
                return;
            }

            if (mAct.CompareResult is Bitmap)
            {
                ScreenShotViewPage p = new ScreenShotViewPage("Compare Result", (Bitmap)mAct.CompareResult);
                xDiffrenceImageFrame.Content = p;
                return;
            }

            xDiffrenceImageFrame.Content = null;
        }
Exemple #3
0
        public POMEditPage(ApplicationPOMModel POM, eRIPageViewMode editMode = eRIPageViewMode.View)
        {
            InitializeComponent();
            mPOM      = POM;
            mEditMode = editMode;

            mBusinessFlowControl = new ucBusinessFlowMap(mPOM, nameof(mPOM.MappedBusinessFlow));
            xFrameBusinessFlowControl.Content = mBusinessFlowControl;

            xShowIDUC.Init(mPOM);
            xFirstRowExpanderLabel.Content = string.Format("'{0}' Details", mPOM.Name);
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Name));
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Description));
            xPageURLTextBox.Init(null, mPOM, nameof(mPOM.PageURL));

            FillTargetAppsComboBox();
            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xTargetApplicationComboBox, ComboBox.SelectedValueProperty, mPOM, nameof(ApplicationPOMModel.TargetApplicationKey));
            xTagsViewer.Init(mPOM.TagsKeys);

            BitmapSource source = null;

            if (mPOM.ScreenShotImage != null)
            {
                source = Ginger.General.GetImageStream(Ginger.General.Base64StringToImage(mPOM.ScreenShotImage.ToString()));
            }

            mScreenShotViewPage      = new ScreenShotViewPage(mPOM.Name, source);
            xScreenShotFrame.Content = mScreenShotViewPage;

            mPomAllElementsPage      = new PomAllElementsPage(mPOM, PomAllElementsPage.eAllElementsPageContext.POMEditPage);
            xUIElementsFrame.Content = mPomAllElementsPage;

            mPomAllElementsPage.raiseUIElementsCountUpdated += UIElementCountUpdatedHandler;
            UIElementTabTextBlockUpdate();

            mAppPlatform = WorkSpace.Instance.Solution.GetTargetApplicationPlatform(POM.TargetApplicationKey);
            ObservableList <Agent> optionalAgentsList = GingerCore.General.ConvertListToObservableList((from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Platform == mAppPlatform select x).ToList());

            GingerCore.GeneralLib.BindingHandler.ObjFieldBinding(xAgentControlUC, ucAgentControl.SelectedAgentProperty, this, nameof(Agent));
            xAgentControlUC.Init(optionalAgentsList, mPOM.LastUsedAgent);

            SetDefaultPage();
        }
Exemple #4
0
        private void BrowseImageButtonClicked(object sender, System.Windows.RoutedEventArgs e)
        {
            System.Windows.Forms.OpenFileDialog op = new System.Windows.Forms.OpenFileDialog();
            op.Title  = "Select a picture";
            op.Filter = "JPEG (*.jpg;*.jpeg)|*.jpg;*.jpeg";
            op.ShowDialog();
            if (!string.IsNullOrEmpty(op.FileName))
            {
                var fileLength = new FileInfo(op.FileName).Length;
                if (fileLength <= 30000)
                {
                    if ((op.FileName != null) && (op.FileName != string.Empty))
                    {
                        using (var ms = new MemoryStream())
                        {
                            BitmapImage      bi    = new BitmapImage(new Uri(op.FileName));
                            Tuple <int, int> sizes = Ginger.General.RecalculatingSizeWithKeptRatio(bi, Ginger.Reports.GingerExecutionReport.GingerExecutionReport.logoWidth, Ginger.Reports.GingerExecutionReport.GingerExecutionReport.logoHight);

                            BitmapImage bi_resized = new BitmapImage();
                            bi_resized.BeginInit();
                            bi_resized.UriSource         = new Uri(op.FileName);
                            bi_resized.DecodePixelHeight = sizes.Item2;
                            bi_resized.DecodePixelWidth  = sizes.Item1;
                            bi_resized.EndInit();
                            Bitmap ScreenShotBitmap = Ginger.General.BitmapImage2Bitmap(bi_resized);
                            mPOM.ScreenShotImage     = Ginger.General.BitmapToBase64(ScreenShotBitmap);
                            mScreenShotViewPage      = new ScreenShotViewPage(mPOM.Name, ScreenShotBitmap);
                            xScreenShotFrame.Content = mScreenShotViewPage;
                        }
                    }
                }
                else
                {
                    Reporter.ToUser(eUserMsgKeys.ImageSize);
                }
            }
        }
Exemple #5
0
 private void UpdateTargetImage()
 {
     this.Dispatcher.Invoke(() =>
     {
         if (mAct.IsTargetSourceFromScreenshot)
         {
             if (mAct.ScreenShots.Count >= 2)
             {
                 ScreenShotViewPage p     = new ScreenShotViewPage("Target Image", mAct.ScreenShots[1]); // TODO: get it from act as target image
                 TargetImageFrame.Content = p;
             }
         }
         else
         {
             // assume file
             string filename = General.GetFullFilePath(CurrentBaselineImagePathTxtBox.ValueTextBox.Text);
             if (File.Exists(filename))
             {
                 ScreenShotViewPage p     = new ScreenShotViewPage("Target Image", mAct.TargetFileName);
                 TargetImageFrame.Content = p;
             }
         }
     });
 }
Exemple #6
0
        public POMEditPage(ApplicationPOMModel POM, RepositoryItemPageViewMode editMode = RepositoryItemPageViewMode.View)
        {
            InitializeComponent();
            mPOM      = POM;
            mEditMode = editMode;

            ControlsBinding.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Name));
            ControlsBinding.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Description));
            ControlsBinding.ObjFieldBinding(xPageURLTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.PageURL));

            xTargetApplicationComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            FillTargetAppsComboBox();
            xTargetApplicationComboBox.Init(mPOM, nameof(ApplicationPOMModel.TargetApplicationKey));
            xTagsViewer.Init(mPOM.TagsKeys);

            BitmapSource source = null;

            if (mPOM.ScreenShotImage != null)
            {
                source = Ginger.General.GetImageStream(Ginger.General.Base64StringToImage(mPOM.ScreenShotImage.ToString()));
            }

            mScreenShotViewPage      = new ScreenShotViewPage(mPOM.Name, source);
            xScreenShotFrame.Content = mScreenShotViewPage;

            mPomAllElementsPage      = new PomAllElementsPage(mPOM, PomAllElementsPage.eAllElementsPageContext.POMEditPage);
            xUIElementsFrame.Content = mPomAllElementsPage;

            UIElementTabTextBlockUpdate();

            ePlatformType          mAppPlatform       = WorkSpace.UserProfile.Solution.GetTargetApplicationPlatform(POM.TargetApplicationKey);
            ObservableList <Agent> optionalAgentsList = GingerCore.General.ConvertListToObservableList((from x in WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <Agent>() where x.Platform == mAppPlatform select x).ToList());

            App.ObjFieldBinding(xAgentControlUC, ucAgentControl.SelectedAgentProperty, this, nameof(Agent));
            xAgentControlUC.Init(optionalAgentsList, mPOM.LastUsedAgent);
        }
Exemple #7
0
        void ElementImageSourceChanged(bool IsFirstCall = false)
        {
            ValueExpression mVE = new ValueExpression(Context.GetAsContext(actSikuli.Context).Environment, Context.GetAsContext(actSikuli.Context), WorkSpace.Instance.SolutionRepository.GetAllRepositoryItems <DataSourceBase>());

            mVE.Value = xPatternImageLocationTextBox.ValueTextBox.Text;
            string calculateValue = mVE.ValueCalculated;

            if (string.IsNullOrEmpty(calculateValue))
            {
                calculateValue = xPatternImageLocationTextBox.ValueTextBox.Text;
            }
            if (!string.IsNullOrEmpty(calculateValue) &&
                File.Exists(amdocs.ginger.GingerCoreNET.WorkSpace.Instance.Solution.SolutionOperations.ConvertSolutionRelativePath(calculateValue)))
            {
                try
                {
                    ScreenShotViewPage screenShotPage = new ScreenShotViewPage(calculateValue, calculateValue, 0.5);
                    xScreenShotsViewFrame.Content = screenShotPage;
                }
                catch (Exception exc)
                {
                    actSikuli.PatternPath = string.Empty;
                    Reporter.ToLog(eLogLevel.ERROR, exc.Message, exc);
                    xScreenShotsViewFrame.Content = null;
                }
            }
            else
            {
                if (!IsFirstCall)
                {
                    Reporter.ToUser(eUserMsgKey.StaticInfoMessage, "No Valid Image file found. Please enter a valid Image path.");
                }
                actSikuli.PatternPath         = string.Empty;
                xScreenShotsViewFrame.Content = null;
            }
        }
 public void ShowScreenShot()
 {
     mScreenshotPage = new ScreenShotViewPage(mWizard.mPomLearnUtils.POM.Name, mWizard.mPomLearnUtils.ScreenShot);
     mScreenshotPage.xZoomSlider.Value = 0.5;
     xScreenShotFrame.Content          = mScreenshotPage;
 }
Exemple #9
0
        public FailedActionsScreenshotsPage(List <string> failedActionsScreenshots)
        {
            InitializeComponent();
            mFailedActionsScreenshots = failedActionsScreenshots;

            // create grid row cols based on screen shots count, can be 1x1, 2x2, 3x3 etc..
            int rowcount   = 1;
            int colsPerRow = 1;

            while (rowcount * colsPerRow < mFailedActionsScreenshots.Count)
            {
                if (rowcount < colsPerRow)
                {
                    rowcount++;    // enable 1 row 2 columns, 2x3, 3x4 etc.. - avoid showing empty row
                }
                else
                {
                    colsPerRow++;
                }
                // we can limit cols if we want for example max 3 per row, and then the grid will have vertical scroll bar
            }

            for (int rows = 0; rows < rowcount; rows++)
            {
                RowDefinition rf = new RowDefinition()
                {
                    Height = new GridLength(50, GridUnitType.Star)
                };
                ScreenShotsGrid.RowDefinitions.Add(rf);
            }

            for (int cols = 0; cols < colsPerRow; cols++)
            {
                ColumnDefinition cf = new ColumnDefinition()
                {
                    Width = new GridLength(50, GridUnitType.Star)
                };
                ScreenShotsGrid.ColumnDefinitions.Add(cf);
            }

            // loop through the screen shot and create new frame per each to show and place in the grid

            int r = 0;
            int c = 0;

            for (int i = 0; i < mFailedActionsScreenshots.Count; i++)
            {
                //TODO: clean me when Screenshots changed to class instead of list of strings
                // just in case we don't have name, TOOD: fix all places where we add screen shots to include name
                string Name = "";
                Name = "Screenshot " + (i + 1).ToString();

                ScreenShotViewPage p = new ScreenShotViewPage(Name, mFailedActionsScreenshots[i]);
                Frame f = new Frame();
                Grid.SetRow(f, r);
                Grid.SetColumn(f, c);
                f.HorizontalAlignment = HorizontalAlignment.Center;
                f.VerticalAlignment   = VerticalAlignment.Center;
                f.Content             = p;
                ScreenShotsGrid.Children.Add(f);

                c++;
                if (c == colsPerRow)
                {
                    c = 0;
                    r++;
                }
            }
        }
Exemple #10
0
 public void ShowScreenShot()
 {
     mScreenshotPage          = new ScreenShotViewPage(mWizard.mPomLearnUtils.POM.Name, mWizard.mPomLearnUtils.ScreenShot);
     xScreenShotFrame.Content = mScreenshotPage;
 }
Exemple #11
0
 public void ShowScreenShot()
 {
     mPOM.ScreenShot   = ((SeleniumDriver)mWizard.WinExplorer).GetScreenShot();
     mScreenshotPage   = new ScreenShotViewPage(mPOM.Name, mPOM.ScreenShot);
     MainFrame.Content = mScreenshotPage;
 }
Exemple #12
0
        public POMEditPage(ApplicationPOMModel POM)
        {
            InitializeComponent();
            mPOM = POM;
            ControlsBinding.ObjFieldBinding(xNameTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Name));
            ControlsBinding.ObjFieldBinding(xDescriptionTextBox, TextBox.TextProperty, mPOM, nameof(mPOM.Description));

            xTargetApplicationComboBox.ComboBox.Style = this.FindResource("$FlatInputComboBoxStyle") as Style;
            FillTargetAppsComboBox();
            xTargetApplicationComboBox.Init(mPOM, nameof(ApplicationPOMModel.TargetApplicationKey));
            xTagsViewer.Init(mPOM.TagsKeys);

            BitmapSource source = null;

            if (mPOM.ScreenShotImage != null)
            {
                source = Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetImageStream(Ginger.Reports.GingerExecutionReport.ExtensionMethods.Base64ToImage(mPOM.ScreenShotImage.ToString()));
            }

            //Bitmap ScreenShot = BitmapFromSource(Ginger.Reports.GingerExecutionReport.ExtensionMethods.GetImageStream(Ginger.Reports.GingerExecutionReport.ExtensionMethods.Base64ToImage(mPOM.LogoBase64Image.ToString())));

            ScreenShotViewPage p = new ScreenShotViewPage(mPOM.Name, source);

            xScreenShotFrame.Content = p;

            //PomElementsMappingPage mappedUIElementsPage = new PomElementsMappingPage(mPOM,null);
            PomAllElementsPage pomAllElementsPage = new PomAllElementsPage(mPOM, null);

            //pomAllElementsPage.mappedUIElementsPage.MainElementsGrid.ValidationRules.Add(ucGrid.eUcGridValidationRules.CantBeEmpty);
            //pomAllElementsPage.unmappedUIElementsPage.MainElementsGrid.ValidationRules.Add(ucGrid.eUcGridValidationRules.CantBeEmpty);
            xUIElementsFrame.Content = pomAllElementsPage;

            //PageNameTextBox.BindControl(mApplicationPOM, nameof(ApplicationPOM.Name));

            //ObservableList<ApplicationPlatform> Apps = App.UserProfile.Solution.ApplicationPlatforms;
            //ApplicationPlatform AP = (from x in Apps where x.Guid == mApplicationPOM.TargetApplicationKey.Guid select x).FirstOrDefault();
            //mApplicationPOM.TargetApplicationKey = AP.Key;  // Create new binding and get updates if exist as key app name might changed

            //Yuval Uncomment
            //TargetApplicationComboBox.BindControl<ApplicationPlatform>(mApplicationPOM, nameof(mApplicationPOM.TargetAppplicationKey), Apps, nameof(ApplicationPlatform.AppName), nameof(ApplicationPlatform.Key));

            //TODO: lazy load based on tabs with cache
            //if (mPOM.ScreenShot == null)
            //{
            //    string filename = mPOM.FileName.Replace("xml", "Screenshot.bmp");  // TODO: use same const
            //    //mPom.ScreenShot = General.LoadBitmapFromFile(filename);
            //}


            //POMSimulatorFrame.Content = new POMSimulatorPage(mPom);


            //LearnWizardPage p2 = new LearnWizardPage(mPom);
            //UIElementsFrame.Content = p2;

            //MappingFrame.Content = new MapUIElementsWizardPage(mPom);

            //NaviagtionsFrame.Content = new NavigationsPage(mPom);

            ////TODO: create a page and move code to design page
            //pd = new ScreenShotViewPage(mPom.Name, mPom.ScreenShot);
            //pd.MouseClickOnScreenshot += MouseClickOnScreenshot;
            //pd.MouseUpOnScreenshot += MouseUpOnScreenshot;
            //pd.MouseMoveOnScreenshot += MouseMoveOnScreenshot;
            //DesignFrame.Content = pd;

            //InitControlPropertiesGrid();
        }