Beispiel #1
0
        void ToggleProfileImage(bool hasSocial)
        {
            var dte = GetService(typeof(SDTE)) as DTE2;
            var cbs = ((Microsoft.VisualStudio.CommandBars.CommandBars)dte.CommandBars);

            Microsoft.VisualStudio.CommandBars.CommandBar        cb            = cbs["OSBIDE Toolbar"];
            Microsoft.VisualStudio.CommandBars.CommandBarControl toolsControl  = cb.Controls["My OSBIDE Profile"];
            Microsoft.VisualStudio.CommandBars.CommandBarButton  profileButton = toolsControl as Microsoft.VisualStudio.CommandBars.CommandBarButton;

            if (hasSocial == true)
            {
                profileButton.Picture     = (stdole.StdPicture)IconConverter.GetIPictureDispFromImage(Resources.profile_new_social);
                profileButton.TooltipText = "New social activity detected";
            }
            else
            {
                profileButton.Picture     = (stdole.StdPicture)IconConverter.GetIPictureDispFromImage(Resources.profile);
                profileButton.TooltipText = "View your profile";
            }
        }
Beispiel #2
0
        private void UpdateSendStatus()
        {
            var dte = GetService(typeof(SDTE)) as DTE2;
            var cbs = ((Microsoft.VisualStudio.CommandBars.CommandBars)dte.CommandBars);

            Microsoft.VisualStudio.CommandBars.CommandBar        cb           = cbs["OSBIDE Toolbar"];
            Microsoft.VisualStudio.CommandBars.CommandBarControl toolsControl = cb.Controls["Log into OSBIDE"];
            Microsoft.VisualStudio.CommandBars.CommandBarButton  loginButton  = toolsControl as Microsoft.VisualStudio.CommandBars.CommandBarButton;

            if (_client.IsSendingData == true)
            {
                loginButton.Picture     = (stdole.StdPicture)IconConverter.GetIPictureDispFromImage(Resources.login_active);
                loginButton.TooltipText = "Connected to OSBIDE";
            }
            else
            {
                loginButton.Picture     = (stdole.StdPicture)IconConverter.GetIPictureDispFromImage(Resources.login);
                loginButton.TooltipText = "Not connected to OSBIDE.  Click to log in.";
            }
        }
        public void create_bar_command(
            string host_menu_bar_name,
            string command_name,
            string item_text,
            string tooltip_text,
            int position,
            menu_command_querystatus_handler querystatus_handler,
            menu_command_exec_handler exec_handler,
            Bitmap picture,
            bool beginGroup
            )
        {
            try
            {
                object[] contextGUIDS = new object[] { };
                RemoveCommandIfAlreadyExits(command_name);

                vsCommandStyle commandStyle = (picture == null) ? vsCommandStyle.vsCommandStyleText : vsCommandStyle.vsCommandStylePictAndText;

                BARS.CommandBar host_bar    = (BARS.CommandBar)((BARS.CommandBars)VSI.ServiceCache.ExtensibilityModel.CommandBars)[host_menu_bar_name];
                Command         new_command = _SSMS_commands_collection.AddNamedCommand2(_ssms.addin, command_name, item_text, tooltip_text, true, 0, ref contextGUIDS, (int)vsCommandStatus.vsCommandStatusSupported + (int)vsCommandStatus.vsCommandStatusEnabled, (int)commandStyle, vsCommandControlType.vsCommandControlTypeButton);
                if (new_command != null)
                {
                    position = (position == 0 ? host_bar.Controls.Count + 1 : position);
                    BARS.CommandBarButton control = (BARS.CommandBarButton)new_command.AddControl(host_bar, position);
                    control.BeginGroup  = beginGroup;
                    control.TooltipText = tooltip_text.Substring(0, tooltip_text.Length > 255 ? 255 : tooltip_text.Length);
                    menu_command_handlers handlers = new menu_command_handlers();
                    handlers.querystatus_handler = querystatus_handler == null ? this._default_querystatus_handler : querystatus_handler;
                    handlers.exec_handler        = exec_handler == null ? this._default_exec_handler : exec_handler;
                    this._addin_menu_commands_dictonary.Add(_ssms.addin.ProgID + "." + command_name, handlers);
                }
            }
            catch (Exception e)
            {
                System.Windows.Forms.MessageBox.Show(e.Message, "Exception at create_bar_command");
                System.Diagnostics.Debug.Print(e.Message);
            }
        }