private static void safeFlushOfCurrentlyDeferred() { if (m_ViewModelOfDeferredChange != null && m_PropertyNameOfDeferredChange != null) { m_ViewModelOfDeferredChange.NotifyPropertyChanged(m_PropertyNameOfDeferredChange); m_ViewModelOfDeferredChange = null; m_PropertyNameOfDeferredChange = null; } }
private void HValueChanged(ObservableBase sender, ValueChangedEventArgs <string> e) { var bSys = IsSystemUser(); if (bSys != SystemAccount) { SystemAccount.Value = bSys; } if (!IsPasswordEnabled) { ShowPassword.Value = false; } }
private static void onDeferringDelayTick(System.Object sender, System.EventArgs e) { System.Diagnostics.Debug.Assert(m_ViewModelOfDeferredChange != null); System.Diagnostics.Debug.Assert(m_PropertyNameOfDeferredChange != null); if (m_DeferringTimer.IsEnabled) { safeFlushOfCurrentlyDeferred(); } m_ViewModelOfDeferredChange = null; m_PropertyNameOfDeferredChange = null; m_DeferringTimer.Stop(); }
private void prepareModalPanel(Window panel, ObservableBase panelViewModel) { if (panel == null || panelViewModel == null) { return; } panel.Owner = this; // prevent tossing this window to background by Windows panel.DataContext = panelViewModel; panel.IsVisibleChanged += new DependencyPropertyChangedEventHandler(onAnyPanel_IsVisibleChanged); // Make sure the HWND is created for SettingsPanel, so that we'll be able to position it before showing it var hwndHelper = new WindowInteropHelper(panel); hwndHelper.EnsureHandle(); }
/// <summary> ///! \brief Notify listeners (but only after a delay) that the specified property has changed ///! \param propertyName Name of the property the change of which should be propagated with some delay /// </summary> protected void NotifyPropertyChangedDeferred(System.String propertyName) { if (m_DeferringTimer == null) { m_DeferringTimer = new System.Windows.Threading.DispatcherTimer(); m_DeferringTimer.Interval = new System.TimeSpan(0, 0, 0, 0, 400); m_DeferringTimer.Tick += new System.EventHandler(onDeferringDelayTick); } // Normally, we need just to extend the delay for the same property by restarting the timer. // But if it's a new request, then Flush the currently delayed property and delay the new one if (m_ViewModelOfDeferredChange != this || m_PropertyNameOfDeferredChange != propertyName) { if (m_DeferringTimer.IsEnabled) safeFlushOfCurrentlyDeferred(); m_ViewModelOfDeferredChange = this; m_PropertyNameOfDeferredChange = propertyName; } m_DeferringTimer.Stop(); m_DeferringTimer.Start(); }
private static void onDeferringDelayTick(System.Object sender, System.EventArgs e) { System.Diagnostics.Debug.Assert(m_ViewModelOfDeferredChange != null); System.Diagnostics.Debug.Assert(m_PropertyNameOfDeferredChange != null); if (m_DeferringTimer.IsEnabled) safeFlushOfCurrentlyDeferred(); m_ViewModelOfDeferredChange = null; m_PropertyNameOfDeferredChange = null; m_DeferringTimer.Stop(); }
private void HSystemAccountChanged(ObservableBase sender, ValueChangedEventArgs <bool> e) { Username.Value = SystemAccount ? Environment.MachineName + "\\SYSTEM" : CurrentUser(); }