コード例 #1
0
		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);
							}
						}
					}
			}

		}
コード例 #2
0
		private void s_LoadMsgForm()
		{

			try
			{
				frmMSG myNewMSG = new frmMSG();
				if (lvwMsgs.SelectedItems.Count == 0)
				{
				}
				else
				{
					myNewMSG.Conference = System.Convert.ToInt32(lvwMsgs.SelectedItems[0].SubItems[5].Text.Trim());
					myNewMSG.MsgID = System.Convert.ToInt32(lvwMsgs.SelectedItems[0].SubItems[4].Text.Trim());
					myNewMSG.MessageType = frmMSG.MsgWindowType.ENUM_VIEWONLY;
					myNewMSG.PrepForMessage();
					myNewMSG.Show();
				}
			}
			catch (Exception ex)
			{
				MessageBox.Show("Unexpected Error occurred" + Environment.NewLine + "Error:  " + ex.ToString() + Environment.NewLine + "Message:  " + ex.Message, "Unexpected Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}

		}