Пример #1
0
        private static void OnIntervalSecondsChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            // WPF framework makes the call and value type is int.
            // Does not need to check the type.
            int newIntervalSeconds  = (int)e.NewValue;
            AutoReloadButton button = source as AutoReloadButton;

            button._timer.Interval = TimeSpan.FromSeconds(newIntervalSeconds);
        }
Пример #2
0
        private static void OnIsCheckedChanged(DependencyObject source, DependencyPropertyChangedEventArgs e)
        {
            bool             isChecked = (bool)e.NewValue;
            AutoReloadButton button    = source as AutoReloadButton;

            if (isChecked)
            {
                button._timer.Start();
                button.ExecuteAutoReloadCommand();
            }
            else
            {
                button._timer.Stop();
            }
        }