Ejemplo n.º 1
0
 public void OnChange(string virtualPath)
 {
     lock (_syncObject)
     {
         try
         {
             var coder = XPCCoder.Create(virtualPath);
             if (coder == null)
             {
                 return;
             }
             coder.Generate();
             XPCAssembly.Delete(coder.VirtualPath);//删除程序集
         }
         catch (Exception ex)
         {
             throw ex;
         }
         finally
         {
             //清空缓存
             XamlUtil.RecoverMemory();
         }
     }
 }
Ejemplo n.º 2
0
        internal static void Generate(string virtualPath)
        {
            XPCCoder coder = XPCCoder.Create(virtualPath);

            if (coder == null)
            {
                return;
            }
            coder.Generate();//生成代码
            if (!IsIgnore(coder))
            {
                if (WriteCode(coder) || !XPCAssembly.Exists(coder))
                {
                    try
                    {
                        //重新生成程序集
                        XPCAssembly.Compile(coder);
                    }
                    catch (Exception ex)
                    {
                        throw ex;
                    }
                }
            }
        }