private void OnAdd_Click(object sender, System.Windows.RoutedEventArgs e) { try { if (this.selectedReportType == ReportTypeEnum.ReportContent && !this.reportCategoryId.HasValue) { throw new ApplicationException("Invalid report category selected"); } ReportDesigner designer = new ReportDesigner(new ReportMasterModel { ReportTypeEnum = (int)this.selectedReportType, PaperKindEnum = (int)PaperKind.A4, PageOrientationEnum = (int)PageOrientationEnum.Portrait, PageMarginTop = 100, PageMarginBottom = 100, PageMarginLeft = 100, PageMarginRight = 100, ProjectName = General.ProjectModel.ModelName, CategoryId = this.reportCategoryId }); ControlDialog.WindowsShowIsClosing += this.WindowsShow_IsClosing; ControlDialog.Show($"New {this.selectedReportType.GetDescriptionAttribute()}", designer, "Save", windowState: WindowState.Maximized); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
private static void LinkImage_Selected(object sender, MouseButtonEventArgs e) { try { Image item = (Image)sender; string verseKey = item.Tag.ParseToString(); Type linkViewerType = Type.GetType("Bibles.Link.LinkViewer,Bibles.Link"); UserControlBase linkViewer = Activator.CreateInstance(linkViewerType, new object[] { verseKey }) as UserControlBase; if (ControlDialog.ShowDialog("Link Viewer", linkViewer, "SaveComments", autoSize: false).IsFalse()) { return; } string[] deletedLinks = linkViewer.GetPropertyValue("GetDeletedLinks").To <string[]>(); foreach (string key in deletedLinks) { BibleLoader.LinkViewerClosed?.Invoke(linkViewer, key); } } catch (Exception err) { ErrorLog.ShowError(err); } }
private void SubjectHeder_Browsed(object sender, string buttonKey) { try { switch (buttonKey) { case "StudyCategoryBrowse": StudyCategories category = new StudyCategories(); if (ControlDialog.ShowDialog("Categories", category, string.Empty, autoSize: false).IsFalse()) { return; } if (category.SelectedCategory == null) { throw new ApplicationException("Category not Selected."); } StudyCategoryModel categoryModel = category.SelectedCategory; this.SubjectHeader.StudyCategoryId = categoryModel.StudyCategoryId; this.SubjectHeader.StudyCategoryName = categoryModel.CategoryName; break; } } catch (Exception err) { ErrorLog.ShowError(err); } }
private void LinkVerse_Cliked(object sender, RoutedEventArgs e) { if (this.SelectedVerseKey.IsNullEmptyOrWhiteSpace() || Formatters.GetVerseFromKey(this.SelectedVerseKey) <= 0 || this.SelectedSide == ParalelleSideEnum.None) { MessageDisplay.Show("Please select a Verse."); return; } try { Type linkType = Type.GetType("Bibles.Link.LinkEditor,Bibles.Link"); object[] args = new object[] { this.selectedBibleId, this.SelectedSide == ParalelleSideEnum.Left ? this.versesDictionaryLeft[Formatters.GetVerseFromKey(this.SelectedVerseKey)] : this.versesDictionaryRight[Formatters.GetVerseFromKey(this.SelectedVerseKey)] }; UserControlBase linkEditor = Activator.CreateInstance(linkType, args) as UserControlBase; string title = $"Link - {GlobalStaticData.Intance.GetKeyDescription(this.SelectedVerseKey)}"; linkEditor.Height = this.Height; if (ControlDialog.ShowDialog(title, linkEditor, "AcceptLink", false).IsFalse()) { return; } int selectedVerse = Formatters.GetVerseFromKey(this.selectedKey); BibleLoader.RefreshVerseNumberPanel ( this.loadedVerseStackDictionaryLeft[selectedVerse], this.BibleLeft.BibleId, this.versesDictionaryLeft[selectedVerse] ); BibleLoader.RefreshVerseNumberPanel ( this.loadedVerseStackDictionaryRight[selectedVerse], this.BibleRight.BibleId, this.versesDictionaryRight[selectedVerse] ); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void EditStudy_Click(object sender, System.Windows.RoutedEventArgs e) { if (this.SelectedStudyHeader == null) { MessageDisplay.Show("Please select a Study."); return; } try { #region CHECK FOR OPEN STUDIES foreach (Window window in Application.Current.Windows) { if (window.GetType() != typeof(ControlWindow)) { continue; } UserControlBase controlBase = window.GetPropertyValue("ControlContent").To <UserControlBase>(); if (controlBase.GetType() != typeof(EditStudy)) { continue; } StudyHeader studyHeader = controlBase.GetPropertyValue("SubjectHeader").To <StudyHeader>(); if (studyHeader.StudyHeaderId <= 0) { continue; } window.Focus(); this.CloseIfNotMainWindow(true); return; } #endregion EditStudy edit = new EditStudy(this.SelectedStudyHeader); ControlDialog.Show(this.SelectedStudyHeader.StudyName, edit, "SaveStudy", autoSize: false); this.CloseIfNotMainWindow(true); } catch (Exception err) { ErrorLog.ShowError(err); } }
private static void StudyBookmark_Selected(object sender, RoutedEventArgs e) { try { MenuItem item = (MenuItem)sender; string studyKey = item.Tag.ParseToString(); string[] keySplit = studyKey.Split(new string[] { "||" }, StringSplitOptions.None); int studyHeaderId = keySplit[0].ToInt32(); #region CHECK FOR OPEN STUDIES foreach (Window window in Application.Current.Windows) { if (window.GetType() != typeof(ControlWindow)) { continue; } UserControlBase controlBase = window.GetPropertyValue("ControlContent").To <UserControlBase>(); if (controlBase.GetType() != typeof(EditStudy)) { continue; } StudyHeader studyHeader = controlBase.GetPropertyValue("SubjectHeader").To <StudyHeader>(); if (studyHeader.StudyHeaderId <= 0) { continue; } window.Focus(); return; } #endregion StudyHeaderModel model = BiblesData.Database.GetStudyHeader(studyHeaderId.ToInt32()); EditStudy edit = new EditStudy(model); ControlDialog.Show(model.StudyName, edit, "SaveStudy", autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void Highlights_Cliked(object sender, RoutedEventArgs e) { try { BibleHighlights highlight = new BibleHighlights(); ControlDialog.Show("Highlights", highlight, string.Empty, showCancelButton: false, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err);; } }
private void OpenStudy_Cliked(object sender, RoutedEventArgs e) { try { StudiesByCategory study = new StudiesByCategory(); ControlDialog.ShowDialog("Open Study", study, string.Empty, autoSize: false, showCancelButton: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void NewStudy_Cliked(object sender, RoutedEventArgs e) { try { EditStudy study = new EditStudy(); ControlDialog.Show("New Study", study, "SaveStudy", owner: this, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void OpenStudy_Cliked(object sender, RoutedEventArgs e) { try { StudiesByCategory study = new StudiesByCategory(); ControlDialog.ShowDialog("Open Study", study, "TryEditStudy", autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void Dictionaries_Cliked(object sender, RoutedEventArgs e) { try { DictionaryViewer dictionary = new DictionaryViewer(); ControlDialog.Show("Dictionaries", dictionary, string.Empty, showOkButton: false, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void Search_Cliked(object sender, RoutedEventArgs e) { try { SearchView search = new SearchView(); ControlDialog.Show("Search", search, string.Empty, owner: this, showCancelButton: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void OnlineResources_Cliked(object sender, RoutedEventArgs e) { try { OnlineResources resources = new OnlineResources(); ControlDialog.Show("Resource Centre", resources, string.Empty, owner: this, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void LanguageSetup_Cliked(object sender, RoutedEventArgs e) { try { TranslationSetup setup = new TranslationSetup(); //if (ControlDialog.ShowDialog("Translation Setup", setup, "SaveSetup", autoSize:false).IsFalse()) ControlDialog.Show("Translation Setup", setup, "SaveSetup", owner: this, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void NewStudy_Click(object sender, RoutedEventArgs e) { try { this.newStudy = new EditStudy(); ControlDialog.ControlDialogClosing += this.ControlDialog_Closing; ControlDialog.Show("New Study", this.newStudy, "SaveStudy", autoSize: false, owner: Application.Current.MainWindow); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void Notes_Cliked(object sender, RoutedEventArgs e) { try { VersesNotes notes = new VersesNotes(); notes.VerseNoteGridModelRequest += this.VerseNoteGridModel_Request; ControlDialog.Show("Verses Notes", notes, string.Empty, showOkButton: false, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err);; } }
private void Bookmarks_Cliked(object sender, RoutedEventArgs e) { try { BookmarksList bookmarks = new BookmarksList(); bookmarks.BookmarkReaderRequest += this.BookmarkReader_Request; ControlDialog.Show("Bookmarks", bookmarks, string.Empty, owner: this, isTopMost: true, autoSize: false); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void Downloads_Cliked(object sender, RoutedEventArgs e) { try { DownloadsView down = new DownloadsView(); if (ControlDialog.ShowDialog("Downloads", down, "DownLoad", autoSize: false).IsFalse()) { return; } } catch (Exception err) { ErrorLog.ShowError(err); } }
private void ModelItem_Browse(object sender, string buttonKey) { try { ModelViewObject modelObject = (ModelViewObject)sender; string strongsNumber = modelObject[0].GetValue().ParseToString(); StrongsVerses verseView = new StrongsVerses(this.BibleId, strongsNumber, this.verseKey); ControlDialog.Show(strongsNumber, verseView, string.Empty, showCancelButton: false, autoSize: false, owner: this.GetParentWindow()); } catch (Exception err) { ErrorLog.ShowError(err); } }
public static bool?ShowDialog(string windowTitle, string text) { TextEditing.Text = text; textControl = new TextEditorControl(text); bool?result = ControlDialog.ShowDialog(windowTitle, textControl, string.Empty); if (result.IsTrue()) { TextEditing.Text = textControl.Text; } textControl = null; return(result); }
public bool TryEditStudy() { if (this.SelectedStudyHeader == null) { MessageDisplay.Show("Please select a Study."); return(false); } #region CHECK FOR OPEN STUDIES foreach (Window window in Application.Current.Windows) { if (window.GetType() != typeof(ControlWindow)) { continue; } UserControlBase controlBase = window.GetPropertyValue("ControlContent").To <UserControlBase>(); if (controlBase.GetType() != typeof(EditStudy)) { continue; } StudyHeader studyHeader = controlBase.GetPropertyValue("SubjectHeader").To <StudyHeader>(); if (studyHeader.StudyHeaderId <= 0 || studyHeader.StudyHeaderId != this.SelectedStudyHeader.StudyHeaderId) { continue; } window.Focus(); return(true); } #endregion EditStudy edit = new EditStudy(this.SelectedStudyHeader); ControlDialog.Show(this.SelectedStudyHeader.StudyName, edit, "SaveStudy", autoSize: false, owner: Application.Current.MainWindow); return(true); }
private void LinkVerse_Cliked(object sender, RoutedEventArgs e) { if (this.selectedKey.IsNullEmptyOrWhiteSpace()) { MessageDisplay.Show("Please select a Verse."); return; } try { Type linkType = Type.GetType("Bibles.Link.LinkEditor,Bibles.Link"); BibleVerseModel verseModel = this.uxSearchPager .ItemsSource .Items .FirstOrDefault(vk => ((BibleVerseModel)vk).BibleVerseKey == this.selectedKey) .To <BibleVerseModel>(); object[] args = new object[] { Formatters.GetBibleFromKey(this.selectedKey), verseModel }; UserControlBase linkEditor = Activator.CreateInstance(linkType, args) as UserControlBase; string title = $"Link - {GlobalStaticData.Intance.GetKeyDescription(this.selectedKey)}"; linkEditor.Height = this.Height; if (ControlDialog.ShowDialog(title, linkEditor, "AcceptLink", false).IsFalse()) { return; } int selectedVerse = Formatters.GetVerseFromKey(this.selectedKey); } catch (Exception err) { ErrorLog.ShowError(err); } }
private void OnEdit_Click(object sender, System.Windows.RoutedEventArgs e) { if (this.SelectedHeaderAndFooter == null) { MessageBox.Show("Please select a Report Object"); return; } try { ReportDesigner designer = new ReportDesigner(this.SelectedHeaderAndFooter); ControlDialog.Show($"Edit {this.selectedReportType.GetDescriptionAttribute()}", designer, "Save", windowState: WindowState.Maximized); } catch (Exception err) { MessageBox.Show(err.InnerExceptionMessage()); } }
private void ChangeCategory_Click(object sender, RoutedEventArgs e) { try { if (this.SelectedHeaderAndFooter == null) { MessageBox.Show("Please select a Report."); return; } CategorySelector selector = new CategorySelector(); if (ControlDialog.ShowDialog("Report Categories", selector, string.Empty).IsFalse()) { return; } if (this.SelectedHeaderAndFooter.CategoryId == selector.SelectedCategoryId) { return; } this.SelectedHeaderAndFooter.CategoryId = selector.SelectedCategoryId; ReportTablesRepository repo = new ReportTablesRepository(); repo.UpdateReportMaster(this.SelectedHeaderAndFooter); this.HeadersAndFooters = this.HeadersAndFooters.Remove(this.SelectedHeaderAndFooter); } catch (Exception err) { MessageBox.Show(err.Message); } }
private void About_Cliked(object sender, RoutedEventArgs e) { About about = new About(); ControlDialog.ShowDialog("About", about, string.Empty, showCancelButton: false); }