コード例 #1
0
        private void InitBtnState(ImgInfo imgInfo)
        {
            btn_love.Foreground    = Brushes.White;
            btn_dislike.Foreground = Brushes.White;
            btn_down.Foreground    = Brushes.White;

            Love love = UserDataManage.GetLove(imgInfo.Id);

            if (love != null)
            {
                if (love.Type == 1)
                {
                    btn_love.Foreground = Brushes.Red;
                }
                else if (love.Type == -1)
                {
                    btn_dislike.Foreground = Brushes.Red;
                }
            }
            Download down     = UserDataManage.GetDown(imgInfo.Id);
            string   fullName = System.IO.Path.Combine(this.DownPath, imgInfo.GetFileName());

            if (System.IO.File.Exists(fullName))
            {
                btn_down.Foreground = Brushes.Red;
                if (down == null)
                {
                    down = new Download()
                    {
                        PictureId = imgInfo.Id, Time = DateTime.Now, FullName = fullName, Valid = 1
                    };
                }
                else if (down.Valid == 0)
                {
                    down.Valid = 1;
                }
                UserDataManage.SaveDown(down, imgInfo);
            }
        }
コード例 #2
0
ファイル: ImageList.xaml.cs プロジェクト: HaiqTop/HWallpaper
        /// <summary>
        /// 初始化壁纸上显示的按钮状态
        /// </summary>
        /// <param name="imgInfo"></param>
        private void InitBtnState(ImgInfo imgInfo)
        {
            if (imgInfo == null)
            {
                return;
            }
            btnPanel.Tag             = imgInfo;
            btn_love.Foreground      = Brushes.White;
            btn_wallpaper.Foreground = Brushes.White;
            btn_dislike.Foreground   = Brushes.White;
            btn_down.Foreground      = Brushes.White;

            btnPanel.Visibility = Visibility.Visible;

            Love love = UserDataManage.GetLove(imgInfo.Id);

            if (love != null)
            {
                if (love.Type == 1)
                {
                    btn_love.Foreground = Brushes.Red;
                }
                else if (love.Type == -1)
                {
                    btn_dislike.Foreground = Brushes.Red;
                }
            }
            Download down     = UserDataManage.GetDown(imgInfo.Id);
            string   fullName = System.IO.Path.Combine(this.DownPath, imgInfo.GetFileName());

            if (System.IO.File.Exists(fullName))
            {
                btn_down.Foreground = Brushes.Red;
                UserDataManage.SetDown(fullName, imgInfo);
            }
        }