Пример #1
0
 void CurrentDomain_UnhandledException(object sender, UnhandledExceptionEventArgs e)
 {
     try
     {
         var exception = e.ExceptionObject as Exception;
         if (exception != null)
         {
             Logging4net.WriteError(exception, "系统异常");
         }
     }
     catch (Exception ex)
     {
         Logging4net.WriteError(ex, "系统异常");
         MsgBox.Show("系统出现错误,即将退出;" + ex.Message);
     }
 }
Пример #2
0
 private void btn_start_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         btn_start.IsEnabled = false;
         initListener();
         btn_start.Content = "启动成功";
     }
     catch (Exception ex)
     {
         MsgBox.Show("启动失败,请检查串口连接是否正常");
         btn_start.IsEnabled = true;
         sp.Dispose();
         sp = null;
         Logging4net.WriteError(ex, "串口监听启动失败");
     }
 }
Пример #3
0
 void TsSendRP(object obj)
 {
     try
     {
         RedPackListInfo item  = obj as RedPackListInfo;
         RequestModel    model = new RequestModel()
         {
             openid      = item.OpenId,
             amount      = item.PackMoney.ToString(),
             clientip    = "127.0.0.1",
             clientport  = "80",
             hdclass     = "17",
             sendtxt     = "解放碑地下环道游戏红包",
             timecontrol = "1"
         };
         string req = SendRedPack.SendTo(model);
         Logging4net.WriteInfo("result: " + req);
         if (!req.Contains("Error") && req.Contains("{\"State\":\"0\"}"))
         {
             this.Update(() => new RedPackListInfo()
             {
                 PaySign = req, PackStatus = 1
             }, a => a.ID == item.ID);
         }
         else
         {
             int i = this.Update(() => new RedPackListInfo()
             {
                 PaySign = req
             }, a => a.ID == item.ID);
         }
     }
     catch (Exception ex)
     {
         Logging4net.WriteError(ex, "红包发送失败");
     }
 }