public MainWindow() { AddSampleCrumbs(); InitializeComponent(); Timer timer = new Timer(5000); timer.Elapsed += (sneder, args) => { Dispatcher.Invoke(new Action(() => { if (IsVisible) { Hide(); } else { Show(); } })); }; TimeDurationTextBox.Text = ScrollAnimationBehavior.GetTimeDuration(SmoothScrollTestListView).ToString(); ShaleHueSlider.Value = _accent.Hue; ShaleSaturationSlider.Value = _accent.Saturation; Application.Current.Resources.MergedDictionaries.Add(_accent.Dictionary); ShaleHueSlider.ValueChanged += ShaleSliders_ValueChanged; ShaleSaturationSlider.ValueChanged += ShaleSliders_ValueChanged; }
private void EnableSmoothScrollingCheckBox_Checked(object sender, RoutedEventArgs e) { bool enable = EnableSmoothScrollingCheckBox.IsChecked == true; ScrollAnimationBehavior.SetIsEnabled(SmoothScrollTestListView, enable); Debug.WriteLine("EnableSmoothScrollingCheckBox_Checked: " + enable); }
private void TimeDurationTextBox_TextChanged(object sender, TextChangedEventArgs e) { if (TimeSpan.TryParse(TimeDurationTextBox.Text, out TimeSpan resultTime)) { ScrollAnimationBehavior.SetTimeDuration(SmoothScrollTestListView, resultTime); TimeDurationBorder.BorderBrush = new SolidColorBrush(Colors.Transparent); Debug.WriteLine("TimeDurationTextBox_TextChanged: " + true); } else { TimeDurationBorder.BorderBrush = new SolidColorBrush(Colors.Red); Debug.WriteLine("TimeDurationTextBox_TextChanged: " + false); } }
private void ScrollAnimationComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { EasingFunctionBase ease = null; if (AnimationTypeComboBox.SelectedIndex != 0) { Type easeType = /*(*/ AnimationTypeComboBox.SelectedItem /* as ComboBoxItem).Content*/.GetType(); ease = (EasingFunctionBase)Activator.CreateInstance(easeType); ease.EasingMode = (EasingMode)Enum.Parse(typeof(EasingMode), ((ComboBoxItem)EasingModeComboBox.SelectedItem).Content.ToString()); } ScrollAnimationBehavior.SetEasingFunction(SmoothScrollTestListView, ease); Debug.WriteLine("ScrollAnimationComboBox_SelectionChanged"); }