public DialogHandlePublishInfoTask( FormAnnouncementManagement parentForm, publishinfo info) { InitializeComponent(); m_ParentForm = parentForm; m_Info = info; }
// 新增公告信息 private void BtnNewMsg_Click(object sender, EventArgs e) { DialogMsgCreate CreateMsgDlg = new DialogMsgCreate(); if (CreateMsgDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK) { publishinfo info = CreateMsgDlg.GetReturnValue(); DialogHandlePublishInfoTask dlg = new DialogHandlePublishInfoTask(this, info); dlg.ShowDialog(); } BtnRefresh_Click(this, e); }
// 发布 private void BtnRelease_Click(object sender, EventArgs e) { if (txtBoxTitle.Text == "" || txtBoxAddress.Text == "") { MessageBox.Show(strings.SendAddrOrMsgCannotBeNull);//"发送地址或信息标题不得为空!"); return; } if (txtBoxTitle.Text.Length > 50) { MessageBox.Show("标题長度不可以大于50個字元!"); return; } if (radioBtnText.Checked && textBox.Text.TrimEnd() == "") { MessageBox.Show("內容不得为空!"); return; } if (radioBtnPic.Checked && txtBoxPicSource.Text == "") { MessageBox.Show("发送图片地址不能为空!"); return; } m_PublishInfo = new publishinfo(); m_PublishInfo.type = radioBtnText.Checked ? 0 : 1; // 0: text, 1: picture m_PublishInfo.dstaddr = txtBoxAddress.Text; m_PublishInfo.title = txtBoxTitle.Text; m_PublishInfo.time = DateTime.Now; m_PublishInfo.isread = 0;//false; string timeStamp = DateTime.Now.ToString("yyyyMMddHHmmssffff"); // [TODO] bmp 室内机可能无法顯示 =_= string filename = string.Format(timeStamp + ".jpg"); string destFile = Path.GetPublishInfoFolderPath() + @"\" + filename; m_PublishInfo.filepath = Path.GetPublishInfoFolderRelativePath() + @"\" + filename; if (radioBtnPic.Checked == true) { File.Copy(txtBoxPicSource.Text, destFile, true); } else { TextJpgConvert(textBox.Text, textBox.Font.ToString(), textBox.Font.Size, destFile); } this.DialogResult = System.Windows.Forms.DialogResult.OK; this.Close(); }