// Events private void הודעהחדשהToolStripMenuItem_Click(object sender, EventArgs e) { this.ChangeMessage(sender, e); Point pntNewMsgLocation = this.MoveAllRight(this.nNewMsgClickLeft); ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, ""); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntNewMsgLocation.Y; cbiNewMsg.Left = pntNewMsgLocation.X; if (this.nMostLeftMsg > pntNewMsgLocation.X) { this.nMostLeftMsg = pntNewMsgLocation.X; } this.scrollArrows1.AddMessage(); // Focusing on new message if (pntNewMsgLocation.X > (3 * (this.nMsgWidth + this.nMsgsDistance))) { this.MoveAllLeft(-1 * (this.Controls.Count - 2) * (this.nMsgWidth + this.nMsgsDistance)); } else { this.scrollArrows1.MoveLeft(); } cbiNewMsg.Focus(); }
public void LoadMessages(bool bLoadFromFile) { this.scrollArrows1.Zero(); this.nMostLeftMsg = this.nLeftMsg; this.nMostRightMsg = this.nLeftMsg; for (int nConveyorIndex = this.Controls.Count - 1; nConveyorIndex >= 1; nConveyorIndex--) { if (this.Controls[nConveyorIndex] is ConveyorBeltItem) { this.Controls[nConveyorIndex].Dispose(); } } Point pntAdditionalMsgLoc = new Point(this.nLeftMsg, this.nTopMsg); if (bLoadFromFile) { MessageQueue.GetMsgQueue().LoadMessages(); } foreach (object objMsgContent in MessageQueue.GetMsgQueue()) { this.nMostRightMsg += this.nMsgsDistance + this.nMsgWidth; if (objMsgContent is string) { ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, (string)objMsgContent); this.Controls.Add(cbiNewMsg); (cbiNewMsg.Controls[0] as RichTextBox).Text = (string)objMsgContent; cbiNewMsg.Top = pntAdditionalMsgLoc.Y; cbiNewMsg.Left = pntAdditionalMsgLoc.X; pntAdditionalMsgLoc.X += this.nMsgWidth + this.nMsgsDistance; this.scrollArrows1.AddMessage(); if (this.Controls.Count < 5) { this.scrollArrows1.MoveLeft(); } } else { ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, (Image)objMsgContent); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntAdditionalMsgLoc.Y; cbiNewMsg.Left = pntAdditionalMsgLoc.X; pntAdditionalMsgLoc.X += this.nMsgWidth + this.nMsgsDistance; this.scrollArrows1.AddMessage(); if (this.Controls.Count < 5) { this.scrollArrows1.MoveLeft(); } } } }
private void תמונהToolStripMenuItem_Click(object sender, EventArgs e) { if (this.openFileDialog1.ShowDialog() == DialogResult.OK) { this.ChangeMessage(sender, e); if (this.openFileDialog1.FileNames[0].StartsWith("\\\\")) { foreach (string strWebFile in this.openFileDialog1.FileNames) { Point pntNewMsgLocation = this.MoveAllRight(this.nNewMsgClickLeft); string strTemp = Path.GetTempFileName(); this.wclFileClient.DownloadFile(strWebFile, strTemp); this.memImage = new MemoryStream((File.ReadAllBytes(strTemp))); Image imgNewImage = Image.FromStream(this.memImage); File.Delete(strTemp); ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, imgNewImage); (cbiNewMsg.Controls[0] as PictureBox).DoubleClick += new EventHandler(cbiNewMsg_DoubleClick); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntNewMsgLocation.Y; cbiNewMsg.Left = pntNewMsgLocation.X; if (this.nMostLeftMsg > pntNewMsgLocation.X) { this.nMostLeftMsg = pntNewMsgLocation.X; } // Focusing on new message if (pntNewMsgLocation.X > (3 * (this.nMsgWidth + this.nMsgsDistance))) { this.MoveAllLeft(-1 * (this.Controls.Count - 2) * (this.nMsgWidth + this.nMsgsDistance)); } else { this.scrollArrows1.MoveLeft(); } this.scrollArrows1.AddMessage(); cbiNewMsg.Focus(); } } else { foreach (string strFileName in this.openFileDialog1.FileNames) { Point pntNewMsgLocation = this.MoveAllRight(this.nNewMsgClickLeft); this.memImage = new MemoryStream((File.ReadAllBytes(strFileName))); Image imgNewImage = Image.FromStream(this.memImage); ConveyorBeltItem cbiNewMsg = new ConveyorBeltItem(this.cntxItemMenu, imgNewImage); (cbiNewMsg.Controls[0] as PictureBox).DoubleClick += new EventHandler(cbiNewMsg_DoubleClick); this.Controls.Add(cbiNewMsg); cbiNewMsg.Top = pntNewMsgLocation.Y; cbiNewMsg.Left = pntNewMsgLocation.X; if (this.nMostLeftMsg > pntNewMsgLocation.X) { this.nMostLeftMsg = pntNewMsgLocation.X; } // Focusing on new message if (pntNewMsgLocation.X > (3 * (this.nMsgWidth + this.nMsgsDistance))) { this.MoveAllLeft(-1 * (this.Controls.Count - 2) * (this.nMsgWidth + this.nMsgsDistance)); } else { this.scrollArrows1.MoveLeft(); } this.scrollArrows1.AddMessage(); cbiNewMsg.Focus(); } } } }