Ejemplo n.º 1
0
        /// <summary>
        /// 初始化工作区
        /// </summary>
        private void IniteWorkArea()
        {
            WebmarkHelp.Navigate(Config.MarkdownHelp);

            //编辑器
            markEdit.MarkDoc = this.markDoc;

            #region 加载编辑器配置

            #region 字体
            //初始化工具栏
            var viewFonts = new ViewModels.FontsViewModel();
            int viewDefaultFontIndex = 0;
            foreach (var i in viewFonts.FontsData)
            {

                comboBoxFontName.Items.Add(new TextBlock()
                {
                    Text = i,
                    FontFamily = new FontFamily(i)
                });
                if (i == Config.Common.EditFontStr)
                {
                    comboBoxFontName.SelectedIndex = viewDefaultFontIndex;
                }
                viewDefaultFontIndex++;
            }
            if (comboBoxFontSize.SelectedIndex < 0)
            {
                comboBoxFontSize.SelectedIndex = 0;
            }
            #endregion

            #region 字体数字
            var fontIndex = Config.Common.EditFontIndex;
            foreach (var i in FontSizeList)
            {
                comboBoxFontSize.Items.Add(new TextBlock()
                {
                    Text = i.ToString()
                });
            }
            comboBoxFontSize.SelectedIndex = fontIndex;
            #endregion

            buttonVEndLine.IsChecked = Config.Common.ShowEndVl;
            markEdit.textEditor.Options.ShowEndOfLine = Config.Common.ShowEndVl;

            buttonVTab.IsChecked = Config.Common.ShowTabs;
            markEdit.textEditor.Options.ShowTabs = Config.Common.ShowTabs;

            buttonVSpaces.IsChecked = Config.Common.ShowSpace;
            markEdit.textEditor.Options.ShowSpaces = Config.Common.ShowSpace;

            buttonNumberBar.IsChecked = Config.Common.LineBar;
            markEdit.textEditor.ShowLineNumbers = Config.Common.LineBar;

            buttonCurrLine.IsChecked = Config.Common.ShowHightLine;
            markEdit.textEditor.Options.HighlightCurrentLine = Config.Common.ShowHightLine;

            BtneditBackColor.Fill = new SolidColorBrush(Config.Common.BackGround);
            markEdit.textEditor.Background = new SolidColorBrush(Config.Common.BackGround);
            #endregion

            //初始化样式
            InisteStyle();

            //文件夹
            foreach (var i in Config.Common.FileList)
            {
                lstFileList.Items.Add(i);
            }
            //test
            // markEdit.LoadText(Properties.Resources.test);

            markDoc.LoadAllHTML(markEdit.textEditor.Text);

            //设置工作模式

            SetWorkArea();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 初始化工作区
        /// </summary>
        private void IniteWorkArea()
        {
            WebmarkHelp.Navigate(Config.MarkdownHelp);

            //编辑器
            markEdit.MarkDoc = this.markDoc;

            #region 加载编辑器配置

            #region 字体
            //初始化工具栏
            var viewFonts            = new ViewModels.FontsViewModel();
            int viewDefaultFontIndex = 0;
            foreach (var i in viewFonts.FontsData)
            {
                comboBoxFontName.Items.Add(new TextBlock()
                {
                    Text       = i,
                    FontFamily = new FontFamily(i)
                });
                if (i == Config.Common.EditFontStr)
                {
                    comboBoxFontName.SelectedIndex = viewDefaultFontIndex;
                }
                viewDefaultFontIndex++;
            }
            if (comboBoxFontSize.SelectedIndex < 0)
            {
                comboBoxFontSize.SelectedIndex = 0;
            }
            #endregion

            #region 字体数字
            var fontIndex = Config.Common.EditFontIndex;
            foreach (var i in FontSizeList)
            {
                comboBoxFontSize.Items.Add(new TextBlock()
                {
                    Text = i.ToString()
                });
            }
            comboBoxFontSize.SelectedIndex = fontIndex;
            #endregion


            buttonVEndLine.IsChecked = Config.Common.ShowEndVl;
            markEdit.textEditor.Options.ShowEndOfLine = Config.Common.ShowEndVl;

            buttonVTab.IsChecked = Config.Common.ShowTabs;
            markEdit.textEditor.Options.ShowTabs = Config.Common.ShowTabs;

            buttonVSpaces.IsChecked = Config.Common.ShowSpace;
            markEdit.textEditor.Options.ShowSpaces = Config.Common.ShowSpace;

            buttonNumberBar.IsChecked           = Config.Common.LineBar;
            markEdit.textEditor.ShowLineNumbers = Config.Common.LineBar;

            buttonCurrLine.IsChecked = Config.Common.ShowHightLine;
            markEdit.textEditor.Options.HighlightCurrentLine = Config.Common.ShowHightLine;

            BtneditBackColor.Fill          = new SolidColorBrush(Config.Common.BackGround);
            markEdit.textEditor.Background = new SolidColorBrush(Config.Common.BackGround);
            #endregion


            //初始化样式
            InisteStyle();

            //文件夹
            foreach (var i in Config.Common.FileList)
            {
                lstFileList.Items.Add(i);
            }
            //test
            // markEdit.LoadText(Properties.Resources.test);

            markDoc.LoadAllHTML(markEdit.textEditor.Text);

            //设置工作模式

            SetWorkArea();
        }