/// <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); } }
/// <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; } } }
/// <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); } }
/// <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(); } }
/// <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); } } }
/// <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); } } }
/// <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; } }
/// <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); } }
/// <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(); }
/// <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(); }
/// <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(); }
/// <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(); } }
/// <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(); } }
/// <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); }
/// <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); } }
/// <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(); }
/// <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(); } }
/// <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); }
/// <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; }