Example #1
0
        /// <summary>
        /// Start sending the transfer request
        /// </summary>
        /// <param name="users">Array of selected users to send the file to</param>
        public void StartSending(User[] users)
        {
            //------------------------------------
            //  Add this to current transfers
            //------------------------------------

            List <Task> Transfers = (List <Task>)Application.Current.Properties["Transfers"];

            //  Send a request for each user selected
            foreach (User u in users)
            {
                Transfers.Add(Task.Run(() =>
                {
                    Send s = new Send(ClickedPath, u);
                    s.Start();
                }));
            }

            //------------------------------------
            //  Re-activate the Transfers Window
            //------------------------------------

            //  NOTE: Apparently, t.Show() or/with t.Activate() do not re-activate it.
            TransfersWindow t = (TransfersWindow)Application.Current.Properties["TransfersWindow"];

            t.WindowState = WindowState.Normal;
            t.Topmost     = true;
            t.Show();
            t.Activate();
            t.Topmost = false;

            //  Close current window
            SendWindow.Close();
        }
Example #2
0
        /// <summary>
        /// Start the transfer
        /// </summary>
        public void StartTransfer()
        {
            //------------------------------------
            //  Wake up the transfer thread
            //------------------------------------

            lock (this)
            {
                Status = Reply.ACCEPTED;
                Monitor.Pulse(this);
            }

            //------------------------------------
            //  Re-activate the Transfers Window
            //------------------------------------

            //  NOTE: Apparently, t.Show() or/with t.Activate() do not re-activate it.
            TransfersWindow t = (TransfersWindow)Application.Current.Properties["TransfersWindow"];

            t.WindowState = WindowState.Normal;
            t.Topmost     = true;
            t.Show();
            t.Activate();
            t.Topmost = false;

            //  Now you can actually close this window
            TheWindow.Close();
        }