Beispiel #1
0
        private static object ReadXmlTagProviders(XmlDocument providersDocument)
        {
            XmlNode providersNode = providersDocument.SelectSingleNode("//tagProviders");

            if (providersNode == null)
            {
                throw new Exception("Invalid tagproviders.xml file detected");
            }

            // get the list of providers from the xml
            HashSet marketSupportedIds = new HashSet();

            marketSupportedIds.AddAll(
                StringHelper.Split(
                    MarketizationOptions.GetFeatureParameter(MarketizationOptions.Feature.TagProviders, "supported"), ";"));
            ArrayList   providers     = new ArrayList();
            XmlNodeList providerNodes = providersDocument.SelectNodes("//tagProviders/provider");

            foreach (XmlNode providerNode in providerNodes)
            {
                TagProvider provider = TagProviderFromXml(providerNode);
                if (marketSupportedIds.Contains(provider.Id))
                {
                    providers.Add(provider);
                }
            }

            // return list of providers
            return(providers.ToArray(typeof(TagProvider)));
        }
Beispiel #2
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.buttonInsert = new System.Windows.Forms.Button();
     this.buttonCancel = new System.Windows.Forms.Button();
     this.tagEditor    = new OpenLiveWriter.PostEditor.Tagging.TagEditor();
     this.SuspendLayout();
     //
     // buttonInsert
     //
     this.buttonInsert.Anchor    = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.buttonInsert.FlatStyle = System.Windows.Forms.FlatStyle.System;
     this.buttonInsert.Location  = new System.Drawing.Point(94, 179);
     this.buttonInsert.Name      = "buttonInsert";
     this.buttonInsert.Size      = new System.Drawing.Size(90, 27);
     this.buttonInsert.TabIndex  = 2;
     this.buttonInsert.Text      = "&Insert";
     this.buttonInsert.Click    += new System.EventHandler(this.buttonInsert_Click);
     //
     // buttonCancel
     //
     this.buttonCancel.Anchor       = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
     this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
     this.buttonCancel.FlatStyle    = System.Windows.Forms.FlatStyle.System;
     this.buttonCancel.Location     = new System.Drawing.Point(190, 179);
     this.buttonCancel.Name         = "buttonCancel";
     this.buttonCancel.Size         = new System.Drawing.Size(90, 27);
     this.buttonCancel.TabIndex     = 3;
     this.buttonCancel.Text         = "Cancel";
     this.buttonCancel.Click       += new System.EventHandler(this.buttonCancel_Click);
     //
     // tagEditor
     //
     this.tagEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                                                                    | System.Windows.Forms.AnchorStyles.Left)
                                                                   | System.Windows.Forms.AnchorStyles.Right)));
     this.tagEditor.Location    = new System.Drawing.Point(12, 9);
     this.tagEditor.Name        = "tagEditor";
     this.tagEditor.Size        = new System.Drawing.Size(264, 152);
     this.tagEditor.TabIndex    = 0;
     this.tagEditor.TagProvider = null;
     this.tagEditor.Tags        = new string[0];
     //
     // TagForm
     //
     this.AcceptButton = this.buttonInsert;
     this.CancelButton = this.buttonCancel;
     this.ClientSize   = new System.Drawing.Size(288, 216);
     this.Controls.Add(this.tagEditor);
     this.Controls.Add(this.buttonCancel);
     this.Controls.Add(this.buttonInsert);
     this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
     this.MaximizeBox     = false;
     this.MinimizeBox     = false;
     this.Name            = "TagForm";
     this.ShowInTaskbar   = false;
     this.StartPosition   = System.Windows.Forms.FormStartPosition.CenterParent;
     this.Text            = "Insert Tags";
     this.ResumeLayout(false);
 }
 public void Save(TagProvider provider)
 {
     IProperties providerProps = TagProviderOptions.GetSubProperties(provider.Id);
     providerProps.SetString(NAME, provider.Name);
     providerProps.SetString(CAPTION, provider.Caption);
     providerProps.SetString(FORMAT, provider.HtmlFormat);
     providerProps.SetString(SEPARATOR, provider.Separator);
 }
Beispiel #4
0
        public void Save(TagProvider provider)
        {
            IProperties providerProps = TagProviderOptions.GetSubProperties(provider.Id);

            providerProps.SetString(NAME, provider.Name);
            providerProps.SetString(CAPTION, provider.Caption);
            providerProps.SetString(FORMAT, provider.HtmlFormat);
            providerProps.SetString(SEPARATOR, provider.Separator);
        }
 private TagProvider[] MergeTagProviders(TagProvider[] writerProviders, TagProvider[] userProviders)
 {
     ArrayList mergedProviders = new ArrayList();
     mergedProviders.AddRange(userProviders);
     foreach (TagProvider provider in writerProviders)
     {
         if (!mergedProviders.Contains(provider) && !IsSuppressed(provider))
             mergedProviders.Add(provider);
     }
     return (TagProvider[])mergedProviders.ToArray(typeof(TagProvider));
 }
        public int CompareTo(object obj)
        {
            TagProvider otherProvider = obj as TagProvider;

            if (otherProvider == null)
            {
                return(0);
            }

            return(Name.CompareTo(otherProvider.Name));
        }
 public void Delete(TagProvider provider)
 {
     TagProviderOptions.RemoveSubProperties(provider.Id);
     foreach (TagProvider xmlProvider in XmlTagProviders)
     {
         if (xmlProvider.Id == provider.Id)
         {
             Suppress(provider);
             break;
         }
     }
 }
Beispiel #8
0
 public void Delete(TagProvider provider)
 {
     TagProviderOptions.RemoveSubProperties(provider.Id);
     foreach (TagProvider xmlProvider in XmlTagProviders)
     {
         if (xmlProvider.Id == provider.Id)
         {
             Suppress(provider);
             break;
         }
     }
 }
Beispiel #9
0
        private void DeleteProvider()
        {
            if (!IsValid())
            {
                return;
            }

            TagProvider  provider = (TagProvider)listBoxOptions.SelectedItem;
            DialogResult result   = DisplayMessage.Show(MessageId.TagConfirmDeleteProvider, provider.Name);

            if (result == DialogResult.Yes)
            {
                _manager.Delete(provider);
                RefreshProviders(true);
            }
        }
Beispiel #10
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (!IsValid())
            {
                return;
            }

            TagProvider provider = (TagProvider)listBoxOptions.SelectedItem;
            EditTagForm tagForm  = new EditTagForm();

            tagForm.Provider = provider;
            DialogResult result = tagForm.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                _manager.Save(tagForm.Provider);
                RefreshProviders(false);
                listBoxOptions.SelectedItem = tagForm.Provider;
            }
        }
Beispiel #11
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            EditTagForm tagForm = new EditTagForm();

            tagForm.Provider = new TagProvider();
            DialogResult result = tagForm.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                TagProvider provider = tagForm.Provider;
                _manager.Save(provider);
                RefreshProviders(false);
                listBoxOptions.SelectedItem = provider;

                if (_context != null)
                {
                    _context.CurrentProvider = provider;
                }
            }
        }
Beispiel #12
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.buttonInsert = new System.Windows.Forms.Button();
            this.buttonCancel = new System.Windows.Forms.Button();
            this.tagEditor = new OpenLiveWriter.PostEditor.Tagging.TagEditor();
            this.SuspendLayout();
            //
            // buttonInsert
            //
            this.buttonInsert.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.buttonInsert.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.buttonInsert.Location = new System.Drawing.Point(94, 179);
            this.buttonInsert.Name = "buttonInsert";
            this.buttonInsert.Size = new System.Drawing.Size(90, 27);
            this.buttonInsert.TabIndex = 2;
            this.buttonInsert.Text = "&Insert";
            this.buttonInsert.Click += new System.EventHandler(this.buttonInsert_Click);
            //
            // buttonCancel
            //
            this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
            this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
            this.buttonCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
            this.buttonCancel.Location = new System.Drawing.Point(190, 179);
            this.buttonCancel.Name = "buttonCancel";
            this.buttonCancel.Size = new System.Drawing.Size(90, 27);
            this.buttonCancel.TabIndex = 3;
            this.buttonCancel.Text = "Cancel";
            this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click);
            //
            // tagEditor
            //
            this.tagEditor.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
                        | System.Windows.Forms.AnchorStyles.Left)
                        | System.Windows.Forms.AnchorStyles.Right)));
            this.tagEditor.Location = new System.Drawing.Point(12, 9);
            this.tagEditor.Name = "tagEditor";
            this.tagEditor.Size = new System.Drawing.Size(264, 152);
            this.tagEditor.TabIndex = 0;
            this.tagEditor.TagProvider = null;
            this.tagEditor.Tags = new string[0];
            //
            // TagForm
            //
            this.AcceptButton = this.buttonInsert;
            this.CancelButton = this.buttonCancel;
            this.ClientSize = new System.Drawing.Size(288, 216);
            this.Controls.Add(this.tagEditor);
            this.Controls.Add(this.buttonCancel);
            this.Controls.Add(this.buttonInsert);
            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
            this.MaximizeBox = false;
            this.MinimizeBox = false;
            this.Name = "TagForm";
            this.ShowInTaskbar = false;
            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            this.Text = "Insert Tags";
            this.ResumeLayout(false);

        }
 private void Suppress(TagProvider provider)
 {
     _properties.GetSubProperties(SUPPRESSED).SetBoolean(provider.Id, true);
 }
 private bool IsSuppressed(TagProvider provider)
 {
     return _properties.GetSubProperties(SUPPRESSED).GetBoolean(provider.Id, false);
 }
 public void SetTagProviders(TagProvider[] providers)
 {
     Items.Clear();
     Items.AddRange(providers);
     Items.Add(new TagOptionsProvider());
 }
Beispiel #16
0
 private void Suppress(TagProvider provider)
 {
     _properties.GetSubProperties(SUPPRESSED).SetBoolean(provider.Id, true);
 }
Beispiel #17
0
 private bool IsSuppressed(TagProvider provider)
 {
     return(_properties.GetSubProperties(SUPPRESSED).GetBoolean(provider.Id, false));
 }