示例#1
0
        public void OpenDoc(string filePath)
        {
            if (BLL.FileManager.isChangeFlag)
            {
                var result = Common.ShowCorfmMessage("当前内容未保存,是否保存?");
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                else if (result == MessageBoxResult.OK)
                {
                    SaveDoc();
                }
                BLL.FileManager.isChangeFlag = false;
            }


            var text = System.IO.File.ReadAllText(filePath);

            markEdit.LoadText(text);
            ChangeTitle();
            markDoc.LoadAllHTML(markEdit.textEditor.Text);
            Config.Common.FileList.Remove(filePath);
            Config.Common.FileList.Insert(0, filePath);
        }
示例#2
0
        /// <summary>
        /// 打开文档
        /// </summary>
        public void OpenDoc()
        {
            if (BLL.FileManager.isChangeFlag)
            {
                var result = Common.ShowCorfmMessage("当前内容未保存,是否保存?");
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                else if (result == MessageBoxResult.OK)
                {
                    SaveDoc();
                }
                BLL.FileManager.isChangeFlag = false;
            }

            var p = BLL.FileManager.OpenMarkdownFile();

            if (p != null)
            {
                markEdit.LoadText(p);
            }
            ChangeTitle();
            markDoc.LoadAllHTML(markEdit.textEditor.Text);
        }
示例#3
0
 private void RibbonWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     if (BLL.FileManager.isChangeFlag)
     {
         var result = Common.ShowCorfmMessage("当前内容未保存,是否保存?");
         if (result == MessageBoxResult.Cancel)
         {
             e.Cancel = true;
             return;
         }
         else if (result == MessageBoxResult.OK)
         {
             SaveDoc();
         }
         BLL.FileManager.isChangeFlag = false;
     }
 }
示例#4
0
        /// <summary>
        /// 新建文档
        /// </summary>
        public void NewDoc()
        {
            if (BLL.FileManager.isChangeFlag)
            {
                var result = Common.ShowCorfmMessage("当前内容未保存,是否保存?");
                if (result == MessageBoxResult.Cancel)
                {
                    return;
                }
                else if (result == MessageBoxResult.OK)
                {
                    SaveDoc();
                }
                BLL.FileManager.isChangeFlag = false;
            }

            markEdit.textEditor.Clear();
            markDoc.LoadAllHTML(markEdit.textEditor.Text);
            Config.CurrBlogsDocument = new BlogsDocumentInfo();
        }