private void button5_Click(object sender, EventArgs e) { var citationRepo = new CitationService(); citationRepo.AddRawCitations( new BelManagedLib.EventData { Text = "First text.", StartPage = 1, StopPage = 1, StartGlyph = 100, StopGlyph = 110, //SelectionRectsString = "1,2,3,4;", Len = 1, Code = (int)CodesEnum.DEKBELCODE_ADDCITATION, FilePath = @"C:\\28", } ); citationRepo.AddRawCitations( new BelManagedLib.EventData { Text = "Second text.", StartPage = 2, StopPage = 2, StartGlyph = 19, StopGlyph = 25, //SelectionRectsString = "1,2,3,4;", Len = 1, Code = (int)CodesEnum.DEKBELCODE_ADDCITATION, FilePath = @"C:\\28", } ); BelGui bel = new BelGui( new BelManagedLib.EventData { Text = "Third text: Recently, analyses of two large stellar surveys revealed the presence.", StartPage = 1, StopPage = 1, StartGlyph = 5, StopGlyph = 8, //SelectionRectsString = "1,2,3,4;", Len = 1, Code = (int)CodesEnum.DEKBELCODE_ADDANDSHOWCITATION, FilePath = @"C:\\28", }); bel.ShowDialog(); label_resulttext.Text = bel.Result.Message; }
public ResultData DoStuff(EventData data) { /* #define DEKBELCODE_ADDVOLUMETITLE 9100 #define DEKBELCODE_ADDBOOKTITLE 9110 #define DEKBELCODE_ADDCHAPTER 9120 #define DEKBELCODE_ADDCITATION 9200 #define DEKBELCODE_ADDANDSHOWCITATION 9300 #define DEKBELCODE_STARTAUTOPAGINATION 9400 */ ResultData res = null; switch ((CodesEnum)data.Code) { case CodesEnum.DEKBELCODE_ADDVOLUMETITLE: break; case CodesEnum.DEKBELCODE_ADDBOOKTITLE: break; case CodesEnum.DEKBELCODE_ADDCHAPTER: break; case CodesEnum.DEKBELCODE_ADDCITATION: var citationRepo = new CitationRepo(); var result = citationRepo.AddRawCitations(data); res = new ResultData { Code = 0, Message = $"Added raw citation. Id = {result.Id}.", Cancel = false, }; break; case CodesEnum.DEKBELCODE_ADDANDSHOWCITATION: BelGui bel = new BelGui(data); bel.ShowDialog(); res = bel.Result; break; case CodesEnum.DEKBELCODE_STARTAUTOPAGINATION: break; default: break; } return(res); }
private void button1_Click(object sender, EventArgs e) { BelGui bel = new BelGui( new BelManagedLib.EventData { Text = "␇ Recently, analyses of two large stellar surveys revealed the presence of a well populated elemental abundance sequence, two distinct sequences in the colour–magnitude diagram and a prominent, slightly retrograde kinematic structure in the halo near the Sun, which may trace an important accretion event experienced by the Galaxy.", StartPage = 1, StopPage = 1, StartGlyph = 5, StopGlyph = 8, //SelectionRects = , Len = 1, Code = 1, FilePath = @"C:\\28", }); bel.ShowDialog(); label_resulttext.Text = bel.Result.Message; }
public ResultData DoStuff(EventData data) { ReferenceService refsvc; string res; switch ((CodesEnum)data.Code) { case CodesEnum.DEKBELCODE_ADDVOLUMETITLE: refsvc = new ReferenceService(); res = refsvc.EditVolumeTitle(data); Result = new ResultData { Code = 0, Message = $"New title set: {res}.", Cancel = string.IsNullOrWhiteSpace(res), }; break; case CodesEnum.DEKBELCODE_ADDBOOKTITLE: refsvc = new ReferenceService(); res = refsvc.AddReference <Book>(data); Result = new ResultData { Code = 0, Message = $"Added book: {res}.", Cancel = string.IsNullOrWhiteSpace(res), }; break; case CodesEnum.DEKBELCODE_ADDCHAPTER: refsvc = new ReferenceService(); res = refsvc.AddReference <Chapter>(data); Result = new ResultData { Code = 0, Message = $"Added chapter: {res}.", Cancel = string.IsNullOrWhiteSpace(res), }; break; case CodesEnum.DEKBELCODE_ADDSUBCHAPTER: refsvc = new ReferenceService(); res = refsvc.AddReference <SubChapter>(data); Result = new ResultData { Code = 0, Message = $"Added subchapter: {res}.", Cancel = string.IsNullOrWhiteSpace(res), }; break; case CodesEnum.DEKBELCODE_ADDPARAGRAPH: refsvc = new ReferenceService(); res = refsvc.AddReference <Paragraph>(data); Result = new ResultData { Code = 0, Message = $"Added paragraph: {res}.", Cancel = string.IsNullOrWhiteSpace(res), }; break; case CodesEnum.DEKBELCODE_ADDRAWCITATION: var mainService = new MainService(); var result = mainService.AddRawCitations(data); Result = new ResultData { Code = 0, Message = $"Added raw citation. Id = {result.Id}.", Cancel = false, }; break; case CodesEnum.DEKBELCODE_SHOWBEL: case CodesEnum.DEKBELCODE_ADDANDSHOWCITATION: BelGui belAdd = new BelGui(data); if (belAdd.IsDisposed) { Result = new ResultData { Cancel = true, Code = -1, Message = "Cancel" }; break; } belAdd.ShowDialog(); Result = belAdd.Result; break; case CodesEnum.DEKBELCODE_ADDCITATIONSILENT: var mainService2 = new MainService(); bool result2 = mainService2.AddCitationSilent(data); if (!result2) { Result = new ResultData { Cancel = true, Code = -1, Message = "Cancel" }; break; } break; case CodesEnum.DEKBELCODE_EDITCITATION: BelGui belEdit = new BelGui(data); if (belEdit.IsDisposed) { Result = new ResultData { Cancel = true, Code = -1, Message = "Cancel" }; break; } belEdit.ShowDialog(); Result = belEdit.Result; break; case CodesEnum.DEKBELCODE_STARTAUTOPAGINATION: refsvc = new ReferenceService(); var page = refsvc.AddPage(data); Result = new ResultData { Code = 0, Message = page == null ? "Page add canceled." : $"Added page reference. Id = {page.Id}.", Cancel = page == null, }; refsvc.Dispose(); break; default: break; } return(Result); }