コード例 #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);
            }
        }