/// <summary> /// End loading animation /// </summary> internal static void AjaxLoadingEnd() { if (ajaxLoading.Opacity != 0) { AnimationHelper.Fade(ajaxLoading, 0, TimeSpan.FromSeconds(.2)); } }
//// AjaxLoading ///// <summary> ///// Loads AjaxLoading and adds it to the window ///// </summary> //internal static void LoadAjaxLoading() //{ // ajaxLoading = new AjaxLoading // { // Focusable = false, // Opacity = 0 // }; // mainWindow.bg.Children.Add(ajaxLoading); //} /// <summary> /// Start loading animation /// </summary> internal static void AjaxLoadingStart() { if (ajaxLoading.Opacity != 1) { AnimationHelper.Fade(ajaxLoading, 1, TimeSpan.FromSeconds(.2)); } }
/// <summary> /// Reset to default state /// </summary> internal static void Unload() { mainWindow.Bar.ToolTip = mainWindow.Bar.Text = NoImage; mainWindow.Title = NoImage + " - " + AppName; canNavigate = false; mainWindow.img.Source = null; freshStartup = true; if (Pics != null) { Pics.Clear(); } PreloadCount = 0; Preloader.Clear(); FolderIndex = 0; mainWindow.img.Width = mainWindow.Scroller.Width = mainWindow.Scroller.Height = mainWindow.img.Height = double.NaN; xWidth = xHeight = 0; prevPicResource = null; if (!string.IsNullOrWhiteSpace(TempZipPath)) { DeleteTempFiles(); TempZipPath = string.Empty; } NoProgress(); AnimationHelper.Fade(ajaxLoading, 0, TimeSpan.FromSeconds(.2)); }
/// <summary> /// Timer starts Slideshow Fade animation. /// </summary> /// <param name="server"></param> /// <param name="e"></param> internal static async void SlideTimer_Elapsed(object server, System.Timers.ElapsedEventArgs e) { await Application.Current.MainWindow.Dispatcher.BeginInvoke((Action)(() => { AnimationHelper.Fade(mainWindow.img, 0, TimeSpan.FromSeconds(.5)); Pic(true, false); AnimationHelper.Fade(mainWindow.img, 1, TimeSpan.FromSeconds(.5)); })); }
/// <summary> /// Find scrollbar and start fade animation /// </summary> /// <param name="show"></param> internal static void ScrollbarFade(bool show) { var s = mainWindow.Scroller.Template.FindName("PART_VerticalScrollBar", mainWindow.Scroller) as System.Windows.Controls.Primitives.ScrollBar; if (show) { AnimationHelper.Fade(s, 1, TimeSpan.FromSeconds(.7)); } else { AnimationHelper.Fade(s, 0, TimeSpan.FromSeconds(1)); } }
/// <summary> /// Shows a black tooltip on screen in a given time /// </summary> /// <param name="message">The message to display</param> /// <param name="center">If centered or on bottom</param> /// <param name="time">How long until it fades away</param> internal static void ToolTipStyle(object message, bool center, TimeSpan time) { sexyToolTip.Visibility = Visibility.Visible; if (center) { sexyToolTip.Margin = new Thickness(0, 0, 0, 0); sexyToolTip.VerticalAlignment = VerticalAlignment.Center; } else { sexyToolTip.Margin = new Thickness(0, 0, 0, 15); sexyToolTip.VerticalAlignment = VerticalAlignment.Bottom; } sexyToolTip.SexyToolTipText.Text = message.ToString(); var anim = new DoubleAnimation(1, TimeSpan.FromSeconds(.5)); anim.Completed += (s, _) => AnimationHelper.Fade(sexyToolTip, TimeSpan.FromSeconds(1.5), time, 1, 0); sexyToolTip.BeginAnimation(UIElement.OpacityProperty, anim); }
/// <summary> /// Hides/shows interface elements with a fade animation /// </summary> /// <param name="show"></param> internal static async void FadeControlsAsync(bool show, double time = .5) { /// Might cause unnecessary cpu usage? Need to check await mainWindow.Dispatcher.BeginInvoke((Action)(() => { if (!Properties.Settings.Default.ShowInterface | Slidetimer.Enabled == true) { if (clickArrowRight != null && clickArrowLeft != null && x2 != null) { var fadeTo = show ? 1 : 0; var timespan = TimeSpan.FromSeconds(time); AnimationHelper.Fade(clickArrowLeft, fadeTo, timespan); AnimationHelper.Fade(clickArrowRight, fadeTo, timespan); AnimationHelper.Fade(x2, fadeTo, timespan); AnimationHelper.Fade(minus, fadeTo, timespan); } } ScrollbarFade(show); })); }