예제 #1
0
        /// <summary>
        /// If the form doesn't have a panel name, call this in the
        /// constructor of the form
        /// </summary>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _panelName = startupArg.PanelClass;

            var panelConfigMapEntry = PanelConfigMap.GetPanelConfigMapEntry(startupArg.PanelClass);

            if (panelConfigMapEntry == null) // did not find the panel
            {
                return(false);
            }

            bool retVal = initWidgetManager(panelConfigMapEntry);

            if (retVal)
            {
                retVal = initAnimationManager(panelConfigMapEntry);
            }

            Windows.SetTopMost(_form);

            PanelManager.Instance.EvtScannerShow += Instance_EvtScannerShow;
            Windows.EvtWindowPositionChanged     += Windows_EvtWindowPositionChanged;

            Windows.SetWindowPositionAndNotify(_form, Windows.WindowPosition.CenterScreen);

            _windowOverlapWatchdog = new WindowOverlapWatchdog(_form);

            return(retVal);
        }
예제 #2
0
파일: ScannerHelper.cs 프로젝트: glwu/acat
        /// <summary>
        /// Initializes an instances of the class
        /// </summary>
        /// <param name="panel">the scanner object</param>
        /// <param name="startupArg">initialization arguments</param>
        public ScannerHelper(IScannerPanel panel, StartupArg startupArg)
        {
            DialogMode = startupArg.DialogMode;

            AppDomain currentDomain = AppDomain.CurrentDomain;
            currentDomain.AssemblyResolve += currentDomain_AssemblyResolve;
        }
예제 #3
0
        /// <summary>
        /// Performs initialization.  Reads the config file for the form, creates
        /// the animation manager, widget manager, loads in  all the widgets,
        /// subscribes to events
        /// Call this function in the Initialize() function in the scanner.
        /// </summary>
        /// <param name="startupArg"></param>
        /// <returns></returns>
        public bool Initialize(StartupArg startupArg)
        {
            Log.Debug("Entered from Initialize");

            Glass.Enable = CoreGlobals.AppPreferences.EnableGlass;

            Glass.EvtShowGlass += Glass_EvtShowGlass;

            StartupArg = startupArg;

            ScannerForm.AutoScaleMode = AutoScaleMode.None;

            ScannerForm.TopMost = true;

            Windows.ShowWindowBorder(ScannerForm,
                                     CoreGlobals.AppPreferences.ScannerShowBorder,
                                     CoreGlobals.AppPreferences.ScannerShowTitleBar ? ScannerForm.Text : String.Empty);

            Windows.EvtWindowPositionChanged += Windows_EvtWindowPositionChanged;

            ScannerForm.SizeChanged += ScannerForm_SizeChanged;

            subscribeTalkWindowManager();

            ScannerForm.Shown          += form_Shown;
            ScannerForm.VisibleChanged += form_VisibleChanged;

            _dialogMode = startupArg.DialogMode;

            var configFile = startupArg.ConfigFileName;

            if (String.IsNullOrEmpty(configFile))
            {
                configFile = PanelConfigMap.GetConfigFileForScreen(ScannerForm.GetType());
            }

            bool retVal = initWidgetManager(configFile);

            if (retVal)
            {
                retVal = initAnimationManager(configFile);
            }

            if (retVal)
            {
                createIdleTimer();
            }

            PositionSizeController.Initialize();

            PositionSizeController.AutoSetPosition();

            _windowOverlapWatchdog = new WindowOverlapWatchdog(ScannerForm);

            WindowActivityMonitor.EvtWindowMonitorHeartbeat += WindowActivityMonitor_EvtWindowMonitorHeartbeat;

            Log.Debug("Returning from Initialize");
            return(retVal);
        }
예제 #4
0
        /// <summary>
        /// Creates the panel with the specified panel class
        /// </summary>
        /// <param name="panelClass">the panel class</param>
        /// <param name="title">title of the panel</param>
        /// <returns>the form for the panel</returns>
        public Form CreatePanel(String panelClass, String title)
        {
            var startupArg = new StartupArg(panelClass)
            {
                ConfigFileName = PanelConfigMap.GetConfigFileForPanel(panelClass)
            };

            return(CreatePanel(panelClass, title, startupArg));
        }
예제 #5
0
        /// <summary>
        /// Creates and initializes the startup arg required to start the
        /// scanner for the widget
        /// </summary>
        /// <param name="widget"></param>
        /// <returns></returns>
        private StartupArg createStartupArgForScanner(Widget widget)
        {
            var startupArg = new StartupArg
            {
                DialogMode     = true,
                FocusedElement = AutomationElement.FromHandle(widget.UIControl.Handle),
            };

            return(startupArg);
        }
예제 #6
0
        /// <summary>
        /// Initialzies the specified scanner panel
        /// </summary>
        /// <param name="scannerPanel">panel to initialize</param>
        /// <param name="arg">panel arguments</param>
        /// <returns>true on success</returns>
        private bool initializePanel(IScannerPanel scannerPanel, PanelRequestEventArgs arg)
        {
            var startupArg = new StartupArg
            {
                FocusedElement = arg.MonitorInfo.FocusedElement,
                PanelClass     = arg.PanelClass,
                ConfigFileName = PanelConfigMap.GetConfigFileForPanel(arg.PanelClass),
                Arg            = arg.RequestArg
            };

            Log.Debug("panelClass:  " + arg.PanelClass + ", ConfigFIle: " + startupArg.ConfigFileName);
            return(scannerPanel.Initialize(startupArg));
        }
예제 #7
0
파일: PanelStack.cs 프로젝트: zezo010/acat
        /// <summary>
        /// Initialzies the specified scanner panel
        /// </summary>
        /// <param name="scannerPanel">panel to initialize</param>
        /// <param name="arg">panel arguments</param>
        /// <returns>true on success</returns>
        private bool initializePanel(IScannerPanel scannerPanel, PanelRequestEventArgs arg)
        {
            var startupArg = new StartupArg
            {
                FocusedElement = arg.MonitorInfo.FocusedElement,
                PanelClass     = arg.PanelClass,
                Arg            = arg.RequestArg
            };

            var panelConfigMapEntry = PanelConfigMap.GetPanelConfigMapEntry(arg.PanelClass);

            Log.Debug("panelClass:  " + arg.PanelClass + ", ConfigFIle: " + ((panelConfigMapEntry != null) ? panelConfigMapEntry.ConfigFileName : String.Empty));
            return(scannerPanel.Initialize(startupArg));
        }
예제 #8
0
파일: PanelStack.cs 프로젝트: zezo010/acat
        /// <summary>
        /// Creates the panel with the specified panel class
        /// </summary>
        /// <param name="panelClass">the panel class</param>
        /// <param name="panelTitle">panel title</param>
        /// <param name="startupArg">statrtup arg for the panel</param>
        /// <returns>the form for the panel</returns>
        public Form CreatePanel(String panelClass, String panelTitle, StartupArg startupArg)
        {
            Log.Debug("panelClass: " + panelClass);

            Form form = CreatePanel(ref panelClass, panelTitle, IntPtr.Zero, null);

            Log.IsNull("Form for this panel ", form);

            if (form is IPanel)
            {
                (form as IPanel).Initialize(startupArg);
            }

            Log.Debug("Returning form from createPanel");

            return(form);
        }
예제 #9
0
        /// <summary>
        /// Performs initialization
        /// </summary>
        /// <param name="startupArg">Startup arguments</param>
        /// <returns>true on success</returns>
        public virtual bool Initialize(StartupArg startupArg)
        {
            PanelClass = startupArg.PanelClass;

            _scannerCommon = new ScannerCommon(this)
            {
                PositionSizeController = { AutoPosition = false }
            };

            if (!_scannerCommon.Initialize(startupArg))
            {
                return(false);
            }

            _rootWidget = PanelCommon.RootWidget;

            return(true);
        }
예제 #10
0
        /// <summary>
        /// Performs initialization
        /// </summary>
        /// <param name="arg">Startup arguments</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg arg)
        {
            startupArg        = arg;
            PanelClass        = startupArg.PanelClass;
            startupCommandArg = startupArg.Arg;

            scannerCommon = new ScannerCommon(this);

            if (!scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return(false);
            }

            rootWidget = scannerCommon.GetRootWidget();
            onInitialize();
            return(true);
        }
예제 #11
0
        /// <summary>
        /// Creates the panel with the specified panel class
        /// </summary>
        /// <param name="panelClass">the panel class</param>
        /// <param name="panelTitle">panel title</param>
        /// <param name="startupArg">statrtup arg for the panel</param>
        /// <returns>the form for the panel</returns>
        public Form CreatePanel(String panelClass, String panelTitle, StartupArg startupArg)
        {
            Log.Debug("panelClass: " + panelClass);
            Form form = CreatePanel(ref panelClass, panelTitle, IntPtr.Zero, null);

            Log.IsNull("Form for this panel ", form);
            if (form is IScannerPanel)
            {
                var scannerPanel = form as IScannerPanel;
                if (String.IsNullOrEmpty(startupArg.ConfigFileName))
                {
                    startupArg.ConfigFileName = PanelConfigMap.GetConfigFileForPanel(panelClass);
                }

                scannerPanel.Initialize(startupArg);
            }

            Log.Debug("Returning form from createPanel");
            return(form);
        }
예제 #12
0
        /// <summary>
        /// Call this in the Initialize function of the Alphabet scanner
        /// </summary>
        /// <param name="startupArg">startup arguments</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            PanelClass = startupArg.PanelClass;

            _scannerCommon = new ScannerCommon(_scannerPanel);
            _scannerHelper = new ScannerHelper(_scannerPanel, startupArg);

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + _form.Name);
                return false;
            }

            _rootWidget = _scannerCommon.GetRootWidget();

            return true;
        }
예제 #13
0
        /// <summary>
        /// Performs initialization.  Reads the config file for the form, creates
        /// the animation manager, widget manager, loads in  all the widgets,
        /// subscribes to events
        /// Call this function in the Initialize() function in the scanner.
        /// </summary>
        /// <param name="startupArg"></param>
        /// <returns></returns>
        public bool Initialize(StartupArg startupArg)
        {
            Log.Debug("Entered from Initialize");

            Glass.Enable = CoreGlobals.AppPreferences.EnableGlass;

            Glass.EvtShowGlass += Glass_EvtShowGlass;

            StartupArg = startupArg;

            ScannerForm.AutoScaleMode = AutoScaleMode.None;

            ScannerForm.TopMost = true;

            Windows.ShowWindowBorder(ScannerForm,
                                    CoreGlobals.AppPreferences.ScannerShowBorder,
                                    CoreGlobals.AppPreferences.ScannerShowTitleBar ? ScannerForm.Text : String.Empty);

            Windows.EvtWindowPositionChanged += Windows_EvtWindowPositionChanged;

            ScannerForm.SizeChanged += ScannerForm_SizeChanged;

            subscribeTalkWindowManager();

            ScannerForm.Shown += form_Shown;
            ScannerForm.VisibleChanged += form_VisibleChanged;

            _dialogMode = startupArg.DialogMode;

            var configFile = startupArg.ConfigFileName;
            if (String.IsNullOrEmpty(configFile))
            {
                configFile = PanelConfigMap.GetConfigFileForScreen(ScannerForm.GetType());
            }

            bool retVal = initWidgetManager(configFile);

            if (retVal)
            {
                retVal = initAnimationManager(configFile);
            }

            if (retVal)
            {
                createIdleTimer();
            }

            PositionSizeController.Initialize();

            PositionSizeController.AutoSetPosition();

            _windowOverlapWatchdog = new WindowOverlapWatchdog(ScannerForm);

            WindowActivityMonitor.EvtWindowMonitorHeartbeat += WindowActivityMonitor_EvtWindowMonitorHeartbeat;

            Log.Debug("Returning from Initialize");
            return retVal;
        }
예제 #14
0
        /// <summary>
        /// Initialzes the scanner
        /// </summary>
        /// <param name="startupArg">Starting arguments</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _scannerCommon = new ScannerCommon(this);
            _scannerHelper = new ScannerHelper(this, startupArg);

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return false;
            }

            Context.AppPanelManager.PausePanelChangeRequests();

            return true;
        }
        /// <summary>
        /// Intitialize the class
        /// </summary>
        /// <param name="startupArg">startup params</param>
        /// <returns>true on cussess</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _alphabetScannerCommon = new AlphabetScannerCommon(this);

            _alphabetScannerCommon.EvtFormatPreditionWord += _homeScreenCommon_EvtFormatPreditionWord;

            bool retVal = _alphabetScannerCommon.Initialize(startupArg);
            if (retVal)
            {
                ScannerCommon.CreateStatusBar();
            }

            //FormBorderStyle = FormBorderStyle.Sizable;
            ControlBox = true;
            return retVal;
        }
예제 #16
0
        /// <summary>
        /// Initializes the class
        /// </summary>
        /// <param name="startupArg">startup parameter</param>
        /// <returns></returns>
        public bool Initialize(StartupArg startupArg)
        {
            Log.Debug();
            PanelClass = startupArg.PanelClass;
            startupCommandArg = startupArg.Arg;
            this.startupArg = startupArg;

            _scannerHelper = new ScannerHelper(this, startupArg);
            scannerCommon = new ScannerCommon(this);

            if (!scannerCommon.Initialize(startupArg))
            {
                return false;
            }

            rootWidget = scannerCommon.GetRootWidget();
            return true;
        }
예제 #17
0
파일: PanelManager.cs 프로젝트: glwu/acat
 /// <summary>
 /// Creates the panel with the specified panel class
 /// </summary>
 /// <param name="panelClass">the panel class</param>
 /// <param name="panelTitle">panel title</param>
 /// <param name="startupArg">statrtup arg for the panel</param>
 /// <returns>the form for the panel</returns>
 public Form CreatePanel(String panelClass, String panelTitle, StartupArg startupArg)
 {
     return getTopOfStack().CreatePanel(panelClass, panelTitle, startupArg);
 }
예제 #18
0
 /// <summary>
 /// Creates the panel with the specified panel class
 /// </summary>
 /// <param name="panelClass">the panel class</param>
 /// <param name="title">title of the panel</param>
 /// <returns>the form for the panel</returns>
 public Form CreatePanel(String panelClass, String title)
 {
     StartupArg startupArg = new StartupArg(panelClass)
     {
         ConfigFileName = PanelConfigMap.GetConfigFileForPanel(panelClass)
     };
     return CreatePanel(panelClass, title, startupArg);
 }
예제 #19
0
 /// <summary>
 /// Creates the panel with the specified panel class
 /// </summary>
 /// <param name="panelClass">the panel class</param>
 /// <param name="panelTitle">panel title</param>
 /// <param name="startupArg">statrtup arg for the panel</param>
 /// <returns>the form for the panel</returns>
 public Form CreatePanel(String panelClass, String panelTitle, StartupArg startupArg)
 {
     return(getTopOfStack().CreatePanel(panelClass, panelTitle, startupArg));
 }
예제 #20
0
 /// <summary>
 /// Intitializes the class
 /// </summary>
 /// <param name="startupArg">startup param</param>
 /// <returns>true on success</returns>
 public bool Initialize(StartupArg startupArg)
 {
     _alphabetScannerCommon = new AlphabetScannerCommon(this);
     return _alphabetScannerCommon.Initialize(startupArg);
 }
예제 #21
0
 /// <summary>
 /// Intitialize the class
 /// </summary>
 /// <param name="startupArg">startup params</param>
 /// <returns>true on cussess</returns>
 public bool Initialize(StartupArg startupArg)
 {
     _alphabetScannerCommon = new AlphabetScannerCommon(this);
     _alphabetScannerCommon.EvtFormatPreditionWord += _homeScreenCommon_EvtFormatPreditionWord;
     return _alphabetScannerCommon.Initialize(startupArg);
 }
예제 #22
0
        /// <summary>
        /// Initialize the class
        /// </summary>
        /// <param name="arg">startup arg</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg arg)
        {
            Log.Debug();

            PanelClass = arg.PanelClass;
            startupCommandArg = arg.Arg;
            startupArg = arg;

            _scannerHelper = new ScannerHelper(this, startupArg);
            scannerCommon = new ScannerCommon(this);

            if (!scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return false;
            }

            rootWidget = scannerCommon.GetRootWidget();
            return true;
        }
예제 #23
0
        /// <summary>
        /// Creates the panel with the specified panel class
        /// </summary>
        /// <param name="panelClass">the panel class</param>
        /// <param name="panelTitle">panel title</param>
        /// <param name="startupArg">statrtup arg for the panel</param>
        /// <returns>the form for the panel</returns>
        public Form CreatePanel(String panelClass, String panelTitle, StartupArg startupArg)
        {
            Log.Debug("panelClass: " + panelClass);
            Form form = CreatePanel(ref panelClass, panelTitle, IntPtr.Zero, null);
            Log.IsNull("Form for this panel ", form);
            if (form is IScannerPanel)
            {
                var scannerPanel = form as IScannerPanel;
                if (String.IsNullOrEmpty(startupArg.ConfigFileName))
                {
                    startupArg.ConfigFileName = PanelConfigMap.GetConfigFileForPanel(panelClass);
                }

                scannerPanel.Initialize(startupArg);
            }

            Log.Debug("Returning form from createPanel");
            return form;
        }
        /// <summary>
        /// Initializes the form
        /// </summary>
        /// <param name="startupArg">Startup arg</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _scannerCommon = new ScannerCommon(this);

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return false;
            }

            return true;
        }
예제 #25
0
        /// <summary>
        /// Initialzes the scanner
        /// </summary>
        /// <param name="startupArg">Starting arguments</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _scannerCommon = new ScannerCommon(this);
            _scannerHelper = new ScannerHelper(this, startupArg);

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return false;
            }

            _scannerCommon.CreateStatusBar();

            return true;
        }
예제 #26
0
        /// <summary>
        /// Initialzies the specified scanner panel
        /// </summary>
        /// <param name="scannerPanel">panel to initialize</param>
        /// <param name="arg">panel arguments</param>
        /// <returns>true on success</returns>
        private bool initializePanel(IScannerPanel scannerPanel, PanelRequestEventArgs arg)
        {
            var startupArg = new StartupArg
            {
                FocusedElement = arg.MonitorInfo.FocusedElement,
                PanelClass = arg.PanelClass,
                ConfigFileName = PanelConfigMap.GetConfigFileForPanel(arg.PanelClass),
                Arg = arg.RequestArg
            };

            Log.Debug("panelClass:  " + arg.PanelClass + ", ConfigFIle: " + startupArg.ConfigFileName);
            return scannerPanel.Initialize(startupArg);
        }
예제 #27
0
 /// <summary>
 /// Creates the panel with the specified panel class
 /// </summary>
 /// <param name="panelClass">the panel class</param>
 /// <returns>the form for the panel</returns>
 public Form CreatePanel(String panelClass)
 {
     var startupArg = new StartupArg(panelClass)
     {
         ConfigFileName = PanelConfigMap.GetConfigFileForPanel(panelClass)
     };
     return CreatePanel(panelClass, String.Empty, startupArg);
 }
예제 #28
0
        /// <summary>
        /// Intitializes the class
        /// </summary>
        /// <param name="startupArg">startup params</param>
        /// <returns>true on cussess</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _alphabetScannerCommon = new AlphabetScannerCommon(this);

            _alphabetScannerCommon.EvtFormatPreditionWord += _alphabetScannerCommon_EvtFormatPreditionWord;

            bool retVal = _alphabetScannerCommon.Initialize(startupArg);
            if (retVal)
            {
                ScannerCommon.CreateStatusBar();
            }

            return retVal;
        }
예제 #29
0
        /// <summary>
        /// Creates and initializes the startup arg required to start the
        /// scanner for the widget
        /// </summary>
        /// <param name="widget"></param>
        /// <returns></returns>
        private StartupArg createStartupArgForScanner(Widget widget)
        {
            var startupArg = new StartupArg
            {
                DialogMode = true,
                FocusedElement = AutomationElement.FromHandle(widget.UIControl.Handle),
            };

            return startupArg;
        }
예제 #30
0
        /// <summary>
        /// Initialzes this class
        /// </summary>
        /// <param name="startupArg">startup args</param>
        /// <returns>true on success</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _scannerCommon = new ScannerCommon(this) { PositionSizeController = { AutoPosition = true } };

            if (!_scannerCommon.Initialize(startupArg))
            {
                Log.Debug("Could not initialize form " + Name);
                return false;
            }

            PanelManager.Instance.EvtScannerShow += Instance_EvtScannerShow;
            PanelManager.Instance.EvtScannerClosed += Instance_EvtScannerClosed;

            return true;
        }
예제 #31
0
        /// <summary>
        /// Intitialize the class
        /// </summary>
        /// <param name="startupArg">startup params</param>
        /// <returns>true on cussess</returns>
        public bool Initialize(StartupArg startupArg)
        {
            _alphabetScannerCommon = new AlphabetScannerCommon(this);

            bool retVal = _alphabetScannerCommon.Initialize(startupArg);
            if (retVal)
            {
                ScannerCommon.CreateStatusBar();
            }

            return retVal;
        }