Пример #1
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            //CLOSE THE STATUS WINDOW ONCE THE FILE GET IS COMPLETE
            foreach (Form OpenWindow in OpenWindows)
            {
                if (OpenWindow.Text == "Get Status")
                {
                    OpenWindow.Invoke((MethodInvoker) delegate { OpenWindow.Close(); });
                    break;
                }
            }

            //IF THE USER SELECTED A DOWNLOAD LOCATION THEN SAVE THE FILE, OTHERWISE OPEN WITH INTERNET EXPLORER
            if (string.IsNullOrEmpty(this.SaveLocation))
            {
                string tmpFileName = Path.Combine(Path.GetTempPath(), this.FileName);
                File.WriteAllBytes(tmpFileName, this.FileBytes);

                //CREATE AN IE PROCESS AND LAUNCH IT WITH THE FILE AS THE PARAMETER
                Process tmpProc = new Process();
                tmpProc.StartInfo = new ProcessStartInfo("IExplore.exe", tmpFileName);
                tmpProc.Start();
            }
            else
            {
                //SAVE THE FILE TO THE SAVE LOCATION AND LET THE USER KNOW IT IS DONE
                File.WriteAllBytes(this.SaveLocation, this.FileBytes);
                MessageBox.Show("File Download Complete");
            }
        }
Пример #2
0
 static int Close(IntPtr L)
 {
     try
     {
         ToLua.CheckArgsCount(L, 1);
         OpenWindow obj = (OpenWindow)ToLua.CheckObject <OpenWindow>(L, 1);
         obj.Close();
         return(0);
     }
     catch (Exception e)
     {
         return(LuaDLL.toluaL_exception(L, e));
     }
 }
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            new Message_Private()
            {
                ConversationID = this.ConversationID, Sender = this.Sender, SenderID = this.SenderID, Message = string.Format(@"Has sent you a file: <a href=""getfile://{0}"">{1}</a>", this.FileID, this.FileName)
            }.Send(ThisConnection);

            foreach (Form OpenWindow in OpenWindows)
            {
                if (OpenWindow.Text == "Send Status")
                {
                    OpenWindow.Invoke((MethodInvoker) delegate { OpenWindow.Close(); });
                    break;
                }
            }
        }