Example #1
0
        private void DoCapture(IScreenDefn screenDefn, ScreenContent content,
                               string CaptureFolderPath)
        {
            var itemReport = screenDefn.Capture(content);

            // accum capture data if post aid key is pagedown.
            if ((content.PostAidKey != null) &&
                (this.CaptureReport != null) &&
                (content.PostAidKey.Value == AidKey.RollUp))
            {
                var r2 = DataTableExt.CombineVertically(this.CaptureReport, itemReport);
                this.CaptureReport = r2;
            }
            else
            {
                this.CaptureReport = itemReport;
            }

            var htmlText = this.CaptureReport.ToHtmlTableText();

            var fileName        = screenDefn.ScreenName + "." + "html";
            var captureFilePath = System.IO.Path.Combine(CaptureFolderPath, fileName);

            System.IO.File.WriteAllText(captureFilePath, htmlText);
        }
Example #2
0
        /// <summary>
        /// fill and make visible the hover window.
        /// Called by the DrawHoverBox method of ItemCanvas.
        /// </summary>
        /// <param name="Position"></param>
        /// <param name="CanvasRowCol"></param>
        /// <param name="MatchScreenDefn"></param>
        /// <param name="Content"></param>
        public void DrawHoverBox(
            Point Position, IScreenLoc CanvasRowCol, IScreenDefn MatchScreenDefn,
            ScreenContent Content)
        {
            // first remove any existing popup hover box.
            RemoveHoverBox();

            // hovering on a screen with a screen defn. Find the item on the screen
            // which is being hovered over.
            string             itemName   = "";
            string             itemValue  = "";
            int                itemRowNum = 0;
            ScreenItemInstance hoverItem  = null;

            if ((MatchScreenDefn != null) && (CanvasRowCol != null))
            {
                var foundItem = MatchScreenDefn.FindItem(CanvasRowCol, Content);
                if (foundItem != null)
                {
                    hoverItem  = foundItem;
                    itemName   = foundItem.GetItemName().EmptyIfNull();
                    itemValue  = foundItem.GetValue(Content);
                    itemRowNum = foundItem.RepeatNum;
                }
            }

            // capture the contents of the screen to a DataTable.
            EnhancedDataTable itemTable = null;
            Grid   srcmbrGrid           = null;
            object hoverData            = null;
            string hoverXaml            = null;
            string hoverCode            = null;

            if ((MatchScreenDefn != null) && (hoverItem != null))
            {
                itemTable = MatchScreenDefn.Capture(Content, hoverItem);
                {
                    hoverXaml = FindHoverXaml(hoverItem.Item);
                    hoverCode = FindHoverCode(hoverItem.Item);
                }

                if (hoverCode.IsNullOrEmpty( ) == false)
                {
                    hoverData = CompileAndRunHoverCode(hoverCode, itemTable);
                }

                if ((MatchScreenDefn.ScreenName == "wrkmbrpdm") && (hoverData == null))
                {
                    // BgnTemp
                    {
                        if (itemTable.Rows.Count == 0)
                        {
                            var rep = Content.ToColumnReport("Content report");
                            rep.DebugPrint();
                            itemTable = MatchScreenDefn.Capture(Content, hoverItem);
                        }
                    }
                    // EndTemp

                    var srcmbr      = itemTable.SelectedRow["MbrName"].ToString();
                    var srcfName    = itemTable.SelectedRow["SrcfName"].ToString();
                    var srcfLib     = itemTable.SelectedRow["SrcfLib"].ToString();
                    var sourceLines = SrcmbrScripts.GetSrcmbrLines(srcfName, srcfLib, srcmbr);
                    hoverData = new { srcmbr, srcfName, srcfLib, sourceLines };
                }
            }

            Grid grid = null;

            if (hoverData != null)
            {
                if (hoverXaml.IsNullOrEmpty( ) == false)
                {
                    var sr     = new StringReader(hoverXaml);
                    var xr     = XmlReader.Create(sr);
                    var uiElem = XamlReader.Load(xr);
                    grid             = uiElem as Grid;
                    grid.DataContext = hoverData;
                }
                else
                {
                    var uiElem = hoverData.ToUIElement();
                    grid = uiElem as Grid;
                }
            }
            else
            {
                // create the controls that make up the hover control.
                ListBox lb = null;
                System.Windows.Controls.Canvas canvas = null;

                if (srcmbrGrid != null)
                {
                    var rv = BuildSrcmbrHoverGrid(srcmbrGrid);
                    grid = rv.Item1;
                }
                else
                {
                    var rv = BuildFoundation();
                    grid   = rv.Item1;
                    lb     = rv.Item2;
                    canvas = rv.Item3;

                    lb.Items.Add("field name:" + itemName);
                    lb.Items.Add("RowCol:" + CanvasRowCol.ToText());
                    lb.Items.Add("Value:" + itemValue);
                    lb.Items.Add("Row number:" + itemRowNum);
                }
            }

            ShowHoverBox(grid, Position);
        }