예제 #1
0
        public override void LoadItems()
        {
            items.Clear();

            int    i             = 0;
            string currentBlogId = _editingManager.CurrentBlog();

            foreach (BlogDescriptor blogDescriptor in BlogSettings.GetBlogs(true))
            {
                using (Blog blog = new Blog(blogDescriptor.Id))
                {
                    string blogName = GetShortenedBlogName(blog.Name);

                    if (blog.Image == null)
                    {
                        Bitmap defaultIcon = ResourceHelper.LoadAssemblyResourceBitmap("OpenPost.Images.BlogAccount.png");
                        items.Add(new GalleryItem(blogName, defaultIcon.Clone() as Bitmap, blog.Id));
                    }
                    else
                    {
                        items.Add(new GalleryItem(blogName, new Bitmap(blog.Image), blog.Id));
                    }

                    if (currentBlogId == blog.Id)
                    {
                        selectedIndex = i;
                    }
                }
                i++;
            }
            base.LoadItems();
        }
예제 #2
0
 void commandSelectBlog_ExecuteWithArgs(object sender, ExecuteEventHandlerArgs args)
 {
     if (WeblogSelected != null)
     {
         WeblogSelected(BlogSettings.GetBlogs(true)[commandSelectBlog.SelectedIndex].Id);
     }
 }
예제 #3
0
        IMenuCommandObject[] IDynamicCommandMenuContext.GetMenuCommandObjects()
        {
            // generate an array of command objects for the current list of weblogs
            ArrayList menuCommands = new ArrayList();

            foreach (BlogDescriptor blog in BlogSettings.GetBlogs(true))
            {
                menuCommands.Add(new SwitchWeblogMenuCommand(blog.Id, blog.Id == _editingManager.BlogId));
            }
            return((IMenuCommandObject[])menuCommands.ToArray(typeof(IMenuCommandObject)));
        }
예제 #4
0
        private void LoadData()
        {
            // take note of which profile is the default
            string defaultBlogId = BlogSettings.DefaultBlogId;

            BeginUpdate();

            Items.Clear();

            // load the profiles
            foreach (BlogDescriptor blog in BlogSettings.GetBlogs(true))
            {
                AddWeblogItem(BlogSettings.ForBlogId(blog.Id));
            }

            // select the first item in the list
            if (Items.Count > 0)
            {
                Items[0].Selected = true;
            }

            EndUpdate();
        }