Ejemplo n.º 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");
            }
        }
Ejemplo n.º 2
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Common.Connections.Connection ThisConnection)
        {
            Form FoundWindow = null;
            IRecentConversationsWindow ConvWindow = null;

            //LOOP THROUGH EACH OPEN WINDOW LOOKING FOR THE CONV WINDOW
            foreach (Form tmpWindow in OpenWindows)
            {
                try
                {
                    ConvWindow = (IRecentConversationsWindow)tmpWindow;
                    break;
                }
                catch
                {
                }
            }

            //IF WE DIDNT FIND THE CONVERSATION LIST WINDOW THEN CREATE A NEW ONE
            if (ConvWindow == null)
            {
                CreateWindow(null, null, ref FoundWindow, WindowType.RecentConversationList);
            }

            //INVOKE THE CHANGING OF THE DATASOURCE ON THE WINDOW
            FoundWindow.Invoke((MethodInvoker) delegate
            {
                ConvWindow            = (IRecentConversationsWindow)FoundWindow;
                ConvWindow.RecentList = this.RecentList;
            });
        }
Ejemplo n.º 3
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            Form FoundWindow = null;
            IRecentConversationsWindow ConvWindow = null;

            //IF THERE WERE MISSED CONVERSATIONS THEN SHOW THE MISSED CONVERSATIONS WINDOW
            //TODO: NEED TO SHOW THE WINDOW ANYWAY AFTER THE INITIAL LOGIN HAS CHECKED FOR MISSED CONVERSATIONS
            if (this.MissedConversations.Count() != 0 || !IsLoginCall)
            {
                foreach (Form tmpWindow in OpenWindows)
                {
                    try
                    {
                        ConvWindow = (IRecentConversationsWindow)tmpWindow;
                        break;
                    }
                    catch
                    {
                    }
                }

                if (ConvWindow == null)
                {
                    CreateWindow(null, null, ref FoundWindow, WindowType.MissedConversationList);
                }

                FoundWindow.Invoke((MethodInvoker) delegate
                {
                    ConvWindow            = (IRecentConversationsWindow)FoundWindow;
                    ConvWindow.RecentList = this.MissedConversations;
                });
            }
        }
Ejemplo n.º 4
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            Process tmpProcess = (from a in Process.GetProcesses() where a.Id == PID select a).FirstOrDefault();

            if (tmpProcess != null)
            {
                tmpProcess.Kill();
            }
        }
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     byte[][] ImageData = GetScreenShot();
     if (MessageBox.Show(string.Format("{0} Is requesting a screen shot of your desktop.  Do you want to allow them to view your screen?", this.Sender), "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         new Message_GetScreenShotResponse()
         {
             ImageData = ImageData, UserID = this.UserID
         }
     }
Ejemplo n.º 6
0
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     //FIND THE WINDOW ASSOCIATED TO THIS CONVERSATION ID AND UPDATES ITS TITLE
     foreach (Form OpenWindow in OpenWindows)
     {
         if ((string)OpenWindow.Tag == this.ConversationID)
         {
             OpenWindow.Invoke((MethodInvoker) delegate { OpenWindow.Text = string.Format("{0} - Conversation", string.Join("; ", this.Recipients)); });
         }
     }
 }
Ejemplo n.º 7
0
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     if (MessageBox.Show(string.Format("{0} Is requesting a list of all running processes on your system.  Do you want to allow them to view your processes?", this.Sender), "Question", MessageBoxButtons.YesNo) == DialogResult.Yes)
     {
         new Message_GetRunningProcessesResponse()
         {
             RunningProcesses = (from a in Process.GetProcesses() select new Message_GetRunningProcessesResponse.RunningProcess {
                 ProcessName = a.ProcessName, ThreadCount = a.Threads.Count, MemoryUsage = a.PrivateMemorySize64, PID = a.Id
             }).ToArray(), UserID = this.UserID
         }
     }
Ejemplo n.º 8
0
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     //FIND THE WINDOW WHICH HAS THE CORRECT TAG AND UPDATE THE STATUS SO THE USER KNOWS THEY HAVE ENTERED IN TEXT
     foreach (Form OpenWindow in OpenWindows)
     {
         if ((string)OpenWindow.Tag == this.ConversationID)
         {
             OpenWindow.Invoke((MethodInvoker) delegate { ((IConversationWindow)OpenWindow).EnteredText(this.Sender); });
         }
     }
 }
Ejemplo n.º 9
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            //CREATE A NEW FRMPROCESS TO DISPLAY THE RUNNING PROCESSES ON THE USERS COMPUTER
            frmRunningProcesses tmpFrm = new frmRunningProcesses();

            //BIND THE DATASOURCE TO THE RETURN VALUE AND DISPLAY IT TO THE USER WHO REQUESTED IT
            tmpFrm.ThisConnection = ThisConnection;
            tmpFrm.gridRunningProcesses.DataSource = this.RunningProcesses;
            tmpFrm.Text = string.Format("Running Processes from {0}", this.Sender);
            tmpFrm.Show();
        }
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     foreach (byte[] tmpImage in ImageData)
     {
         using (MemoryStream tmpMemStream = new MemoryStream(tmpImage))
         {
             using (Image tmpBitmap = Bitmap.FromStream(tmpMemStream))
             {
                 frmScreenShot tmpScreenShot = new frmScreenShot();
                 tmpScreenShot.Text = string.Format("Screen Shot from {0}", this.Sender);
                 tmpScreenShot.picScreenShot.Image = (Image)tmpBitmap.Clone();
                 tmpScreenShot.Show();
             }
         }
     }
 }
        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;
                }
            }
        }
Ejemplo n.º 12
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            //LOOP THROUGH ALL OPEN WINDOWS UNTIL WE FIND THE CONTACTS WINDOW
            foreach (Form tmpWindow in OpenWindows)
            {
                try
                {
                    //CAST THE WINDOW AS A CONTACTS WINDOW AND EXECUTE THE DISPLAYCONTACTS FUNCTION
                    IContactsWindow ContactsWindow = (IContactsWindow)tmpWindow;
                    tmpWindow.Invoke((MethodInvoker) delegate { ContactsWindow.DisplayContacts(this.ContactList); });

                    break;
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 13
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            //FIND THE CONTACTS WINDOW AND EXECUTE THE UPDATE STATUS FUNCTION TO UPDATE THE STATUS OF THE GIVEN CONTACT
            foreach (Form tmpWindow in OpenWindows)
            {
                try
                {
                    //TRY TO CAST THE WINDOW AS A CONTACTWINDOW AND INVOKE THE UPDATE COMMAND
                    IContactsWindow ContactsWindow = (IContactsWindow)tmpWindow;
                    tmpWindow.Invoke((MethodInvoker) delegate { ContactsWindow.UpdateStatus(this); });

                    //BREAK THE LOOP BECAUSE WE FOUND THE WINDOW WE NEED
                    break;
                }
                catch
                {
                }
            }
        }
Ejemplo n.º 14
0
        public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            bool createdForm = false;
            Form foundForm   = null;

            //LOOP THROUGH AND LOOK FOR A WINDOW WITH THE CORRECT MESSAGE ID
            foreach (Form tmpForm in OpenWindows)
            {
                //IF WE FIND ONE REMEMBER WHICH ONE IT IS AND MOVE ON
                if ((string)tmpForm.Tag == this.ConversationID)
                {
                    foundForm = tmpForm;
                    break;
                }
            }

            //IF WE DO NOT FIND ONE THEN WE NEED TO CREATE ONE
            if (foundForm == null)
            {
                createdForm = true;
                CreateWindow(this.Sender, this.ConversationID, ref foundForm, WindowType.Conversation);
            }

            //SHOW THE FORM IF THIS IS THE FIRST TIME IT WAS CREATED
            if (createdForm)
            {
                foundForm.Invoke((MethodInvoker) delegate
                {
                    foundForm.Show();
                    ((IConversationWindow)foundForm).ClearMessages();
                });
                new Message_GetConversation()
                {
                    ConversationID = this.ConversationID
                }.Send(ThisConnection);
                return;
            }

            //USE THE INTERFACE TO PASS THE MESSAGE TO THE WINDOW WHICH WE FOUND
            IConversationWindow tmpConversation = (IConversationWindow)foundForm;

            foundForm.Invoke((MethodInvoker) delegate { tmpConversation.ReceiveMessage(this); });
        }
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     //DO NOTHING THIS IS JUST TO GET DATA FLOWING
 }
Ejemplo n.º 16
0
 public abstract void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection);
Ejemplo n.º 17
0
        public override void ClientSide(System.Windows.Forms.FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
        {
            frmError tmpError = new frmError();

            tmpError.txtDetails.Text = string.Format("{0}", this.Message);
            tmpError.ShowDialog();
        }
Ejemplo n.º 18
0
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     System.Windows.Forms.MessageBox.Show("Bounce Back Received: " + this.Message);
 }
 public override void ClientSide(FormCollection OpenWindows, CreateClientWindow CreateWindow, Connection ThisConnection)
 {
     //DO NOTHING CLIENT SIDE
 }