/// <summary> /// Enable the connection for use. /// </summary> public void Connect() { if (Connection == IntPtr.Zero) { throw new ApplicationException("Connection not established."); } if (WindowTimer.Enabled) { throw new ApplicationException("Connection timer already running."); } WindowTimer.Start(); }
/// <summary> /// Called by the timer package when the window timer elapses, on the /// main thread. /// </summary> /// <param name="sender">Unused.</param> /// <param name="e">Unused.</param> private void WindowTimer_Tick(object sender, EventArgs e) { if (Connection == IntPtr.Zero) { return; } // // Allow the NetLayerWindow package to perform periodic, time-based // tasks, and set the timer for future expiration. // WindowTimer.Interval = (int)AuroraServerNetLayerTimeout(Connection); WindowTimer.Start(); }
/// <summary> /// Dispose the object. /// </summary> /// <param name="Disposing">Supplies true if called from /// Dispose.</param> private void Dispose(bool Disposing) { // // Clean up unmanaged resources and stop the timer. // if (Connection != IntPtr.Zero) { AuroraServerNetLayerDestroy(Connection); Connection = IntPtr.Zero; } if (WindowTimer.Enabled) { WindowTimer.Stop(); } }
/// <summary> /// Event to close the window when the timer has elapsed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void WindowTimer_Tick(object sender, EventArgs e) { // Returns that the window was closed correctly and stops the timer CookingPageViewModel.VM.confirmationWindow.DialogResult = true; WindowTimer.Stop(); }