コード例 #1
0
        private void AnalyzeCompleted(object sender, AsyncAnalyzeCompletedEventArgs e)
        {
            AssemblyModel assemblyModel = e.Result as AssemblyModel;
            this.Invoke((MethodInvoker)delegate()
            {
                if (e.Error == null && !e.Cancelled)
                {
                    if (assemblyModel != null && this.tvAssembly.Nodes.ContainsKey(assemblyModel.FileName))
                    {
                        this.tvAssembly.Nodes[assemblyModel.FileName].Tag = assemblyModel;
                        foreach (DeveloperModel developer in assemblyModel.Developers)
                        {
                            TreeNode developerNode = this.tvAssembly.Nodes[assemblyModel.FileName].Nodes.Add(developer.Name, developer.Name, "user", "user");
                            developerNode.Tag = developer;
                        }
                        AddAnalyzeCompletedNum();
                        this.tvAssembly.Nodes[assemblyModel.FileName].Expand();
                    }
                }
                else if (e.Error != null && assemblyModel != null)
                {
                    if (assemblyModel != null && this.tvAssembly.Nodes.ContainsKey(assemblyModel.FileName))
                    {
                        this.tvAssembly.Nodes[assemblyModel.FileName].Tag = null;
                        this.tvAssembly.Nodes[assemblyModel.FileName].Text = string.Format("{0}(解析出错,请查看日志)", assemblyModel.FileName);
                    }

                    if (e.Error is System.Reflection.ReflectionTypeLoadException)
                    {
                        System.Reflection.ReflectionTypeLoadException err = (System.Reflection.ReflectionTypeLoadException)e.Error;
                        if (err.LoaderExceptions != null && err.LoaderExceptions.Length > 0)
                            log.Write(string.Format("解析出错:message:{0}{1}StackTrace:{2}{3}LoaderExceptions:{4}", e.Error.Message, Environment.NewLine, e.Error.StackTrace, Environment.NewLine, err.LoaderExceptions[0].Message));
                    }
                    else
                        log.Write(string.Format("解析出错:message:{0} StackTrace:{1}", e.Error.Message, e.Error.StackTrace));
                }
                else if (e.Error != null && assemblyModel == null)
                {
                    if (e.Error is System.Reflection.ReflectionTypeLoadException)
                    {
                        System.Reflection.ReflectionTypeLoadException err = (System.Reflection.ReflectionTypeLoadException)e.Error;
                        if (err.LoaderExceptions != null && err.LoaderExceptions.Length > 0)
                            log.Write(string.Format("解析出错:message:{0}{1}StackTrace:{2}{3}LoaderExceptions:{4}", e.Error.Message, Environment.NewLine, e.Error.StackTrace, Environment.NewLine, err.LoaderExceptions[0].Message));
                    }
                    else
                        log.Write(string.Format("解析出错:message:{0} StackTrace:{1}", e.Error.Message, e.Error.StackTrace));
                }
                else if (e.Cancelled)
                {
                    this.tvAssembly.Nodes[assemblyModel.FileName].Tag = null;
                    this.tvAssembly.Nodes[assemblyModel.FileName].Text = string.Format("{0}(已取消)", assemblyModel.FileName);
                }
            });
        }
コード例 #2
0
 private void AsyncAnalyzeCompleted(AssemblyModel assemblyModel, Exception runException)
 {
     if (AnalyzeCompleted != null)
     {
         AsyncAnalyzeCompletedEventArgs completedEventArgs = new AsyncAnalyzeCompletedEventArgs(assemblyModel, runException, isCancel);
         AnalyzeCompleted(this, completedEventArgs);
     }
 }