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