/// <summary> /// Sets up calibration procedure and wires the events. Reads settings from file. /// </summary> protected override void Initialize() { #if ASL // Create Port COM Object this.aslPort = new ASLSerialOutPort3Class(); // ??? this.stopwatch2 = new Stopwatch(); // Load Asl tracker settings. if (File.Exists(this.UserSettingsFile)) { this.settings = UserSettings.Load(this.UserSettingsFile); } else { this.settings = new UserSettings(); this.settings.Store(this.UserSettingsFile); } #endif }
/// <summary> /// Unserialize an UserSettings object /// </summary> /// <returns>UserSettings object</returns> public UserSettings Load() { this.settingsFile = Ogama.Properties.Settings.Default.EyeTrackerSettingsPath + "ASLUserSettings.cfg"; string errorMsg; var result = (UserSettings)AslUtil.LoadXml(typeof(UserSettings), this.settingsFile, true/*create new*/, out errorMsg); if (result == null) { MessageBox.Show(errorMsg, "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning); result = new UserSettings(); } return result; }
/////////////////////////////////////////////////////////////////////////////// // Public methods // /////////////////////////////////////////////////////////////////////////////// #region PUBLICMETHODS #endregion //PUBLICMETHODS /////////////////////////////////////////////////////////////////////////////// // Inherited methods // /////////////////////////////////////////////////////////////////////////////// #region OVERRIDES #endregion //OVERRIDES /////////////////////////////////////////////////////////////////////////////// // Eventhandler // /////////////////////////////////////////////////////////////////////////////// #region EVENTHANDLER /// <summary> /// The on Load event handler for the dialog. /// </summary> /// <param name="sender">Source of the event</param> /// <param name="e">An empty <see cref="EventArgs"/></param> private void AslSettingsDialog_Load(object sender, EventArgs e) { #if ASL this.userSettings = UserSettings.Load(this.aslTracker.SettingsFile); #endif this.InitializeControls(); // Initialize interface this.serialOutClass.Notify += new _IASLSerialOutPort2Events_NotifyEventHandler(this.OnNotify); this.EnableDisable(); this.StreamingCheckbox_CheckedChanged(sender, e); this.somethingChange = false; }
/////////////////////////////////////////////////////////////////////////////// // Public methods // /////////////////////////////////////////////////////////////////////////////// #region PUBLICMETHODS #if ASL /// <summary> /// Unserialize an UserSettings object /// </summary> /// <param name="fileName">Target file name </param> /// <returns>UserSettings object</returns> public static UserSettings Load(string fileName) { string errorMsg; var result = (UserSettings)AslUtil.LoadXml(typeof(UserSettings), fileName, true/*create new*/, out errorMsg); if (result == null) { MessageBox.Show(errorMsg, "WARNING", MessageBoxButtons.OK, MessageBoxIcon.Warning); result = new UserSettings(); } return result; }
/////////////////////////////////////////////////////////////////////////////// // Construction and Initializing methods // /////////////////////////////////////////////////////////////////////////////// #region CONSTRUCTION /// <summary> /// Initializes a new instance of the aslSettingsDialog class. /// </summary> /// <param name="tracker">The <see cref="AslTracker"/> to be used</param> /// <param name="aslSerialPort">The connection to the dll.</param> public aslSettingsDialog(AslTracker tracker, ASLSerialOutPort3Class aslSerialPort) { this.records = new ArrayList(); // call the Windows Form Designer generated method this.InitializeComponent(); this.aslTracker = tracker; this.userSettings = this.aslTracker.Settings; this.serialOutClass = aslSerialPort; // call the additional local initialize method this.CustomInitialize(); this.InitializeControls(); this.somethingChange = false; }