Contains numerous functions for window manipulation, window sizing, window positioning, etc. Has cross-thread invoke-required functions for most of the commonly used windows functions
Exemplo n.º 1
0
 /// <summary>
 /// Docks this scanner to the companian scanner
 /// </summary>
 /// <param name="scanner">companian scanner</param>
 private void dockToScanner(Form scanner)
 {
     if (scanner is IScannerPanel)
     {
         Windows.DockWithScanner(this, scanner, Context.AppWindowPosition);
     }
 }
Exemplo n.º 2
0
        /// <summary>
        /// Handle actuation of a widget - navigate, select language
        /// etc depending on what the widget represents
        /// </summary>
        /// <param name="widget">widget to actuate</param>
        /// <param name="handled">true if handled</param>
        private void handleWidgetSelection(Widget widget, ref bool handled)
        {
            if (widget.UserData is CultureInfo)
            {
                onLanguageSelected((CultureInfo)widget.UserData);
                handled = true;
            }
            else
            {
                handled = true;
                switch (widget.Value)
                {
                case "@Quit":
                    Windows.CloseAsync(this);
                    break;

                case "@CmdNextPage":
                    gotoNextPage();
                    break;

                case "@CmdPrevPage":
                    gotoPreviousPage();
                    break;

                default:
                    handled = false;
                    break;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Key press handler.  Process the ESC key to quit
        /// </summary>
        /// <param name="sender">event sender</param>
        /// <param name="e">event args</param>
        private void _keyboardActuator_EvtKeyPress(object sender, KeyPressEventArgs e)
        {
            int c = e.KeyChar;

            if (c == 27)
            {
                Windows.CloseAsync(this);
            }
        }
Exemplo n.º 4
0
 /// <summary>
 /// Delete the file
 /// </summary>
 /// <param name="fileInfo">info about the file</param>
 private void handleDeleteFile(FileInfo fileInfo)
 {
     if (DialogUtils.ConfirmScanner(String.Format(R.GetString("DeleteFileQ"), fileInfo.Name)))
     {
         Windows.SetText(SearchFilter, String.Empty);
         File.Delete(fileInfo.FullName);
         loadFiles();
     }
 }
Exemplo n.º 5
0
 /// <summary>
 /// Docks this scanner to the companian scanner
 /// </summary>
 /// <param name="scanner">companian scanner</param>
 private void dockToScanner(Form scanner)
 {
     if (scanner is IScannerPanel)
     {
         if (((IPanel)scanner).PanelCommon.DisplayMode != DisplayModeTypes.Popup)
         {
             Windows.DockWithScanner(this, scanner, Context.AppWindowPosition);
         }
     }
 }
Exemplo n.º 6
0
 /// <summary>
 /// Confirm and close the scanner
 /// </summary>
 private void close()
 {
     if (EvtDone != null)
     {
         EvtDone.BeginInvoke(false, null, null);
     }
     else
     {
         if (DialogUtils.ConfirmScanner(PanelManager.Instance.GetCurrentForm(), R.GetString("CloseQ")))
         {
             Windows.CloseForm(this);
         }
     }
 }
Exemplo n.º 7
0
        /// <summary>
        /// Docks this scanner to the companian scanner
        /// </summary>
        /// <param name="scanner">companian scanner</param>
        private void dockToScanner(Form scanner)
        {
            if (!Windows.GetVisible(this))
            {
                return;
            }

            if (scanner is IScannerPanel)
            {
                if (((IPanel)scanner).PanelCommon.DisplayMode != DisplayModeTypes.Popup)
                {
                    Windows.DockWithScanner(this, scanner, Context.AppWindowPosition);
                    Windows.SetTopMost(scanner);
                }
            }

            if (Left < 0)
            {
                Left = 0;
            }
        }
Exemplo n.º 8
0
        /// <summary>
        /// User selected a language from the list.  If reqd,
        /// ask the user to confirm the switch
        /// </summary>
        /// <param name="cultureInfo">Cultureinfo of the language selected</param>
        /// <returns>true on success</returns>
        private void onLanguageSelected(CultureInfo cultureInfo)
        {
            if (DialogUtils.ConfirmScanner(String.Format(R.GetString("ConfirmSwitchLanguage"), cultureInfo.DisplayName)))
            {
                Windows.SetVisible(this, false);

                var toastForm = new ToastForm(R.GetString("PleaseWait"), -1);
                Windows.SetWindowPosition(toastForm, Windows.WindowPosition.CenterScreen);
                toastForm.Show();

                Invoke(new MethodInvoker(delegate
                {
                    Context.ChangeCulture(cultureInfo);
                }));

                toastForm.Close();

                var prefs = ACATPreferences.Load();
                prefs.Language = cultureInfo.Name;
                prefs.Save();

                Windows.CloseAsync(this);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Resort the file list and refresh it in the display
        /// </summary>
        private void switchSortOrder()
        {
            switch (_sortOrder)
            {
            case SortOrder.DateDescending:
                _sortOrder = SortOrder.DateAscending;
                break;

            case SortOrder.DateAscending:
                _sortOrder = SortOrder.AtoZ;
                break;

            case SortOrder.AtoZ:
                _sortOrder = SortOrder.ZtoA;
                break;

            case SortOrder.ZtoA:
                _sortOrder = SortOrder.DateDescending;
                break;
            }

            _pageNumber     = 0;
            _pageStartIndex = 0;
            _allFilesList   = getAllFiles(Folders, _sortOrder);
            _fileList       = filterFiles(_allFilesList, _includeFileExtensions, _excludeFileExtensions, Windows.GetText(SearchFilter));
            refreshFileList();
        }
Exemplo n.º 10
0
        /// <summary>
        /// Kicks off the background worker to display the calibration form
        /// </summary>
        /// <param name="position">where to display the form?</param>
        /// <param name="caption">caption of the form</param>
        /// <param name="prompt">any message to display?</param>
        /// <param name="timeout">calibration timeout</param>
        /// <param name="enableConfigure">should calibration button be enabled?</param>
        private void showCalibrationForm(Windows.WindowPosition position, String caption, String prompt, int timeout, bool enableConfigure)
        {
            _bgTaskDoneEvent.Reset();
            _bgWorker = new Worker
            {
                Prompt = prompt,
                Timeout = timeout,
                Caption = caption,
                EnableConfigure = enableConfigure,
                WorkerSupportsCancellation = true,
                WorkerReportsProgress = false,
                Position = position
            };

            _bgWorker.RunWorkerCompleted += bgWorker_RunCompleted;
            _bgWorker.DoWork += bgWorker_DoWork;
            _formCreatedEvent.Reset();
            _bgWorker.RunWorkerAsync();

            _formCreatedEvent.WaitOne();
        }
Exemplo n.º 11
0
 /// <summary>
 /// Delete the file
 /// </summary>
 /// <param name="itemTag">info about the file</param>
 private void handleDeleteFile(FileInfo fileInfo)
 {
     Windows.SetText(SearchFilter, String.Empty);
     File.Delete(fileInfo.FullName);
     loadFiles();
 }
Exemplo n.º 12
0
 /// <summary>
 /// The window position of the scanner changed.  Set
 /// the talk window position relative to the scanner.
 /// </summary>
 /// <param name="form">Scanner form</param>
 /// <param name="position">current position</param>
 private void Windows_EvtWindowPositionChanged(Form form, Windows.WindowPosition position)
 {
     if (form == ScannerForm)
     {
         Context.AppWindowPosition = position;
         notifyScannerShow();
     }
 }
Exemplo n.º 13
0
        /// <summary>
        /// Docks the scanner to another window (the parent parameter)
        /// </summary>
        /// <param name="parent">window to dock to</param>
        /// <param name="position">relative position of docking</param>
        public void DockScanner(IntPtr parent, Windows.WindowPosition position)
        {
            _dock = true;
            AutoPosition = false;

            _dockScanner = new DockScanner(parent, _form, position);
            if (Windows.GetVisible(_form))
            {
                _dockScanner.Dock();
            }
        }
Exemplo n.º 14
0
 /// <summary>
 /// Set focus to this scanner
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="e">event args</param>
 private void FileBrowserScanner_Shown(object sender, EventArgs e)
 {
     Windows.SetForegroundWindow(Handle);
     Windows.ClickOnWindow(this);
 }
Exemplo n.º 15
0
 /// <summary>
 /// Displays the calibartion form if it is not already
 /// displayed. Updates the caption, prompt on the form
 /// </summary>
 /// <param name="position">where to display the form?</param>
 /// <param name="caption">caption of the form</param>
 /// <param name="prompt">any message to display?</param>
 /// <param name="timeout">calibration timeout</param>
 /// <param name="enableConfigure">should calibration button be enabled?</param>
 public void UpdateCalibrationStatus(Windows.WindowPosition position, String caption, String prompt, int timeout, bool enableConfigure)
 {
     if (calibrationForm == null)
     {
         showCalibrationForm(position, caption, prompt, timeout, enableConfigure);
     }
     else if (calibrationForm.Visible)
     {
         calibrationForm.Update(caption, prompt);
     }
 }
Exemplo n.º 16
0
 /// <summary>
 /// The search filter changed.  Reload the file list
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="e">event args</param>
 private void SearchFilter_TextChanged(object sender, EventArgs e)
 {
     _pageNumber     = 0;
     _pageStartIndex = 0;
     _fileList       = filterFiles(_allFilesList, _includeFileExtensions, _excludeFileExtensions, Windows.GetText(SearchFilter));
     refreshFileList();
 }
Exemplo n.º 17
0
        /// <summary>
        /// Look at filters, load files from the  specified folders
        /// </summary>
        private void loadFiles()
        {
            _allFilesList = getAllFiles(Folders, _sortOrder);
            _fileList     = filterFiles(_allFilesList, _includeFileExtensions, _excludeFileExtensions, Windows.GetText(SearchFilter));

            if (_tabStopButtonCount >= 3)
            {
                _entriesPerPage = _tabStopButtonCount - 2;
                refreshFileList();
            }
        }
Exemplo n.º 18
0
 /// <summary>
 /// Set focus to this scanner
 /// </summary>
 /// <param name="sender">event sender</param>
 /// <param name="e">event args</param>
 private void SwitchLanguageScanner_Shown(object sender, EventArgs e)
 {
     Windows.SetForegroundWindow(Handle);
     Windows.ClickOnWindow(this);
 }
Exemplo n.º 19
0
 /// <summary>
 /// Initializes a new instance of the class.
 /// </summary>
 /// <param name="windowHandleDockTo">handle of window to dock to</param>
 /// <param name="form">the dockee</param>
 /// <param name="dockPosition">Relative position of dock</param>
 public DockScanner(IntPtr windowHandleDockTo, Form form, Windows.WindowPosition dockPosition)
 {
     _windowHandleDockTo = windowHandleDockTo;
     _form = form;
     _automationElementDockTo = null;
     _dockPosition = dockPosition;
 }