Esempio n. 1
0
        private void btnSearch_Click(object sender, EventArgs e)
        {
            string text    = txtSearch.Text;
            string version = cbNIV.Checked ? "NIV" : "";

            version = cbCUV.Checked ? "CUV" : "NIV";
            List <string> bible = Bibles.getScripture(version, text);
            int           n     = bible.Count;

            for (int i = 0; i < n; i++)
            {
                lstSearch.Text += bible[i] + "\n";
            }
        }
 public IBibleProvider CreateProvider(Bibles.IBibleDescriptor descriptor)
 {
     IBibleProvider provider = null;
     if (descriptor is FileBibleDescriptor)
     {
         provider = new FileBibleProvider();
     }
     else if (descriptor is DatabaseBibleDescriptor)
     {
         provider = new DatabaseBibleProvider();
     }
     if (provider != null)
     {
         provider.Initialize(descriptor);
     }
     return provider;
 }
Esempio n. 3
0
        public void SetBible(string path)
        {
            _chapterCount.Clear();
            var list = CommonFunction.GetBibleList().ToList();

            foreach (var bibile in list)
            {
                var id = list.IndexOf(bibile);
                Bibles.Add(new Bible()
                {
                    Id = id, Book = bibile.Key, Name = bibile.Value
                });
            }

            _xmldoc.Load(path);
            var xmlnodes   = _xmldoc.SelectNodes("/XMLBIBLE/BIBLEBOOK");
            var bibleBooks = new Dictionary <string, string>();

            if (xmlnodes != null)
            {
                foreach (var xmlnode in xmlnodes.Cast <XmlNode>().Where(xmlnode => xmlnode.Attributes != null))
                {
                    if (xmlnode.Attributes == null)
                    {
                        continue;
                    }
                    string name = xmlnode.Attributes.GetNamedItem("bname").Value;
                    bibleBooks.Add(name, name);
                    var xmlNodeList = xmlnode.SelectNodes("CHAPTER");
                    if (xmlNodeList == null)
                    {
                        continue;
                    }
                    if (xmlnode.Attributes != null)
                    {
                        _chapterCount.Add(xmlnode.Attributes.GetNamedItem("bname").Value, xmlNodeList.Count);
                    }
                }
            }
            SelectedChapter = selectedChapter;
        }
Esempio n. 4
0
        private void btngo_Click(object sender, EventArgs e)
        {/*
          * const string filename = @"C:\Users\zhang\source\repos\Bible1\SqliteDataAcc\content\NIV.db";
          * const string sql = "select * from books;";
          * var conn = new SQLiteConnection("Data Source=" + filename + ";Version=3;");
          * try
          * {
          *     conn.Open();
          *     DataSet ds = new DataSet();
          *     var da = new SQLiteDataAdapter(sql, conn);
          *     da.Fill(ds);
          *     grid.DataSource = ds.Tables[0].DefaultView;
          * }
          * catch (Exception)
          * {
          *     throw;
          * }*/
            //string text = txtSearch.Text;
            string version = cbNIV.Checked ? "NIV" : "";

            version         = cbCUV.Checked ? "CUV" : "NIV";
            grid.DataSource = Bibles.getScripture(version, "Eph", 2);
        }
 public override void Initialize(Bibles.IBibleDescriptor descriptor)
 {
     _descriptor = descriptor as FileBibleDescriptor;
 }