Пример #1
0
        private void Publish()
        {
            string password = this.ftpConfiguration.Password;

            if ((password == null) || (password.Length == 0))
            {
                FtpPasswordDialog dialog = new FtpPasswordDialog();
                if (dialog.Run())
                {
                    password = dialog.Password;
                }
                else
                {
                    return;
                }
            }

            try
            {
                this.document.Save();                 // TODO: What if the user don't like to save the file locally? This will be fixed in the next week!
                Cursor currentCursor = Cursor.Current;
                Cursor.Current = Cursors.WaitCursor;

                FtpConnection ff = new FtpConnection(this.ftpConfiguration.Host, this.ftpConfiguration.UserName, password, Int32.Parse(this.ftpConfiguration.Port));
                ff.ChangeDirectory(this.ftpConfiguration.Directory);
                ff.Upload(this.document.Url);
                ff.Disconnect();

                Cursor.Current = currentCursor;
                MessageBox.Show(this.applicationWindow, "File Publised Successfully.", Resource.GetString("ApplicationName"), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception exception)
            {
                MessageBox.Show(this.applicationWindow, exception.Message, Resource.GetString("ApplicationName"));
            }
        }
Пример #2
0
        private void Publish()
        {
            string password = this.ftpConfiguration.Password;

            if ((password == null) || (password.Length == 0))
            {
                FtpPasswordDialog dialog = new FtpPasswordDialog();
                if ( dialog.Run() )
                {
                    password = dialog.Password;
                }
                else
                {
                    return;
                }
            }

            try
            {
                this.document.Save(); // TODO: What if the user don't like to save the file locally? This will be fixed in the next week!
                Cursor currentCursor = Cursor.Current;
                Cursor.Current = Cursors.WaitCursor;

                FtpConnection ff = new FtpConnection(this.ftpConfiguration.Host, this.ftpConfiguration.UserName, password, Int32.Parse(this.ftpConfiguration.Port));
                ff.ChangeDirectory(this.ftpConfiguration.Directory);
                ff.Upload(this.document.Url);
                ff.Disconnect();

                Cursor.Current = currentCursor;
                MessageBox.Show(this.applicationWindow, "File Publised Successfully.", Resource.GetString("ApplicationName"), MessageBoxButtons.OK, MessageBoxIcon.Information);

            }
            catch(Exception exception)
            {
                MessageBox.Show(this.applicationWindow, exception.Message, Resource.GetString("ApplicationName"));
            }
        }