예제 #1
0
 public void ProcessMessage(object message)
 {
     if (message is AdminReportClientcountMessage)
     {
         AdminReportClientcountMessage m = message as AdminReportClientcountMessage;
         this.parent.Invoke(new Action(delegate
         {
             this.parent.UpdateUserCountText(m.Value, m.Total, m.Waiting, m.States);
         }));
     }
     if (message is AdminReportEmergencyStopMessage)
     {
         AdminReportEmergencyStopMessage m = message as AdminReportEmergencyStopMessage;
         this.parent.Invoke(new Action(delegate
         {
             this.parent.UpdateStoppedServices(m.ServiceList);
         }));
     }
 }
예제 #2
0
 public void SetUserCount(AdminReportClientcountMessage message)
 {
     this.Form.Invoke(new Action(delegate
     {
         StringBuilder stringBuilder = new StringBuilder();
         string text = DateTime.Now.ToString("yy/MM/dd HH:mm:ss");
         stringBuilder.AppendFormat("[{0}] {1}/{2}(Wait {3})", new object[]
         {
             text,
             message.Value,
             message.Total,
             message.Waiting
         });
         foreach (KeyValuePair <string, int> keyValuePair in message.States)
         {
             stringBuilder.AppendFormat(" {0}({1})", keyValuePair.Key, keyValuePair.Value);
         }
         string text2 = stringBuilder.ToString();
         this.Form.TextUserCount.Text = text2;
         try
         {
             using (HeroesSupportDataContext heroesSupportDataContext = new HeroesSupportDataContext())
             {
                 heroesSupportDataContext.UserCount.InsertOnSubmit(new UserCount
                 {
                     Text = text2,
                     Time = DateTime.Now
                 });
                 heroesSupportDataContext.SubmitChanges();
             }
         }
         catch
         {
             this.Form.TextLog.AppendText(string.Format("\r\n[{0} - {1}] Error while saving user count into db.", text, LogType.ERROR));
         }
     }));
 }