Пример #1
0
        public VerseGridForm(Verse verse)
        {
            InitializeComponent();
            this.Text = "Interlinear Bible Editor";

            Uow = new UnitOfWork();

            Translation = verse.ParentTranslation;
            NAME        = Translation.Name;
            // $"{NAME.Replace("'", "").Replace("+", "")}.";

            LoadBooks();

            //var view = new XPView(Uow, typeof(BookBase)) {
            //    CriteriaString = $"[Status.BookType] = {(int)Translation.BookType}"
            //};
            //view.Properties.Add(new ViewProperty("NumberOfBook", SortDirection.None, "[NumberOfBook]", false, true));
            //view.Properties.Add(new ViewProperty("BookTitle", SortDirection.None, "[BookTitle]", false, true));

            //var list = new List<BookBaseInfo>();
            //foreach (ViewRecord item in view) {
            //    list.Add(new BookBaseInfo() {
            //        NumberOfBook = item["NumberOfBook"].ToInt(),
            //        BookTitle = item["BookTitle"].ToString()
            //    });
            //}
            //editBook.DataSource = list;

            var index = verse.GetVerseIndex();

            btnOblubienicaEu.Visibility   = index.NumberOfBook >= 470 ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never;
            btnLogosSeptuagint.Visibility = index.NumberOfBook < 470 ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never;


            VerseControl = new VerseGridControl()
            {
                Dock = DockStyle.Fill
            };
            pnlContent.Controls.Add(VerseControl);

            //this.Load += new EventHandler(delegate (object sender, EventArgs e) {
            //    Application.DoEvents();
            //    var bookInfo = list.Where(x => x.NumberOfBook == index.NumberOfBook).FirstOrDefault();
            //    txtBook.EditValue = bookInfo;
            //    editBook_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, bookInfo));
            //    Application.DoEvents();
            //    txtChapter.EditValue = index.NumberOfChapter;
            //    editChapter_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, index.NumberOfChapter));
            //    Application.DoEvents();
            //    txtVerse.EditValue = index.NumberOfVerse;
            //    editVerse_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, index.NumberOfVerse));
            //    Application.DoEvents();
            //});

            TransliterationController = new GreekTransliterationController();

            txtIndex.EditValue = verse.Index;
            txtIndex_KeyUp(txtIndex, new KeyEventArgs(Keys.Enter));
        }
Пример #2
0
        public InterlinearEditorForm(Verse verse)
        {
            InitializeComponent();
            this.Text = "Interlinear Bible Editor";

            Uow = new UnitOfWork();

            Translation = verse.ParentTranslation;// new XPQuery<Translation>(Uow).Where(x => x.Name == verse.ParentTranslation.Name).FirstOrDefault();
            NAME        = Translation.Name;

            var view = new XPView(Uow, typeof(BookBase));

            view.CriteriaString = $"[Status.BookType] = {(int)Translation.BookType}";
            view.Properties.Add(new ViewProperty("NumberOfBook", SortDirection.None, "[NumberOfBook]", false, true));
            view.Properties.Add(new ViewProperty("BookTitle", SortDirection.None, "[BookTitle]", false, true));

            var list = new List <BookBaseInfo>();

            foreach (ViewRecord item in view)
            {
                list.Add(new BookBaseInfo()
                {
                    NumberOfBook = item["NumberOfBook"].ToInt(),
                    BookTitle    = item["BookTitle"].ToString()
                });
            }

            var index = verse.GetVerseIndex();

            btnOblubienicaEu.Visibility   = index.NumberOfBook >= 470 ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never;
            btnLogosSeptuagint.Visibility = index.NumberOfBook < 470 ? DevExpress.XtraBars.BarItemVisibility.Always : DevExpress.XtraBars.BarItemVisibility.Never;
            editBook.DataSource           = list;

            VerseControl = new VerseEditorControl()
            {
                Dock = DockStyle.Fill
            };
            this.Controls.Add(VerseControl);

            this.Load += new EventHandler(delegate(object sender, EventArgs e) {
                Application.DoEvents();
                var bookInfo      = list.Where(x => x.NumberOfBook == index.NumberOfBook).FirstOrDefault();
                txtBook.EditValue = bookInfo;
                editBook_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, bookInfo));
                Application.DoEvents();
                txtChapter.EditValue = index.NumberOfChapter;
                editChapter_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, index.NumberOfChapter));
                Application.DoEvents();
                txtVerse.EditValue = index.NumberOfVerse;
                editVerse_EditValueChanged(this, new DevExpress.XtraEditors.Controls.ChangingEventArgs(null, index.NumberOfVerse));
                Application.DoEvents();
            });

            TransliterationController = new GreekTransliterationController();
        }