예제 #1
0
 private string CreateMessage(bool succes)
 {
     try
     {
         IMessageConfig messageconfig = new MessageConfig();
         HtmlMessage    htmlmessage   = new HtmlMessage(messageconfig);
         var            messageBody   = htmlmessage.CreateMessageBody(Logger.Instance.LogList, succes);
         return(htmlmessage.CreateLayout(messageBody));
     }
     catch (Exception ex)
     {
         throw new Exception($"Fout bij het aanmaken van mail bericht.{Environment.NewLine}[Error]{ex.Message}");
     }
 }
예제 #2
0
 public HtmlMessage QueryPub(string xh)
 {
     try
     {
         Dictionary <string, object> dictionary = new Dictionary <string, object>();
         dictionary.Add("XH", xh);
         Dictionary <string, object> dictionary2 = BaseDAOFactory.GetBaseDAOSQLite().querySQL("pubQueryOne", dictionary)[0] as Dictionary <string, object>;
         HtmlMessage message = new HtmlMessage(dictionary2["xh"].ToString(), dictionary2["bt"].ToString(), dictionary2["nr"].ToString(), dictionary2["lx"].ToString(), 10);
         this.log.Info("查询公告明细信息");
         return(message);
     }
     catch (Exception exception)
     {
         this.log.Error("查询公告明细信息异常:" + exception.ToString());
         return(null);
     }
 }
예제 #3
0
 internal MessageForm(PubClient parent, HtmlMessage mess)
 {
     this.InitializeComponent();
     base._IsMoveFlag           = false;
     this.parent                = parent;
     this.mess                  = mess;
     this.messText.DocumentText = mess.Title;
     this.showSec               = mess.TipShowSec;
     if (mess.Id.Equals("000000"))
     {
         this.showBt.Hide();
     }
     this.reTimer          = new Timer();
     this.reTimer.Interval = 0x3e8;
     this.reTimer.Tick    += new EventHandler(this.reTimer_Tick);
     this.reTimer.Start();
 }
예제 #4
0
 public bool SavePub(HtmlMessage mess)
 {
     try
     {
         Dictionary <string, object> dictionary = new Dictionary <string, object>();
         dictionary.Add("XH", mess.Id);
         dictionary.Add("BT", mess.Title);
         dictionary.Add("NR", mess.Message);
         dictionary.Add("LX", mess.Type);
         int num = BaseDAOFactory.GetBaseDAOSQLite().未确认DAO方法2_疑似updateSQL("pubSave", dictionary);
         this.log.Info("保存公告信息");
         return(num == 1);
     }
     catch (Exception exception)
     {
         this.log.Error("保存公告信息异常:" + exception.ToString());
         return(false);
     }
 }
예제 #5
0
 private void getMess(HtmlMessage mess)
 {
     try
     {
         IPubManager manager = new PubManager();
         if (manager.SavePub(mess))
         {
             string id = mess.Id;
             if (id.PadLeft(0x19, '0').CompareTo(Config.maxMessID.PadLeft(0x19, '0')) > 0)
             {
                 Config.maxMessID = id;
                 PropertyUtil.SetValue("PUB_MAX_MESS_ID", id);
             }
         }
         new MessageForm(this, mess).ShowDialog();
     }
     catch (Exception exception)
     {
         this.log.ErrorFormat("接收公告信息异常:{0}", exception.ToString());
     }
 }
예제 #6
0
 private void Login(LoginOKMessage mess)
 {
     try
     {
         if (!mess.Code.Equals("0000"))
         {
             status = string.Format("[{0}]连接公告服务器失败({1},{2})", DateTime.Now.ToLocalTime(), mess.Code, mess.Mess);
             Thread.Sleep(0x3e8);
             this.ReConnectServer();
         }
         else
         {
             status = string.Format("[{0}]连接公告服务器成功({1}:{2})", DateTime.Now.ToLocalTime(), this.client.ServerPoint.Address.ToString(), this.client.ServerPoint.Port);
             HtmlMessage message = new HtmlMessage("000000", "已连接到公告服务器!", "", "", 3);
             new MessageForm(this, message).ShowDialog();
         }
     }
     catch (Exception exception)
     {
         this.log.ErrorFormat("接收登录反馈信息异常:{0}", exception.ToString());
     }
 }
예제 #7
0
파일: Class1.cs 프로젝트: hkloudou/HX-Base
 public static void smethod_3(HtmlMessage htmlMessage_0)
 {
     Console.WriteLine("MESSAGE:");
     Console.WriteLine("MESS:{0}", htmlMessage_0.Message);
 }
예제 #8
0
 public HtmlMessage Append(HtmlMessage message)
 {
     sb.Append(message);
     return(this);
 }
예제 #9
0
 public HtmlMessage Strike(HtmlMessage inner) => TagBuilder("s", inner);
예제 #10
0
 public HtmlMessage Underline(HtmlMessage inner) => TagBuilder("u", inner);
예제 #11
0
 public HtmlMessage Italic(HtmlMessage inner) => TagBuilder("i", inner);
예제 #12
0
 public HtmlMessage Bold(HtmlMessage inner) => TagBuilder("b", inner);
예제 #13
0
        int ShowInstance(
            string message,
            string caption,
            string button1,
            string button2,
            string button3,
            string button4,
            MessageBoxIcon icon,
            int width  = -1,
            int height = -1)
        {
            IWin32Window owner = SessionManager.ActiveForm;
            DialogResult dr;

            try
            {
                // Use DevExpress message box

                if (Message == null)
                {
                    XtraMessageBox.SmartTextWrap = true;

                    XtraMessageBoxArgs mba = new XtraMessageBoxArgs();
                    mba.Owner         = Owner;
                    mba.Text          = message;
                    mba.Caption       = caption;
                    mba.Buttons       = new DialogResult[] { DialogResult.OK };
                    mba.AllowHtmlText = DevExpress.Utils.DefaultBoolean.False;
                    dr = XtraMessageBox.Show(mba);
                    return((int)dr);
                }

                if (width > 0) // size specified
                {
                    Width  = width;
                    Height = height;
                }

                Text         = caption;
                Message.Text = message;
                int definedCount = 0;
                definedCount += SetupButton(Button1, button1);
                definedCount += SetupButton(Button2, button2);
                definedCount += SetupButton(Button3, button3);
                definedCount += SetupButton(Button4, button4);

                int shift = (Button2.Left - Button1.Left) * (4 - definedCount);
                Button1.Left += shift;
                Button2.Left += shift;
                Button3.Left += shift;
                Button4.Left += shift;

                if (message.Contains("</") || message.Contains("/>") || Lex.Contains(message, "<br>"))
                { // display HTML prompt
                    Message.Visible     = false;
                    HtmlMessage.Visible = true;
                    string       htmlFile  = TempFile.GetTempFileName("html");
                    StreamWriter sw        = new StreamWriter(htmlFile);
                    int          backColor = ((BackColor.R * 256 + BackColor.G) * 256) + BackColor.B;
                    string       hexColor  = String.Format("#{0:X}", backColor);
                    if (!Lex.Contains(message, "<body")) // set basic style for page
                    {
                        sw.Write("<body " +
                                 " topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' hspace='0' vspace='0' " +
                                 " style=\"font-size:8.5pt;font-family:'Tahoma';background-color:" + hexColor + "\">");
                    }

                    else // just try to set matching background color
                    {
                        message = Lex.Replace(message, "background-color: #FFFFFF", "background-color: " + hexColor);
                    }

                    message = message.Replace("\n", "<br>");
                    message = message.Replace("\r", "");

                    sw.Write(message);
                    if (!Lex.Contains(message, "<body"))
                    {
                        sw.Write("</body>");
                    }
                    sw.Close();
                    HtmlMessage.Navigate(htmlFile);
                }

                else // display simple label prompt
                {
                    HtmlMessage.Visible = false;
                    Message.Visible     = true;
                    Message.BackColor   = Message.Parent.BackColor;
                    if (Lex.Contains(message, "<br>")) // replace "<br>" with newlines
                    {
                        message = message.Replace("<br>", "\n");
                    }

                    message       = Lex.AdjustEndOfLineCharacters(message, "\n"); // convert any new line chars to standard char
                    Message.Lines = message.Split('\n');

                    if (Message.Lines.Length <= 4)
                    {
                        Message.BorderStyle           = BorderStyles.NoBorder;
                        Message.Properties.ScrollBars = ScrollBars.None;
                    }
                    else
                    {
                        Message.BorderStyle           = BorderStyles.Default;
                        Message.Properties.ScrollBars = ScrollBars.Vertical;
                    }

                    //Message.Text = prompt;
                }

                SetIconImageIndex(IconImage, icon); // set the proper icon

                owner = SessionManager.ActiveForm;
                //owner = null; // debug (switching to another app and then back to the main form does not bring up this modal dialog)
                dr = ShowDialog(owner);
                return((int)dr);
            }

            catch (Exception ex)
            {
                string errorMsg = "Show: " + message + "\r\n" + new StackTrace(true);
                ClientLog.Message(errorMsg);
                DebugLog.Message(errorMsg);
                return((int)DialogResult.OK);
            }
        }
예제 #14
0
        private void method_0()
        {
            while (!this.bool_2)
            {
                if (this.bool_3)
                {
                    break;
                }
                if ((this.udpClient_0 != null) && ((this.udpClient_0.Available > 5) || this.udpClient_0.Client.Connected))
                {
                    byte[] buffer;
                    try
                    {
                        buffer = this.udpClient_0.Receive(ref this.ipendPoint_0);
                    }
                    catch (Exception exception)
                    {
                        this.ilog_0.ErrorFormat("接收数据异常:{0}", exception.ToString());
                        Thread.Sleep(500);
                        continue;
                    }
                    object obj2 = SerializeTool.Deserialize(buffer);
                    Type   type = obj2.GetType();
                    if (type == typeof(LoginOKMessage))
                    {
                        LoginOKMessage message = (LoginOKMessage)obj2;
                        this.bool_1 = true;
                        if (message.Code.Equals("0000"))
                        {
                            this.bool_0 = true;
                        }
                        this.ipendPoint_1 = message.EndPoint;
                        this.method_2(message);
                    }
                    else if (type == typeof(HtmlMessage))
                    {
                        HtmlMessage      message2 = (HtmlMessage)obj2;
                        ReceiveOKMessage message3 = new ReceiveOKMessage(this.string_0, this.string_1, message2.Id);
                        buffer = SerializeTool.Serialize(message3);
                        this.udpClient_0.Send(buffer, buffer.Length, this.ipendPoint_0);
                        this.method_1(message2);
                    }
                    else if (type == typeof(StopSrvMessage))
                    {
                        this.bool_3 = true;
                        StopSrvMessage message4 = (StopSrvMessage)obj2;
                        this.method_3(message4);
                    }
                    else
                    {
                        this.ilog_0.ErrorFormat("接收到的消息格式错误:{0}", type.ToString());
                    }
                }
                else if (!this.bool_0 && (DateTime.Now.Subtract(this.dateTime_0).TotalSeconds > this.MaxConnWaitTime))
                {
                    this.dateTime_0 = DateTime.Now.AddYears(1);
                    LoginOKMessage message5 = new LoginOKMessage("Z999", new IPEndPoint(IPAddress.Any, 0))
                    {
                        Mess = string.Concat(new object[] { "登录超时[", this.ipendPoint_0.Address, ":", this.ipendPoint_0.Port, "]" })
                    };
                    this.method_2(message5);
                }
                Thread.Sleep(500);
            }
            bool flag = this.bool_3;

            this.bool_3 = false;
            this.bool_2 = false;
            if (flag && (this.ReConnectEvent != null))
            {
                this.ReConnectEvent();
            }
        }