Show
Ignore:
Timestamp:
09/01/08 09:03:20 (4 months ago)
Author:
poolmmjp
Message:
  • fav状況を★マークで表示するようにした(Twitter/FriendFeed)。
  • ★マークをクリックしてfavできるようにした(Twitter/FriendFeed/Wassr/はてなハイク)。
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/csharp/MMMMB/MMMMB/MiniBlogView.cs

    r14118 r18564  
    183183                item.SetValue("content", e.Content); 
    184184                item.SetValue("time", toShortDate(e.Date)); 
     185 
     186                string ex = ""; 
     187                if (miniBlog is IFavoritable) 
     188                { 
     189                    FavoriteProperty fav = (FavoriteProperty)e.ExtendedProperties["favorited"]; 
     190                    Template favorited = new Template("favorited"); 
     191                    favorited.SetValue("value", (fav.Favorited ? "on" : "off")); 
     192                    favorited.SetValue("permalink", e.Permalink.ToString()); 
     193                    favorited.SetValue("featurename", ((IFavoritable)miniBlog).FeatureName); 
     194                    ex += favorited.ToString(); 
     195                } 
     196                item.SetValue("extended", ex); 
     197 
    185198                sb.Insert(0, item.ToString()); 
    186199            } 
     
    220233        { 
    221234            ContextMenuStrip menu = new ContextMenuStrip(); 
    222  
    223             if (miniBlog is IFavoritable) 
    224             { 
    225                 IFavoritable favable = (IFavoritable)miniBlog; 
    226                 ToolStripItem fav = new ToolStripMenuItem(favable.FeatureName + "(&F)"); 
    227                 fav.Click += new EventHandler(delegate(object sender, EventArgs e){ 
    228                     favable.Create(permalink); 
    229                 }); 
    230                 menu.Items.Add(fav); 
    231                 menu.Items.Add(new ToolStripSeparator()); 
    232             } 
    233235 
    234236            ToolStripItem open = new ToolStripMenuItem("�J��(&O)"); 
     
    247249        } 
    248250 
     251        public void FavoriteClick(string permalink) 
     252        { 
     253            FavoriteProperty fav = null; 
     254            foreach (Entry e in entryList) 
     255            { 
     256                if (e.Permalink.ToString() == permalink) 
     257                { 
     258                    fav = (FavoriteProperty)e.ExtendedProperties["favorited"]; 
     259                } 
     260            } 
     261            if (fav == null) return; 
     262 
     263            IFavoritable favable = (IFavoritable)miniBlog; 
     264            if (!fav.Favorited) 
     265            { 
     266                favable.Create(permalink); 
     267                fav.Favorited = true; 
     268            } 
     269            else 
     270            { 
     271                favable.Destroy(permalink); 
     272                fav.Favorited = false; 
     273            } 
     274            Redraw(); 
     275        } 
     276 
    249277        public void OnScroll(int scrollY) 
    250278        {