public static MotivateDesktopNotifyIcon Instance() { if (instance == null) { instance = new MotivateDesktopNotifyIcon(); } return instance; }
public static MotivateDesktopNotifyIcon Instance() { if (instance == null) { instance = new MotivateDesktopNotifyIcon(); } return(instance); }
private void FailedGettingWallpaperPreview(object sender) { if (ShouldForceShowWallpaperPreviewWindow) { MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("出错了", "检查壁纸更新时出错."); } ShouldForceShowWallpaperPreviewWindow = false; }
public static void ExitApp() { App.Current.Dispatcher.Invoke(new Action( delegate { MotivateDesktopNotifyIcon.Instance().Hide(); App.Current.Shutdown(); } ), null); }
public void DownloadAndApplyWallpaper(DateTime date, WallpaperChecker.WallpaperFormats format) { MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("正在下载", "正在下载壁纸,完成后将自动设置为桌面壁纸."); isDownloading = true; string wallpaperUrl = getWallpaperUrl(date, format); if (wallpaperUrl != null) { downloadAndApply(wallpaperUrl); } }
private void Window_Loaded(object sender, RoutedEventArgs e) { this.Hide(); MotivateDesktopNotifyIcon.Instance(); WallpaperChecker.Instance().GotWallpaperPreview += new WallpaperChecker.GotWallpaperPreviewEventHandler(GotWallpaperPreview); WallpaperChecker.Instance().FailedGettingWallpaperPreview += new WallpaperChecker.FailedGettingWallpaperPreviewEventHandler(FailedGettingWallpaperPreview); checkWallpaper(); System.Timers.Timer checkWallpaperTimer = new System.Timers.Timer(15 * 60 * 1000); checkWallpaperTimer.Elapsed += new System.Timers.ElapsedEventHandler(checkWallpaperTimer_Elapsed); checkWallpaperTimer.Start(); setAutoexitTimerEnabled(MotivateDesktop.Properties.Settings.Default.AutoExit); }
private void setWallpaper_MouseDown(object sender, MouseEventArgs e) { WallpaperDownloader wallpaperDownloader = WallpaperDownloader.Instance(); if (wallpaperDownloader.IsDownloading) { MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("正在下载", "有一张壁纸正在下载,请等待下载完成..."); } else { System.Threading.Thread wallpaperDownloadThread = new System.Threading.Thread(new System.Threading.ThreadStart( delegate { wallpaperDownloader.DownloadAndApplyWallpaper(WallpaperChecker.Instance().WallpaperDate, WallpaperChecker.Instance().WallpaperFormat); } )); wallpaperDownloadThread.Start(); } AnimatedCloseMainWrapper(); }
private void downloadAndApplyWallpaperFailed() { isDownloading = false; MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("出错了", "下载设置壁纸失败."); }