Exemplo n.º 1
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button that will invoke adding items
            this.addButton = new ButtonInfo();
            this.addButton.Caption = "Add Resource Item";
            this.addButton.Image = Properties.Resources.resStringAdd;
            this.addButton.OnClick += this.AddButton_Click;
            this.addButton.ToolBarVisible = false;
            this.addButton.ToolTip = "Adds a new resource item to the current resource bundle";
            this.addButton.Context = PluginContext.ResourceSet.ToString(); // this button can be pressed when a local resource set is loaded/selected
            this.context.AddButton(this.addButton);

            // create the button that will invoke removing items
            this.removeButton = new ButtonInfo();
            this.removeButton.Caption = "Remove Resource Item";
            this.removeButton.Image = Properties.Resources.resStringDel;
            this.removeButton.OnClick += this.RemoveButton_Click;
            this.removeButton.ToolBarVisible = false;
            this.removeButton.ToolTip = "Removes selected resource item from the current resource bundle";
            this.removeButton.Context = PluginContext.ResourceItem.ToString();    // this button can be pressed when a row is selected on editing grid
            this.context.AddButton(this.removeButton);

            // create the button that will invoke editing items
            this.editButton = new ButtonInfo();
            this.editButton.Caption = "Edit Resource Item";
            this.editButton.OnClick += this.EditButton_Click;
            this.editButton.ToolBarVisible = false;
            this.editButton.ToolTip = "Edits selected resource item";
            this.editButton.Context = PluginContext.ResourceItem.ToString();    // this button can be pressed when a row is selected on editing grid
            this.context.AddButton(this.editButton);
        }
Exemplo n.º 2
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button to mark
            this.markButton = new ButtonInfo();
            this.markButton.Caption = "Mark for Review";
            this.markButton.Image = null;
            this.markButton.OnClick += this.MarkInvoke;
            this.markButton.OnRefresh += this.Refresh;
            this.markButton.ToolBarVisible = true;
            this.markButton.ToolTip = "Marks item for later review";
            this.markButton.ShortcutKeys = Keys.Control | Keys.M;
            this.markButton.Context = PluginContext.LocalResourceItem.ToString();    // this plug in can be invoke when a resouce item is selected
            this.context.AddButton(this.markButton);

            // create the button to unmark
            this.unmarkButton = new ButtonInfo();
            this.unmarkButton.Caption = "Unmark for Review";
            this.unmarkButton.Image = null;
            this.unmarkButton.OnClick += this.UnmarkInvoke;
            this.unmarkButton.OnRefresh += this.Refresh;
            this.unmarkButton.ToolBarVisible = true;
            this.unmarkButton.ToolTip = "Unmarks item for later review";
            this.unmarkButton.ShortcutKeys = Keys.Control | Keys.U;
            this.unmarkButton.Context = PluginContext.LocalResourceItem.ToString();    // this plug in can be invoke when a resouce item is selected
            this.context.AddButton(this.unmarkButton);
        }
Exemplo n.º 3
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button that will invoke the plug in
            this.button = new ButtonInfo();
            this.button.Caption = "Plug-Ins Overview";
            this.button.Image = Resources.PlugInImage;
            this.button.OnClick += this.Invoke;
            this.button.ToolBarVisible = false;
            this.button.ToolTip = "Displays a list of loaded plug ins";
            this.context.AddButton(this.button);
        }
Exemplo n.º 4
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button that will invoke the plug in
            this.button = new ButtonInfo();
            this.button.Caption = "Copy all Base Values";
            this.button.Image = null;
            this.button.OnClick += this.Invoke;
            this.button.ToolBarVisible = false;
            this.button.ToolTip = "Copies all values from base to local resource set";
            this.button.Context = PluginContext.ResourceSet.ToString();    // this plug in can be invoke when a local resource set is loaded/selected
            this.context.AddButton(this.button);
        }
Exemplo n.º 5
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // create the button that will invoke the plug in
            this.button = new ButtonInfo();
            this.button.Caption = "Statistics";
            this.button.Image = null;
            this.button.OnClick += this.Invoke;
            this.button.ToolBarVisible = false;
            this.button.ToolTip = "Displays statistics about the current project";
            this.button.Context = PluginContext.ResourceBundle.ToString(); // plug in can be invoke if there is something loaded
            this.context.AddButton(this.button);
        }
Exemplo n.º 6
0
        public void Initialize(IContext context)
        {
            this.context = context;

            // subscribe to events that will do the actual exclusion from automated translation
            this.context.BeforeItemAutoTranslation += this.context_BeforeItemAutoTranslation;
            this.context.AfterItemAutoTranslation += this.context_AfterItemAutoTranslation;
            this.context.CurrentResourceBundleChanged += context_CurrentResourceBundleChanged;

            // create the button that will invoke the plug in
            this.button = new ButtonInfo();
            this.button.Caption = "Exclusions";
            this.button.Image = null;
            this.button.OnClick += this.Invoke;
            this.button.ToolBarVisible = false;
            this.button.ToolTip = "Handles a list of items that should be excluded from translation";
            this.button.Context = PluginContext.ResourceBundle.ToString();    // this plug in can be invoke when a local resource set is loaded/selected
            this.context.AddButton(this.button);
        }
Exemplo n.º 7
0
        public void Initialize(IContext context)
        {
            this.context = context;

            this.context.Container.RegisterType<ITranslatorEngine, MicrosoftTranslatorEngine>();

            // create the button that will invoke the plug in
            this.button = new ButtonInfo();
            this.button.Caption = "Web Translator";
            this.button.Image = null;
            this.button.OnClick += this.Invoke;
            this.button.ToolBarVisible = true;
            this.button.ToolTip = "Automatically translate resources using Google services";
            this.button.Context = PluginContext.ResourceSet.ToString();    // this plug in can be invoke when a local resource set is loaded/selected
            this.context.AddButton(this.button);

            // load translation languages in the background
            // this will significantly speed up opening the translation form
            ThreadPool.QueueUserWorkItem(LoadLanguages);
        }
Exemplo n.º 8
0
        /// <summary>
        /// This is called by <see cref="Context"></see> in order to create buttons when requested by other code
        /// </summary>
        /// <param name="buttonInfo">Information about the button to be created</param>
        public void AddButton(ButtonInfo buttonInfo)
        {
            if (buttonInfo == null)
            {
                throw new ArgumentNullException("buttonInfo");
            }

            // menu item
            ToolStripMenuItem menuItem = new ToolStripMenuItem(null, null, this.ButtonClick);
            menuItem.Tag = buttonInfo;
            menuItem.Name = "MenuButton" + buttonInfo.GetHashCode();
            menuItem.ShortcutKeys = buttonInfo.ShortcutKeys;
            ToolsToolStripMenuItem.DropDownItems.Add(menuItem);

            // toolbar item
            ToolStripButton toolbarItem = new ToolStripButton(null, buttonInfo.Image, this.ButtonClick);
            toolbarItem.Tag = buttonInfo;
            toolbarItem.Name = "ToolbarButton" + buttonInfo.GetHashCode();
            MainToolStrip.Items.Insert(3, toolbarItem);

            UpdateMenuItem(buttonInfo, menuItem, toolbarItem);

            this.plugInsButtons.Add(buttonInfo);
        }
Exemplo n.º 9
0
 public void AddButton(ButtonInfo buttonInfo)
 {
     this.AddButtonDelegate.Invoke(buttonInfo);
 }
Exemplo n.º 10
0
        private static void UpdateMenuItem(ButtonInfo buttonInfo, ToolStripItem menuItem, ToolStripItem toolbarItem)
        {
            menuItem.Enabled = !buttonInfo.Disabled;
            menuItem.Text = buttonInfo.Caption;
            menuItem.Image = buttonInfo.Image;
            menuItem.Visible = buttonInfo.Visible;

            toolbarItem.Enabled = !buttonInfo.Disabled;
            toolbarItem.ToolTipText = buttonInfo.ToolTip;
            toolbarItem.Image = buttonInfo.Image;
            toolbarItem.Visible = buttonInfo.ToolBarVisible && buttonInfo.Visible;

            // text is not shown on toolbar button, except if no image is defined
            if (toolbarItem.Image == null)
            {
                toolbarItem.Text = buttonInfo.Caption;
            }
        }