Skip to content
Alen Pelin edited this page Jul 2, 2015 · 1 revision

UI Helpers

Some most typical UI-related operations are aggregated in several static helper classes: WindowHelper, MainWindowHelper, AuthenticationHelper and InstanceHelperEx.

WindowHelper

Type: SIM.Tool.Base.WindowHelper, SIM.Tool.Base

This is very handy class for a variety of things, not only windows.

+ AskForSelection (title, header, message, items, window, ...)

This method raises native Windows select dialog if specific conditions are met or custom multi-select window that waits for users input.

+ Ask (title, defaultValue, window)

The wrapper around a custom input dialog that prompts user to input some text value

+ LongRunningTask (action, title, window, message, ...)

Executes the action in a thread showing native Windows progress dialog.

+ ShowDialog (window, owner)

The wrapper that shows a modal window or regular window depending on the settings.

+ ShowWindow (window, owner)

The wrapper that shows a window and handles all thrown exceptions.

+ ShowMessage (message, ...)

The wrapper around MessageBox with correct title inserted.

+ OpenInBrowser (url, isFrontEnd)

Opens specific URL in specific browser specified in settings.

+ OpenFolder (path)

Opens specific path in Windows Explorer.

+ OpenFile (path)

Opens specific file in default editor.

MainWindowHelper

Type: SIM.Tool.Windows.MainWindowHelper, SIM.Tool.Windows

A helper class for manipulating main window, legacy code that is being refactored into commands located in MainWindowComponents namespace.

AuthenticationHelper

Type: SIM.Tool.Base.AuthenticationHelper, SIM.Tool.Base

+ LoginAsAdmin (instance, url)

A helper class for bypassing authentication of local instance. The logic is simple and secure:

  • call to the LoginAsAdmin (instance, url) method creates unique key
  • the key lifetime is limited to 15 seconds
  • the /sitecore/shell/sim-agent folder is being created and the .aspx page is created inside
  • the page will be deleted either in 15 seconds or when first requested
  • requesting the page will authenticate current visitor as sitecore\admin

InstanceHelperEx

Type: SIM.Tool.Base.InstanceHelperEx, SIM.Tool.Base

A helper contains logic for exposing some UI-related logic related to specific Sitecore instance.

+ BrowseInstance (instance, virtualPath, isFrontEnd)

Opens specific virtual path (e.g. /sitecore/admin) in front-end or back-end folder.

+ PreheatInstance (instance, window)

Checks if the instance has worker process and if it does not then requests keepalive page and waits for any response. This process is executed in background thread with visual progress indication.

+ OpenCurrentLogFile (instance, window)

Detects the types of log files instance has (e.g. log, crawling.log etc.) and suggest user to choose one. Then it looks for the most recently created file and opens it in bundled LogViewer app. If the instance restarts then LogViewer app is being closed and newly created log is opened instead.