Reflection .NET API
Attachmate.Reflection Assembly / Attachmate.Reflection.Productivity Namespace / IScreenHistory Interface / NumberOfScreensToRemember Property
Example


In This Topic
    NumberOfScreensToRemember Property
    In This Topic
    Gets or sets the number of host screens in the Screen History list.
    Syntax
    'Declaration
     
    
    Property NumberOfScreensToRemember As Integer
    'Usage
     
    
    Dim instance As IScreenHistory
    Dim value As Integer
     
    instance.NumberOfScreensToRemember = value
     
    value = instance.NumberOfScreensToRemember
    int NumberOfScreensToRemember {get; set;}
    Exceptions
    ExceptionDescription
    This exception is thrown if you modify a Reflection property that's been secured via the Permissions Manager, or if such a modification requires Administrator privileges.
    Example
    This sample sets the NumberOfScreensToRemember to limit the number of screens in the screen history to 25.
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using Attachmate.Reflection.UserInterface;
    using Attachmate.Reflection.Productivity;
    using Attachmate.Reflection.Emulation.IbmHosts;
    using Attachmate.Reflection.Framework;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.IO;
    using Word = Microsoft.Office.Interop.Word; 
    
    namespace ScreenHistory
    {
        class Program
        {
    
            static void terminal_BeforeDisconnect(object sender, EventArgs e)
            {
                IIbmTerminal terminal = (IIbmTerminal)sender;
    
                IScreenHistory history = terminal.Productivity.ScreenHistory;
    
                //Delete the first screen from the history
                history.DeleteScreen(0);
    
                List<Image> screenImages = new List<Image>();
    
    
    
                for (int i = 0; i < history.Count; i++)
                {
                    byte[] screenImage = history.GetHistoryScreenImage(i);
    
                    MemoryStream memstr = new MemoryStream(screenImage);
                    Image image = Image.FromStream(memstr);
    
    
    
                    screenImages.Add(image);
                }
    
    
                IOfficeTools tools = terminal.Productivity.OfficeTools;
    
                tools.CreateWordProcessingDocumentWithGraphicSet(screenImages, null, null);
    
    
                Word.Application word = (Word.Application)System.Runtime.InteropServices.Marshal.GetActiveObject("Word.Application");
    
    
                string screenLog = Environment.UserName + DateTime.Now.ToString("yyyyMMddHHmmssfff");
                
                
                word.ActiveDocument.SaveAs(Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\" + screenLog);
                word.ActiveDocument.Close();
                word.Quit();
    
    
                history.SaveScreenHistoryFile(Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\Reflection\myScreens.rshx", true);
            }
    
    
            static void Main(string[] args)
            {
                //Start a visible instance of Reflection or get the instance running at the given channel name
                Application app = MyReflection.CreateApplication("myWorkspace", true);
    
                //Create a terminal from the session document file
                string sessionPath = Environment.GetEnvironmentVariable("USERPROFILE") + @"\Documents\Micro Focus\Reflection\demoSession.rd3x";
                IIbmTerminal terminal = (IIbmTerminal)app.CreateControl(sessionPath);
    
                //Make the session visible in the workspace
                IFrame frame = (IFrame)app.GetObject("Frame");
                frame.CreateView(terminal);
    
                IScreenHistory history = terminal.Productivity.ScreenHistory;
    
                history.ManualCaptureOnly = false;
    
                history.ClearAllScreens();
    
                history.ScreenHistoryPanelVisible = true;
    
                history.NumberOfScreensToRemember = 25;
    
                history.ClearHistoryOnDisconnect = false;
    
                terminal.BeforeDisconnect += terminal_BeforeDisconnect;
    
                Console.ReadLine();
            }
    
    
        }
    }
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    See Also