private void miniRptcmdMsgs_Click(object sender, System.EventArgs eventArgs) { frmMSG myNewMSG = new frmMSG(); wcServerAPI.TMsgHeader wMSG = new wcServerAPI.TMsgHeader(); if ((((Button)sender).Name) == this.cmdMsgOpen.Name) { ////Open MSG s_LoadMsgForm(); } else if ((((Button)sender).Name) == this.cmdMsgRefresh.Name) { ////Refresh Display s_ReloadMessages(); } else if ((((Button)sender).Name) == this.cmdMsgNew.Name) { myNewMSG.Conference = ((clsList)(cmbMAreas.Items[cmbMAreas.SelectedIndex])).ItemData; myNewMSG.MsgID = -1; myNewMSG.MessageType = frmMSG.MsgWindowType.ENUM_NEWMESSAGE; myNewMSG.PrepForMessage(); myNewMSG.Show(); } else if ((((Button)sender).Name) == this.cmdMsgDelete.Name) { if (lvwMsgs.SelectedItems.Count == 0) { } else { DialogResult questAskSure = MessageBox.Show("Are you sure you wish to delete this message?", "Confirm Delete...", MessageBoxButtons.OK); if (questAskSure == System.Windows.Forms.DialogResult.Yes) { if (wcServerAPI.GetMessageById(System.Convert.ToInt32(lvwMsgs.SelectedItems[0].SubItems[5].Text), System.Convert.ToInt32(lvwMsgs.SelectedItems[0].SubItems[4].Text), ref wMSG)) { if (wcServerAPI.DeleteMessage(ref wMSG)) { lvwMsgs.Items.Remove(lvwMsgs.SelectedItems[0]); } else { MessageBox.Show("Error removing the selected message", "WINS Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Error finding the selected message", "WINS Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } } }
private short f_LoadWCMSGSByArea(int lngArea) { My.MyApplication.Application.DoEvents(); try { wcServerAPI.TMsgHeader wMSG = new wcServerAPI.TMsgHeader(); System.Windows.Forms.ListViewItem Itmx = null; int lngMSGID = 0; int lngMSGCount = 0; lvwMsgs.Items.Clear(); lngMSGCount = wcServerAPI.GetTotalMessagesInConference(lngArea); lngMSGID = 0; if (lngMSGCount > 0) { pbMsgs.Maximum = lngMSGCount; while (wcServerAPI.SearchMessageById(lngArea, lngMSGID, ref wMSG)) { if (pbMsgs.Value + 1 > pbMsgs.Maximum) { pbMsgs.Maximum = pbMsgs.Value + 1; } pbMsgs.Value = pbMsgs.Value + 1; Itmx = lvwMsgs.Items.Add(wMSG.MsgTo.Name.Trim(), 1); Itmx.SubItems.Add(wMSG.MsgFrom.Name.Trim()); Itmx.SubItems.Add(wMSG.Subject.Trim()); Itmx.SubItems.Add(modBSMiniRPT.DateToDateString(wMSG.MsgTime, true).Trim()); Itmx.SubItems.Add(wMSG.Id.ToString().Trim()); Itmx.SubItems.Add(wMSG.Conference.ToString().Trim()); lngMSGID = wMSG.Id + 1; } } pbMsgs.Value = 0; } catch (Exception ex) { MessageBox.Show("Unexpected Error occurred" + Environment.NewLine + "Error: " + ex.ToString() + Environment.NewLine + "Message: " + ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } My.MyApplication.Application.DoEvents(); return 0; }
private short LoadMessageView() { try { wcServerAPI.TMsgHeader wMSG = new wcServerAPI.TMsgHeader(); if (wcServerAPI.GetMessageById(mvarConference, mvarMSGID, ref wMSG)) { txtMsgTo.Text = wMSG.MsgTo.Name.Trim(); txtMsgFrom.Text = wMSG.MsgFrom.Name.Trim(); txtMsgSubject.Text = wMSG.Subject.Trim(); txtMSGBody.Text = wcServerAPI.GetText("wc:\\conf(" + mvarConference.ToString().Trim() + ")\\message(" + mvarMSGID.ToString().Trim() + ")").Trim(); txtMSGBody.Text = txtMSGBody.Text.Replace("\n", Environment.NewLine); if (wMSG.IsPrivate != 0) { ToolStripStatusLabel1.Enabled = true; } if (wMSG.ReceiptRequested != 0) { ToolStripStatusLabel2.Enabled = true; } if (wMSG.Received != 0) { ToolStripStatusLabel3.Enabled = true; } if (mvarEnumType == MsgWindowType.ENUM_VIEWONLY) { picMTools.Visible = false; txtMSGBody.Height = stbMsg.Top - txtMSGBody.Top - 5; } } else { MessageBox.Show("Error accessing the specified message", "WINS Error...", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Dispose(); } } catch (Exception ex) { MessageBox.Show("Unexpected Error occurred" + Environment.NewLine + "Error: " + ex.ToString() + Environment.NewLine + "Message: " + ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); this.Dispose(); } return 0; }
public short PrepForMessage() { try { wcServerAPI.TMsgHeader wMSG = new wcServerAPI.TMsgHeader(); wcServerAPI.TConfDesc wCONF = new wcServerAPI.TConfDesc(); if (wcServerAPI.GetConfDesc(mvarConference, ref wCONF)) { if (wCONF.AllowReturnReceipt != 0) { chkRR.Enabled = true; } if (wCONF.ValidateNames != 0) { boolCheckValidNames = true; } switch (wCONF.MailType) { case wcServerAPI.mtNormalPublicPrivate: case wcServerAPI.mtNormalPrivate: case wcServerAPI.mtEmailOnly: chkPVT.Enabled = true; break; default: chkPVT.Enabled = false; break; } } if (mvarMSGID == -1) { txtMsgFrom.Text = modBSMiniRPT.BBSSysopName; } else { picMTools.Visible = true; switch (mvarEnumType) { case MsgWindowType.ENUM_EDITMESSAGE: ////Editing Message break; case MsgWindowType.ENUM_FORWARDMESSAGE: ////Forwarded Message break; case MsgWindowType.ENUM_NEWMESSAGE: ////New Message break; case MsgWindowType.ENUM_REPLYMESSAGE: ////Reply Message break; case MsgWindowType.ENUM_VIEWONLY: ////Read Only View picMTools.Visible = false; LoadMessageView(); break; } } } catch (Exception ex) { MessageBox.Show("Unexpected Error occurred" + Environment.NewLine + "Error: " + ex.ToString() + Environment.NewLine + "Message: " + ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } return 0; }