/// <summary>
 /// <para>Initializes a new instance of the  <see cref="ApplicationConfigurationNode"/> class with an <see cref="ApplicationData"/> object containing the data for the application.</para>
 /// </summary>
 /// <param name="applicationData">
 /// <para>An <see cref="ApplicationData"/> object.</para>
 /// </param>
 public ApplicationConfigurationNode(ApplicationData applicationData)
     : base()
 {
     if (applicationData == null)
     {
         throw new ArgumentNullException("applicationData");
     }
     this.applicationData = applicationData;
 }
        private void OpenFile()
        {
            OpenFileDialog fileDialog = new OpenFileDialog();
            fileDialog.Filter = SR.ConfigurationFileDialogFilter;
            fileDialog.CheckFileExists = true;
            fileDialog.CheckPathExists = true;
            fileDialog.AddExtension = true;
            fileDialog.DefaultExt = ".config";
            fileDialog.RestoreDirectory = true;
            DialogResult result = UIService.ShowOpenDialog(fileDialog);

            if (result == DialogResult.OK)
            {
                string file = fileDialog.FileName;
                ApplicationData data = new ApplicationData(string.Empty, Path.GetDirectoryName(file), file);
                IUIHierarchy hierarchy = new UIHierarchy(new ApplicationConfigurationNode(data), ServiceProvider, new ConfigurationContext(file));
                UIHierarchyService.AddHierarchy(hierarchy);
                hierarchy.Open();
            }
        }
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="AddApplicationConfigurationNodeCommand"/> class with an <see cref="IServiceProvider"/> and if the error service should be cleared after the command executes.</para>
 /// </summary>
 /// <param name="serviceProvider">
 /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
 /// </param>
 /// <param name="clearErrorService">
 /// <para>Determines if all the messages in the <see cref="IConfigurationErrorLogService"/> should be cleared when the command has executed.</para>
 /// </param>
 public AddApplicationConfigurationNodeCommand(IServiceProvider serviceProvider, bool clearErrorService)
     : base(serviceProvider, clearErrorService)
 {
     this.applicationData = new ApplicationData();
 }
 /// <summary>
 /// <para>Initialize a new instance of the <see cref="AddApplicationConfigurationNodeCommand"/> class with an <see cref="IServiceProvider"/> and if the error service should be cleared after the command executes.</para>
 /// </summary>
 /// <param name="serviceProvider">
 /// <para>The a mechanism for retrieving a service object; that is, an object that provides custom support to other objects.</para>
 /// </param>
 /// <param name="clearErrorService">
 /// <para>Determines if all the messages in the <see cref="IConfigurationErrorLogService"/> should be cleared when the command has executed.</para>
 /// </param>
 public AddApplicationConfigurationNodeCommand(IServiceProvider serviceProvider, bool clearErrorService) : base(serviceProvider, clearErrorService)
 {
     this.applicationData = new ApplicationData();
 }
 public override void SetUp()
 {
     base.SetUp();
     data = ApplicationData.FromCurrentAppDomain();
     applicationNode = new ApplicationConfigurationNode(data);
     CreateHierarchyAndAddToHierarchyService(applicationNode, CreateDefaultConfiguration());
     ClientLoggingConfigurationDesignManager loggingConfigurationDesignManager = new ClientLoggingConfigurationDesignManager();
     loggingConfigurationDesignManager.Register(Host);
 }
Exemplo n.º 6
0
 /// <summary>
 /// <para>
 /// Creates an <see cref="ApplicationData"/> object using the properties of the current <see cref="AppDomain"/>.
 /// </para>
 /// </summary>
 /// <returns><para>An <see cref="ApplicationData"/> object.</para></returns>
 public static ApplicationData FromCurrentAppDomain()
 {
     ApplicationData appData = new ApplicationData();
     AppDomain current = AppDomain.CurrentDomain;
     appData.Name = current.FriendlyName;
     appData.BaseDirectory = current.BaseDirectory;
     appData.ConfigurationFilePath = current.SetupInformation.ConfigurationFile;
     return appData;
 }