当前位置: 首页>>代码示例>>C#>>正文


C# ASObject.getString方法代码示例

本文整理汇总了C#中ASObject.getString方法的典型用法代码示例。如果您正苦于以下问题:C# ASObject.getString方法的具体用法?C# ASObject.getString怎么用?C# ASObject.getString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ASObject的用法示例。


在下文中一共展示了ASObject.getString方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BlackList

        public bool BlackList(ASObject mail, string type)
        {
            bool IsChange = false;
            string folder = mail.getString("folder");
            if (folder == "INBOX")
                IsChange = true;
            if (folder == "SPAM")
                IsChange = true;
            if (!IsChange)
                return false;

            string toFolder = null;
            if (type == "email_b")
            {
                Remoting.call("MailManager.addBlackList", new object[] { mail.getString("contact_mail"), null, mail.getString("mail_from_label") });
                toFolder = "SPAM";
            }
            else if (type == "email_w")
            {
                Remoting.call("MailManager.removeBlackList", new object[] { mail.getString("contact_mail"), null });
                toFolder = "INBOX";
            }
            else if (type == "domain_b")
            {
                string contact_mail = mail.getString("contact_mail");
                string[] spilts = contact_mail.Split('@');
                if (spilts.Length != 2)
                    return false;
                Remoting.call("MailManager.addBlackList", new object[] { null, spilts[1], mail.getString("mail_from_label") });
                toFolder = "SPAM";
            }
            else if (type == "domain_w")
            {
                string contact_mail = mail.getString("contact_mail");
                string[] spilts = contact_mail.Split('@');
                if (spilts.Length != 2)
                    return false;
                Remoting.call("MailManager.removeBlackList", new object[] { null, spilts[1] });
                toFolder = "INBOX";
            }

            if (folder == toFolder)
                return false;

            mail["folder"] = toFolder;

            updateMail(mail, new string[] { "folder" });

            return true;
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:50,代码来源:MailWorker.cs

示例2: MoveFolder

        public bool MoveFolder(ASObject mail, string toFolder)
        {
            string folder = mail.getString("folder");
            if (toFolder == folder)
                return false;
            if (folder == "DRAFT" || folder == "OUTBOX" || folder == "DSBOX" || folder == "SENDED")
                return false;

            mail["folder"] = toFolder;

            updateMail(mail, new string[] { "folder" });

            return true;
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:14,代码来源:MailWorker.cs

示例3: sendReceiptMail

        /// <summary>
        /// 发送阅读回折邮件
        /// </summary>
        /// <param name="sHtmlText">邮件内容</param>
        /// <param name="from">发送人</param>
        /// <param name="to">接收人</param>
        public void sendReceiptMail(string sHtmlText, string subject, ASObject from, string[] to)
        {
            using (MemoryStreamEx stream = new MemoryStreamEx(32000))
            {
                Mail_Message m = new Mail_Message();
                m.MimeVersion = "1.0";
                m.Date = DateTime.Now;
                m.MessageID = MIME_Utils.CreateMessageID();

                m.Subject = subject;
                StringBuilder sb = new StringBuilder();
                foreach (string p in to)
                {
                    if (sb.Length > 0)
                        sb.Append(",");
                    sb.Append(p);
                }
                m.To = Mail_t_AddressList.Parse(sb.ToString());

                //--- multipart/alternative -----------------------------------------------------------------------------------------
                MIME_h_ContentType contentType_multipartAlternative = new MIME_h_ContentType(MIME_MediaTypes.Multipart.alternative);
                contentType_multipartAlternative.Param_Boundary = Guid.NewGuid().ToString().Replace('-', '.');
                MIME_b_MultipartAlternative multipartAlternative = new MIME_b_MultipartAlternative(contentType_multipartAlternative);
                m.Body = multipartAlternative;

                //--- text/plain ----------------------------------------------------------------------------------------------------
                MIME_Entity entity_text_plain = new MIME_Entity();
                MIME_b_Text text_plain = new MIME_b_Text(MIME_MediaTypes.Text.plain);
                entity_text_plain.Body = text_plain;
                text_plain.SetText(MIME_TransferEncodings.QuotedPrintable, Encoding.UTF8, sHtmlText);
                multipartAlternative.BodyParts.Add(entity_text_plain);

                //--- text/html ------------------------------------------------------------------------------------------------------
                MIME_Entity entity_text_html = new MIME_Entity();
                MIME_b_Text text_html = new MIME_b_Text(MIME_MediaTypes.Text.html);
                entity_text_html.Body = text_html;
                text_html.SetText(MIME_TransferEncodings.QuotedPrintable, Encoding.UTF8, sHtmlText);
                multipartAlternative.BodyParts.Add(entity_text_html);

                MIME_Encoding_EncodedWord headerwordEncoder = new MIME_Encoding_EncodedWord(MIME_EncodedWordEncoding.Q, Encoding.UTF8);
                m.ToStream(stream, headerwordEncoder, Encoding.UTF8);
                stream.Position = 0;

                SMTP_Client.QuickSendSmartHost(null, from.getString("send_address", "stmp.sina.com"), from.getInt("send_port", 25),
                    from.getBoolean("is_send_ssl", false), from.getString("account"), PassUtil.Decrypt(from.getString("password")),
                    from.getString("account"), to, stream);
            }
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:54,代码来源:MailWorker.cs

示例4: send

        /// <summary>
        /// 发送邮件
        /// </summary>
        /// <param name="mm">邮件对象</param>
        /// <param name="from">发送人</param>
        /// <param name="to">接收人</param>
        private void send(Mail_Message mm, ASObject from, string[] to)
        {
            using (MemoryStreamEx stream = new MemoryStreamEx(32000))
            {
                MIME_Encoding_EncodedWord headerwordEncoder = new MIME_Encoding_EncodedWord(MIME_EncodedWordEncoding.Q, Encoding.UTF8);
                mm.ToStream(stream, headerwordEncoder, Encoding.UTF8);
                stream.Position = 0;

                SMTP_Client.QuickSendSmartHost(null, from.getString("send_address", "stmp.sina.com"), from.getInt("send_port", 25),
                    from.getBoolean("is_send_ssl", false), from.getString("account"), PassUtil.Decrypt(from.getString("password")),
                    from.getString("account"), to, stream);
            }
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:19,代码来源:MailSendWorker.cs

示例5: OnMailEvent

        void OnMailEvent(MailWorker.Event eventType, ASObject mail, string[] updateFields)
        {
            switch (eventType)
            {
                case MailWorker.Event.Delete:
                    return;
                case MailWorker.Event.Create:
                    {
                        if (mail == null)
                            return;
                        MailWorker.instance.saveMailRecord(mail);

                        string folder = mail.getString("folder");
                        XElement folderXml = sxml.XPathSelectElement("/mailbox/folder[@name='" + folder + "']");
                        string count = folderXml.AttributeValue("count");
                        if (IsBool(mail.get("is_seen")))
                        {
                            if (count == "(1)" || count == "")
                                folderXml.SetAttributeValue("count", "");
                            else
                            {
                                count = count.Replace("(", "").Replace(")", "");
                                folderXml.SetAttributeValue("count", "(" + (NumberUtil.toLong(count) - 1) + ")");
                            }
                        }
                        else
                        {
                            if (count == "")
                                folderXml.SetAttributeValue("count", "(1)");
                            else
                            {
                                count = count.Replace("(", "").Replace(")", "");
                                folderXml.SetAttributeValue("count", "(" + (NumberUtil.toLong(count) + 1) + ")");
                            }
                        }

                        if (mail["mail_date"] is DateTime && !IsBool(mail.get("is_handled")))
                        {
                            DateTime time = (DateTime)mail["mail_date"];
                            string value = unhandledMailProvider.JudgeTimePhase(time);
                            folderXml = sxml.XPathSelectElement("/folder/folder[@value='" + value + "']");
                            if (folderXml != null)
                            {
                                count = folderXml.AttributeValue("count");
                                if (count == "")
                                    folderXml.SetAttributeValue("count", "(1)");
                                else
                                {
                                    count = count.Replace("(", "").Replace(")", "");
                                    folderXml.SetAttributeValue("count", "(" + (NumberUtil.toLong(count) + 1) + ")");
                                }
                            }
                        }
                    }
                    break;
                case MailWorker.Event.Update:
                    {
                        if (mail == null || updateFields == null || updateFields.Length == 0)
                            return;

                        MailWorker.instance.updateMail(mail, updateFields);

                        bool is_seen = false;
                        bool is_handled = false;
                        foreach (string s in updateFields)
                        {
                            if (s == "is_seen")
                                is_seen = true;
                            else if (s == "is_handled")
                                is_handled = true;
                        }

                        if (is_seen)
                        {
                            string folder = mail.getString("folder");
                            XElement folderXml = sxml.XPathSelectElement("/mailbox/folder[@name='" + folder + "']");
                            string count = folderXml.AttributeValue("count");
                            if (IsBool(mail.get("is_seen")))
                            {
                                if (count == "(1)" || count == "")
                                    folderXml.SetAttributeValue("count", "");
                                else
                                {
                                    count = count.Replace("(", "").Replace(")", "");
                                    folderXml.SetAttributeValue("count", "(" + (NumberUtil.toLong(count) - 1) + ")");
                                }
                            }
                            else
                            {
                                if (count == "")
                                    folderXml.SetAttributeValue("count", "(1)");
                                else
                                {
                                    count = count.Replace("(", "").Replace(")", "");
                                    folderXml.SetAttributeValue("count", "(" + (NumberUtil.toLong(count) + 1) + ")");
                                }
                            }
                        }

                        if (is_handled)
//.........这里部分代码省略.........
开发者ID:nbhopson,项目名称:QMail,代码行数:101,代码来源:MailBoxBar.xaml.cs

示例6: executeRecvMaill

        private void executeRecvMaill(ASObject ac, string pubId)
        {
            mailAccount = new MailAccount();

            mailAccount.pubId = pubId;
            mailAccount.account = ac.getString("account");
            mailAccount.name = ac.getString("name");
            mailAccount.recv_server = ac.getString("recv_address");
            mailAccount.recv_port = ac.getInt("recv_port");
            mailAccount.recv_type = (ac.getInt("recv_type") == 1 ? MailAccount.RECV_TYPE.POP3 : MailAccount.RECV_TYPE.IMAP);
            mailAccount.password = PassUtil.Decrypt(ac.getString("password"));
            mailAccount.recv_ssl = ac.getBoolean("is_recv_ssl");

            uids = new List<string>();
            /*
            DataSet ds = DBWorker.ExecuteQuery("select mail_uid from ML_Mail where mail_account = '" + mailAccount.account + "'");
            if (ds.Tables.Count > 0)
            {
                DataTable dt = ds.Tables[0];
                foreach (DataRow row in dt.Rows)
                {
                    if (String.IsNullOrWhiteSpace(row[0] as string))
                        continue;
                    uids.Add((string)row[0]);
                }
            }*/
            //获取账户对应的所有UIDs
            object result = Remoting.call("MailManager.getMailAccountUids", new object[] { mailAccount.account });
            object[] record = result as object[];
            if (record != null && record.Length > 0)
            {
                foreach (object r in record)
                {
                    uids.Add(r as string);
                }
            }

            try
            {
                if (mailAccount.recv_type == MailAccount.RECV_TYPE.POP3)
                {
                    pop3RecvMail();
                }
                else if (mailAccount.recv_type == MailAccount.RECV_TYPE.IMAP)
                {
                    imapRecvMail();
                }

                if (hasError)
                    throw new Exception("邮件已全部接收完成,但至少有一封邮件发生错误,相关内容请查看详细信息。");
            }
            catch (Exception e)
            {
                throw e;
            }
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:56,代码来源:MailReceiveWorker.cs

示例7: showMail

        private void showMail(ASObject mail)
        {
            try
            {
                webBrowser.Navigate("about:blank");
                attachments.Children.Clear();

                Subject.Text = mail["subject"] as string;
                DateTime date = (DateTime)mail["mail_date"];
                if (date != null)
                    Date.Text = date.ToString("yyyy-MM-dd HH:mm");
                else
                    Date.Text = "";

                Sender.Text = mail["mail_from_label"] as string;

                int customer_grade = mail.getInt("customer_grade");

                GradeLabel.Text = getGradeLabel(customer_grade);
                GradeImage.Source = getGradeImage(customer_grade);

                int handle_action = mail.getInt("handle_action");
                HandleActionLabel.Text = getHandleAction(handle_action);
                HandleActionImage.Source = getHandleActionImage(handle_action);

                /*
                string remark = mail.getString("remark");
                if (String.IsNullOrWhiteSpace(remark))
                    txtRemark.Visibility = System.Windows.Visibility.Collapsed;
                else
                    txtRemark.Text = remark;
                 * */

                string contents = mail["contents"] as string;
                if (!String.IsNullOrEmpty(contents))
                {
                    XmlDocument contentsXml = new XmlDocument();
                    contentsXml.LoadXml(CleanInvalidXmlChars(contents));
                    string htmlfile = null;
                    bool hasText = false;
                    string root_path;

                    root_path = Desktop.instance.ApplicationPath + "/mail/" + mail["mail_file"];
                    DirectoryInfo dirinfo = Directory.GetParent(root_path);
                    root_path = dirinfo.FullName + "/" + mail["uuid"] + ".parts/";

                    foreach (XmlElement xml in contentsXml.GetElementsByTagName("PART"))
                    {
                        string type = xml.GetAttribute("type");
                        if (type == "html")
                        {
                            htmlfile = root_path + mail["uuid"] + ".html";
                        }
                        else if (type == "text")
                        {
                            hasText = true;
                        }
                        else if (type == "file")
                        {
                            if (String.IsNullOrEmpty(xml.GetAttribute("content-id")))
                            {
                                AttachmentItem item = new AttachmentItem();
                                item.SetAttachment(root_path + xml.GetAttribute("filename"));
                                attachments.Children.Add(item);
                            }
                        }
                    }

                    if (!String.IsNullOrEmpty(htmlfile))
                    {
                        if (File.Exists(htmlfile))
                        {
                            Uri uri = new Uri("file:///" + htmlfile);
                            webBrowser.Navigate(uri);
                        }
                    }
                    else if (hasText)
                    {
                        string textfile = root_path + mail["uuid"] + ".text.html";
                        if (File.Exists(textfile))
                        {
                            Uri uri = new Uri("file:///" + textfile);
                            webBrowser.Navigate(uri);
                        }
                    }
                }

                txtFrom.Text = mail.getString("country_from");
                txtArea.Text = (String.IsNullOrWhiteSpace(mail.getString("area_from")) ? "" : mail.getString("area_from"));
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Write(e.StackTrace);
                ime.controls.MessageBox.Show(e.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:96,代码来源:MailViewWindow.xaml.cs

示例8: OnHtmlEditorImageChangedEvent

 void OnHtmlEditorImageChangedEvent(HtmlEditor.Event eventType, ASObject value)
 {
     StringBuilder sb = new StringBuilder();
     sb.Append("<img src='").Append(value.getString("path")).Append("'");
     if(value.ContainsKey("width"))
         sb.Append(" width='").Append(value.getString("width")).Append("px'");
     if (value.ContainsKey("height"))
         sb.Append(" height='").Append(value.getString("height")).Append("px'");
     if(value.ContainsKey("alt"))
         sb.Append(" alt='").Append(value.getString("alt")).Append("'");
     sb.Append(" />");
     if(eventType == Event.Create)
         runtime.call("HtmlEditorInsertContent", new object[] { sb.ToString()});
     else if(eventType == Event.Update)
         runtime.call("HtmlEditorReplaceContent", new object[] { sb.ToString() });
 }
开发者ID:nbhopson,项目名称:QMail,代码行数:16,代码来源:HtmlEditor.xaml.cs

示例9: recvMaill

        private void recvMaill(ASObject ac, string pubId, bool isJoin = false)
        {
            string account = ac.getString("account");
            try
            {
                if (!pubIds.Contains(pubId))
                {
                    MessageManager.instance.subscribeMessage(pubId);
                    pubIds.Add(pubId);
                }
                executeRecvMaill(ac, pubId);
                AsyncOption option = new AsyncOption("MailManager.recvTaskFinished");
                option.showWaitingBox = false;
                Remoting.call("MailManager.recvTaskFinished", new object[] { account }, this, option);
                if (pubIds.Contains(pubId))
                {
                    MessageManager.instance.endPublish(pubId);
                    pubIds.Remove(pubId);
                }
            }
            catch (Exception ex)
            {
                error(ex.Message);
                return;
            }
            finally
            {
                AsyncOption option = new AsyncOption("MailManager.recvTaskFinished");
                option.showWaitingBox = false;
                Remoting.call("MailManager.recvTaskFinished", new object[] { account }, this, option);
                if (pubIds.Contains(pubId))
                {
                    MessageManager.instance.endPublish(pubId);
                    pubIds.Remove(pubId);
                }
            }

            if (!isJoin)
            {
                recvs.Remove(ac);
                execute(recvs);
            }
            else
            {
                joinList.Remove(ac);
                isJoinAccept = false;
            }
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:48,代码来源:MailReceiveWorker.cs

示例10: ShowMail

        public void ShowMail(ASObject mail, bool isSearch = false)
        {
            btnGrade.IsEnabled = !isSearch;
            btnRemark.IsEnabled = !isSearch;
            btnHandle.IsEnabled = !isSearch;

            if (mail.getString("folder") != "INBOX" && !isSearch)
            {
                btnGrade.IsEnabled = false;
                btnRemark.IsEnabled = false;
                btnHandle.IsEnabled = false;
            }

            hideTranslate();

            tobTranslate.IsChecked = false;

            this.mail = mail;
            try
            {
                root.Visibility = System.Windows.Visibility.Visible;
                Mouse.OverrideCursor = Cursors.Wait;

                webBrowser.Navigate("about:blank");
                attachments.Children.Clear();

                txtSubject.Text = mail["subject"] as string;
                DateTime date = (DateTime)mail["mail_date"];
                if (date != null)
                    txtDate.Text = date.ToString("yyyy-MM-dd HH:mm");
                else
                    txtDate.Text = "";

                txtSender.Text = mail["mail_from_label"] as string;

                int customer_grade = mail.getInt("customer_grade");

                txtGradeLabel.Text = getGradeLabel(customer_grade);
                imgGrade.Source = getGradeImage(customer_grade);

                int handle_action = mail.getInt("handle_action");
                txtHandleAction.Text = getHandleAction(handle_action);
                imgHandleAction.Source = getHandleActionImage(handle_action);

                string contents = mail["contents"] as string;
                string file = Desktop.instance.ApplicationPath + "/mail/" + mail["mail_file"];
                if (String.IsNullOrEmpty(contents) || !File.Exists(file))
                {
                    if (!isSearch)
                    {
                        MailWorker.instance.ParseMail(mail);
                        MailWorker.instance.updateMailRecord(mail, new string[] { "attachments", "contents" });
                    }
                    else
                        MailWorker.instance.ParseMail(mail);
                    contents = mail["contents"] as string;
                }
                XmlDocument contentsXml = new XmlDocument();
                if (!String.IsNullOrEmpty(contents))
                {
                    contentsXml.LoadXml(CleanInvalidXmlChars(contents));
                    string htmlfile = null;
                    bool hasText = false;
                    string root_path;

                    root_path = Desktop.instance.ApplicationPath + "/mail/" + mail["mail_file"];
                    DirectoryInfo dirinfo = Directory.GetParent(root_path);
                    root_path = dirinfo.FullName + "/" + mail["uuid"] + ".parts/";

                    foreach (XmlElement xml in contentsXml.GetElementsByTagName("PART"))
                    {
                        string type = xml.GetAttribute("type");
                        if (type == "html")
                        {
                            htmlfile = root_path + mail["uuid"] + ".html";
                        }
                        else if (type == "text")
                        {
                            hasText = true;
                        }
                        else if (type == "file")
                        {
                            if (String.IsNullOrEmpty(xml.GetAttribute("content-id")))
                            {
                                AttachmentItem item = new AttachmentItem();
                                item.SetAttachment(root_path + xml.GetAttribute("filename"));
                                attachments.Children.Add(item);
                            }
                        }
                    }

                    if (!String.IsNullOrEmpty(htmlfile))
                    {
                        if (File.Exists(htmlfile))
                        {
                            Uri uri = new Uri("file:///" + htmlfile);
                            webBrowser.Navigate(uri);
                        }
                    }
                    else if (hasText)
//.........这里部分代码省略.........
开发者ID:nbhopson,项目名称:QMail,代码行数:101,代码来源:MailReader.xaml.cs

示例11: showMail

        private void showMail(ASObject mail)
        {
            try
            {
                if (Mail_Type == MailType.Dsbox)
                {
                    btnSave.IsEnabled = false;
                    btnAudit.IsEnabled = false;
                }

                txtTo.TextChanged -= txtTo_TextChanged;
                cboFrom.SelectionChanged -= cboFrom_SelectionChanged;

                string mail_account = mail["mail_account"] as string;
                from = MailSendWorker.instance.findAccount(mail_account);

                if (from == null)
                {
                    txtTo.TextChanged += txtTo_TextChanged;
                    cboFrom.SelectionChanged += cboFrom_SelectionChanged;
                }

                string file = mail.getString("mail_file");
                StringBuilder sb = new StringBuilder();
                Mail_Message = MailWorker.instance.ParseMail(file);
                if (Mail_Type == MailType.Transmit)
                    txtSubject.Text = "Fw:" + mail["subject"] as string;
                else if (Mail_Type == MailType.Reply || Mail_Type == MailType.AllReply)
                {
                    txtSubject.Text = "Re:" + mail["subject"] as string;
                }
                else
                    txtSubject.Text = mail["subject"] as string;

                sb.Clear();
                Mail_t_AddressList addresses = Mail_Message.Cc;
                if (addresses != null)
                {
                    foreach (Mail_t_Mailbox mailbox in addresses.Mailboxes)
                    {
                        sb.Append(mailbox.Address).Append(";");
                    }
                    if (sb.ToString().LastIndexOf(";") != -1)
                        sb.Remove(sb.ToString().LastIndexOf(";"), 1);

                    txtCc.Text = sb.ToString();
                }

                if (Mail_Type == MailType.Draft || Mail_Type == MailType.Dsbox)
                    txtTo.Text = mail["mail_to"] as string;
                else if (Mail_Type != MailType.Transmit)
                    txtTo.Text = mail["contact_mail"] as string;

                if (Mail_Type != MailType.Transmit)
                {
                    //审核人
                    if (mail.ContainsKey("reviewer_id") && !String.IsNullOrWhiteSpace(mail.getString("reviewer_id")))
                    {
                        txtAudit.Text = mail.getString("reviewer_name");
                    }
                }

                sb.Clear();
                string uid = mail["uuid"] as string;
                DirectoryInfo dirinfo = Directory.GetParent(store_path + file);
                string dir = dirinfo.FullName + "/" + uid + ".parts";

                if (Mail_Type == MailType.Transmit)
                {
                    sb.Append(getTransmitVm(mail, Mail_Message));
                    sb.Append("<blockquote id=\"isReplyContent\" style=\"PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid\">");
                }
                else if (Mail_Type == MailType.Reply || Mail_Type == MailType.AllReply)
                {
                    sb.Append(getReplyVm(mail, Mail_Message));
                    sb.Append("<blockquote id=\"isReplyContent\" style=\"PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid\">");
                }

                string textHtml = parseMIMEContent(Mail_Message, dir);
                sb.Append(textHtml);

                if (Mail_Type == MailType.Transmit || Mail_Type == MailType.Reply || Mail_Type == MailType.AllReply)
                {
                    sb.Append("</blockquote>");
                }

                htmlEditor.ContentHtml = sb.ToString();

                if (Mail_Type == MailType.Draft || Mail_Type == MailType.Dsbox)
                {
                    _saveMail = _mail;
                }
            }
            catch (Exception e)
            {
                System.Diagnostics.Debug.Write(e.StackTrace);
                ime.controls.MessageBox.Show(e.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
开发者ID:nbhopson,项目名称:QMail,代码行数:99,代码来源:MailSendWindow.xaml.cs

示例12: btnSendMail_Click

        void btnSendMail_Click(object sender, RoutedEventArgs e)
        {
            using (MemoryStreamEx stream = new MemoryStreamEx(32000))
            {
                try
                {
                    if (String.IsNullOrWhiteSpace(txtTo.Text))
                        throw new Exception("收件人不能为空!");

                    if (Mail_Message == null)
                        Mail_Message = createMessage();

                    updateMessage(Mail_Message);

                    if ((Mail_Type == MailType.AllReply || Mail_Type == MailType.Reply) && _mail != null)
                        Mail_Message.InReplyTo = _mail["message_id"] as string;

                    MIME_Encoding_EncodedWord headerwordEncoder = new MIME_Encoding_EncodedWord(MIME_EncodedWordEncoding.Q, Encoding.UTF8);
                    Mail_Message.ToStream(stream, headerwordEncoder, Encoding.UTF8);

                    int mail_type = (int)DBWorker.MailType.OutboxMail;
                    string folder = "OUTBOX";
                    if (reviewer != null)
                    {
                        mail_type = (int)DBWorker.MailType.SendMail;
                        folder = "DSBOX";
                    }
                    if (_saveMail == null)
                    {
                        StringBuilder sb = new StringBuilder();
                        string uuid = Guid.NewGuid().ToString();
                        sb.Append(MailReceiveWorker.getFilePath(uuid)).Append("/").Append(uuid).Append(".eml");
                        string file = sb.ToString();
                        DirectoryInfo dir = Directory.GetParent(store_path + file);
                        if (!dir.Exists)
                            dir.Create();

                        Mail_Message.ToFile(store_path + file, headerwordEncoder, Encoding.UTF8);
                        _saveMail = saveMail(null, Mail_Message, uuid, file, mail_type, folder);
                        if (mail_type == (int)DBWorker.MailType.SendMail)
                        {
                            _saveMail["reviewer_id"] = reviewer.getLong("id");
                            _saveMail["reviewer_name"] = reviewer.getString("name");
                            _saveMail["operator_id"] = Desktop.instance.loginedPrincipal.id;
                            _saveMail["operator_name"] = Desktop.instance.loginedPrincipal.name;
                        }
                        MailWorker.instance.dispatchMailEvent(MailWorker.Event.Create, _saveMail, null);

                        if (mail_type == (int)DBWorker.MailType.SendMail)
                        {
                            MailWorker.instance.syncUserMail(_saveMail);
                        }
                    }
                    else
                    {
                        List<string> list = getUpdateFields();
                        string file = _saveMail["mail_file"] as string;
                        string uuid = _saveMail["uuid"] as string;
                        Mail_Message.ToFile(store_path + file, headerwordEncoder, Encoding.UTF8);
                        _saveMail = saveMail(_saveMail, Mail_Message, uuid, file, mail_type, folder);
                        if (mail_type == (int)DBWorker.MailType.SendMail)
                        {
                            _saveMail["reviewer_id"] = reviewer.getLong("id");
                            _saveMail["reviewer_name"] = reviewer.getString("name");
                            list.Add("reviewer_id");
                            list.Add("reviewer_name");
                            if (String.IsNullOrWhiteSpace(_saveMail.getString("operator_id")))
                            {
                                _saveMail["operator_id"] = Desktop.instance.loginedPrincipal.id;
                                _saveMail["operator_name"] = Desktop.instance.loginedPrincipal.name;
                                list.Add("operator_id");
                                list.Add("operator_name");
                            }
                        }
                        MailWorker.instance.dispatchMailEvent(MailWorker.Event.Update, _saveMail, list.ToArray());
                    }

                    if (Mail_Type == MailType.AllReply || Mail_Type == MailType.Reply)
                    {
                        _mail["handle_action"] = 2;
                        _mail["is_handled"] = true;

                        MailWorker.instance.dispatchMailEvent(MailWorker.Event.Update, _mail, new string[] { "handle_action", "is_handled" });
                    }
                    if (mail_type == (int)DBWorker.MailType.OutboxMail)
                    {
                        MailSendWorker.instance.AddMail(_saveMail);
                        MailSendWorker.instance.Start();
                    }

                    this.Close();
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Debug.Write(ex.StackTrace);
                    this.Dispatcher.BeginInvoke((System.Action)delegate
                    {
                        ime.controls.MessageBox.Show(ex.Message, "错误", MessageBoxButton.OK, MessageBoxImage.Error);
                    }, System.Windows.Threading.DispatcherPriority.ApplicationIdle);
                }
//.........这里部分代码省略.........
开发者ID:nbhopson,项目名称:QMail,代码行数:101,代码来源:MailSendWindow.xaml.cs

示例13: btnAudit_Click

 void btnAudit_Click(object sender, RoutedEventArgs e)
 {
     PrincipalSelectWindow pwin = new PrincipalSelectWindow(true);
     pwin.setRootPath("/", false);
     pwin.Owner = this;
     if (pwin.ShowDialog() == true)
     {
         reviewer = pwin.SingleValue;
         txtAudit.Text = reviewer.getString("name");
     }
 }
开发者ID:nbhopson,项目名称:QMail,代码行数:11,代码来源:MailSendWindow.xaml.cs

示例14: cb_findDepartmentGroup

 private void cb_findDepartmentGroup(ASObject data)
 {
     PrincipalSelectFieldNode node = new PrincipalSelectFieldNode();
     node.id = data.getLong("id");
     if (data.getString("name") == "%DepartmentRoot%")
         node.Label = "部门";
     else
         node.Label = data.getString("name");
     node.type = "D";
     node.entity = data;
     PrincipalList.Add(node);
 }
开发者ID:nbhopson,项目名称:QMail,代码行数:12,代码来源:PrincipalSelectWindow.xaml.cs


注:本文中的ASObject.getString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。