public void DetachProject() { if (this.proj != null) { if (ehRefresh != null) { this.proj.Refresh -= ehRefresh; ehRefresh = null; } } this.proj = null; bibVersePreviewControl1.DetachProject(); }
private void StartProject(bool activate) { #if DEMO searchExpired = true; #endif if (this.lbBibleBook.SelectedIndex == -1 || this.lbBibleChapter.SelectedIndex == -1 || this.lbBibleVerse.SelectedIndex == -1) { return; } // Build start verse BibleVerse bv = new BibleVerse(); bv.RefBook = ((BookData)this.lbBibleBook.SelectedItem).mappingName; bv.RefChapter = this.lbBibleChapter.SelectedIndex + 1; bv.RefVerse = ((VerseData)this.lbBibleVerse.SelectedItem).num; #if !DEMO // Get selection range int startR = -1; int endR = -1; bool validSelction = false; ParseData pd = ParseVerse(txtBibleLocation.Text, false); if (pd.verse != "" && pd.endVerse != "" && int.TryParse(pd.verse, out startR) && int.TryParse(pd.endVerse, out endR) && endR >= startR) { validSelction = true; } #endif // Create & activate project BibleProject bp = new BibleProject(bv); #if !DEMO if (validSelction) { bp.selectionRangeStartVerse = startR; bp.selectionRangeEndVerse = endR; } #endif Program.Presenter.AddProject(bp); if (activate) { bp.Activate(); } // Clear ui this.Deactivate(); }
public void AttachProject(BibleProject proj) { if (proj != this.proj) { DetachProject(); this.proj = proj; ehRefresh = new EventHandler(proj_refresh); this.proj.Refresh += ehRefresh; CalculateItems(); this.Refresh(); } }
public void AttachProject(IProject proj) { if (this.proj != proj) { DetachProject(); this.proj = (BibleProject)proj; if ((object)proj as ISlideShow == null) { throw (new ApplicationException("The project must implement ISlideShow")); } ehRefresh = new EventHandler(project_refresh); this.proj.Refresh += ehRefresh; bibVersePreviewControl1.AttachProject(this.proj); } this.RefreshUI(); }
public void DetachProject() { if (proj != null && ehRefresh != null) { proj.Refresh -= ehRefresh; } this.proj = null; ehRefresh = null; // Reset variables hitMapping.Clear(); verseRectMapping.Clear(); highlightedVerse = null; scrollerPos = 0; scrollerRatio = 1; scrollerHeight = 0; searchTerms.Clear(); }
protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); if (e.Button == MouseButtons.Left && proj != null) { switch (proj.GetProjectType()) { case ProjectType.Bible: BibleProject bp = (BibleProject)proj; bp.GoNextSlide(); break; case ProjectType.Song: SongProject sp = (SongProject)proj; sp.GoNextSlide(); break; } } }