Ejemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the ToolSecurityManager class
 /// </summary>
 public MenuItemSecurityManager()
 {
     _theInstance = this;
 }
		/// <summary>
		/// Initializes a new instance of the ToolSecurityManager class
		/// </summary>
		public MenuItemSecurityManager()
		{
			_theInstance = this;
		}
		/// <summary>
		/// Initializes a new instance of the SnapInHostingEngine class
		/// </summary>
		/// <param name="additionalCommonAppDataPath">Additional path in which data common to all users will be stored. Example: "Company Name\Application Name\Version X.X.X"</param>
		/// <param name="additionalLocalUserAppDataPath">Additional path in which data particular to the current user will be stored. Example: "Company Name\Application Name\Version X.X.X"</param>
		public SnapInHostingEngine(string additionalCommonAppDataPath, string additionalLocalUserAppDataPath)
		{
			// thunk to this instance, the one and only
			_theInstance = this;

			// create a new application context
			_applicationContext = new SnapInApplicationContext();

			// create a new instance manager
			_instanceManager = new ApplicationInstanceManager();

			// combine the common app data path and the additional path to form this instance's common app data path
			_commonDataPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.CommonApplicationData), additionalCommonAppDataPath);

			// combine the local user app data path and the additional path to form this instance's local user app data path
			_localUserDataPath = Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), additionalLocalUserAppDataPath);			

			// combine the local user path with logs to form the logs path
			_logsDataPath = Path.Combine(_localUserDataPath, "Logs");
			
			// combine the log path with the file name to form the full log path						
			_logFilename = Path.Combine(_logsDataPath, "Log.txt");

			// format the common configuration filename
			_commonConfigurationFilename = Path.Combine(_commonDataPath, SnapInHostingEngine.DefaultCommonConfigurationFilename);

			// format the local user configuration filename
			_localUserConfigurationFilename = Path.Combine(_localUserDataPath, SnapInHostingEngine.DefaultLocalUserConfigurationFilename);

			// format the configuration engine's configuration filename
			_configurationEngineConfigurationFilename = Path.Combine(_commonDataPath, ConfigurationEngine.DefaultConfigurationFilename);

			// format the installation engine's configuration filename
			_installationEngineConfigurationFilename = Path.Combine(_localUserDataPath, InstallationEngine.DefaultConfigurationFilename);

			// wire up to our own snapin events so that we can catch the events first and proxy some work before anyone else gets the events
			this.SnapInInstalled += new SnapInDescriptorEventHandler(OnInternalSnapInInstalled);
			this.SnapInUninstalled += new SnapInDescriptorEventHandler(OnInternalSnapInUninstalled);

			// create new window manager
			_windowManger = new WindowManager();

			// create a new xml configuration manager
			_xmlConfigurationManager = new XmlConfigurationManager();
			_xmlConfigurationManager.EnumeratingConfigurations += new XmlConfigurationManagerEventHandler(OnConfigurationManagerEnumeratingConfigurations);

			// create a new menu item security manager
			_menuItemSecurityManager = new MenuItemSecurityManager();			
		}