Exemple #1
0
 public void UpdateFileTransfer(FileTransfer fileTransfer)
 {
     /*for(int i = 0; i < transfers.Count; i++)
     {
         Activity ac = (Activity)transfers[i];
         if(ac.fileTransfer == fileTransfer)
         {
             SetFileInfo(ac.fileTransfer, i);
         }
     }*/
 }
Exemple #2
0
 public Activity(FileTransfer fileTransfer)
 {
     this.fileTransfer = fileTransfer;
     bmp = ExtractIcon.GetIcon(fileTransfer.FileName, false).ToBitmap();
 }
Exemple #3
0
        public void UpdateSendActivity(FileTransfer fileTransfer, SendFileEvent sfe)
        {
            SendFile sendFile = (SendFile)fileTransfer;
            if(sfe.fileSendStatus == TransferStatus.START_SEND)
            {
                DisplayMessage("Sending file: ", Color.SaddleBrown, "", false);

            //	UpdateFiletransferData(fileTransfer);
            }
            else if(sfe.fileSendStatus == TransferStatus.FILE_SENDING)
            {
                //string tempString = "Sending Bytes: " + sendFile.ReadBytes.ToString() + "/" + sendFile.FileSize.ToString();
            //	UpdateFiletransferData(fileTransfer);

                //this.Invoke(new DisplayMessageDelegate(this.DisplayMessage), new  object []{tempString, Color.SaddleBrown, "", false});
            }
            else if(sfe.fileSendStatus == TransferStatus.SEND_OK)
            {
                DisplayMessage("Send OK!", Color.SaddleBrown, "", false);

            //	UpdateFiletransferData(fileTransfer);
                //label3.Text = "Sending Bytes: Done!";
                //sendFile.close();
            }
            else if(sfe.fileSendStatus == TransferStatus.SOCKET_EXCEPTION)
            {
            }
            //	else
            {
                DisplayMessage("Send event: " + sfe.fileSendStatus.ToString() + '\n', Color.SaddleBrown, "", false);
            }
        }
Exemple #4
0
        /*	public void SetDGPContactOnlineStatus(char status)
        {
            //contact.Status.Status = status;
            //SetDGPContactName(contact.Name);
        }
        */
        public void NewActivity(FileTransfer fileTransfer)
        {
            fileTransfer.TransferCompleteEvent += new DGP_Messenger.FileTransfer.TransferComplete(fileTransfer_TransferDoneEvent);
            Activity activity = new Activity(fileTransfer);
            activity.linkLabel = new LinkLabel();
            //activity.label = new Label();
            //activity.image = new PictureBox();
            //activity.Top = 0;

            // label
            /*activity.label.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            activity.label.Location = new System.Drawing.Point(pictureBox5.Right + 4, pictureBox5.Bottom - 80);
            activity.label.Name = "label2";
            activity.label.Size = new System.Drawing.Size(120, 80);
            activity.label.TabIndex = 15;
            activity.label.Text = labelText;
            activity.label.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            activity.label.SendToBack();
            */
            // linkLabel
            activity.linkLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            //activity.linkLabel.Location = new System.Drawing.Point(pictureBox5.Right + 4, pictureBox5.Bottom - 80 );
            activity.linkLabel.Name = "linkLabel2";
            activity.linkLabel.Size = new System.Drawing.Size(120, 80);
            activity.linkLabel.TabIndex = 17;
            activity.linkLabel.TabStop = true;
            activity.linkLabel.Text = "";
            activity.linkLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
            //		activity.linkLabel.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabel1_LinkClicked);

            /*activity.image.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
            activity.image.Location = new System.Drawing.Point(pictureBox5.Right + 110, pictureBox5.Bottom - 75);
            activity.image.Name = "image1";
            activity.image.TabStop = false;
            activity.image.SizeMode = PictureBoxSizeMode.Normal;
            activity.image.Size = new System.Drawing.Size(10, 10);
            activity.image.Image = close.Image;
            activity.image.Click += new System.EventHandler(this.close_Click);
            activity.image.Cursor = System.Windows.Forms.Cursors.Hand;

            */
            //this.Controls.Add(activity.label);
            //this.Controls.Add(activity.linkLabel);
            //this.Controls.Add(activity.image);

            //activity.linkLabel.BringToFront();

            //fileActivity.Add(activity);

            //this.dataTransferForm.AddNewTransfer(activity);
            //this.dataTransferForm.Show();

            //linkLabel1.Top = 296;
            //linkLabel1.BringToFront();
            //activityPosition.Start();

            //this.dataTransferForm.AddNewTransfer(activity);
        }
Exemple #5
0
        private void UpdateReciveActivity(FileTransfer fileTransfer, SendFileEvent sfe)
        {
            ReciveFile reciveFile  = (ReciveFile)fileTransfer;
            if(sfe.fileSendStatus == TransferStatus.CONFIRM_RECIVE)
            {
                //UpdateFiletransferData(fileTransfer);

                for(int i = 0; i < fileActivity.Count; i++)
                {
                    Activity ac = (Activity)fileActivity[i];
                    if(fileTransfer.Equals(ac.fileTransfer))
                    {
                        ac.linkLabel.Text = "Spara filen!";
                    }
                }

                DisplayMessage(this.contact.Name + " Vill skicka filen \"" + reciveFile.FileName.Trim() + "\" till dig. " +
                            "Klicka på transfersknappen för att visa fildelningsfönstret där du kan välja att spara filen.", Color.SkyBlue, "", false);
            }
            else if(sfe.fileSendStatus == TransferStatus.FILE_RECIVING)
            {
            //	UpdateFiletransferData(fileTransfer);

                DisplayMessage("recived bytes" + fileTransfer.TransferedBytes, Color.SaddleBrown, "", false);

                //this.Invoke(new DisplayMessageDelegate(this.DisplayMessage), new  object []{"Recived Bytes: " + reciveFile.RecivedBytes.ToString() + "/" + reciveFile.FileSize, Color.SaddleBrown, "", false});
            }
            else if(sfe.fileSendStatus == TransferStatus.RECIVE_OK)
            {
                DisplayMessage("Recive OK", Color.SaddleBrown, "", false);
                reciveFile.close();

            //	UpdateFiletransferData(fileTransfer);
            }
            else if(sfe.fileSendStatus == TransferStatus.SOCKET_EXCEPTION)
            {
            }
            //		else
            {
                DisplayMessage("Recive event: " + sfe.fileSendStatus.ToString() + '\n', Color.SaddleBrown, "", false);
            }
        }
Exemple #6
0
 public NewFileTransferEventArgs(FileTransfer init)
 {
     fileTransfer = init;
 }
Exemple #7
0
 public Activity(FileTransfer fileTransfer)
 {
     this.fileTransfer = fileTransfer;
     bmp = ExtractIcon.GetIcon(fileTransfer.FileName, false).ToBitmap();
 }