Ejemplo n.º 1
0
 protected void TurnOnResource(string strModuleName)
 {
     moduleVersion = manager.getModule(strModuleName);
     System.Diagnostics.Debug.Assert(moduleVersion != null);
     m_nBook    = 0;             // forces a refresh
     m_nChapter = 0;
     m_nVerse   = 0;
     DisplayVerses();
 }
Ejemplo n.º 2
0
        public void ShowFootnote(string key, Point location)
        {
            //Record the key so we don't popup this hover over again
            Tag = key;

            //Set the location
            Location = location;

            //Parse the link
            string strModule = null;

            key = key.Substring(key.IndexOf('?') + 1);             //key.Replace("passagestudy.jsp?", "");
            string[] splitKey = key.Split('&');
            action = splitKey[0].Replace("action=", "");
            type   = splitKey[1].Replace("type=", "");
            value  = splitKey[2].Replace("value=", "");
            if (splitKey.GetUpperBound(0) >= 3)
            {
                strModule = splitKey[3].Replace("module=", "");
            }

            string strReference = null;

            if (splitKey.GetUpperBound(0) >= 4)
            {
                strReference = splitKey[4].Replace("passage=", "");
                strReference = strReference.Replace("%3A", ":");
                strReference = strReference.Replace("+", " ");
            }

            /*
             * if (action.Equals("showStrongs") && type.Equals("Greek"))
             *      ShowStrongsGreek(value);
             * else if (action.Equals("showStrongs") && type.Equals("Hebrew"))
             *      ShowStrongsHebrew(value);
             * else if (action.Equals("showMorph") && type.Contains("strongMorph"))
             *      ShowMorphRobinson(value);
             * else if (action.Equals("showMorph") && type.Contains("robinson"))
             *      ShowMorphRobinson(value);
             * else
             */
            if (action.Equals("showNote") && type.Contains("x") && !String.IsNullOrEmpty(strModule))
            {
                // I'm imagining that the module of the note could be different from the module of the text
                SWModule moduleForNote;
                if (!_lstModules.TryGetValue(strModule, out moduleForNote))
                {
                    moduleForNote = _manager.getModule(strModule);
                    _lstModules.Add(strModule, moduleForNote);
                }
                ShowNote(moduleForNote, new SWKey(strReference), value);
            }
            else if (action.Equals("showNote") && type.Contains("n") && !String.IsNullOrEmpty(strModule))
            {
                // I'm imagining that the module of the note could be different from the module of the text
                SWModule moduleForNote;
                if (!_lstModules.TryGetValue(strModule, out moduleForNote))
                {
                    moduleForNote = _manager.getModule(strModule);
                    _lstModules.Add(strModule, moduleForNote);
                }
                ShowNote(moduleForNote, new SWKey(strReference), value);
            }
            else
            {
                System.Diagnostics.Debug.Assert(false);
                SetDisplayText("");
            }

            Show();
            webBrowser.Focus();
        }
Ejemplo n.º 3
0
        protected void InitializeSword()
        {
            // Initialize Module Variables
            filterManager = new MarkupFilterMgr((char)Sword.FMT_HTMLHREF, (char)Sword.ENC_HTML);

            /* NOTE: GC.SuppressFinalize(filterManager);
             *  This must be placed here so the garbage collector (GC) doesn't try to clean up
             * something that was already cleaned up.  If this is not left in an error will
             * occur when the application closes.  This happens because when the SWMgr is
             * cleaned by the GC it cleans its own filter and removes it from memory.  When
             * the GC then tries to clean up the filterManager object it doesn't really
             * exist in memory anymore and therefore it throws an exception saying some
             * memory is probably corrupt because this object points to trash in memory.
             * -Richard Parsons 11-21-2006
             */
            GC.SuppressFinalize(filterManager);

            manager = new SWMgr(filterManager);
            if (manager == null)
            {
                throw new ApplicationException("Unable to create the Sword utility manager");
            }

            foreach (string strPath in GetModuleLocations())
            {
                manager.augmentModules(strPath);
            }

            // first determine all the possible resources available
            int numOfModules = (int)manager.getModules().size();

            for (int i = 0; i < numOfModules; i++)
            {
                if (manager.getModuleAt(i).Type().Equals("Biblical Texts"))                 //Limit to just bibles, comment out to see all modules
                {
                    string strModuleName = manager.getModuleAt(i).Name();
                    if (lstModulesToSuppress.Contains(strModuleName))
                    {
                        continue;
                    }

                    string strModuleDesc = manager.getModuleAt(i).Description();
                    if (Properties.Settings.Default.SwordModulesUsed.Contains(strModuleName))
                    {
                        lstBibleResources.Add(new SwordResource(strModuleName, strModuleDesc, true));
                        InitSwordResourceRadioButton(strModuleName, strModuleDesc);
                    }
                    else
                    {
                        lstBibleResources.Add(new SwordResource(strModuleName, strModuleDesc, false));
                    }
                }
            }

            string moduleToStartWith = CstrNetFreeModuleName;

            if (!string.IsNullOrEmpty(Properties.Settings.Default.LastSwordModuleUsed))
            {
                moduleToStartWith = Properties.Settings.Default.LastSwordModuleUsed;
            }

            moduleVersion = manager.getModule(moduleToStartWith);
            if (moduleVersion == null)
            {
                throw new ApplicationException(String.Format("Can't find the Sword module '{0}'. Is Sword installed?", Properties.Settings.Default.SwordModulesUsed[0]));
            }

            // Setup the active module
            // Word of Christ in red
            manager.setGlobalOption("Words of Christ in Red", "On");

            //Footnotes
            manager.setGlobalOption("Footnotes", "On");

            /* NOTE: This is needed so the DOM Script I'm using for strongs numbers,
             * morph, and footnote tags will work.  This basicly allows the webbrowser
             * control to talk to my form control using DOM Script using the command
             * window.external.<the public method from this form>;
             * -Richard Parsons 01-31-2007
             */
            webBrowserNetBible.ObjectForScripting = this;

            if (tableLayoutPanelSpinControls.Controls[CstrRadioButtonPrefix + moduleToStartWith] is RadioButton)
            {
                RadioButton rb = (RadioButton)tableLayoutPanelSpinControls.Controls[CstrRadioButtonPrefix + moduleToStartWith];
                rb.Checked = true;
            }
        }
Ejemplo n.º 4
0
 public SWModule getModule(string modName)
 {
     return(manager.getModule(modName));
 }