Exemplo n.º 1
0
        void transfer_StateChanged( Transfer.State oldState, Transfer.State newState )
        {
            // If this method was called by a different thread, invoke it to run on the form thread.
            if ( InvokeRequired )
            {
                BeginInvoke( new MethodInvoker( delegate { transfer_StateChanged( oldState, newState ); } ) );
                return;
            }

            switch ( newState )
            {
                case Transfer.State.TRANSFERRING:
                    progressPane = new ProgressPane( transfer );
                    ChangeContent( progressPane );
                    break;
                case Transfer.State.VERIFYING:
                    if ( progressPane != null )
                        progressPane.SetVerifying( );
                    break;
                case Transfer.State.FAILED:
                    ChangeContent( new TransferFailedPane( transfer ) );
                    break;
                case Transfer.State.FINISHED:
                    ChangeContent( new TransferCompletePane( transfer ) );
                    break;
            }
        }
Exemplo n.º 2
0
 public ProgressPane( Transfer transfer )
 {
     InitializeComponent( );
     this.transfer = transfer;
     lblTitle.Text = String.Format( "{0} {1}...", Util.IsTransferIncoming( transfer ) ? "Receiving" : "Sending", transfer.FileName );
     Width = pbFileProgress.Width + pbFileProgress.Left + 16;
 }
Exemplo n.º 3
0
 public TransferFailedPane( Transfer transfer )
 {
     InitializeComponent( );
     this.transfer = transfer;
     this.AutoHide = true;
     secondsToHide = 8;
     lblTitle.Text = String.Format( "Failed to {0} {1}", Util.IsTransferIncoming( transfer ) ? "receive" : "sending", transfer.FileName );
     Width = lblTitle.Width + lblTitle.Left + 16;
     OnHideTimeChanged( );
 }
Exemplo n.º 4
0
        public TransferNotificationForm( Transfer transfer )
        {
            InitializeComponent( );
            this.transfer = transfer;

            if ( Util.IsTransferIncoming( transfer ))
                ChangeContent( new AcceptOrDenyPane( (IncomingTransfer) transfer ) );
            else
                ChangeContent( new WaitingForAcceptPane( (OutgoingTransfer) transfer ) );

            Show( );
        }
Exemplo n.º 5
0
        public TransferCompletePane( Transfer transfer )
        {
            InitializeComponent( );
            this.transfer = transfer;
            this.AutoHide = true;

            lblTitle.Text = String.Format( "{0} {1} successfully!", transfer.FileName, Util.IsTransferIncoming( transfer ) ? "received" : "sent" );

            // Hide the "open" links for outgoing transfers.
            if ( !Util.IsTransferIncoming( transfer ))
            {
                lblOpen.Visible = lblOpenFolder.Visible = false;
                lblHide.Left = lblOpen.Left;
            }

            Width = lblTitle.Width + lblTitle.Left + 16;
            OnHideTimeChanged( );
        }
Exemplo n.º 6
0
 /// <summary>
 /// Returns true if the given transfer is incoming; false if outgoing.
 /// </summary>
 public static bool IsTransferIncoming( Transfer t )
 {
     return ( typeof( IncomingTransfer ) == t.GetType( ) );
 }
Exemplo n.º 7
0
 /// <summary>
 /// Creates the notification form for the given transfer on the UI thread.
 /// </summary>
 public static void CreateForTransfer( Transfer transfer )
 {
     MainForm.Instance.BeginInvoke( (MethodInvoker) delegate { new TransferNotificationForm( transfer ); } );
 }