/// <summary> /// 添加一条网络文件信息 /// </summary> /// <param name="info"></param> /// <param name="data"></param> public void AppendFileMes(Transmission.NetFileData info, UserData data, bool isPub) { MS_Label mS_Label; mS_Label = new MS_Label(false, this.master.IsPub, data, this.scrollBar1); mS_Label.Width = this.panel_sub.Width - 5; mS_Label.SetNetFileMes(info, this.showtime, isPub); this.NewMessageCount++; AddControl(mS_Label); }
/// <summary> /// 将文件消息添加到窗口 /// </summary> public static void AppendFileMes(this Form1 f1, Transmission.NetFileData fdata) { if (fdata.isPublic) { KeyData.StaticInfo.ClassPanel.AppendFileMes(fdata, Method.GetUser(fdata.senderIP), true); } else { UserData data = Method.GetUser(fdata.senderIP); data.TalkPanel.AppendFileMes(fdata, data, false); } }
/// <summary> /// 插入文件消息(网络) /// </summary> /// <param name="path"></param> public void SetNetFileMes(Transmission.NetFileData data, bool showtime, bool ispubmes) { fmes = new FileMes(user.IP); fmes.SetInfo(data); fmes.Anchor = AnchorStyles.Top | AnchorStyles.Left; SetLocation_File(); this.Height = fmes.Location.Y + fmes.Height + 10; this.Controls.Remove(this.label1); this.Controls.Add(fmes); this.lb_nowTime.Visible = showtime; fmes.FileDownLoadOver += (end, filename) => { string mes = string.Format("{0}接收了文件\"{1}\"", KeyData.StaticInfo.MyUser.Name, filename); if (ispubmes) { Transmitters.Sender.SendEventMessageToAll(mes); } else { Transmitters.Sender.SendEventMessage(end, mes); } }; }
public void SetInfo(Transmission.NetFileData info) { this.FileSize = long.Parse(info.fileLen); this.Init(info.senderFilePath, false); }