Exemplo n.º 1
0
        /// <summary>
        /// Command handler which writes the active definition to a temporary merge script and opens that script in notepad.
        /// </summary>
        public static void OnOpenInNotepad(ICommandParameter parameter, ICompositionHost host, DocumentEditSite site)
        {
            var activeDefinition = site?.EditControl?.Document?.Envoy?.ReferenceDefinition;

            if (activeDefinition != null)
            {
                var fileName = Path.GetTempFileName();
                File.WriteAllText(fileName, MergeScriptBuilder.Create(activeDefinition.ToEnumerable(), host).ToString());
                Process.Start("Notepad.exe", fileName);
            }
        }
 private void AddIconToBuilder(MergeScriptBuilder builder, MethodCall methodCall, FunctionSignatureCache signatureCache)
 {
     if (signatureCache?.IconModel != null)
     {
         var generationOptions = new ElementGenerationOptions(GenerationReason.Merge);
         var table             = IconTable.GetIconTableToGenerate(methodCall, generationOptions);
         if (table != null)
         {
             table.AddIcon(methodCall.Target, signatureCache.IconModel);
             builder.AddElement(new MergeElementInfo(table));
         }
     }
 }