private void RenderHeader(IGalleryItem item) { Title.Text = item.Title; string color = Utils.GetAccentColorHex(Activity); SubTitle.SetText(Utils.FromHtml($"by <b><font color='{color}'>{item.UploaderName}</font></b> • {item.Ups} points"), TextView.BufferType.Spannable); }
private void RenderAlbum(IGalleryItem item) { Item = item; Title.Text = item.Title; AlbumRecyclerView.SetLayoutManager(new LinearLayoutManager(Context)); bindings.Add(this.SetBinding(() => Item.AlbumImages).WhenSourceChanges(UpdateAlbumAdapter)); }
public override void Initialize(IComponent component) { base.Initialize(component); // this.m_pCollectionItem = base.Component as ICollectionItem; this.m_pRibbonApplicationObjectDesignHelper = base.Component as IRibbonApplicationObjectDesignHelper; this.m_pObjectDesignHelper = base.Component as IObjectDesignHelper; this.m_pCollectionObjectDesignHelper = base.Component as ICollectionObjectDesignHelper; this.m_pPopupObjectDesignHelper = base.Component as IPopupObjectDesignHelper; // this.m_pRibbonControl = base.Component as IRibbonControl; this.m_pRibbonPageItem = base.Component as IRibbonPageItem; this.m_pButtonGroupItem = base.Component as IButtonGroupItem; this.m_pGalleryItem = base.Component as IGalleryItem; this.m_RibbonGalleryRowItem = base.Component as RibbonGalleryRowItem; // if (this.m_pRibbonControl != null) { IDesignerHost host = GetService(typeof(IDesignerHost)) as IDesignerHost; if (host != null) { if (host.RootComponent is System.Windows.Forms.Form) { System.Windows.Forms.Form form = (System.Windows.Forms.Form)host.RootComponent; form.MainMenuStrip = this.m_pRibbonControl.MenuStrip; this.m_pRibbonControl.ParentForm = form; if (form is WFNew.RibbonForm) { ((WFNew.RibbonForm)form).RibbonControl = this.m_pRibbonControl; } } } } }
private void UpdateItem(int index) { ListViewItem lvi = _listView.Items[index]; IGalleryItem item = (IGalleryItem)_gallery[index]; lvi.SubItems.Clear(); AddSubItems(lvi, item); lvi.Text = item.Name; int keyIndex = _listView.LargeImageList.Images.IndexOfKey(lvi.ImageKey); var existing = _listView.LargeImageList.Images[keyIndex]; var @new = (Image)item.Image; if (existing != @new) { if (@new != null) { _listView.LargeImageList.Images[keyIndex] = @new; } else { _listView.LargeImageList.Images.RemoveAt(keyIndex); } _listView.RedrawItems(index, index, true); } }
public override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); var position = Arguments.GetInt(POSITION_ARG); item = (Activity as BrowserActivity)?.Vm.Images.ElementAt(position); isAlbum = item.ItemType == GalleryItemType.Album; }
private void OnItemActivate(object sender, EventArgs e) { if (_listView.FocusedItem != null) { IGalleryItem item = _listView.FocusedItem.Tag as IGalleryItem; _component.Activate(item); } }
public ScrollDropDownButtonItem(IGalleryItem pGalleryItem) : base(GalleryScrollButtonStyle.eScrollDropDownButton) { base.Name = "GISShare.Controls.WinForm.WFNew.ScrollDropDownButtonItem"; base.Text = "画廊列表按钮"; // this.owner = pGalleryItem; ((ISetOwnerHelper)this).SetOwner(owner as IOwner); }
public MainPage() { this.InitializeComponent(); _imagelist = new ObservableCollection <ClientImage>(); _imageGallery = new List <IGalleryItem>(); DataContext = this; saveSlot = null; Loaded += MainPage_Loaded; }
private void RenderImage(IGalleryItem item) { MainImage.RenderContent(item); var hasDescription = !string.IsNullOrEmpty(item.Description); var descView = Description; if (hasDescription) descView.Text = item.Description; else descView.Visibility = ViewStates.Gone; }
private void SetDimensions(View view, IGalleryItem itemToRender) { var layParams = view.LayoutParameters; var width = DpToPx(Math.Min(PxToDp(LayoutRoot.Width, Resources), itemToRender.Width), Resources); var height = (int)Math.Ceiling((itemToRender.Height / (double)itemToRender.Width) * width); layParams.Width = width; layParams.Height = height; view.LayoutParameters = layParams; }
public void ShareItem(IGalleryItem item) { Intent sendIntent = new Intent(); sendIntent.SetAction(Intent.ActionSend); sendIntent.PutExtra(Intent.ExtraTitle, item.Title ?? "Sharing from Monocle Giraffe"); sendIntent.PutExtra(Intent.ExtraText, item.Link); sendIntent.SetType("text/plain"); context.StartActivity(sendIntent); }
private static IGalleryItem CastToGalleryItem(object item) { IGalleryItem galleryItem = item as IGalleryItem; if (galleryItem == null) { throw new InvalidCastException("DataSource must be an IBindingList of IGalleryItem objects."); } return(galleryItem); }
public static IItem ToItem(this IGalleryItem galleryItem) { if (galleryItem.IsAlbum && galleryItem is GalleryAlbum album) { return(album.ToAlbum()); } else if (!galleryItem.IsAlbum && galleryItem is GalleryImage image) { return(image.ToImage()); } return(null); }
private void RenderImage(IGalleryItem item) { MainImageView.SetImageResource(global::Android.Resource.Color.Transparent); LayoutRoot.Post(() => SetDimensions(MainImageView, item)); MainImageView.Visibility = ViewStates.Visible; VideoWrapper.Visibility = ViewStates.Gone; MainVideoView.Visibility = ViewStates.Gone; var width = DpToPx(Math.Min(PxToDp(LayoutRoot.Width, Resources), item.Width), Resources); ImageService.Instance .LoadUrl(item.Link) .DownSample(width) .Into(MainImageView); }
/// <summary> /// Activates the specified <see cref="IGalleryItem"/>. /// </summary> /// <param name="item">The item to activate.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="item"/> is null.</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="item"/> is not in the <see cref="DataSource"/>.</exception> /// <exception cref="InvalidOperationException">Thrown if <see cref="DataSource"/> is null.</exception> public void Activate(IGalleryItem item) { Platform.CheckForNullReference(item, "item"); if (_dataSource == null) { throw new InvalidOperationException(_msgNullDataSource); } if (!_dataSource.Contains(item)) { throw new ArgumentException(_msgItemNotInDataSource, "item"); } NotifyItemActivated(item); }
public void RenderContent(IGalleryItem item) { switch (item.ItemType) { case GalleryItemType.Animation: RenderVideo(item); break; case GalleryItemType.Image: RenderImage(item); break; default: throw new NotSupportedException($"Itemtype {item.ItemType.ToString()} is not supported."); } }
protected void ImageTapped(IGalleryItem clickedItem, object collection) { if (collection == Albums) { GoToBrowser((IEnumerable <IGalleryItem>)Albums, Albums.IndexOf((AlbumItem)clickedItem), PageKeyHolder.SelfBrowserPageKey); } else if (collection == Images) { GoToBrowser(Images, Images.IndexOf((GalleryItem)clickedItem), PageKeyHolder.SelfBrowserPageKey); } else if (collection == Favourites) { GoToBrowser(Favourites, Favourites.IndexOf((GalleryItem)clickedItem), PageKeyHolder.SubredditBrowserPageKey); } }
private void AddItem(object item) { IGalleryItem galleryItem = CastToGalleryItem(item); string imageKey = Guid.NewGuid().ToString(); _listView.LargeImageList.Images.Add(imageKey, (Image)galleryItem.Image); ListViewItem lvi = new ListViewItem(galleryItem.Name, imageKey); AddSubItems(lvi, galleryItem); lvi.ToolTipText = galleryItem.Description; lvi.Tag = galleryItem; _listView.Items.Add(lvi); }
private void RenderVideo(IGalleryItem item) { //detector = new GestureDetector(new GestureListener(MainVideoView)); LayoutRoot.Post(() => SetDimensions(MainVideoView, item)); MainVideoView.Visibility = ViewStates.Visible; MainVideoView.SetVideoURI(global::Android.Net.Uri.Parse(item.Mp4)); MediaController controller = new MediaController(Context); controller.SetAnchorView(MainVideoView); controller.SetMediaPlayer(MainVideoView); MainVideoView.SetMediaController(controller); //MainVideoView.Start(); //MainVideoView.SeekTo(100); // MainVideoView.Touch += MainVideoView_Touch; MainVideoView.Prepared += MainVideoView_Prepared; }
/// <summary> /// Selects the specified <see cref="IGalleryItem"/>. /// </summary> /// <remarks> /// Unselection of all items can be accomplished by passing an empty enumeration to <see cref="Select(IEnumerable{IGalleryItem})"/>. /// </remarks> /// <param name="item">The item to select.</param> /// <exception cref="ArgumentNullException">Thrown if <paramref name="item"/> is null.</exception> /// <exception cref="ArgumentException">Thrown if <paramref name="item"/> is not in the <see cref="DataSource"/>.</exception> /// <exception cref="InvalidOperationException">Thrown if <see cref="DataSource"/> is null.</exception> public void Select(IGalleryItem item) { Platform.CheckForNullReference(item, "item"); if (_dataSource == null) { throw new InvalidOperationException(_msgNullDataSource); } if (!_dataSource.Contains(item)) { return; // throw new ArgumentException(_msgItemNotInDataSource, "item"); } _selection = new Selection(item); _dataSelection = new Selection(item.Item); NotifySelectionChanged(); }
private void RenderImage(IGalleryItem item) { var hasDescription = !string.IsNullOrEmpty(item.Description); //var descView = Description; if (hasDescription) { Description.Text = item.Description; } else { Description.Visibility = ViewStates.Gone; } MainImage.RenderContent(item, InFragmentManager); }
public ScrollUpButtonItem(IGalleryItem pGalleryItem) : base(GalleryScrollButtonStyle.eScrollUpButton) { READONLY_TimerInterval = (int)(1.5 * System.Windows.Forms.SystemInformation.DoubleClickTime); // base.Name = "GISShare.Controls.WinForm.WFNew.ScrollUpButtonItem"; base.Text = "向上翻动"; // this.owner = pGalleryItem; ((ISetOwnerHelper)this).SetOwner(owner as IOwner); // this.m_Timer = new System.Windows.Forms.Timer(); this.m_Timer.Interval = READONLY_TimerInterval; this.m_Timer.Tick += new EventHandler(Timer_Tick); }
private void RenderVideo(IGalleryItem itemToRender) { MainImageView.Visibility = ViewStates.Gone; LayoutRoot.Post(() => { SetDimensions(MainVideoView, itemToRender); }); VideoWrapper.Alpha = 0; VideoWrapper.Visibility = ViewStates.Visible; MainVideoView.SetVideoURI(global::Android.Net.Uri.Parse(itemToRender.Mp4)); MainVideoView.Prepared += (sender, e) => { var mp = sender as MediaPlayer; (sender as MediaPlayer).Looping = true; VideoWrapper.Alpha = 1; MainVideoView.Start(); }; }
private void UpdateItem(int index) { ListViewItem lvi = _listView.Items[index]; IGalleryItem item = (IGalleryItem)_gallery[index]; int keyIndex = _listView.LargeImageList.Images.IndexOfKey(lvi.ImageKey); var existing = _listView.LargeImageList.Images[keyIndex]; var @new = (Image)item.Image; if (existing != @new) { _listView.LargeImageList.Images[keyIndex] = @new; // update name, description _listView.RedrawItems(index, index, true); } }
private void AddSubItems(ListViewItem lvi, IGalleryItem galleryItem) { string[] galleryDescriptionLines = galleryItem.Description.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < galleryDescriptionLines.Length; i++) { if (galleryDescriptionLines.Length > this.MaxDescriptionLines && i == this.MaxDescriptionLines - 1) { // There are more descriptions then number of lines allowed // and this is pass the last line, add ellipsis instead lvi.SubItems.Add("...", Color.Gray, Color.Transparent, _listView.Font); } else { // Add regular description line lvi.SubItems.Add(galleryDescriptionLines[i], Color.Gray, Color.Transparent, _listView.Font); } } }
private void UpdateItem(int index) { ListViewItem lvi = _listView.Items[index]; IGalleryItem item = (IGalleryItem)_gallery[index]; int keyIndex = _listView.LargeImageList.Images.IndexOfKey(lvi.ImageKey); // ensure tag is the correct item (may change if item at index was set via indexer) lvi.Tag = item; var existing = _listView.LargeImageList.Images[keyIndex]; var @new = (Image)item.Image; if (existing != @new) { _listView.LargeImageList.Images[keyIndex] = @new; // update name, description _listView.RedrawItems(index, index, true); } }
public void RenderContent(IGalleryItem itemToRender, FragmentManager fragmentManager) { this.fragmentManager = fragmentManager; item = itemToRender; if (item.Id == BrowserItemFragment.DUMMY) { RenderDummy(); return; } switch (itemToRender.ItemType) { case GalleryItemType.Animation: RenderVideo(itemToRender); break; case GalleryItemType.Image: RenderImage(itemToRender); break; default: throw new NotSupportedException($"Itemtype {itemToRender.ItemType.ToString()} is not supported."); } }
public RibbonGalleryPopup(IGalleryItem ribbonGalleryItem) { this.m_RibbonGalleryMirrorPopupPanel = new RibbonGalleryMirrorPopupPanelItem(ribbonGalleryItem); this.m_RibbonGalleryMirrorPopupPanel.LeftTopRadius = 5; this.m_RibbonGalleryMirrorPopupPanel.LeftBottomRadius = 6; this.m_RibbonGalleryMirrorPopupPanel.RightTopRadius = 6; this.m_RibbonGalleryMirrorPopupPanel.RightBottomRadius = 7; // this.m_ToolStripControlHost = new ToolStripControlHost(new BaseItemHost(this.m_RibbonGalleryMirrorPopupPanel)); this.m_RibbonGalleryMirrorPopupPanel.Entity = this.m_ToolStripControlHost.Control; this.m_ToolStripControlHost.Dock = DockStyle.Fill; //this.m_ToolStripControlHost.BackColor = base.BackColor; this.m_ToolStripControlHost.Margin = new Padding(0); this.m_ToolStripControlHost.Padding = new Padding(0); base.Items.Add(this.m_ToolStripControlHost); // this.Margin = new Padding(0); this.Padding = new Padding(0); this.DropShadowEnabled = false; this.ShowItemToolTips = false; // ((ISetOwnerHelper)(this.m_ToolStripControlHost.Control)).SetOwner(this); }
public async Task FetchSubredditImage(EduardoContext context, string subredditName) { IGalleryItem img = await ImgurHelper.SearchImgurSubreddit(_credentials.ImgurClientId, _credentials.ImgurClientSecret, subredditName); if (img != null) { switch (img) { case GalleryAlbum album: await context.Channel.SendMessageAsync(album.Link); break; case GalleryImage image: await context.Channel.SendMessageAsync(image.Link); break; } } else { await context.Channel.SendMessageAsync($"**Could not find subreddit with name {subredditName}.**"); } }
public async Task SearchImgur(EduardoContext context, string searchQuery = null) { IGalleryItem img = await ImgurHelper.SearchImgur(_credentials.ImgurClientId, _credentials.ImgurClientSecret, searchQuery); if (img != null) { switch (img) { case GalleryAlbum album: await context.Channel.SendMessageAsync(album.Link); break; case GalleryImage image: await context.Channel.SendMessageAsync(image.Link); break; } } else { await context.Channel.SendMessageAsync($"**Could not find any images that match {searchQuery}**"); } }
/// <summary> /// /// </summary> /// <param name="droppedData"></param> /// <param name="targetItem"></param> /// <param name="action"></param> /// <param name="modifiers"></param> /// <returns></returns> public override sealed DragDropOption PerformDrop(IDragDropObject droppedData, IGalleryItem targetItem, DragDropOption action, ModifierFlags modifiers) { DragDropOption performedAction; IList<IGalleryItem> droppedItems = ExtractGalleryItemList(droppedData); if (droppedItems != null) { if (_draggedItems == droppedItems) { performedAction = PerformDropLocalItems(droppedItems, targetItem, action, modifiers); } else { performedAction = PerformDropForeignItems(droppedItems, targetItem, action, modifiers); } } else { performedAction = PerformDropForeignObject(droppedData, targetItem, action, modifiers); } return performedAction; }
public void AddGalleryItem(IGalleryItem i_GalleryItem, GalleryElementAdder i_ElementAdder) { i_ElementAdder.AddElement(this, i_GalleryItem); }
private void AddSubItems(ListViewItem lvi, IGalleryItem galleryItem) { string[] galleryDescriptionLines = galleryItem.Description.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries); for (var i = 0; i < galleryDescriptionLines.Length; i++) { if (galleryDescriptionLines.Length > _component.MaxDescriptionLines && i == _component.MaxDescriptionLines - 1) { // There are more descriptions then number of lines allowed // and this is pass the last line, add ellipsis instead lvi.SubItems.Add("...", Color.Gray, Color.Transparent, _listView.Font); } else { // Add regular description line lvi.SubItems.Add(galleryDescriptionLines[i], Color.Gray, Color.Transparent, _listView.Font); } } }
public void ShareItem(IGalleryItem item) { itemToShare = item; shareType = IMAGE; DataTransferManager.ShowShareUI(); }
/// <summary> /// Constructs a new <see cref="GalleryItemDragEventArgs"/>. /// </summary> /// <param name="item">The <see cref="IGalleryItem"/>.</param> public GalleryItemDragEventArgs(IGalleryItem item) : base(item) { _additionalDataFormats = new List<object>(); }
/// <summary> /// Checks for allowed drag & drop actions involving the specified foreign data and the given target on this component. /// </summary> /// <param name="droppingData">The <see cref="IDragDropObject"/> object that encapsulates all forms of the foreign data.</param> /// <param name="targetItem">The target item that the user is trying to drop on to.</param> /// <param name="actions"></param> /// <param name="modifiers">The modifier keys that are being held by the user.</param> /// <returns>The allowed <see cref="DragDropKind"/> action for this attempted drag & drop operation.</returns> public override sealed DragDropOption CheckDrop(IDragDropObject droppingData, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers) { DragDropOption allowedActions; IList<IGalleryItem> droppingItems = ExtractGalleryItemList(droppingData); if (droppingItems != null) { if (_draggedItems == droppingItems) { allowedActions = CheckDropLocalItems(droppingItems, targetItem, actions, modifiers); } else { allowedActions = CheckDropForeignItems(droppingItems, targetItem, actions, modifiers); } } else { allowedActions = CheckDropForeignObject(droppingData, targetItem, actions, modifiers); } return actions & allowedActions; }
private void RenderImage(IGalleryItem item) { var imageService = ImageService.Instance; imageService.LoadFileFromApplicationBundle("DummyImage.png").Into(MainImageView); LayoutRoot.Post(() => SetDimensions(MainImageView, item)); MainImageView.Visibility = ViewStates.Visible; var width = DpToPx(Math.Min(PxToDp(LayoutRoot.Width), item.Width)); imageService.LoadUrl(item.Link).DownSample(width).Into(MainImageView); }
/// <summary> /// Checks if drag-dropping <see cref="IGalleryItem"/>s from within this gallery on top of the specified item is allowed. /// </summary> /// <param name="droppingItems">The list of <see cref="IGalleryItem"/>s to drop.</param> /// <param name="targetItem">The target <see cref="IGalleryItem"/> at which the <paramref name="droppingItems"/> are being dropped.</param> /// <param name="actions">The interactions that are being allowed by the data source.</param> /// <param name="modifiers">The modifier keys that currently being pressed.</param> /// <returns>The allowed interactions for dropping the <paramref name="droppingItems"/> here.</returns> protected virtual DragDropOption CheckDropLocalItems(IList<IGalleryItem> droppingItems, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers) { return DragDropOption.None; }
/// <summary> /// Performs a drag-drop of <see cref="IGalleryItem"/>s from outside this gallery on top of the specified item. /// </summary> /// <param name="droppedItems">The list of <see cref="IGalleryItem"/>s to drop.</param> /// <param name="targetItem">The target <see cref="IGalleryItem"/> at which the <paramref name="droppedItems"/> are being dropped.</param> /// <param name="actions">The interaction to take.</param> /// <param name="modifiers">The modifier keys that were pressed at the time of the drop.</param> /// <returns>The actual interaction on the <paramref name="droppedItems"/> that was taken.</returns> protected virtual DragDropOption PerformDropForeignItems(IList<IGalleryItem> droppedItems, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers) { return DragDropOption.None; }
private void SetDimensions(View view, IGalleryItem item) { var layParams = view.LayoutParameters; var width = DpToPx(Math.Min(PxToDp(LayoutRoot.Width), item.Width)); var height = (int)Math.Ceiling((item.Height / (double)item.Width) * width); layParams.Width = width; layParams.Height = height; view.LayoutParameters = layParams; }
public void ShareItem(IGalleryItem item) { throw new NotImplementedException(); }
/// <summary> /// Checks for allowed drag & drop actions involving the specified foreign data and the given target on this component. /// </summary> /// <param name="droppingData">The <see cref="IDragDropObject"/> object that encapsulates all forms of the foreign data.</param> /// <param name="targetItem">The target item that the user is trying to drop on to.</param> /// <param name="actions"></param> /// <param name="modifiers">The modifier keys that are being held by the user.</param> /// <returns>The allowed <see cref="DragDropKind"/> action for this attempted drag & drop operation.</returns> public virtual DragDropOption CheckDrop(IDragDropObject droppingData, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers) { return(DragDropOption.None); }
public void AddElement(IGallery i_Gallery, IGalleryItem i_Item) { List <IGalleryItem> galleryItems = i_Gallery.GalleryItems; galleryItems.Add(i_Item); }
/// <summary> /// /// </summary> /// <param name="droppedData"></param> /// <param name="targetItem"></param> /// <param name="action"></param> /// <param name="modifiers"></param> /// <returns></returns> public virtual DragDropOption PerformDrop(IDragDropObject droppedData, IGalleryItem targetItem, DragDropOption action, ModifierFlags modifiers) { return(DragDropOption.None); }
protected void ImageTapped(IGalleryItem clickedItem, object collection) { if (collection == Albums) GoToBrowser((IEnumerable<IGalleryItem>)Albums, Albums.IndexOf((AlbumItem)clickedItem), PageKeyHolder.SelfBrowserPageKey); else if (collection == Images) GoToBrowser(Images, Images.IndexOf((GalleryItem)clickedItem), PageKeyHolder.SelfBrowserPageKey); else if (collection == Favourites) GoToBrowser(Favourites, Favourites.IndexOf((GalleryItem)clickedItem), PageKeyHolder.SubredditBrowserPageKey); }
private void RenderHeader(IGalleryItem item) { Title.Text = item.Title; SubTitle.SetText(Html.FromHtml($"by <font color='#528ACA'>{item.UploaderName}</font> • {item.Ups} points"), TextView.BufferType.Spannable); }
/// <summary> /// Performs a drag-drop of a non-<see cref="IGalleryItem"/> object from outside this gallery on top of the specified item. /// </summary> /// <param name="droppedData">The data object to drop.</param> /// <param name="targetItem">The target <see cref="IGalleryItem"/> at which the <paramref name="droppedData"/> is being dropped.</param> /// <param name="actions">The interaction to take.</param> /// <param name="modifiers">The modifier keys that were pressed at the time of the drop.</param> /// <returns>The actual interaction on the <paramref name="droppedData"/> that was taken.</returns> protected virtual DragDropOption PerformDropForeignObject(IDragDropObject droppedData, IGalleryItem targetItem, DragDropOption actions, ModifierFlags modifiers) { return DragDropOption.None; }
/// <summary> /// Constructs a new <see cref="GalleryItemEventArgs"/>. /// </summary> /// <param name="item">The <see cref="IGalleryItem"/>.</param> public GalleryItemEventArgs(IGalleryItem item) { _item = item; }