Пример #1
0
        public void InstallWindowsHook()
        {
            if (hHook == 0)
            {
                // Create an instance of HookProc.
                MouseHookProcedure = new Win32.USER32.HookProc(WindowHookProc);

                hHook = Win32.USER32.SetWindowsHookEx(Win32.USER32.WH_CALLWNDPROC,
                                                      MouseHookProcedure,
                                                      (IntPtr)0,
                                                      AppDomain.GetCurrentThreadId());
                //If SetWindowsHookEx fails.
                if (hHook == 0)
                {
                    MeetingAlerts alert = new MeetingAlerts();
                    alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Warning, "SetWindowsHookEx Failed", true, false);
//					MessageBox.Show("SetWindowsHookEx Failed");
                    return;
                }
            }
            else
            {
                bool ret = Win32.USER32.UnhookWindowsHookEx(hHook);
                //If UnhookWindowsHookEx fails.
                if (ret == false)
                {
                    MeetingAlerts alert = new MeetingAlerts();
                    alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Warning, "UnhookWindowsHookEx Failed", true, false);
                    //MessageBox.Show("UnhookWindowsHookEx Failed");
                    return;
                }
                hHook = 0;
            }
        }
Пример #2
0
        public void downloadThreadFunction()
        {
            string strURL    = fileInformation.filePath;
            string localpath = "webfile";
            int    nIndex2   = strURL.LastIndexOf("/");

            if (nIndex2 != -1)
            {
                localpath = strURL.Substring(nIndex2 + 1, strURL.Length - nIndex2 - 1);
            }

            string localPath = _selectedFile;

            IsDownloadedSuccessfully = (DownloadFile(fileInformation.filePath, localpath) > 0);
            localFilePath            = localpath;
            if (!IsDownloadedSuccessfully)
            {
                MeetingAlerts alert = new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info, "Unable to download file from server. Please contact Support", true, false);
                //MessageBox.Show("Unable to download file from server. Please contact Support","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
            else if (IsWebPresentation)
            {
                DialogResult = DialogResult.OK;
                Close();
            }
        }
Пример #3
0
 private void btnAnswer_Click(object sender, System.EventArgs e)
 {
     if (testPollType == PollType.FreeResponse)
     {
         if (textBox1.Text.Length < 1)
         {
             MeetingAlerts alert = new MeetingAlerts();
             alert.ShowMessage(Client.Alerts.MeetingAlerts.AlertType.Info, "Please enter your answer", true, false);
             //MessageBox.Show("Please enter your answer","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
             return;
         }
     }
     //this.m_bAnswered=true;
     btnAnswer.Enabled = false;
     DialogResult      = DialogResult.OK;
     Close();
 }
Пример #4
0
        private void btnOpen_Click(object sender, System.EventArgs e)
        {
            DialogResult res;

            if (modified == true)
            {
                res = MessageBox.Show("Do you want to save the current notes", "Save notes?", System.Windows.Forms.MessageBoxButtons.YesNoCancel);
                if (res == DialogResult.Cancel)
                {
                    return;
                }
                else if (res == DialogResult.Yes)
                {
                    btnSave_Click(this, new System.EventArgs());
                }
            }

            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "TXT|*.txt";
            res        = dlg.ShowDialog();
            if (res == DialogResult.Cancel)
            {
                return;
            }
            try
            {
                fileName = dlg.FileName;              //
                StreamReader sr = new StreamReader(dlg.FileName);
                string       s  = sr.ReadToEnd();
                sr.Close();
                ignoreFirst       = true;
                this.textBox.Text = s;
                this.modified     = false;
            }
            catch (Exception)
            {
                MeetingAlerts alert = new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.NonFatal, "Couldnt open " + this.fileName + " for reading", true, false);
                //MessageBox.Show("Couldnt open " + this.fileName + " for reading","WebMeeting",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
            }
        }
Пример #5
0
        private void loginBtn_Click(object sender, System.EventArgs e)
        {
            /*if(txtBoxName.Text.Length < 1)
             * {
             *      MessageBox.Show("Please enter a name","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
             *      return;
             * }
             *
             * if(txtBoxEmail.Text.Length < 1)
             * {
             *      MessageBox.Show("Please enter an email","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
             *      return;
             * }
             * if(txtFTPIP.Text.Length < 1)
             * {
             *      MessageBox.Show("Please provide ftp address","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
             *      return;
             * }
             * if(txtConferenceID.Text.Length <  1)
             * {
             *      MessageBox.Show("Please provide conference ID","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
             *      return;
             * }*/
            if (txtPassword.Text.Length < 1)
            {
                MeetingAlerts alert = new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info, "Please provide passsword ", true, false);
                //MessageBox.Show("Please provide passsword ","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }
            Info.getInstance().Password = this.txtPassword.Text;
            //Info.getInstance().FtpIP=this.txtFTPIP.Text;


            this.DialogResult = DialogResult.OK;
            Close();
        }
Пример #6
0
        public void Save()
        {
            if (fileName == "")
            {
                SaveAs();
                return;
            }
            try
            {
                StreamWriter sw = new StreamWriter(this.fileName);
                sw.Write(this.textBox.Text);
                sw.Close();
                this.modified = false;
                MeetingAlerts alert = new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Info, this.fileName + " saved", true, false);
//				MessageBox.Show(this.fileName + " saved","WebMeeting",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
            }
            catch (Exception)
            {
                MeetingAlerts alert = new MeetingAlerts();
                alert.ShowMessage(Alerts.MeetingAlerts.AlertType.Action, "Could not open " + this.fileName + " for writing", true, false);
                //MessageBox.Show("Could not open " + this.fileName + " for writing","WebMeeting",System.Windows.Forms.MessageBoxButtons.OK,System.Windows.Forms.MessageBoxIcon.Warning);
            }
        }
Пример #7
0
        /// <summary>
        /// Upload a file and set the resume flag.
        /// </summary>
        /// <param name="fileName"></param>
        /// <param name="resume"></param>
        public void Upload(string fileName, bool resume)
        {
            if (!this.loggedin)
            {
                this.Login();
            }

            Socket cSocket = null;
            long   offset  = 0;

            if (resume)
            {
                try
                {
                    this.BinaryMode = true;

                    offset = GetFileSize(Path.GetFileName(fileName));
                }
                catch (Exception)
                {
                    // file not exist
                    offset = 0;
                }
            }

            FileStream input;

            // open stream to read file
            try
            {
                int tries = 1;
                do
                {
                    try
                    {
                        input = new FileStream(fileName, FileMode.Open, System.IO.FileAccess.Read, FileShare.Read);
                        break;
                    }
                    catch (Exception)                   // ee)
                    {
                        tries++;
                        if (tries > 3)
                        {
                            return;
                        }
                        System.Threading.Thread.Sleep(200);
                    }
                }while(true);



                if (resume && input.Length < offset)
                {
                    // different file size
                    Debug.WriteLine("Overwriting " + fileName, "FtpClient");
                    offset = 0;
                }
                else if (resume && input.Length == offset)
                {
                    // file done
                    input.Close();
                    Debug.WriteLine("Skipping completed " + fileName + " - turn resume off to not detect.", "FtpClient");
                    return;
                }

                // dont create untill we know that we need it
                cSocket = this.createDataSocket();

                if (offset > 0)
                {
                    this.sendCommand("REST " + offset);
                    if (this.resultCode != 350)
                    {
                        Debug.WriteLine("Resuming not supported", "FtpClient");
                        offset = 0;
                    }
                }


                this.sendCommand("STOR " + Path.GetFileName(fileName));

                if (this.resultCode != 125 && this.resultCode != 150)
                {
                    throw new FtpException(result.Substring(4));
                }

                if (offset != 0)
                {
                    Debug.WriteLine("Resuming at offset " + offset, "FtpClient");

                    input.Seek(offset, SeekOrigin.Begin);
                }

                Debug.WriteLine("Uploading file" + fileName + " to " + remotePath, "FtpClient");

                long total = 0;
                while ((bytes = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    cSocket.Send(buffer, bytes, 0);
                    total   += bytes;
                    progress = (int)((total * 100) / input.Length);
                    if (OnStatusUpdateFunction != null)
                    {
                        OnStatusUpdateFunction(progress);
                    }

                    if (m_bBreak)
                    {
                        break;
                    }
                }

                input.Close();

                if (cSocket.Connected)
                {
                    cSocket.Close();
                }

                this.readResponse();

                if (this.resultCode != 226 && this.resultCode != 250)
                {
                    throw new FtpException(this.result.Substring(4));
                }
            }
            catch (Exception ee)
            {
                MeetingAlerts alert = new MeetingAlerts();
                alert.ShowMessage(Client.Alerts.MeetingAlerts.AlertType.NonFatal, ee.Message + " Upload Function", true, false);
                //System.Windows.Forms.MessageBox.Show(ee.Message + " Upload Function","WebMeeting",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }