コード例 #1
0
        private void UpdatePluginList()
        {
            // clear existing list
            listViewInstalledPlugins.Items.Clear();
            imageListPlugins.Images.Clear();

            // re-initialize list
            int imageIndex = 0;

            ContentSourceInfo[] pluginContentSources = ContentSourceManager.PluginContentSources;
            foreach (ContentSourceInfo pluginContentSource in pluginContentSources)
            {
                imageListPlugins.Images.Add(BidiHelper.Mirror(pluginContentSource.Image));
                ListViewItem listViewItem = new ListViewItem();
                listViewItem.Tag        = pluginContentSource;
                listViewItem.ImageIndex = imageIndex++;
                RefreshListViewItem(listViewItem);
                listViewInstalledPlugins.Items.Add(listViewItem);
            }
            // select first item if possible
            if (listViewInstalledPlugins.Items.Count > 0)
            {
                listViewInstalledPlugins.Items[0].Selected = true;
            }

            // update the details pane
            UpdateDetailsPane();
        }
コード例 #2
0
        /// <summary>
        /// sideBarControl_SelectedIndexChanged event handler.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        private void sideBarControl_SelectedIndexChanged(object sender, EventArgs e)
        {
            //	Make the selected PreferencesPanel visible.
            if (sideBarControl.SelectedIndex < preferencesPanelList.Count && preferencesPanelList[sideBarControl.SelectedIndex] != null)
            {
                PreferencesPanel preferencesPanel = (PreferencesPanel)preferencesPanelList[sideBarControl.SelectedIndex];
                if (BidiHelper.IsRightToLeft && preferencesPanel.RightToLeft != RightToLeft.Yes)
                {
                    preferencesPanel.RightToLeft = RightToLeft.Yes;
                }
                BidiHelper.RtlLayoutFixup(preferencesPanel);
                panelPreferences.Controls.Add(preferencesPanel);
                if (ShowKeyboardCues)
                {
                    //fix bug 406441, if the show cues window messages have been sent to the form
                    //resend them to force the new control to show them
                    ControlHelper.HideAccelerators(this);
                    ControlHelper.ShowAccelerators(this);
                }

                if (ShowFocusCues)
                {
                    //fix bug 406420, if the show cues window messages have been sent to the form
                    //resend them to force the new control to show them
                    ControlHelper.HideFocus(this);
                    ControlHelper.ShowFocus(this);
                }
                preferencesPanel.BringToFront();
            }

            //	Remove unselected panels.
            RemoveUnselectedPanels();
        }
コード例 #3
0
ファイル: BaseForm.cs プロジェクト: zcatt/OpenLiveWriter
        protected override void OnShown(EventArgs e)
        {
            base.OnShown(e);
            if (!suppressAutoRtlFixup)
            {
                BidiHelper.RtlLayoutFixup(this);
            }

            if (SystemInformation.HighContrast)
            {
                ControlHelper.Walk(
                    delegate(Control c, object state)
                {
                    LinkLabel link = c as LinkLabel;
                    if (link != null)
                    {
                        if (link.LinkColor == SystemColors.HotTrack)
                        {
                            link.LinkColor = SystemColors.ControlText;
                        }
                        if (link.LinkBehavior != LinkBehavior.AlwaysUnderline)
                        {
                            link.LinkBehavior = LinkBehavior.AlwaysUnderline;
                        }
                    }
                },
                    this,
                    null);
            }
        }
コード例 #4
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            int delta = -previewButton.Width + DisplayHelper.AutoFitSystemButton(previewButton, previewButton.Width, int.MaxValue);

            videoCode.Width      -= delta;
            videoCode.RightToLeft = System.Windows.Forms.RightToLeft.No;

            if (BidiHelper.IsRightToLeft)
            {
                lblService.SizeChanged += new EventHandler(lblService_SizeChanged);
                videoCode.TextAlign     = HorizontalAlignment.Right;
            }
            else
            {
                lblSize.SizeChanged += new EventHandler(lblSize_SizeChanged);
            }

            int oldTop = pictureBorder.Top;

            pictureBorder.Top     = videoCode.Bottom + 6;
            pictureBorder.Height -= pictureBorder.Top - oldTop;

            BidiHelper.RtlLayoutFixup(this, true, true, Controls);
        }
コード例 #5
0
        private void _control_Load(object sender, EventArgs e)
        {
            LayoutHelper.AutoFitLabels(_labelSize);

            DisplayHelper.AutoFitSystemLabel(_labelOne, _labelOne.Width, int.MaxValue);
            DisplayHelper.AutoFitSystemButton(_previewButton, 0, int.MaxValue);

            if (_control.RightToLeft == RightToLeft.Yes)
            {
                _webImageUrl.Left  = _previewButton.Right + (int)DisplayHelper.ScaleX(WebImageUrlPadding);
                _webImageUrl.Width = _pictureBorder.Right - _previewButton.Right - (int)DisplayHelper.ScaleX(WebImageUrlPadding);

                _fileSize.Left  = _pictureBorder.Left;
                _fileSize.Width = _labelSize.Left - _fileSize.Left - SizeLabelPadding;
            }
            else
            {
                _webImageUrl.Left  = _pictureBorder.Left;
                _webImageUrl.Width = _previewButton.Left - _webImageUrl.Left - (int)DisplayHelper.ScaleX(WebImageUrlPadding);

                _fileSize.Left  = _labelSize.Right + SizeLabelPadding;
                _fileSize.Width = _pictureBorder.Right - _fileSize.Left;
            }

            BidiHelper.RtlLayoutFixup(_control);

            _webImageUrl.Select();
        }
コード例 #6
0
 void IRtlAware.Layout()
 {
     if (!reversed)
     {
         reversed = true;
         BidiHelper.RtlLayoutFixup(this, true, true, Controls);
     }
 }
コード例 #7
0
 /// <summary>
 /// Raises the CreateControl method and reverses
 /// the location of any child controls if running
 /// in a right-to-left culture.
 /// </summary>
 protected override void OnCreateControl()
 {
     base.OnCreateControl();
     if (!_layedOut)
     {
         _layedOut = true;
         BidiHelper.RtlLayoutFixup(this);
     }
 }
コード例 #8
0
 private void UpdateListViewItem(ListViewItem listViewItem, LiveClipboardFormatHandler formatHandler)
 {
     imageListFormats.Images.Add(BidiHelper.Mirror((Bitmap)formatHandler.FormatImage));
     listViewItem.Tag        = formatHandler;
     listViewItem.ImageIndex = imageListFormats.Images.Count - 1;
     listViewItem.SubItems.Clear();
     listViewItem.Text = " " + formatHandler.FormatName;
     listViewItem.SubItems.Add(new ListViewItem.ListViewSubItem(listViewItem, formatHandler.FormatDescription));
 }
コード例 #9
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            // We do this just to reverse the anchor directions of the children
            BidiHelper.RtlLayoutFixup(this, true, true, Controls);

            UpdateQueryStatus();
        }
コード例 #10
0
        /// <summary>
        /// Loads a Bitmap from an Assembly's resource stream.
        /// </summary>
        /// <param name="assembly">The Assembly to load the Bitmap from.</param>
        /// <param name="path">The explicit path to the Bitmap, null to use the default.</param>
        /// <param name="resource">The name of the Bitmap to load (i.e. "Image.png").</param>
        public static Bitmap LoadAssemblyResourceBitmap(Assembly assembly, string path, string resource, bool mirror)
        {
            //	If a path was not specified, default to using the name of the assembly.
            if (path == null)
            {
                path = assembly.GetName().Name;
            }

            //	Format the schema resource name that we will load from the assembly.
            string resourceName = String.Format(CultureInfo.InvariantCulture, "{0}.{1}", path, resource);
            string key          = String.Format(CultureInfo.InvariantCulture, "{0},{1}", resourceName, mirror);
            //	Get the bitmap.
            Bitmap bitmap;

            lock (typeof(ResourceHelper))
            {
                //	Initialize the bitmap cache if necessary
                if (bitmapCache == null)
                {
                    bitmapCache = new Dictionary <string, Bitmap>();
                }

                //	Locate the resource name in the bitmap cache.  If found, return it.
                if (!bitmapCache.TryGetValue(key, out bitmap))
                {
                    //	Get a stream on the resource.  If this fails, null will be returned.  This means
                    //	that we could not find the resource in the assembly.
                    using (Stream stream = assembly.GetManifestResourceStream(resourceName))
                    {
                        if (stream != null)
                        {
                            //	Load the bitmap.
                            // Bitmaps require their underlying streams to remain open
                            // for as long as their bitmaps are in use.  We don't want to hold open the
                            // resource stream though, so copy it to a memory stream.
                            bitmap = new Bitmap(StreamHelper.CopyToMemoryStream(stream));

                            if (BidiHelper.IsRightToLeft && mirror)
                            {
                                Bitmap temp = BidiHelper.Mirror(bitmap);
                                bitmap.Dispose();
                                bitmap = temp;
                            }
                        }

                        //	Cache the bitmap.
                        bitmapCache.Add(key, bitmap);
                    }
                }

                //	Done!
                return(bitmap);
            }
        }
コード例 #11
0
        private void DoLayout()
        {
            SuspendLayout();

            _videoLoginStatusControl.Top      = ContentSourceLayout.Y_MARGIN;
            _videoLoginStatusControl.Height   = (int)DisplayHelper.ScaleY(32);
            _videoLoginStatusControl.Width    = (Width - (ContentSourceLayout.X_MARGIN * 2)) / 2 - ContentSourceLayout.X_SPACING;
            _videoLoginStatusControl.TabIndex = 0;
            _videoLoginStatusControl.Left     = ContentSourceLayout.X_MARGIN;

            _videoRequestComboBox.Top            = _videoLoginStatusControl.Top;
            _videoRequestComboBox.Height         = _videoLoginStatusControl.Height - ContentSourceLayout.Y_SPACING;
            _videoRequestComboBox.ItemHeight     = _videoLoginStatusControl.Height - ContentSourceLayout.Y_SPACING;
            _videoRequestComboBox.IntegralHeight = true;
            _videoRequestComboBox.TabIndex       = 10;
            _videoRequestComboBox.Left           = _videoLoginStatusControl.Right + ContentSourceLayout.X_SPACING;
            _videoRequestComboBox.Width          = Width - _videoRequestComboBox.Left - ContentSourceLayout.X_MARGIN;

            _videoPagingControl.Height   = (int)DisplayHelper.ScaleY(40);
            _videoPagingControl.Top      = Bottom - _videoPagingControl.Height + ContentSourceLayout.Y_SPACING;
            _videoPagingControl.Anchor   = AnchorStyles.Bottom | AnchorStyles.Right;
            _videoPagingControl.TabIndex = 40;

            _sidebarService.Top      = _videoLoginStatusControl.Bottom + ContentSourceLayout.Y_SPACING;
            _sidebarService.Height   = Height - _sidebarService.Top - _videoPagingControl.Height;
            _sidebarService.Width    = (int)DisplayHelper.ScaleX(101);
            _sidebarService.Anchor   = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left;
            _sidebarService.Name     = "videoProviderListBox";
            _sidebarService.TabIndex = 20;
            _sidebarService.Left     = _videoLoginStatusControl.Left + LISTBOX_PADDING;

            _listBoxVideos.Top  = _sidebarService.Top;
            _listBoxVideos.Left = _sidebarService.Right + ContentSourceLayout.X_SPACING;

            _listBoxVideos.Height   = _sidebarService.Height;
            _listBoxVideos.Width    = _videoRequestComboBox.Right - _sidebarService.Width - 2 * MARGIN_X - LISTBOX_PADDING;
            _listBoxVideos.Anchor   = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
            _listBoxVideos.TabIndex = 30;
            _listBoxVideos.Name     = "listBoxVideos";

            _videoPagingControl.Width = _videoRequestComboBox.Width;
            _videoPagingControl.Left  = _videoRequestComboBox.Left;

            _videoLoginControl.Location = _listBoxVideos.Location;
            _videoLoginControl.Size     = _listBoxVideos.Size;
            _videoLoginControl.Anchor   = _listBoxVideos.Anchor;
            _videoLoginControl.Visible  = true;
            _videoLoginControl.TabIndex = 30;

            BidiHelper.RtlLayoutFixup(this, true, true, Controls);

            ResumeLayout();
        }
コード例 #12
0
 /// <summary>
 /// Custom RTL layout is necessary to ensure that RTL fixup only happens once.
 /// Specifically, the "Select blog type" panel gets fixed up twice just because
 /// it's part of the wizard form on the form's first layout and it also gets
 /// reversed on the way into the form.
 ///
 /// Really we should not reverse wizard steps on the way in unless the form's
 /// reversal has already occurred, but this way we'll be robust to changes in
 /// our form reversal strategy.
 /// </summary>
 void IRtlAware.Layout()
 {
     if (!rtlApplied)
     {
         rtlApplied = true;
         Control[] childControls = new Control[Controls.Count];
         for (int i = 0; i < childControls.Length; i++)
         {
             childControls[i] = Controls[i];
         }
         BidiHelper.RtlLayoutFixup(this, true, true, childControls);
     }
 }
コード例 #13
0
        protected override void LoadEditor()
        {
            base.LoadEditor();
            WarmSettings = new WarmDecorator.WarmDecoratorSettings(Settings);

            this.trackBarWarmth.Value  = (int)(WarmSettings.WarmthPosition * 500f);
            trackBarWarmth.SmallChange = trackBarWarmth.Maximum / 20;
            trackBarWarmth.LargeChange = trackBarWarmth.Maximum / 5;

            BidiHelper.RtlLayoutFixup(this);

            label1.Top     = label2.Top = trackBarWarmth.Bottom;
            AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.DecoratorColorTemp));
            trackBarWarmth.AccessibleName = ControlHelper.ToAccessibleName(Res.Get(StringId.DecoratorColorTemp));
        }
コード例 #14
0
        public WebImageForm()
        {
            InitializeComponent();

            _source.Init(panelLayout.Width, panelLayout.Height);
            UserControl uc = _source.ImageSelectionControls;

            panelLayout.Controls.Add(uc);
            buttonInsert.Text         = Res.Get(StringId.InsertImageButton);
            buttonCancel.Text         = Res.Get(StringId.CancelButton);
            buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            Text = Res.Get(StringId.Plugin_WebImage_Title);
            Icon = ApplicationEnvironment.ProductIcon;

            LayoutHelper.FixupOKCancel(buttonInsert, buttonCancel);
            BidiHelper.RtlLayoutFixup(this);
        }
コード例 #15
0
        private void LoadCategories(bool doRtlFixup)
        {
            Controls.Clear();
            int y = DockPadding.Top;
            List <BlogPostCategory> categories = new List <BlogPostCategory>(ctx.Categories);

            if (categories.Count == 0)
            {
                return;
            }

            categories.Add(new BlogPostCategoryNone());
            categories.Sort();

            BlogPostCategory[] selected = ctx.SelectedCategories;

            foreach (BlogPostCategory cat in categories)
            {
                RadioButton radio = new RadioButton();
                Controls.Add(radio);
                radio.Text           = HtmlUtils.UnEscapeEntities(cat.Name, HtmlUtils.UnEscapeMode.Default);
                radio.AccessibleName = cat.Name;
                radio.UseMnemonic    = false;
                radio.Tag            = cat;
                radio.AutoSize       = true;
                radio.Location       = new Point(DockPadding.Left, y);
                y = radio.Bottom;

                if (BlogPostCategoryNone.IsCategoryNone(cat))
                {
                    radio.Checked = selected.Length == 0;
                }
                else
                {
                    radio.Checked = Array.IndexOf(selected, cat) >= 0;
                }

                radio.CheckedChanged += radio_CheckedChanged;
            }

            if (doRtlFixup)
            {
                BidiHelper.RtlLayoutFixup(this, true);
            }
        }
コード例 #16
0
        private void UpdateImages()
        {
            if (_normalImage == null)
            {
                return;
            }

            if (RightToLeft == RightToLeft.Yes ^ mirrored)
            {
                _normalImage = BidiHelper.Mirror(_normalImage);
                if (_disabledImage != null)
                {
                    _disabledImage = BidiHelper.Mirror(_disabledImage);
                }
                mirrored = !mirrored;
            }
            Image = Enabled ? _normalImage : (_disabledImage ?? _normalImage);
        }
コード例 #17
0
        private void RearrangeControls()
        {
            if (!Visible)
            {
                return;
            }

            // This width depends on the contents of the combo, which are dynamic
            DisplayHelper.AutoFitSystemCombo(comboBoxPosts, 0, int.MaxValue, false);



            int HPADDING = GetHpadding();
            int x;

            // a
            x = labelShow.Right + HPADDING;

            // b
            comboBoxPosts.Left = x;
            x = comboBoxPosts.Right + HPADDING;

            // c
            if (labelPosts.Visible)
            {
                labelPosts.Left = x;
            }
            else
            {
                panelType.Left = x;

                int x1 = 0;
                radioButtonPosts.Left = x1;
                x1 = radioButtonPosts.Right + HPADDING;

                radioButtonPages.Left = x1;
                // x1 = radioButtonPages.Right + HPADDING;

                panelType.Width = radioButtonPages.Right;
            }

            BidiHelper.RtlLayoutFixup(panelType);
            buttonDelete.Left = textBoxFilter.Right - buttonDelete.Width;
        }
コード例 #18
0
        /// <summary>
        /// This is the method invoked when a bidi response is received.
        /// </summary>
        /// <param name="sender">IPrinterQueue object.</param>
        /// <param name="e">The results of the bidi response.</param>
        private void OnBidiResponseReceived(object sender, PrinterQueueEventArgs e)
        {
            if (e.StatusHResult != (int)HRESULT.S_OK)
            {
                MockInkStatus();
                return;
            }

            //
            // Display the ink levels from the mock data.
            //

            BidiHelperSource = new BidiHelper(e.Response);
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource"));
            }
            InkStatusTitle = "Ink status (Live data)";
        }
コード例 #19
0
        public PanelLoginControl()
        {
            InitializeComponent();

            lblEmailExample.SizeChanged += new EventHandler(lblEmailExample_SizeChanged);

            BackColor = SystemInformation.HighContrast ? SystemColors.Window : SystemColors.ControlLightLight;

            txtPassword.PasswordChar   = Res.PasswordChar;
            btnLogin.Text              = Res.Get(StringId.Plugin_Video_Soapbox_Passport_Login);
            pictureBoxLogo.RightToLeft = RightToLeft.No;

            if (BidiHelper.IsRightToLeft)
            {
                RightToLeft = RightToLeft.Yes;
                BidiHelper.RtlLayoutFixup(this, true, true, Controls);
            }

            if (BidiHelper.IsRightToLeft)
            {
                pictureBoxLogo.Left = txtUsername.Right - pictureBoxLogo.Width;
            }
            else
            {
                pictureBoxLogo.Left = txtUsername.Left;
            }

            lblStatus.Font      = Res.GetFont(FontSize.XLarge, FontStyle.Regular);
            lblStatus.ForeColor = SystemColors.ControlDarkDark;

            linkLabelCreateMicrosoftAccountID.Text      = Res.Get(StringId.CWLiveIDCreateAccount2);
            linkLabelCreateMicrosoftAccountID.LinkColor = ColorizedResources.Instance.SidebarLinkColor;
            linkLabelPrivacy.LinkColor = ColorizedResources.Instance.SidebarLinkColor;
            linkLabelPrivacy.Text      = Res.Get(StringId.LiveIDPrivacy);
            lblPassword.FlatStyle      = FlatStyle.System;
            lblEmailExample.FlatStyle  = FlatStyle.System;
            lblUsername.FlatStyle      = FlatStyle.System;
            linkLabelCreateMicrosoftAccountID.FlatStyle    = FlatStyle.System;
            linkLabelCreateMicrosoftAccountID.LinkBehavior = LinkBehavior.HoverUnderline;
            linkLabelPrivacy.FlatStyle    = FlatStyle.System;
            linkLabelPrivacy.LinkBehavior = LinkBehavior.HoverUnderline;
        }
コード例 #20
0
        protected override void OnCreateControl()
        {
            base.OnCreateControl();
            if (!BidiHelper.IsRightToLeft || RightToLeft == RightToLeft.No)
            {
                User32.SendMessage(Handle, WM.EM_SETMARGINS, (UIntPtr)EC.RIGHTMARGIN, new IntPtr((BUTTON_WIDTH + BUTTON_RIGHT_OFFSET) << 16));
            }
            else
            {
                if (!rtlFixedUp)
                {
                    rtlFixedUp = true;

                    int leftMargin  = Margin.Left;
                    int rightMargin = Margin.Right;
                    BidiHelper.RtlLayoutFixup(this);
                    Margin = new Padding(leftMargin, Padding.Top, rightMargin, Padding.Bottom);
                }
            }
        }
コード例 #21
0
        protected virtual void SetWizardBody(Control control)
        {
            wizardBody.Controls.Clear();
            wizardBody.Controls.Add(control);

            control.Location = new Point(0, 0);
            control.Anchor   = ((AnchorStyles)((((AnchorStyles.Top | AnchorStyles.Bottom)
                                                 | AnchorStyles.Left)
                                                | AnchorStyles.Right)));

            if (!_scaledControls.Contains(control)) //only scale controls one time
            {
                DisplayHelper.Scale(control);
                OnAddControl(control);
                _scaledControls.Add(control);
            }
            control.Size = new Size(wizardBody.Width, wizardBody.Height);

            // This may get called multiple times per control, and that's OK, they are designed for it.
            BidiHelper.RtlLayoutFixup(control);
        }
コード例 #22
0
        private void LayoutControls(CategoryContext categoryContext, bool sizeForm, bool performRtlLayoutFixup)
        {
            ClearForm();
            SuspendLayout();

            // calculate how much room there is above me on the parent form
            int  parentControlY = _parentControl.PointToScreen(_parentControl.Location).Y;
            Form parentForm     = _parentControl.FindForm();
            int  parentFormY    = parentForm.PointToScreen(parentForm.ClientRectangle.Location).Y;
            int  maxHeight      = parentControlY - parentFormY - ScaleY(_topMargin) - ScaleY(_bottomMargin);

            // enforce additional constraint (or not, let freedom reign!)
            //maxHeight = Math.Min(maxHeight, 400) ;

            using (PositionManager positionManager = new PositionManager(ScaleX(X_MARGIN), ScaleY(Y_MARGIN + 2), ScaleY(4), ScaleX(MinDropDownWidth), categoryContainerControl.Width, maxHeight, scale))
            {
                // add 'none' if we're single selecting categories
                if (categoryContext.SelectionMode != CategoryContext.SelectionModes.MultiSelect)
                {
                    AddCategoryControl(new BlogPostCategoryListItem(new BlogPostCategoryNone(), 0), positionManager);
                }

                // add the other categories
                BlogPostCategoryListItem[] categoryListItems = BlogPostCategoryListItem.BuildList(categoryContext.Categories, true);
                foreach (BlogPostCategoryListItem categoryListItem in categoryListItems)
                {
                    AddCategoryControl(categoryListItem, positionManager);
                }

                if (sizeForm)
                {
                    PositionAndSizeForm(positionManager);
                }
            }
            if (performRtlLayoutFixup)
            {
                BidiHelper.RtlLayoutFixup(categoryContainerControl);
            }
            ResumeLayout();
        }
コード例 #23
0
        /// <summary>
        /// This method is invoked when there is an error retrieving Bidi information.
        /// A mock bidi response is loaded from resource and displayed.
        /// </summary>
        private void MockInkStatus()
        {
            //
            // Load mock bidi response resource.
            //

            Assembly     a         = Assembly.GetExecutingAssembly();
            Stream       xmlData   = a.GetManifestResourceStream("PrinterExtensionSample.bidi_Ink_mock.xml");
            StreamReader sr        = new StreamReader(xmlData);
            string       xmlString = sr.ReadToEnd();

            //
            // Display the ink levels from the mock data.
            //

            BidiHelperSource = new BidiHelper(xmlString);
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs("BidiHelperSource"));
            }
            InkStatusTitle = "Ink status (Mocked data)";
        }
コード例 #24
0
        private void UpdatePluginList()
        {
            BlogPublishingPluginSettings settings = TemporaryBlogSettings.PublishingPluginSettings;

            List <ContentSourceInfo> plugins = new List <ContentSourceInfo>(
                Join(ContentSourceManager.EnabledPublishNotificationPlugins, ContentSourceManager.EnabledHeaderFooterPlugins));

            plugins.Sort(ContentSourceManager.CreateComparison(settings));

            listViewPlugins.BeginUpdate();
            try
            {
                listViewPlugins.Items.Clear();
                imgListPlugins.Images.Clear();

                foreach (ContentSourceInfo csi in plugins)
                {
                    imgListPlugins.Images.Add(BidiHelper.Mirror(csi.Image));
                    ListViewItem item = new ListViewItem();
                    item.Tag        = csi;
                    item.Text       = " " + csi.Name;
                    item.ImageIndex = imgListPlugins.Images.Count - 1;
                    item.Checked    = settings.IsEnabled(csi.Id) ?? false;
                    listViewPlugins.Items.Add(item);
                }

                if (listViewPlugins.Items.Count > 0)
                {
                    listViewPlugins.Items[0].Selected = true;
                }
            }
            finally
            {
                listViewPlugins.EndUpdate();
            }

            ManageMoveButtons();
        }
コード例 #25
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            RefreshParentCombo();


            if (panelAddCategory.Visible)
            {
                if (comboBoxParent.Visible)
                {
                    DisplayHelper.AutoFitSystemButton(buttonAdd);
                    using (new AutoGrow(this, AnchorStyles.Bottom | AnchorStyles.Right, false))
                    {
                        textBoxAddCategory.Width = buttonAdd.Right - textBoxAddCategory.Left;

                        DisplayHelper.AutoFitSystemCombo(comboBoxParent, 0, int.MaxValue, true);
                        comboBoxParent.Left = textBoxAddCategory.Left;
                        comboBoxParent.Top  = textBoxAddCategory.Bottom + ScaleY(3);
                        buttonAdd.Top       = comboBoxParent.Top + (comboBoxParent.Height - buttonAdd.Height) / 2;
                        buttonAdd.Left      = comboBoxParent.Right + ScaleX(3);

                        if (buttonAdd.Right > textBoxAddCategory.Right)
                        {
                            int deltaX = buttonAdd.Right - textBoxAddCategory.Right;
                            textBoxAddCategory.Width += deltaX;
                            using (LayoutHelper.SuspendAnchoring(textBoxAddCategory, buttonAdd, comboBoxParent))
                                panelAddCategory.Width += deltaX;
                            categoryContainerControl.Width += deltaX;
                        }
                        else
                        {
                            buttonAdd.Left       = textBoxAddCategory.Right - buttonAdd.Width;
                            comboBoxParent.Width = buttonAdd.Left - comboBoxParent.Left - ScaleX(3);
                        }

                        int deltaY = comboBoxParent.Bottom - textBoxAddCategory.Bottom;
                        panelAddCategory.Height      += deltaY;
                        categoryContainerControl.Top += deltaY;
                        categoryRefreshControl.Top   += deltaY;
                    }
                }
                else
                {
                    using (new AutoGrow(this, AnchorStyles.Right, false))
                    {
                        int deltaX = -buttonAdd.Width + DisplayHelper.AutoFitSystemButton(buttonAdd);
                        textBoxAddCategory.Width -= deltaX;

                        int desiredWidth = DisplayHelper.MeasureString(textBoxAddCategory, textBoxAddCategory.Text).Width + (int)DisplayHelper.ScaleX(10);
                        deltaX += desiredWidth - textBoxAddCategory.Width;
                        if (deltaX > 0)
                        {
                            panelAddCategory.Width         += deltaX;
                            categoryContainerControl.Width += deltaX;
//							textBoxAddCategory.Width += deltaX;
//							buttonAdd.Left = textBoxAddCategory.Right + ScaleX(3);
//							textBoxAddCategory.Width = Math.Max(desiredWidth, textBoxAddCategory.Width);
//							textBoxAddCategory.Width = buttonAdd.Left - textBoxAddCategory.Left - ScaleX(3);
                        }
                    }
                }

                /*using (LayoutHelper.SuspendAnchoring(comboBoxParent, buttonAdd, textBoxAddCategory, panelAddCategory, categoryContainerControl))
                 * {
                 *  if (comboBoxParent.Visible)
                 *  {
                 *      deltaW = -comboBoxParent.Width + DisplayHelper.AutoFitSystemCombo(comboBoxParent, 0, int.MaxValue, true);
                 *      buttonAdd.Left += deltaW;
                 *  }
                 *
                 *  int oldWidth = buttonAdd.Width;
                 *  DisplayHelper.AutoFitSystemButton(buttonAdd);
                 *  buttonAdd.Width += (int)DisplayHelper.ScaleX(6); // add some more "air" in the Add button
                 *  deltaW += buttonAdd.Width - oldWidth;
                 *
                 *  panelAddCategory.Width += deltaW;
                 *  categoryContainerControl.Width += deltaW;
                 *  Width += deltaW;
                 * }*/
            }

            // use design time defaults to drive dynamic layout
            _topMargin    = categoryContainerControl.Top;
            _bottomMargin = Bottom - categoryContainerControl.Bottom;

            using (new AutoGrow(this, AnchorStyles.Right, false))
                LayoutControls(_categoryContext, true, false);
            UpdateSelectedCategories(_categoryContext.SelectedCategories);

            BidiHelper.RtlLayoutFixup(this);
        }
コード例 #26
0
 void IRtlAware.Layout()
 {
     BidiHelper.RtlLayoutFixup(this, true, true, Controls);
 }