コード例 #1
0
        public override void Save()
        {
            if (_postEditorPreferences.IsModified())
            {
                _postEditorPreferences.Save();
            }

            if (_wordCountPreferences.IsModified())
            {
                _wordCountPreferences.Save();
            }
        }
コード例 #2
0
        public override void Save()
        {
            string destinationRecentPosts = Path.Combine(_postEditorPreferences.WeblogPostsFolder + "\\Recent Posts");
            string destinationDrafts      = Path.Combine(_postEditorPreferences.WeblogPostsFolder + "\\Drafts");

            Directory.CreateDirectory(destinationRecentPosts);
            Directory.CreateDirectory(destinationDrafts);

            _postEditorPreferences.SaveWebLogPostFolder();

            if (string.Compare(_originalFolder, _postEditorPreferences.WeblogPostsFolder, true, CultureInfo.CurrentUICulture) != 0)
            {
                string            message = "You  have updated the default location for your blog posts, would you like to move any existing posts?";
                string            caption = "Move existing posts";
                MessageBoxButtons buttons = MessageBoxButtons.YesNo;
                DialogResult      result;

                result = MessageBox.Show(message, caption, buttons);

                if (result == DialogResult.Yes)
                {
                    MovePosts(Path.Combine(_originalFolder + @"\\Recent Posts\\"), destinationRecentPosts);

                    MovePosts(Path.Combine(_originalFolder + @"\\Drafts\\"), destinationDrafts);

                    PostEditorForm frm = Application.OpenForms?[0] as PostEditorForm;
                    if (frm != null)
                    {
                        PostEditorMainControl ctrl = frm.Controls?[0] as PostEditorMainControl;
                        if (ctrl != null)
                        {
                            ctrl.FirePostListChangedEvent();
                        }
                    }
                }
            }

            if (_postEditorPreferences.IsModified())
            {
                _postEditorPreferences.Save();
            }

            if (_wordCountPreferences.IsModified())
            {
                _wordCountPreferences.Save();
            }

            _originalFolder = _postEditorPreferences.WeblogPostsFolder;
        }