using System;
using System.Diagnostics;
using System.Threading;
using System.Windows.Forms;
using UtilityClass; namespace Program
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
// 增加捕获
ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ThreadException += new ThreadExceptionEventHandler(AppEvents.OnThreadException); // 开始监听
Trace.Listeners.Clear();
Trace.Listeners.Add(new TraceLog(Application.StartupPath + "\\Error.Log")); Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (new FormLogin().ShowDialog() == DialogResult.OK)
Application.Run(FormMain.Instance);
} public class ApplicationEventHandlerClass
{
public void OnThreadException(object sender, ThreadExceptionEventArgs e)
{
Trace.Write(e.Exception, "未捕获的异常");
ShowMsg.ShowErr(sender as IWin32Window, "程序出现错误:\r\n" + e.Exception.Message + "\r\n\r\n请联系管理员以解决此问题!");
}
}
}
}

Program.cs 累积_C#的更多相关文章

  1. Program.cs

    Program.cs using System; namespace HelloWorld { class Program { [STAThread] static void Main(string[ ...

  2. Asp.Net Core 入门(一)——Program.cs做了什么

    ASP.NET Core 是微软推出的一种全新的跨平台开源 .NET 框架,用于在 Windows.Mac 或 Linux 上生成基于云的新式 Web 应用程序.国内目前关于Asp.Net Core的 ...

  3. 探索Asp net core3中的 项目文件、Program.cs和通用host(译)

    引言 原文地址 在这篇博客中我将探索一些关于Asp.net core 3.0应用的基础功能--.csproj 项目文件和Program源文件.我将会描述他们从asp.net core 2.X在默认模版 ...

  4. 探索ASP.NET Core 3.0系列一:新的项目文件、Program.cs和generic host

    前言:在这篇文章中我们来看看ASP.Net Core 3.0应用程序中一些基本的部分—— .csproj项目文件和Program.cs文件.我将会介绍它们从 ASP.NET Core 2.x 中的默认 ...

  5. ASP.NET Core 2 preview 1中Program.cs,Startup.cs和CreateDefaultBuilder的探索

    Exploring Program.cs, Startup.cs and CreateDefaultBuilder in ASP.NET Core 2 preview 1 ASP.NET Core 2 ...

  6. ASP.NET Core 基础知识(三) Program.cs类

    ASP.NET Framework应用程序是严重依赖于IIS的,System.Web 中有很多方法都是直接调用的 IIS API,并且它还是驻留在IIS进程中的.而 ASP.NET Core 的运行则 ...

  7. asp.net core 3.1 入口:Program.cs中的Main函数

    本文分析Program.cs 中Main()函数中代码的运行顺序分析asp.net core程序的启动,重点不是剖析源码,而是理清程序开始时执行的顺序.到底用了哪些实例,哪些法方. asp.net c ...

  8. AspNet Core Web 应用程序的启动(有关 Program.cs类/ Startup.cs类 ) 当项目中干掉 Startup.cs 类如何设置启动 配置等等

    .有关怎么创建Core MVC/API 这里就不说了,前段时间的博客有说过: 1.  项目生成后会有如图所示两个类 Program类Startup类 2. Startup类  初始内容 public ...

  9. 设置启动窗体Program.cs文件

    using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; names ...

随机推荐

  1. main方法原来只要放在public static类中就能跑,涨知识了

    接口中可以装在嵌套类对象. public interface ClassInterface { void howdy(); class Test implements ClassInterface { ...

  2. Ubuntu下安装、卸载notepad++

    Ubuntu下的安装方法: sudo add-apt-repository ppa:notepadqq-team/notepadqq sudo apt-get update sudo apt-get ...

  3. 基于TextRank提取关键词、关键短语、摘要

    一.TextRank原理 TextRank是一种用来做关键词提取的算法,也可以用于提取短语和自动摘要.因为TextRank是基于PageRank的,所以首先简要介绍下PageRank算法. 1. Pa ...

  4. paho.mqtt.embedded-c MQTTPacket transport.c hacking

    /******************************************************************************* * paho.mqtt.embedde ...

  5. Windows 7 SP1 多国语言包(MUI language packs)官方下载

      为了装一款 Gal Game (为毛不是装 H-Game?),使用 APP 还是太辛苦了,反正相信童鞋们也都用上“瘟妻”了嘛,装个日文的语言包基本上就可以解决问题了.大家都知道只有旗舰版(Wind ...

  6. AngularJS的简单订阅发布模式例子

    控制器之间的交互方式广播 broadcast, 发射 emit 事件 类似于 js中的事件 , 可以自己定义事件 向上传递直到 document 在AngularJs中 向上传递直到 rootScop ...

  7. c++hook全局触控事件

    https://gist.github.com/vbfox/1339671 namespace BlackFox { using System; using System.ComponentModel ...

  8. Finally什么时候会被执行

    PS:有return意味着程序结束,他一定会在程序结束前执行: PS:    return返回前 会把数据存储到指定的位置,基本类型是不会改变的.引用类型是会影响修改的值的

  9. Reaction 开源可自定义实时的电商平台

    Reaction 开源可自定义实时的电商平台,支持以下特性 拖放商品 订单处理 支付 物流 税 折扣 Analytics(分析) 与许多第三方应用程序集成 graphql 开发api 简单demo 使 ...

  10. oracle C# 访问

    使用oracle的odp.net 进行oracle数据库的访问对于进行oracle数据库的开发来说是比较方便的,使用的方式与ADO.net 是一致的. 一下为使用的测试 1. 安装必要的oracle ...