コード例 #1
0
 public WeblogHeader(Control parent, PanelBody weblogPanelBody)
     : base(parent)
 {
     Caption = String.Empty ;
     _weblogPanelBody = weblogPanelBody ;
 }
コード例 #2
0
        public DefaultSidebarControl(ISidebarContext sidebarContext, IBlogPostEditingSite postEditingSite)
        {
            // This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            // record the post management context and subscribe to the post list changed event
            _postEditingSite = postEditingSite ;

            // subscribe to changes that require us to re-layout the sidebar
            _postEditingSite.WeblogChanged +=new WeblogHandler(_postEditingSite_WeblogChanged);
            _postEditingSite.WeblogSettingsChanged +=new WeblogSettingsChangedHandler(_postEditingSite_WeblogSettingsChanged);
            _postEditingSite.FrameWindow.Layout +=new LayoutEventHandler(FrameWindow_Layout);
            _postEditingSite.PostListChanged +=new EventHandler(_postEditingSite_PostListChanged);
            ContentSourceManager.GlobalContentSourceListChanged +=new EventHandler(ContentSourceManager_GlobalContentSourceListChanged);

            // add the tooltip
            _toolTip = new ToolTip2(components);
            _toolTip.InitialDelay = 750 ;

            // set the caption
            Text = ApplicationEnvironment.ProductName;
            AccessibleName = Res.Get(StringId.SidebarPanel) ;

            //	Turn on double buffered painting.
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // initialize components
            //_weblogPanelHeader = new PanelHeader(this, WEBLOG_PANEL_CAPTION);
            // _weblogPanelBody = new PanelBody();
            // _weblogHeader = new WeblogHeader(this, _weblogPanelBody) ;
            // _viewWeblogCommand = new LinkCommand(this, _toolTip, CommandId.ViewWeblog.ToString());
            // _viewWeblogCommand.Name = "ViewWeblog";
            // _viewWeblogAdminCommand = new LinkCommand(this, _toolTip, CommandId.ViewWeblogAdmin.ToString());
            // _viewWeblogAdminCommand.Name = "ViewWeblogAdmin";

            _headerControl = new SidebarHeaderControl();

            _openPanelHeader = new PanelHeader(this, OPEN_PANEL_CAPTION) ;
            _openPanelBody = new PanelBody();
            _draftsSectionHeader = new SectionHeader(this, DRAFTS_SECTION_CAPTION, SidebarColors.FirstSectionBottomColor );
            _draftsPostList = new DraftPostList(this, _toolTip, DRAFTS_SECTION_CAPTION);
            _draftsPostList.PostSelected +=new PostEventHandler(_draftsPostList_PostSelected);
            _draftsPostList.PostDeleteRequested +=new PostEventHandler(_draftsPostList_PostDeleteRequested);
            _openDraftCommand = new LinkCommand(this, "PostHtmlEditing.Sidebar.Images.OpenPost.png", MORE_DRAFTS_CAPTION, MORE_DRAFTS_ACCNAME, _toolTip, MORE_DRAFTS_TOOLTIP, CommandId.OpenDrafts.ToString());
            _recentPostsSectionHeader = new SectionHeader(this, RECENT_POSTS_SECTION_CAPTION, SidebarColors.SecondSectionBottomColor );
            _recentPostList = new RecentPostList(this, _toolTip, RECENT_POSTS_SECTION_CAPTION);
            _recentPostList.PostSelected +=new PostEventHandler(_recentPostList_PostSelected);
            _openPostCommand = new LinkCommand(this, "PostHtmlEditing.Sidebar.Images.OpenPost.png", MORE_POSTS_CAPTION, MORE_POSTS_ACCNAME, _toolTip, MORE_POSTS_TOOLTIP, CommandId.OpenRecentPosts.ToString());
            _insertPanelHeader = new PanelHeader(this, INSERT_PANEL_CAPTION);
            _insertPanelBody = new PanelBody();
            _insertLinkCommand = new LinkCommand(this, "PostHtmlEditing.Sidebar.Images.InsertLink.png", INSERT_LINK_CAPTION, INSERT_LINK_ACCNAME, _toolTip, INSERT_LINK_TOOLTIP, CommandId.InsertLink.ToString());
            _insertPictureCommand = new LinkCommand(this, "BlogThis.ItemTypes.Images.ImageItem.png", INSERT_PICTURE_CAPTION, INSERT_PICTURE_ACCNAME, _toolTip, INSERT_PICTURE_TOOLTIP, CommandId.InsertPictureFromFile.ToString());

            ContentSourceInfo csi = ContentSourceManager.GetContentSourceInfoById(PhotoAlbumContentSource.ID);
            if (csi != null)
            {
                _insertPhotoAlbumCommand = new LinkCommand(this, csi.Image,
                    String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi.InsertableContentSourceSidebarText),
                    String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi.InsertableContentSourceSidebarText),
                    _toolTip,
                    null,
                    PhotoAlbumContentSource.ID);
            }

            ContentSourceInfo csi2 = ContentSourceManager.GetContentSourceInfoById(WebImageContentSource.ID);
            if (csi2 != null)
            {
                _insertWebImage = new LinkCommand(this, csi2.Image,
                    String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi2.InsertableContentSourceSidebarText),
                    String.Format(CultureInfo.CurrentCulture, Res.Get(StringId.PluginInsertSidebarText), csi2.InsertableContentSourceSidebarText),
                    _toolTip,
                    null,
                    WebImageContentSource.ID);
            }

            _insertTableCommand = new LinkCommand(this, "Tables.Commands.Images.CommandInsertTableCommandBarButtonBitmapEnabled.png", INSERT_TABLE_CAPTION, INSERT_TABLE_ACCNAME, _toolTip, INSERT_TABLE_TOOLTIP, CommandId.InsertTable.ToString());
            _contentInsertCommands = new ContentInsertCommands(this, _toolTip, LINK_COMMAND_PADDING, int.MaxValue);
            _separator2 = new SeparatorControl();

            Controls.Add(_separator2);
            Controls.Add(_headerControl);

            UpdatePostLists() ;
        }