コード例 #1
0
 public static MotivateDesktopNotifyIcon Instance()
 {
     if (instance == null)
     {
         instance = new MotivateDesktopNotifyIcon();
     }
     return instance;
 }
コード例 #2
0
 public static MotivateDesktopNotifyIcon Instance()
 {
     if (instance == null)
     {
         instance = new MotivateDesktopNotifyIcon();
     }
     return(instance);
 }
コード例 #3
0
 private void FailedGettingWallpaperPreview(object sender)
 {
     if (ShouldForceShowWallpaperPreviewWindow)
     {
         MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("出错了", "检查壁纸更新时出错.");
     }
     ShouldForceShowWallpaperPreviewWindow = false;
 }
コード例 #4
0
 public static void ExitApp()
 {
     App.Current.Dispatcher.Invoke(new Action(
                                       delegate
     {
         MotivateDesktopNotifyIcon.Instance().Hide();
         App.Current.Shutdown();
     }
                                       ), null);
 }
コード例 #5
0
        public void DownloadAndApplyWallpaper(DateTime date, WallpaperChecker.WallpaperFormats format)
        {
            MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("正在下载", "正在下载壁纸,完成后将自动设置为桌面壁纸.");
            isDownloading = true;
            string wallpaperUrl = getWallpaperUrl(date, format);

            if (wallpaperUrl != null)
            {
                downloadAndApply(wallpaperUrl);
            }
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        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();
        }
コード例 #8
0
 private void downloadAndApplyWallpaperFailed()
 {
     isDownloading = false;
     MotivateDesktopNotifyIcon.Instance().ShowBalloonTip("出错了", "下载设置壁纸失败.");
 }