예제 #1
0
 /// <summary>
 /// Imports selected components to the active VB project
 /// Calls special method for handling document type components
 /// </summary>
 /// <param name="args">arguments with all necessary information from a view</param>
 /// <returns></returns>
 public bool ImportComponents(ImportEventArgs args)
 {
     try
     {
         VBProject vbProject = _vbe.ActiveVBProject;
         bool      replace   = args.Override;
         foreach (Component item in args.SelectedComponents)
         {
             if (replace)
             {
                 _vbe.RemoveComponent(item.Name);
             }
             IImportType componentType = ComponentFactory.GetTypeClass(item.Type);
             componentType.Import(_vbe, item, replace);
         }
         return(true);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, strings.ImportFormMessageCaption, MessageBoxButton.OK, MessageBoxImage.Error);
         return(false);
     }
 }