예제 #1
0
 private void btnManageTemplate_Click(object sender, EventArgs e)
 {
     using (frmTemplate dialog = new frmTemplate())
     {
         dialog.Init("BLL.vm", "");
         dialog.ShowDialog();
     }
 }
예제 #2
0
        protected override void OnExcuteCommand()
        {
            try
            {
                ProjectItem projectItem = SolutionHelper.GetSelectedProjectItemsRecursively().FirstOrDefault();
                bool wasOpen = projectItem.IsOpen[Constants.vsViewKindTextView];
                if (!wasOpen)
                {
                    try
                    {
                        projectItem.Open(Constants.vsViewKindTextView);
                    }
                    catch { }
                }
                if (projectItem.Document != null)
                {
                    projectItem.Document.Activate();
                    var textDocument = (TextDocument)projectItem.Document.Object("TextDocument");
                    textDocument.Selection.SelectAll();
                    string templateName = projectItem.Document.Name.Substring(0, projectItem.Document.Name.LastIndexOf('.')) + ".vm";
                    string template = textDocument.Selection.Text;
                    using (frmTemplate dialog = new frmTemplate())
                    {
                        dialog.Init(templateName, template);
                        dialog.ShowDialog();
                        projectItem.Document.Close(vsSaveChanges.vsSaveChangesYes);
                    }

                    //var codeItems = CodeModelHelper.RetrieveCodeItemsIncludingRegions(projectItem.Document);

                    //var regions = codeItems.OfType<CodeItemRegion>().ToList();
                    //var usingStatements = codeItems.OfType<CodeItemUsingStatement>().ToList();
                    //var namespaces = codeItems.OfType<CodeItemNamespace>().ToList();
                    //var classes = codeItems.OfType<CodeItemClass>().ToList();

                    //var delegates = codeItems.OfType<CodeItemDelegate>().ToList();
                    //var enumerations = codeItems.OfType<CodeItemEnum>().ToList();
                    //var events = codeItems.OfType<CodeItemEvent>().ToList();
                    //var fields = codeItems.OfType<CodeItemField>().ToList();
                    //var interfaces = codeItems.OfType<CodeItemInterface>().ToList();
                    //var methods = codeItems.OfType<CodeItemMethod>().ToList();
                    //var properties = codeItems.OfType<CodeItemProperty>().ToList();
                    //var structs = codeItems.OfType<CodeItemStruct>().ToList();
                }
            }
            catch
            {
                
                
            }
        }
예제 #3
0
 protected override void OnExcuteCommand()
 {
     try
     {
         TextDocument doc = VSIHelper.DTE2.ActiveDocument.Object("TextDocument") as TextDocument;
         string templateName = DateTime.Now.ToString("yyyyMMddhhmmss") + ".vm";
         string template = doc.Selection.Text;
         using (frmTemplate dialog = new frmTemplate())
         {
             dialog.Init(templateName, template);
             dialog.ShowDialog();
         }
     }
     catch 
     {
         
        
     }
 }
예제 #4
0
 protected override void OnExcuteCommand()
 {
     try
     {
         using (frmTemplate dialog = new frmTemplate())
         {
             dialog.Init("BLL.vm", "");
             dialog.ShowDialog();
         }
     }
     catch 
     {
         
        
     }
 }