public void RibbonLoad(Office.IRibbonUI ribbonUi) { ActionHandlerFactory = new ActionHandlerFactory(); EnabledHandlerFactory = new EnabledHandlerFactory(); LabelHandlerFactory = new LabelHandlerFactory(); SupertipHandlerFactory = new SupertipHandlerFactory(); ImageHandlerFactory = new ImageHandlerFactory(); ContentHandlerFactory = new ContentHandlerFactory(); PressedHandlerFactory = new PressedHandlerFactory(); CheckBoxActionHandlerFactory = new CheckBoxActionHandlerFactory(); DisableFormatTab = new Boolean(); ShouldCompressImages = new Boolean(); _ribbon = ribbonUi; }
//Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1 public void RibbonLoad(Office.IRibbonUI ribbonUi) { ActionHandlerFactory = new ActionHandlerFactory(); EnabledHandlerFactory = new EnabledHandlerFactory(); LabelHandlerFactory = new LabelHandlerFactory(); SupertipHandlerFactory = new SupertipHandlerFactory(); ImageHandlerFactory = new ImageHandlerFactory(); ContentHandlerFactory = new ContentHandlerFactory(); PressedHandlerFactory = new PressedHandlerFactory(); CheckBoxActionHandlerFactory = new CheckBoxActionHandlerFactory(); _ribbon = ribbonUi; SetVoicesFromInstalledOptions(); SetCoreVoicesToSelections(); }
public async Task <FileContentResult> GenerateExcel(BlankFile param, long userId, IImageHandler imageHandler = null) { if (!param.Validate()) { throw new ArgumentException(); } var blankType = await _blankTypeRepository.Get() .FirstOrDefaultAsync(bt => bt.Name.Equals(param.Type, StringComparison.OrdinalIgnoreCase)); if (blankType == null) { throw new InvalidOperationException(); } var questions = _questionRepository.Get().Where(q => q.BlankTypeId == blankType.Id).Select(q => q.Question); _imageHandler = imageHandler ?? ImageHandlerFactory.GetImageHanlderByType(blankType.Type); var file = await _imageHandler.GenerateExcel(param, questions) ?? throw new InvalidOperationException(); var user = await _userRepository.GetAsync(userId); file = await _blankFileRepository.AddAsync(file); user.BlankFileUsers.Add(new BlankFileUser { BlankFile = file, BlankFileId = file.Id, User = user, UserId = user.Id }); await _userRepository.EditAsync(user); return(new FileContentResult(Convert.FromBase64String(file.Data), file.FileType) { FileDownloadName = file.Name }); }
public async Task <BlankType> AddBlankType(TypeFile param, IImageHandler imageHandler = null) { if (await _blankTypeRepository.Get() .AnyAsync(entity => entity.Name.Equals(param.BlankTypeName, StringComparison.OrdinalIgnoreCase))) { throw new InvalidOperationException(); } _imageHandler = imageHandler ?? ImageHandlerFactory.GetImageHanlderByType(param.Type); var questions = await _imageHandler.GetQuestionsFromBlank(param); var questionsToAdd = questions?.Where(x => !string.IsNullOrWhiteSpace(x)).ToArray(); const int minQuestionsCount = 1; if (questionsToAdd == null || questionsToAdd.Length < minQuestionsCount) { throw new ArgumentException(); } if (questionsToAdd.Count(q => q.Contains("?")) != questionsToAdd.Length) { var questionsWithoutQuestion = questionsToAdd.Where(q => !q.Contains("?")).Select(x => x + "?").ToList(); questionsToAdd = questionsToAdd.Select(q => q.Contains("?") ? q : questionsWithoutQuestion.FirstOrDefault(qwq => qwq.Contains(q))).ToArray(); } var addedType = await _blankTypeRepository.AddAsync(new BlankType { Type = param.Type, Name = param.BlankTypeName }); foreach (var q in questionsToAdd) { await _questionRepository.AddAsync(new QuestionEntity { BlankTypeId = addedType.Id, Question = q }); } return(addedType); }
public Bitmap GetImage(Office.IRibbonControl control) { ActionFramework.Common.Interface.ImageHandler imageHandler = ImageHandlerFactory.CreateInstance(control.Id, control.Tag); return(imageHandler.Get(control.Id)); }
//Create callback methods here. For more information about adding callback methods, select the Ribbon XML item in Solution Explorer and then press F1 public void RibbonLoad(Office.IRibbonUI ribbonUi) { ActionHandlerFactory = new ActionHandlerFactory(); LabelHandlerFactory = new LabelHandlerFactory(); SupertipHandlerFactory = new SupertipHandlerFactory(); ImageHandlerFactory = new ImageHandlerFactory(); _ribbon = ribbonUi; SetVoicesFromInstalledOptions(); SetCoreVoicesToSelections(); }
public IEnumerable <string> GetTypes() { return(ImageHandlerFactory.GetTypes()); }
public Bitmap GetImage(Office.IRibbonControl control) { var imageHandler = ImageHandlerFactory.CreateInstance(control.Id, control.Tag); return(imageHandler.Get(control.Id)); }