private void btnOpnQry_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new Microsoft.Win32.OpenFileDialog();

            dialog.Filter = "Rich Text File (*.psql)|*.psql|All Files (*.*)|*.*";
            if (dialog.ShowDialog() == true)
            {
                if (this.TbQry.Items.Count < 15)
                {
                    var      name   = dialog.FileName;
                    int      index  = name.LastIndexOf(@"\");
                    TabQuery newTAb = new TabQuery();
                    newTAb.Title = name.Substring(index + 1, name.Length - index - 1);

                    newTAb.Content = new RichTextBox()
                    {
                        MaxHeight = 200, MinHeight = 200, FontFamily = new FontFamily("Consolas"), FontSize = 20f
                    };
                    this.TbQry.Items.Add(newTAb);
                    // read file
                    FileStream  fStream;
                    RichTextBox richTextBox = (RichTextBox)newTAb.Content;
                    var         range       = new TextRange(richTextBox.Document.ContentStart,
                                                            richTextBox.Document.ContentEnd);

                    if (File.Exists(dialog.FileName))

                    {
                        fStream = new FileStream(dialog.FileName, FileMode.OpenOrCreate);

                        range.Load(fStream, DataFormats.Text);

                        fStream.Close();
                    }
                    newTAb.Focus();
                }
                else
                {
                    MessageBox.Show("Too more Tab cause your bad experience");
                }
            }
        }
        private void btnNewtab_Click(object sender, RoutedEventArgs e)
        {
            if (this.TbQry.Items.Count < 15)
            {
                var name = String.Format("{0} {1}", "New Tab", this.TbQry.Items.Count + 1);
                //var newTAb = new TabItem() { Header = name };
                TabQuery newTAb = new TabQuery();
                newTAb.Height = 25;
                newTAb.Title  = name;

                newTAb.Content = new RichTextBox()
                {
                    MaxHeight = 200, MinHeight = 200, FontFamily = new FontFamily("Consolas"), FontSize = 14f, Uid = name, Name = name
                };
                this.TbQry.Items.Add(newTAb);
                newTAb.Focus();
            }
            else
            {
                MessageBox.Show("Too more Tab cause your bad experience");
            }
        }