示例#1
0
        public void PopulateBibleCacheTab()
        {
            Extensions.Set available = new Extensions.Set();
            Extensions.Set cached    = new Extensions.Set();

            BiblesAvailable_listEx.Items.Clear();
            BiblesCached_listEx.Items.Clear();

            foreach (string book in _MainForm.bibles.Translations())
            {
                cached.Add(book);
                BiblesCached_listEx.Add(book, 1);
            }

            foreach (string book in SwordW.Instance().getBibles())
            {
                available.Add(book);
            }

            available = available - cached;

            foreach (string book in available.Keys)
            {
                BiblesAvailable_listEx.Add(book, 0);
            }
        }
示例#2
0
        /// <summary>
        /// Removes a bible translation from the cache
        /// </summary>
        /// <param name="Index"></param>
        private void BiblesCached_listEx_PressIcon(int Index)
        {
            string tr = BiblesCached_listEx.Items[Index].ToString();

            _MainForm.bibles.Remove(tr);
            BiblesCached_listEx.Remove(Index);
            BiblesAvailable_listEx.Add(tr);
            _MainForm.BibleText_Translations_Populate();
        }
示例#3
0
        private void swordWorker_RunWorkerCompleted(
            object sender,
            RunWorkerCompletedEventArgs e)
        {
            bool added;

            // First, handle the case where an exception was thrown.
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message);
                added = false;
            }
            else if (e.Cancelled)
            {
                // Next, handle the case where the user canceled
                // the operation.
                // Note that due to a race condition in
                // the DoWork event handler, the Cancelled
                // flag may not have been set, even though
                // CancelAsync was called.
                added = false;
            }
            else
            {
                // Finally, handle the case where the operation
                // succeeded.

                // e.Result.ToString();
                added = (bool)e.Result;
            }

            if (added)
            {
                int    Index = BiblesAvailable_listEx.SelectedIndex;
                string tr    = BiblesAvailable_listEx.Items[Index].ToString();

                BiblesAvailable_listEx.Remove(Index);
                _MainForm.BibleText_Translations_Populate();
                BiblesCached_listEx.Add(tr, 1);
            }

            BibleCache_progressBar.Value   = BibleCache_progressBar.Maximum;
            BibleCache_Message.Visible     = false;
            BibleCache_progressBar.Visible = false;
        }