/// <summary> /// For `preview` /// </summary> /// <param name="slide">the temp slide to produce preview image</param> /// <param name="contentSlide">the slide that contains content</param> /// <param name="slideWidth"></param> /// <param name="slideHeight"></param> /// <param name="source"></param> private EffectsDesigner(PowerPoint.Slide slide, PowerPoint.Slide contentSlide, float slideWidth, float slideHeight, ImageItem source) : base(slide) { ContentSlide = contentSlide; Setup(slideWidth, slideHeight, source); }
private void Setup(float slideWidth, float slideHeight, ImageItem source) { SlideWidth = slideWidth; SlideHeight = slideHeight; Source = source; DeleteShapesWithPrefix(ShapeNamePrefix); }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape, Settings settings) { if (option.StyleName != TextCollection.PictureSlidesLabText.StyleNameDirectText && option.StyleName != TextCollection.PictureSlidesLabText.StyleNameBlur && option.StyleName != TextCollection.PictureSlidesLabText.StyleNameSpecialEffect && option.StyleName != TextCollection.PictureSlidesLabText.StyleNameOverlay) { designer.ApplyPseudoTextWhenNoTextShapes(); } if ((option.IsUseBannerStyle || option.IsUseFrostedGlassBannerStyle) && (option.GetTextBoxPosition() == Position.Left || (option.GetTextBoxPosition() == Position.Centre && option.GetBannerDirection() != BannerDirection.Horizontal) || option.GetTextBoxPosition() == Position.Right)) { designer.ApplyTextWrapping(); } else if (option.IsUseCircleStyle || option.IsUseOutlineStyle) { designer.ApplyTextWrapping(); } else { designer.RecoverTextWrapping(option.GetTextBoxPosition(), option.GetTextAlignment()); } ApplyTextEffect(option, designer); designer.ApplyTextGlowEffect(option.IsUseTextGlow, option.TextGlowColor); return new List<Shape>(); }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { designer.ApplyPseudoTextWhenNoTextShapes(); if ((option.IsUseBannerStyle || option.IsUseFrostedGlassBannerStyle) && (option.GetTextBoxPosition() == Position.Left || option.GetTextBoxPosition() == Position.Centre || option.GetTextBoxPosition() == Position.Right)) { designer.ApplyTextWrapping(); } else if (option.IsUseCircleStyle || option.IsUseOutlineStyle) { designer.ApplyTextWrapping(); } else { designer.RecoverTextWrapping(); } ApplyTextEffect(option, designer); designer.ApplyTextGlowEffect(option.IsUseTextGlow, option.TextGlowColor); return new List<Shape>(); }
public ImageItemCollection ParseAll(ref string html) { ImageItem item; ImageItemCollection list = null; MatchCollection mc = FirstStep(ref html); if (mc.Count < 1) return null; List<string> urls = SecondStep(mc); list = new ImageItemCollection(); foreach(string m in urls) { item = new ImageItem(m); list.Add(item); string resized = Resize(m); if (resized != null) { item = new ImageItem(resized); list.Add(item); } } if (list.Count < 1) return null; return list; }
private void Setup(float slideWidth, float slideHeight, ImageItem source) { SlideWidth = slideWidth; SlideHeight = slideHeight; Source = source; PrepareShapesForPreview(); }
public BmtvConfig() { Username = new StringItem { Name = "Username" }; Password = new StringItem { Name = "Password" }; CaptchaImage = new ImageItem { Name = "Captcha Image" }; CaptchaText = new StringItem { Name = "Captcha Text" }; }
public void ApplyStyle(ImageItem source, Slide contentSlide, float slideWidth, float slideHeight, StyleOptions option = null) { if (Globals.ThisAddIn != null) { Globals.ThisAddIn.Application.StartNewUndoEntry(); } if (option != null) { SetStyleOptions(option); } // try to use cropped/adjusted image to apply var fullsizeImage = source.FullSizeImageFile; source.FullSizeImageFile = source.CroppedImageFile ?? source.FullSizeImageFile; source.OriginalImageFile = fullsizeImage; var effectsHandler = new EffectsDesigner(contentSlide, slideWidth, slideHeight, source); ApplyStyle(effectsHandler, source, isActualSize: true); source.FullSizeImageFile = fullsizeImage; source.OriginalImageFile = null; }
public PreviewInfo PreviewApplyStyle(ImageItem source, Slide contentSlide, float slideWidth, float slideHeight, StyleOption option) { Logger.Log("PreviewApplyStyle begins"); SetStyleOptions(option); SlideWidth = slideWidth; SlideHeight = slideHeight; var previewInfo = new PreviewInfo(); EffectsDesignerForPreview.PreparePreviewing(contentSlide, slideWidth, slideHeight, source); // use thumbnail to apply, in order to speed up source.BackupFullSizeImageFile = source.FullSizeImageFile; var backupImageFile = source.ImageFile; source.FullSizeImageFile = null; source.ImageFile = source.CroppedThumbnailImageFile ?? source.ImageFile; GenerateStyle(EffectsDesignerForPreview, source, isActualSize: false); // recover the source back source.FullSizeImageFile = source.BackupFullSizeImageFile; source.ImageFile = backupImageFile; EffectsDesignerForPreview.GetNativeSlide().Export(previewInfo.PreviewApplyStyleImagePath, "JPG", GetPreviewWidth(), PreviewHeight); Logger.Log("PreviewApplyStyle done"); return previewInfo; }
public PreviewInfo PreviewApplyStyle(ImageItem source, Slide contentSlide, float slideWidth, float slideHeight, StyleOption option) { SetStyleOptions(option); SlideWidth = slideWidth; SlideHeight = slideHeight; var previewInfo = new PreviewInfo(); var handler = CreateEffectsHandlerForPreview(source, contentSlide); // use thumbnail to apply, in order to speed up var fullSizeImgPath = source.FullSizeImageFile; var originalThumbnail = source.ImageFile; source.FullSizeImageFile = null; source.ImageFile = source.CroppedThumbnailImageFile ?? source.ImageFile; ApplyStyle(handler, source, isActualSize: false); // recover the source back source.FullSizeImageFile = fullSizeImgPath; source.ImageFile = originalThumbnail; handler.GetNativeSlide().Export(previewInfo.PreviewApplyStyleImagePath, "JPG", GetPreviewWidth(), PreviewHeight); handler.Delete(); return previewInfo; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { if (option.IsUseTextBoxStyle) { designer.ApplyTextboxEffect(option.TextBoxColor, option.TextBoxTransparency); } return new List<Shape>(); }
public ConfigurationDataCaptchaLogin() { Username = new StringItem { Name = "Username" }; Password = new StringItem { Name = "Password" }; CaptchaImage = new ImageItem { Name = "Captcha Image" }; CaptchaText = new StringItem { Name = "Captcha Text" }; CaptchaCookie = new HiddenItem("") { Name = "Captcha Cookie" }; }
public void PreparePreviewing(PowerPoint.Slide contentSlide, float slideWidth, float slideHeight, ImageItem source) { Logger.Log("PreparePreviewing begins"); InitLayoutAndDesign(contentSlide); DeleteAllShapes(); CopyShapes(contentSlide); Setup(slideWidth, slideHeight, source); Logger.Log("PreparePreviewing done"); }
/// <param name="instructionMessageOptional">Enter any instructions the user will need to setup the tracker</param> public ConfigurationDataCaptchaLogin(string instructionMessageOptional = null) { Username = new StringItem { Name = "Username" }; Password = new StringItem { Name = "Password" }; CaptchaImage = new ImageItem { Name = "Captcha Image" }; CaptchaText = new StringItem { Name = "Captcha Text" }; CaptchaCookie = new HiddenItem("") { Name = "Captcha Cookie" }; Instructions = new DisplayItem(instructionMessageOptional) { Name = "" }; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { // store style options information into original image shape // return original image and cropped image return designer.EmbedStyleOptionsInformation( source.OriginalImageFile, source.FullSizeImageFile, source.ContextLink, source.Rect, option); }
public static void GetMetaInfo(ref string url, ImageItem item) { if (IsValidGoogleImageLink(url)) { var googleImageUri = new Uri(url); var parameters = HttpUtility.ParseQueryString(googleImageUri.Query); url = HttpUtility.UrlDecode(parameters.Get("imgurl")); item.ContextLink = HttpUtility.UrlDecode(parameters.Get("imgrefurl")); } }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { var result = new List<Shape>(); if (option.IsUseOverlayStyle) { var backgroundOverlayShape = designer.ApplyOverlayEffect(option.OverlayColor, option.Transparency); result.Add(backgroundOverlayShape); } return result; }
public ImageItemforUI(ImageItem imageitem) { imageId = imageitem.ImageId; path = imageitem.Path; // 本来ならここでDB読んでタグを収集 tags = new List<string>(); tags.Add("テストタグ1"); tags.Add("テストタグ2"); tags.Add("テストタグ3"); }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape, Settings settings) { var result = new List<Shape>(); if (option.IsUseFrameStyle) { var frameOverlayShape = designer.ApplyAlbumFrameEffect(option.FrameColor, option.FrameTransparency); result.Add(frameOverlayShape); } return result; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { var result = new List<Shape>(); if (option.IsUseBannerStyle) { var bannerOverlayShape = ApplyBannerStyle(option, designer, imageShape); result.Add(bannerOverlayShape); } return result; }
public void TestGetMetaInfo() { var imgItem = new ImageItem(); var link = _googleImgLink.Clone() as string; UrlUtil.GetMetaInfo(ref link, imgItem); Assert.AreEqual("http://tctechcrunch2011.files.wordpress.com/2011/05/tcdisrupt_tc-9.jpg", link); Assert.AreEqual("http://techcrunch.com/2011/05/21/the-hack-is-on-at-the-hackathon/", imgItem.ContextLink); }
public void TestGetMetaInfoWithDecoding() { var imgItem = new ImageItem(); var link = _googleImgLinkThatNeedDecode.Clone() as string; UrlUtil.GetMetaInfo(ref link, imgItem); Assert.AreEqual("http://www.virgin.com/sites/default/files/Articles/Entrepreneur%20Getty/Entrepreneur_breakfast_getty.jpg", link); Assert.AreEqual("http://www.virgin.com/entrepreneur/in-focus-the-rise-of-flexible-working", imgItem.ContextLink); }
public void Init() { _designer = new StylesDesigner(App); _sourceImage = new ImageItem { ImageFile = PathUtil.GetDocTestPath() + "koala.jpg", Tooltip = "some tooltip" }; _contentSlide = PpOperations.SelectSlide(1); }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape, Settings settings) { var result = new List<Shape>(); if (option.IsUseOutlineStyle) { var outlineOverlayShape = designer.ApplyRectOutlineEffect(imageShape, option.OutlineColor, 0); result.Add(outlineOverlayShape); } return result; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { var result = new List<Shape>(); if (option.IsUseCircleStyle) { var circleOverlayShape = designer.ApplyCircleRingsEffect(option.CircleColor, option.CircleTransparency); result.Add(circleOverlayShape); } return result; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { designer.ApplyImageReference(source.ContextLink); if (option.IsInsertReference) { designer.ApplyImageReferenceInsertion(source.ContextLink, option.GetFontFamily(), option.FontColor, option.CitationFontSize, option.ImageReferenceTextBoxColor, option.GetCitationTextBoxAlignment()); } return new List<Shape>(); }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { var result = new List<Shape>(); if (option.IsUseTriangleStyle) { var triangleOverlayShape = designer.ApplyTriangleEffect(option.TriangleColor, option.FontColor, option.TriangleTransparency); result.Add(triangleOverlayShape); } return result; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape) { var result = new List<Shape>(); if (option.IsUseBlurStyle) { var blurImageShape = option.IsUseSpecialEffectStyle ? designer.ApplyBlurEffect(source.SpecialEffectImageFile, option.BlurDegree) : designer.ApplyBlurEffect(degree: option.BlurDegree); result.Add(blurImageShape); } return result; }
public IList<Shape> Execute(StyleOption option, EffectsDesigner designer, ImageItem source, Shape imageShape, Settings settings) { // in previewing if (source.FullSizeImageFile == null) { return new List<Shape>(); } // store style options information into original image shape // return original image and cropped image return designer.EmbedStyleOptionsInformation( source.BackupFullSizeImageFile, source.FullSizeImageFile, source.ContextLink, source.Source, source.Rect, option); }
public void Init() { _contentSlide = PpOperations.SelectSlide(1); _processingSlide = PpOperations.SelectSlide(2); _imgItem = new ImageItem { ImageFile = Img, Tooltip = "some tooltips" }; _designer = EffectsDesigner.CreateEffectsDesignerForApply(_contentSlide, Pres.PageSetup.SlideWidth, Pres.PageSetup.SlideHeight, _imgItem); }
public override void InitWindow() { SetParameters( nameof(GraphView), nameof(GraphView), 800, 800, false); SetMinSize(1000, 1000); SetBackground(45, 45, 45); var title = UiElements.GetTitleBar(); var mainLayout = UiElements.GetMainLayout(); var buttonsList = UiElements.GetButtonsList(); _toolbar = UiElements.GetToolbar(); var leftLayoutItem = UiElements.GetLeftLayoutItem(); var tabView = UiElements.GetTabView(); var logTextArea = UiElements.GetLogTextArea(); _imageArea = new ImageItem( new Bitmap( "/home/nick/RiderProjects/DiscreteMaths/Graphs/Graphs/notGenerated.png")); _imageArea.SetMaxWidth(1024); _imageArea.SetMaxHeight(1024); _imageArea.KeepAspectRatio(true); _tabView = tabView; _buttonsList = buttonsList; _logTextArea = logTextArea; _logTextArea.SetText("Log Journal" + Environment.NewLine); _logTextArea.SetFont(new Font(FontFamily.GenericMonospace, 14, FontStyle.Bold)); AddItems(title, mainLayout); mainLayout.AssignLeftItem(leftLayoutItem); mainLayout.AssignRightItem(buttonsList); leftLayoutItem.AddItems(tabView, _toolbar); tabView.AddTabs(new Tab("Graph"), new Tab("Log")); tabView.AddItemToTabByName("Log", _logTextArea); tabView.AddItemToTabByName("Graph", _imageArea); PopulateButtonsList(); PopulateToolbar(); }
private static void DownLoadImageItem(ImageItem imageItem, WebClient client, int catid) { string folderName = "Download/" + catid + "/"; if (!Directory.Exists(folderName)) { Directory.CreateDirectory(folderName); } string fname = imageItem.title + "--" + imageItem.thumbnail.Remove(0, imageItem.thumbnail.LastIndexOf('/') + 2); //FileInfo desfile = new FileInfo(folderName + fname); //if (desfile.Directory.Exists == false) desfile.Directory.Create(); //client.DownloadFile(imageItem.thumbnail, folderName + fname); Console.WriteLine("下载...: " + imageItem.thumbnail); //client.DownloadFile(imageItem.url, folderName + fname + ".svg"); Console.WriteLine("下载...:" + imageItem.url); }
public ImageControl(Settings settings, ImageItem item) { Settings = settings; ImageItem = item; DataContext = this; InitializeComponent(); MouseEnter += (sender, args) => VisualStateManager.GoToState(this, nameof(MouseOverState), true); MouseLeave += (sender, args) => VisualStateManager.GoToState(this, nameof(NormalState), true); ScoreBorder.Visibility = item.Site.SurpportState.IsSupportScore ? Visibility.Visible : Visibility.Collapsed; ResolutionBorder.Visibility = item.Site.SurpportState.IsSupportResolution ? Visibility.Visible : Visibility.Collapsed; DetailPageLinkButton.Click += (sender, args) => ImageItem.DetailUrl.Go(); RefreshButton.Click += RefreshButtonOnClick; }
private void PaintItem(object sender, DrawItemEventArgs e) { if (e.Index == -1) { return; } e.DrawBackground(); if ((e.State & DrawItemState.Selected) != 0) { e.Graphics.FillRectangle(_HighLightBrush, e.Bounds); } Item item = (Item)this.Items[e.Index]; Rectangle bounds = e.Bounds; int x = bounds.X + 2; if (item.GetType() == typeof(ImageItem)) { ImageItem imgitem = (ImageItem)item; if (imgitem.Image != null) { Image img = imgitem.Image; int y = bounds.Y + ((int)(bounds.Height / 2)) - ((int)(img.Height / 2)) + 1; e.Graphics.DrawImage(img, x, y, img.Width, img.Height); x += img.Width + 2; } } else if (item.GetType() == typeof(MultipleImagesItem)) { MultipleImagesItem imgitem = (MultipleImagesItem)item; if (imgitem.Images != null) { for (int i = 0; i < imgitem.Images.Count; i++) { Image img = (Image)imgitem.Images[i]; int y = bounds.Y + ((int)(bounds.Height / 2)) - ((int)(img.Height / 2)) + 1; e.Graphics.DrawImage(img, x, y, img.Width, img.Height); x += img.Width + 2; } } } int fonty = bounds.Y + ((int)(bounds.Height / 2)) - ((int)(e.Font.Height / 2)); e.Graphics.DrawString(item.Text, e.Font, new SolidBrush(e.ForeColor), x, fonty); e.DrawFocusRectangle(); }
public void Add(ImageItem image) { var temp = Template.Replace("{0}", image.Image); var temp2 = temp.Replace("{1}", image.Thumb); var temp3 = temp2.Replace("{2}", image.Title); var temp4 = temp3.Replace("{3}", image.Description); var temp5 = temp4.Replace("{4}", image.Link); if (FirstAdd) { Builder.Append(temp5); FirstAdd = false; } else { Builder.Append("," + temp5); } }
protected virtual void FireSelectedSeriesChanged() { if (this.SelectedSeries != null) { this.Images.InternalList = this.SelectedSeries.Images; } else { this.Images.InternalList = null; } if (_selectedSeriesChanged != null) { _selectedSeriesChanged(this, new EventArgs()); } this.SelectedImage = this.Images.GetFirstImage(); }
public static ImageItem BuildImageItem(this Item item, ID fieldId, MediaUrlOptions options = null) { var imageField = (ImageField)item.Fields[fieldId]; var imageUrl = imageField?.MediaItem == null ? string.Empty : imageField.ImageUrl(options); var imageAlt = imageField?.Alt ?? string.Empty; var imageItem = new ImageItem() { Item = item, Src = imageUrl, Alt = imageAlt, Width = imageField?.Width, Heigth = imageField?.Height }; return(imageItem); }
public IPlayer GetPlayer(MediaItem mediaItem) { AudioItem audioItem = mediaItem as AudioItem; if (audioItem != null) { return(getAudioPlayer(audioItem)); } ImageItem imageItem = mediaItem as ImageItem; if (imageItem != null) { return(getImagePlayer(imageItem)); } return(null); }
private void CurrentImageItem_OnClick(ImageItem currentItem) { if (currentViewMode == ViewMode.Preview && !animated) { t = 0; currentViewMode = ViewMode.View; selectedItem = currentItem; canvasGroup.interactable = false; selectedItem.transform.SetParent(viewRect, true); startAnchorPosition = selectedItem.Rect.anchoredPosition; startRectSize = selectedItem.Rect.sizeDelta; viewRectAnchor = startAnchorPosition; selectedItem.EnterViewMode(); } }
/// <summary> /// Update styles variation images after its flyout been open /// </summary> public void UpdateStylesVariationImagesAfterOpenFlyout(ImageItem source, Slide contentSlide, float slideWidth, float slideHeight) { var selectedId = StylesVariationListSelectedId.Number; var scrollOffset = View.GetVariationListBoxScrollOffset(); var targetStyleItem = StylesPreviewListSelectedItem.ImageItem; StylesVariationList.Clear(); if (!IsAbleToUpdateStylesVariationImages(source, targetStyleItem, contentSlide)) { return; } UpdateStylesVariationImages(source, contentSlide, slideWidth, slideHeight); StylesVariationListSelectedId.Number = selectedId; View.SetVariationListBoxScrollOffset(scrollOffset); }
/// <summary> /// Update styles variation iamges before its flyout is open /// </summary> /// <param name="source"></param> /// <param name="contentSlide"></param> /// <param name="slideWidth"></param> /// <param name="slideHeight"></param> /// <param name="givenOptions"></param> /// <param name="givenVariants"></param> public void UpdateStyleVariationImagesWhenOpenFlyout(ImageItem source, Slide contentSlide, float slideWidth, float slideHeight, List <StyleOptions> givenOptions = null, Dictionary <string, List <StyleVariants> > givenVariants = null) { var targetStyleItem = StylesPreviewListSelectedItem.ImageItem; StylesVariationList.Clear(); if (!IsAbleToUpdateStylesVariationImages(source, targetStyleItem, contentSlide)) { return; } InitStylesVariationCategories(givenOptions, givenVariants, targetStyleItem.Tooltip); UpdateStylesVariationImages(source, contentSlide, slideWidth, slideHeight); StylesVariationListSelectedId.Number = 0; View.SetVariationListBoxScrollOffset(0d); }
public void ImageItemTest_withID() { // Arrange ImageItem item = new ImageItem("_xx1", "Image"); // Act // Assert Assert.IsNotNull(item); Assert.IsNotNull(item.Reader); Assert.AreEqual("", item.BaseTableName); Assert.AreEqual("Image", item.TargetTableName); Assert.AreEqual("_xx1", item.ID); Assert.IsNull(item.Image); Assert.IsNull(item.Details); Assert.IsNull(item.Status); Assert.IsNull(item.LastUpdated); }
public ActionResult Add(MessageItem model, HttpPostedFileBase uploadImageFile) { var imageItem = new ImageItem(); var galleryItem = new GalleryItem(); var messageItem = new MessageItem(); if (ModelState.IsValid) { using (var dataBase = new ApplicationDbContext()) { messageItem.Date = DateTime.Now; messageItem.Title = model.Title; messageItem.MessageText = model.MessageText; if (uploadImageFile != null) { imageItem.Image = new byte[uploadImageFile.ContentLength]; uploadImageFile.InputStream.Read(imageItem.Image, 0, uploadImageFile.ContentLength); dataBase.Images.Add(imageItem); dataBase.SaveChanges(); galleryItem.ImageId = imageItem.Id; galleryItem.IsVideo = false; galleryItem.IsVisible = true; galleryItem.Title = model.Title; galleryItem.Description = string.Empty; dataBase.Gallery.Add(galleryItem); dataBase.SaveChanges(); messageItem.ImageId = galleryItem.Id; } else { messageItem.ImageId = null; } dataBase.Messages.Add(messageItem); dataBase.SaveChanges(); } ModelState.Clear(); } //Successfully created return(View("Created", messageItem)); }
public ActionResult Edit(MessageItem model, HttpPostedFileBase uploadImageFile) { var imageItem = new ImageItem(); var galleryItem = new GalleryItem(); using (var dataBase = new ApplicationDbContext()) { var itemForEdit = dataBase.Messages.SingleOrDefault(message => message.Id == model.Id); if (itemForEdit != null) { if (uploadImageFile != null) { imageItem.Image = new byte[uploadImageFile.ContentLength]; uploadImageFile.InputStream.Read(imageItem.Image, 0, uploadImageFile.ContentLength); dataBase.Images.Add(imageItem); dataBase.SaveChanges(); galleryItem.ImageId = imageItem.Id; galleryItem.IsVideo = false; galleryItem.IsVisible = true; galleryItem.Title = model.Title; galleryItem.Description = string.Empty; dataBase.Gallery.Add(galleryItem); dataBase.SaveChanges(); itemForEdit.ImageId = galleryItem.Id; model.ImageId = galleryItem.Id; } else { model.ImageId = itemForEdit.ImageId; } model.Date = itemForEdit.Date; itemForEdit.Title = model.Title; itemForEdit.MessageText = model.MessageText; itemForEdit.IsDeleted = false; dataBase.SaveChanges(); } } //Successfully deleted return(View("Modified", model)); }
private void PicturePanel_ControlRemoved(object sender, ControlEventArgs e) { ImageItem ii = e.Control.Tag as ImageItem; if (ii != null && imageCollection.Count > 0) { if (ii.IsBindEvent()) { ii.ValueChanged -= Ii_ValueChanged; } imageCollection.Remove(ii); if (e.Control.Equals(activeBox)) { activeBox = null; } //TODO: 重新计算最新值的坐标 _nextPoint } }
public void RetrieveBasicInformationTest_withValidID_AdditionalInfo(string value) { // Arrange ImageItem item = new ImageItem("_xx1", "Image"); item.BaseTableName = value; // Act int count = item.RetrieveBasicInformation(false); // Assert Assert.AreEqual(1, count); Assert.AreEqual("_xx1", item.ID); Assert.AreEqual("_xxx", item.Image.ID); Assert.AreEqual($"{value} Image Details X1", item.Details); Assert.AreEqual("_xxx", item.Status.ID); Assert.AreEqual($"{value} Image LastUpdated X1", item.LastUpdated); }
public void RetrieveTest_withInvalidID_AdditionalInfo(string value) { // Arrange ImageItem item = new ImageItem("_aa1", "Image"); item.BaseTableName = value; // Act int count = item.Retrieve(false); // Assert Assert.AreEqual(0, count); Assert.AreEqual("_aa1", item.ID); Assert.IsNull(item.Image); Assert.IsNull(item.Details); Assert.IsNull(item.Status); Assert.IsNull(item.LastUpdated); }
private void NG_button_Click(object sender, RoutedEventArgs e) { System.Collections.IList list = IMG_LSTVIEW_UI.SelectedItems as System.Collections.IList; if (list.Count != 1) { return; } ImageItem item = (ImageItem)list[0]; string imageFile = item.p_Image_uri; string sets = ""; foreach (StackPanel stack in SetItems_stackPanel.Children) { var txt = stack.Children[0] as TextBlock; sets += "_" + txt.Text; } sets += "_NG"; string dir = Path.GetDirectoryName(imageFile) + "\\NG\\"; Directory.CreateDirectory(dir); string newFileName = dir + Path.GetFileNameWithoutExtension(imageFile) + sets + Path.GetExtension(imageFile); File.Copy(imageFile, newFileName, true); int nextIndex = IMG_LSTVIEW_UI.SelectedIndex + 1; if (IMG_LSTVIEW_UI.ILV_GetImgItems().Count == nextIndex) { MessageBox.Show("마지막 이미지입니다!"); return; } IMG_LSTVIEW_UI.SelectedIndex = nextIndex; if (KeepSets_checkBox.IsChecked == false) { DeleteAllItem(); } }
/// <summary> /// Creates a service image item for testing. /// </summary> /// <returns>A service image item with values.</returns> private static ImageItem CreateServiceImageItem() { var item = new ImageItem(); item.Id = CreateUri(); item.Title = "Title"; item.Height = 20; item.Width = 30; item.Description = "Description"; item.Resources = new ResourceCollection(); item.Resources.Add(CreateServiceResource()); item.Creator = "Creator"; item.Created = new DateTime(2009, 1, 1); item.Metadata = new List <MetadataField> { new MetadataField("TestName", "TestValue") }; return(item); }
public ImageItem[] GetDayContents(TrainingDayDTO day) { List <ImageItem> items = new List <ImageItem>(); foreach (var a6wEntry in day.Objects.OfType <A6WEntryDTO>()) { StringBuilder builder = new StringBuilder(); builder.AppendLine("A6W"); builder.AppendLine(string.Format(A6WEntryStrings.CalendarDayText, a6wEntry.Day.DayNumber)); ImageItem item = new ImageItem(); item.BackBrush = EntryObjectColors.A6W; item.Content = builder.ToString(); item.Entry = a6wEntry; item.ToolTip = Name; item.Image = Image; items.Add(item); } return(items.ToArray()); }
/// <summary> /// Convert FB2 image item /// </summary> /// <param name="imageItem">item to convert</param> /// <param name="imageConverterParams"></param> /// <returns>XHTML representation</returns> public IHTMLItem Convert(ImageItem imageItem, ImageConverterParamsV3 imageConverterParams) { if (imageItem == null) { throw new ArgumentNullException("imageItem"); } var image = new Image(HTMLElementType.HTML5); image.Alt.Value = imageItem.AltText ?? string.Empty; image.Source.Value = imageConverterParams.Settings.ReferencesManager.AddImageRefferenced(imageItem, image); image.GlobalAttributes.ID.Value = imageConverterParams.Settings.ReferencesManager.AddIdUsed(imageItem.ID, image); if (imageItem.Title != null) { image.GlobalAttributes.Title.Value = imageItem.Title; } imageConverterParams.Settings.Images.ImageIdUsed(imageItem.HRef); return(image); }
public ImageItem.ThumbnailInfo GetThumbnailForImage(ImageItem item) { string imageid = item.ImageID; string thumb_file; string lc_filename = item.Filename.ToLower(); if (lc_filename.EndsWith("jpg") || lc_filename.EndsWith("png") || lc_filename.EndsWith("jpeg")) { thumb_file = item.Dirname + Util.DirSep + ".thumbnails" + Util.DirSep + item.Filename; } else { thumb_file = item.Dirname + Util.DirSep + ".thumbnails" + Util.DirSep + item.Filename + ".jpg"; } FileInfo thumbfi = new FileInfo(thumb_file); if (!thumbfi.Exists) { DirectoryInfo thumb_dinfo = new DirectoryInfo(item.Dirname + Util.DirSep + ".thumbnails"); Console.WriteLine(item.Dirname + Util.DirSep + ".thumbnails"); thumb_dinfo.Create(); // we need to create a thumbnail Thumbnailer.ThumbnailerInfo tinfo = new Thumbnailer.ThumbnailerInfo(); tinfo.id = imageid; tinfo.source = item.Dirname + Util.DirSep + item.Filename; tinfo.target = thumb_file; #if NO_MULTITHREAD thumbnailer.MakeThumbnail(tinfo); // fall through #else thumbnailer.Thumbnail(tinfo); return(null); #endif } ImageItem.ThumbnailInfo ti = new ImageItem.ThumbnailInfo(); ti.filename = thumb_file; return(ti); }
public async Task <IActionResult> UploadFile([FromForm] ImageItem item) { if (!MultipartRequestHelper.IsMultipartContentType(Request.ContentType)) { return(BadRequest($"Expected a multipart request,but got {Request.ContentType}")); } try { using (var stream = item.Image.OpenReadStream()) { var cloudBlock = await UploadToBlob(item.Image.FileName, null, stream); //// Retrieve the filename of the file you have uploaded //var filename = provider.FileData.FirstOrDefault()?.LocalFileName; if (string.IsNullOrEmpty(cloudBlock.StorageUri.ToString())) { return(BadRequest("An error has occured while uploading your file. Please try again.")); } ListingItem listingItem = new ListingItem(); listingItem.Title = item.Title; listingItem.Seller = item.Seller; listingItem.Price = item.Price; listingItem.Description = item.Description; listingItem.email = item.email; listingItem.userId = item.userId; System.Drawing.Image image = System.Drawing.Image.FromStream(stream); listingItem.Url = cloudBlock.SnapshotQualifiedUri.AbsoluteUri; listingItem.Uploaded = DateTime.Now.ToString(); _context.ListingItem.Add(listingItem); await _context.SaveChangesAsync(); return(Ok($"File: {item.Title} has successfully uploaded")); } } catch (Exception ex) { return(BadRequest($"An error has occured. Details: {ex.Message}")); } }
private void AddSlideThumbnail(PowerPointSlide slide, int pos = -1, bool isCurrentSlide = false) { if (slide == null) { return; } var thumbnailPath = TempPath.GetPath("slide-" + DateTime.Now.GetHashCode() + slide.Index); slide.GetNativeSlide().Export(thumbnailPath, "JPG", GetPreviewWidth(), PreviewHeight); ImageItem imageItem; if (isCurrentSlide) { imageItem = new ImageItem { ImageFile = thumbnailPath, Tooltip = "(Current) Slide " + slide.Index }; } else { imageItem = new ImageItem { ImageFile = thumbnailPath, Tooltip = "Slide " + slide.Index }; } Dispatcher.Invoke(new Action(() => { if (pos == -1) { SlideList.Add(imageItem); } else { SlideList.Insert(pos, imageItem); } })); }
public List <ImageItem> GetImagesWatingToUploadToFtp() { _imageList = new List <ImageItem>(); string[] ext = new string[] { ".jpg" }; var listOfFiles = System.IO.Directory.GetFiles(ImageFolder).Where(f => !f.Contains("_ftp") && ext.Any(a => f.Contains(a))).ToArray(); foreach (var filename in listOfFiles) { string fname = Path.GetFileNameWithoutExtension(filename); string[] fnameArray = fname.Split('_'); fname = fnameArray[8]; //string fname = fnamewithftp.Remove(fnamewithftp.IndexOf("_ftp"), 4); ImageItem img = new ImageItem(0, fname, fname, DateTime.Now); _imageList.Add(img); } return(_imageList); }
void ReleaseDesignerOutlets() { if (ImageItem != null) { ImageItem.Dispose(); ImageItem = null; } if (MainLabel != null) { MainLabel.Dispose(); MainLabel = null; } if (SubtitleLabel != null) { SubtitleLabel.Dispose(); SubtitleLabel = null; } }
public void UpdatePictureInPictureVariationWhenAddedNewOne(ImageItem newPicture) { Logger.Log("Check for update picture in picture aspect when added new one"); Logger.Log("is in picture aspect: " + IsInPictureVariation()); Logger.Log("new pic is null: " + (newPicture == null)); if (!IsInPictureVariation() || newPicture == null) { return; } for (var i = 0; i < _8PicturesInPictureVariation.Count; i++) { var imageItem = _8PicturesInPictureVariation[i]; if (imageItem.ImageFile == StoragePath.NoPicturePlaceholderImgPath) { _8PicturesInPictureVariation[i] = newPicture; break; } } }
public override ImageItem Load(string id) { ImageItem image = new ImageItem(); try { string ftpfullpath = CreateURI(id); using (WebClient request = new WebClient()) { request.Credentials = _Credentials; image.ImageData = request.DownloadData(ftpfullpath); } } catch (WebException) { // } return(image); }
private void DrawComplite(ImageItem arg1, uint[] res) { var writeableBitmap = (WriteableBitmap)arg1.Image.Source; writeableBitmap.Lock(); unsafe { var lenght = Math.Min(writeableBitmap.Height * writeableBitmap.Width, res.Length); long pBackBuffer = (long)writeableBitmap.BackBuffer; for (int i = 0; i < lenght - 1; i++) { pBackBuffer += sizeof(uint); *((uint *)pBackBuffer) = res[i]; } } writeableBitmap.AddDirtyRect(new Int32Rect(0, 0, (int)writeableBitmap.Width, (int)writeableBitmap.Height)); writeableBitmap.Unlock(); }