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); }
/// <summary> /// Coming in here means add a new citation. We are called from Sumatra. /// </summary> /// <param name="message"></param> public BelGui(EventData message) : this() { if (DBService == null) { Mef.Initialize(this); } List <RawCitation> rawCitations = DBService.Select <RawCitation>(); DBService.ClearTable <RawCitation>(); // Get volume and storage History history = HistoryRepo.GetLastOpened(); // Our currently open file in Sumatra VM.CurrentVolume = DBService.SelectById <Volume>(history.VolumeId); VM.CurrentStorage = DBService.SelectById <Storage>(history.StorageId); // Create new citation VM.CurrentCitation = CitationRepo.CreateNewCitation(rawCitations, message); CitationService.CitationChanged += CitationService_CitationChanged; LoadControls(); }