Exemplo n.º 1
0
        // Handlers

        public void UpdateQuoteHandler(double q)
        {
            if (!isLoggedIn)
            {
                return;
            }

            RedrawQuoteDelegate rDel = new RedrawQuoteDelegate(clientForm.UpdateQuote);

            clientForm.BeginInvoke(rDel, new object[] { q });

            ConfirmDialogDelegate cDel = new ConfirmDialogDelegate(clientForm.ConfirmDialog);

            clientForm.BeginInvoke(cDel, new object[] { q });
        }
Exemplo n.º 2
0
        public void SendMessageToClient(String senderNameInfo, String message, Boolean confirmation)
        {
            String aliasJS           = senderNameInfo.Split('(')[0].Trim();
            String senderName        = senderNameInfo.Split(')')[0].Trim() + ")";
            String info              = senderNameInfo.Split(')')[1].Trim();
            String senderNameDispaly = "";

            if ((info == null) || (info == ""))
            {
                senderNameDispaly = senderName;
            }
            else
            {
                senderNameDispaly = info.Split(';')[0].Trim() + " (" + info.Split(';')[1].Trim() + ")";
            }
            // hide host nmae /////////////////////////////////////////////
            if (clientForm.hideHostName == "true")
            {
                senderNameDispaly = senderNameDispaly.Split('(')[0].Trim();
            }
            ///////////////////////////////////////////////////////////////

            String msgText;

            if (message == "selftest")
            {
                clientForm.selftestResult = true;
                return;
            }

            message = Regex.Replace(message, @"<", "&#60;");
            message = Regex.Replace(message, @">", "&#62;");
            message = Regex.Replace(message, @"\n", "<br>");
            message = Regex.Replace(message, @"  ", "&nbsp; ");

            message = Regex.Replace(message, @"((http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?)",
                                    "<span title='$1' style ='COLOR: #0000ff; TEXT-DECORATION: underline; CURSOR: pointer;' onclick=\"window.external.openLink('$1')\">$1</span>",
                                    RegexOptions.IgnoreCase);

            message = Regex.Replace(message, @"(([a-zA-Z0-9_\-\.]+)@([a-zA-Z0-9_\-\.]+)\.([a-zA-Z]{2,5}))",
                                    "<span title='mailto:$1' style ='COLOR: #0000ff; TEXT-DECORATION: underline; CURSOR: pointer;' onclick=\"window.external.openLink('mailto:$1')\">$1</span>",
                                    RegexOptions.IgnoreCase);

            if (confirmation)
            {
                message = Regex.Replace(message, @"sDeliveryTotal", clientForm.SettingList["sDeliveryTotal"]);
                message = Regex.Replace(message, @"sDeliveryFailed", clientForm.SettingList["sDeliveryFailed"]);
            }

            if (clientForm.modeReadOnly == "true")
            {
                msgText = "<tr><td align='center' height='2'></td></tr><tr><td align='left'>" +
                          "<div style='FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: arial;'>" +
                          DateTime.Now.ToString() + " " + clientForm.SettingList["sMsgFrom"] + " " +
                          "<span style ='COLOR: #0000ff; TEXT-DECORATION: underline;'>" + senderNameDispaly + "</span></div><br>" +
                          "<font style='FONT-WEIGHT: normal; FONT-SIZE: 14px; COLOR: #000000; FONT-FAMILY: arial;'>" + message + "</font>" +
                          "<hr style = 'HEIGHT:1px;'></td></tr>";
            }
            else
            {
                msgText = "<tr><td align='center' height='2'></td></tr><tr><td align='left'>" +
                          "<div style='FONT-WEIGHT: normal; FONT-SIZE: 12px; COLOR: #000000; FONT-FAMILY: arial;'>" +
                          DateTime.Now.ToString() + " " + clientForm.SettingList["sMsgFrom"] + " " +
                          "<span title = '" + clientForm.SettingList["sTitleReply"] + "'" +
                          "style ='COLOR: #0000ff; TEXT-DECORATION: underline; CURSOR: pointer;'" +
                          "onclick=\"window.external.getReplyName('" + senderNameInfo + "')\"; onmouseup=\"mouseButton" + aliasJS + "(event)\";>" + senderNameDispaly + "</span></div><br>" +
                          "<script>var mouseButton" + aliasJS + " = function (e) {  var e = e || window.event;  var btn; if ('object' === typeof e) { btn = e.button; " +
                          "if (btn == 2) { window.external.showFormInfo('" + senderNameInfo + "'); } } }</script>" +
                          "<font style='FONT-WEIGHT: normal; FONT-SIZE: 14px; COLOR: #000000; FONT-FAMILY: arial;'>" + message + "</font>" +
                          "<hr style = 'HEIGHT:1px;'></td></tr>";
            }

            txtMessagesUpdateDelegate WFUDelegate = new txtMessagesUpdateDelegate(SendMessageToClientReturned);

            clientForm.BeginInvoke(WFUDelegate, new object[] { senderName, msgText });
        }