Exemple #1
0
        public IDsmSettingsManager GetIDsmSettingsManager()
        {
            if (_dsmSettingsManager == null)
            _dsmSettingsManager = new DsmSettingsManager(GetISettingsRepository());

              return _dsmSettingsManager;
        }
Exemple #2
0
 public DebuggerHook(DTE2 applicationObject, AddinController controller, IViewAdapter viewAdapter, IDsmSettingsManager settingsManager)
 {
     _settingsManager   = settingsManager;
     _viewAdapter       = viewAdapter;
     _controller        = controller;
     _applicationObject = applicationObject;
 }
Exemple #3
0
 public DebuggerHook(DTE2 applicationObject, AddinController controller, IViewAdapter viewAdapter, IDsmSettingsManager settingsManager)
 {
     _settingsManager = settingsManager;
       _viewAdapter = viewAdapter;
       _controller = controller;
       _applicationObject = applicationObject;
 }
Exemple #4
0
        public IDsmSettingsManager GetIDsmSettingsManager()
        {
            if (_dsmSettingsManager == null)
            {
                _dsmSettingsManager = new DsmSettingsManager(GetISettingsRepository());
            }

            return(_dsmSettingsManager);
        }
Exemple #5
0
        public AddinController(ISessionManager sessionManager, IDsmSettingsManager settingsManager, IViewAdapter viewAdapter, IDteAdapter dteAdapter, 
            IExceptionManager exceptionManager)
        {
            _exceptionManager = exceptionManager;
              _viewAdapter = viewAdapter;
              _settingsManager = settingsManager;
              _dteAdapter = dteAdapter;
              _sessionManager = sessionManager;

              if (_sessionManager.CurrentSession != null)
            _selectedSessionName = _sessionManager.CurrentSession.Name;
        }
Exemple #6
0
        public FrmSessions(IDteAdapter dteAdapter, IDsmSettingsManager settings, IExceptionManager exceptionManager)
            : base()
        {
            InitializeComponent();

              splitContainer1.Panel2Collapsed = true;

              _dteAdapter = dteAdapter;
              _settings = settings;
              _exceptionManager = exceptionManager;

              ShowInTaskbar = false;
        }
Exemple #7
0
        public FrmSessions(IDteAdapter dteAdapter, IDsmSettingsManager settings, IExceptionManager exceptionManager)
            : base()
        {
            InitializeComponent();

            splitContainer1.Panel2Collapsed = true;

            _dteAdapter       = dteAdapter;
            _settings         = settings;
            _exceptionManager = exceptionManager;

            ShowInTaskbar = false;
        }
Exemple #8
0
        public AddinController(ISessionManager sessionManager, IDsmSettingsManager settingsManager, IViewAdapter viewAdapter, IDteAdapter dteAdapter,
                               IExceptionManager exceptionManager)
        {
            _exceptionManager = exceptionManager;
            _viewAdapter      = viewAdapter;
            _settingsManager  = settingsManager;
            _dteAdapter       = dteAdapter;
            _sessionManager   = sessionManager;

            if (_sessionManager.CurrentSession != null)
            {
                _selectedSessionName = _sessionManager.CurrentSession.Name;
            }
        }
Exemple #9
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            try
            {
                _applicationObject = (DTE2)application;

                _addInInstance = (AddIn)addInInst;

                var container = new Container();

                _exceptionManager = container.GetIExceptionManager();

                _controller = container.GetAddinController(_applicationObject);

                _debugHook = container.GetDebugHook(_applicationObject);
                _debugHook.Hook();

                _settingsManager = container.GetIDsmSettingsManager();

                if ((connectMode == ext_ConnectMode.ext_cm_Startup) || (connectMode == ext_ConnectMode.ext_cm_AfterStartup))
                {
                    //_settings = Settings.Default;
                    //_settings.Reload();

                    CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;

                    // Create a toolbar for this app
                    string managerToolbarName = "Document Session Manager";
                    managerToolbar = null;
                    //try
                    //{
                    //  managerToolbar = ((Microsoft.VisualStudio.CommandBars.CommandBars)this._applicationObject.CommandBars)[managerToolbarName];
                    //}
                    //catch (ArgumentException)
                    //{
                    //}

                    if (managerToolbar == null)
                    {
                        managerToolbar = (CommandBar)commandBars.Add(managerToolbarName, MsoBarPosition.msoBarTop, System.Type.Missing, true);

                        _settingsManager.LoadSettings();
                        managerToolbar.Position = (MsoBarPosition)Enum.Parse(typeof(MsoBarPosition),
                                                                             _settingsManager.DsmSettings.ToolBarPosition ?? MsoBarPosition.msoBarTop.ToString());
                        managerToolbar.RowIndex = _settingsManager.DsmSettings.ToolBarRowIndex;
                        managerToolbar.Visible  = _settingsManager.DsmSettings.ToolBarVisible;

                        if (_settingsManager.DsmSettings.ToolBarTop != -1)
                        {
                            managerToolbar.Top = _settingsManager.DsmSettings.ToolBarTop;
                        }
                        if (_settingsManager.DsmSettings.ToolBarLeft != -1)
                        {
                            managerToolbar.Left = _settingsManager.DsmSettings.ToolBarLeft;
                        }
                        //if (_settingsManager.DsmSettings.ToolBarWidth != -1)
                        //  managerToolbar.Width = _settingsManager.DsmSettings.ToolBarWidth;
                        //if (_settingsManager.DsmSettings.ToolBarHeight != -1)
                        //  managerToolbar.Height = _settingsManager.DsmSettings.ToolBarHeight;
                    }

                    object controlCreated;

                    _controlsCreated.Clear();

                    //PictureManager.CommandButtons.Clear();

                    AddCommand(managerToolbar, "DsmSessionList", "DsmSessionList",
                               "Sessions", vsCommandControlType.vsCommandControlTypeDropDownCombo, 1,
                               vsCommandStyle.vsCommandStyleComboCaseSensitive, 0, out controlCreated);

                    CommandBarComboBox combo = controlCreated as CommandBarComboBox;
                    if (combo != null)
                    {
                        combo.Width = 200;
                    }

                    AddCommand(managerToolbar, "DsmLoadSession", "DsmLoadSession",
                               "Load session", vsCommandControlType.vsCommandControlTypeButton, 1,
                               vsCommandStyle.vsCommandStylePict, 2, out controlCreated);

                    AddCommand(managerToolbar, "DsmSaveSessionAs", "DsmSaveSessionAs",
                               "Save session as", vsCommandControlType.vsCommandControlTypeButton, 2,
                               vsCommandStyle.vsCommandStylePict, 6, out controlCreated);

                    AddCommand(managerToolbar, "DsmSaveSession", "DsmSaveSession",
                               "Save session", vsCommandControlType.vsCommandControlTypeButton, 3,
                               vsCommandStyle.vsCommandStylePict, 5, out controlCreated);

                    AddCommand(managerToolbar, "DsmDeleteSessions", "DsmDeleteSessions",
                               "Delete sessions", vsCommandControlType.vsCommandControlTypeButton, 4,
                               vsCommandStyle.vsCommandStylePict, 1, out controlCreated);

                    AddCommand(managerToolbar, "DsmReloadSession", "DsmReloadSession",
                               "Reload session", vsCommandControlType.vsCommandControlTypeButton, 5,
                               vsCommandStyle.vsCommandStylePict, 4, out controlCreated);

                    AddCommand(managerToolbar, "DsmRecentlyClosed", "DsmRecentlyClosed",
                               "Recently closed documents", vsCommandControlType.vsCommandControlTypeButton, 6,
                               vsCommandStyle.vsCommandStylePict, 3, out controlCreated);
                }
            }
            catch (Exception ex)
            {
                _exceptionManager.HandleException(ex);
            }
        }
Exemple #10
0
 public ViewAdapter(IDteAdapter dteAdapter, IDsmSettingsManager settings, IExceptionManager exceptionManager)
 {
     _settings = settings;
       _dteAdapter = dteAdapter;
       _exceptionManager = exceptionManager;
 }
Exemple #11
0
 public static void NotifyPluginUnloaded()
 {
     _settingsManager = null;
 }
Exemple #12
0
 public ViewAdapter(IDteAdapter dteAdapter, IDsmSettingsManager settings, IExceptionManager exceptionManager)
 {
     _settings         = settings;
     _dteAdapter       = dteAdapter;
     _exceptionManager = exceptionManager;
 }
Exemple #13
0
 public static void NotifyPluginUnloaded()
 {
     _settingsManager = null;
 }
Exemple #14
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            try
              {
            _applicationObject = (DTE2)application;

            _addInInstance = (AddIn)addInInst;

            var container = new Container();

            _exceptionManager = container.GetIExceptionManager();

            _controller = container.GetAddinController(_applicationObject);

            _debugHook = container.GetDebugHook(_applicationObject);
            _debugHook.Hook();

            _settingsManager = container.GetIDsmSettingsManager();

            if ((connectMode == ext_ConnectMode.ext_cm_Startup) || (connectMode == ext_ConnectMode.ext_cm_AfterStartup))
            {
              //_settings = Settings.Default;
              //_settings.Reload();

              CommandBars commandBars = (CommandBars)_applicationObject.CommandBars;

              // Create a toolbar for this app
              string managerToolbarName = "Document Session Manager";
              managerToolbar = null;
              //try
              //{
              //  managerToolbar = ((Microsoft.VisualStudio.CommandBars.CommandBars)this._applicationObject.CommandBars)[managerToolbarName];
              //}
              //catch (ArgumentException)
              //{
              //}

              if (managerToolbar == null)
              {
            managerToolbar = (CommandBar)commandBars.Add(managerToolbarName, MsoBarPosition.msoBarTop, System.Type.Missing, true);

            _settingsManager.LoadSettings();
            managerToolbar.Position = (MsoBarPosition)Enum.Parse(typeof(MsoBarPosition),
              _settingsManager.DsmSettings.ToolBarPosition ?? MsoBarPosition.msoBarTop.ToString());
            managerToolbar.RowIndex = _settingsManager.DsmSettings.ToolBarRowIndex;
            managerToolbar.Visible = _settingsManager.DsmSettings.ToolBarVisible;

            if (_settingsManager.DsmSettings.ToolBarTop != -1)
              managerToolbar.Top = _settingsManager.DsmSettings.ToolBarTop;
            if (_settingsManager.DsmSettings.ToolBarLeft != -1)
              managerToolbar.Left = _settingsManager.DsmSettings.ToolBarLeft;
            //if (_settingsManager.DsmSettings.ToolBarWidth != -1)
            //  managerToolbar.Width = _settingsManager.DsmSettings.ToolBarWidth;
            //if (_settingsManager.DsmSettings.ToolBarHeight != -1)
            //  managerToolbar.Height = _settingsManager.DsmSettings.ToolBarHeight;

              }

              object controlCreated;

              _controlsCreated.Clear();

              //PictureManager.CommandButtons.Clear();

              AddCommand(managerToolbar, "DsmSessionList", "DsmSessionList",
            "Sessions", vsCommandControlType.vsCommandControlTypeDropDownCombo, 1,
            vsCommandStyle.vsCommandStyleComboCaseSensitive, 0, out controlCreated);

              CommandBarComboBox combo = controlCreated as CommandBarComboBox;
              if (combo != null)
            combo.Width = 200;

              AddCommand(managerToolbar, "DsmLoadSession", "DsmLoadSession",
            "Load session", vsCommandControlType.vsCommandControlTypeButton, 1,
            vsCommandStyle.vsCommandStylePict, 2, out controlCreated);

              AddCommand(managerToolbar, "DsmSaveSessionAs", "DsmSaveSessionAs",
            "Save session as", vsCommandControlType.vsCommandControlTypeButton, 2,
            vsCommandStyle.vsCommandStylePict, 6, out controlCreated);

              AddCommand(managerToolbar, "DsmSaveSession", "DsmSaveSession",
            "Save session", vsCommandControlType.vsCommandControlTypeButton, 3,
            vsCommandStyle.vsCommandStylePict, 5, out controlCreated);

              AddCommand(managerToolbar, "DsmDeleteSessions", "DsmDeleteSessions",
            "Delete sessions", vsCommandControlType.vsCommandControlTypeButton, 4,
            vsCommandStyle.vsCommandStylePict, 1, out controlCreated);

              AddCommand(managerToolbar, "DsmReloadSession", "DsmReloadSession",
            "Reload session", vsCommandControlType.vsCommandControlTypeButton, 5,
            vsCommandStyle.vsCommandStylePict, 4, out controlCreated);

              AddCommand(managerToolbar, "DsmRecentlyClosed", "DsmRecentlyClosed",
            "Recently closed documents", vsCommandControlType.vsCommandControlTypeButton, 6,
            vsCommandStyle.vsCommandStylePict, 3, out controlCreated);

            }
              }
              catch (Exception ex)
              {
            _exceptionManager.HandleException(ex);
              }
        }