示例#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 bool FileClose()
        {
            if (this.document != null)
            {
                if (this.document.IsDirty)
                {
                    string       message      = "Do you want to save the changes to \'" + document.Url + "\'.";
                    DialogResult dialogResult = MessageBox.Show(this.applicationWindow, message, Resource.GetString("ApplicationName"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning);
                    switch (dialogResult)
                    {
                    case DialogResult.Yes:
                        this.document.Save();
                        break;

                    case DialogResult.Cancel:
                        return(false);

                    case DialogResult.No:
                        break;
                    }
                }

                this.document.Dispose();
                this.document = null;
            }


            if (this.applicationWindow.View.Controls.Count > 0)
            {
                Control control = this.applicationWindow.View.Controls[0];
                control.Parent = null;
                control.Dispose();
            }

            return(true);
        }