private void SaveFile(AsClosableTabItem tabItem)
        {
            var textEditor = tabItem.Content as ICSharpCode.AvalonEdit.TextEditor;
            string filename = textEditor.Document.FileName;
            if (String.IsNullOrEmpty(filename) == true)
            {
                Microsoft.Win32.SaveFileDialog dlg = new Microsoft.Win32.SaveFileDialog();
                dlg.DefaultExt = ".py";
                if (dlg.ShowDialog() ?? false)
                {
                    filename = dlg.FileName;
                    textEditor.Document.FileName = dlg.FileName;

                    string headerText = System.IO.Path.GetFileNameWithoutExtension(filename);
                    tabItem.SetHeader(headerText);
                }
                else
                {
                    return;
                }
            }

            textEditor.Save(filename);
            string message = "[" + DateTime.Now.ToString("tt HH:mm:ss") + "] Save succeeded(" + filename + ")" + Environment.NewLine;
            textboxOutput.AppendText(message);
            textboxOutput.ScrollToEnd();
        }
        private void AddScriptTabFile(string filename)
        {
            var textEditor = new ICSharpCode.AvalonEdit.TextEditor();
            textEditor.HorizontalScrollBarVisibility = ScrollBarVisibility.Auto;
            textEditor.VerticalScrollBarVisibility = ScrollBarVisibility.Auto;
            textEditor.FontFamily = new WM.FontFamily("Consolas");
            textEditor.ShowLineNumbers = true;
            textEditor.SyntaxHighlighting = selectedHighlighting_;

            string headerText = "NewFile";
            if (String.IsNullOrEmpty(filename) == false)
            {
                textEditor.Document.FileName = filename;
                textEditor.Load(filename);
                headerText = System.IO.Path.GetFileNameWithoutExtension(filename);
            }

            AsClosableTabItem tabItem = new AsClosableTabItem();
            tabItem.SetHeader(headerText);
            tabItem.Content = textEditor;

            int tabIndex = tabScript.Items.Add(tabItem);
            tabScript.SelectedIndex = tabIndex;
        }