コード例 #1
0
        protected override void UpdateItemSpacing()
        {
            if (_layout == null)
            {
                return;
            }

            if (_itemDecoration != null)
            {
                RemoveItemDecoration(_itemDecoration);
            }

            _itemDecoration = CreateSpacingDecoration(_layout);
            AddItemDecoration(_itemDecoration);

            var adapter = GetAdapter();

            if (adapter != null)
            {
                adapter.NotifyItemChanged(_oldPosition);
                Carousel.ScrollTo(_oldPosition, position: Xamarin.Forms.ScrollToPosition.Center);
            }

            base.UpdateItemSpacing();
        }
コード例 #2
0
 void UpdateItemDecoration()
 {
     if (_itemDecoration != null)
     {
         RemoveItemDecoration(_itemDecoration);
     }
     _itemDecoration = CreateSpacingDecoration(ItemsLayout);
     AddItemDecoration(_itemDecoration);
 }
コード例 #3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (_itemDecoration != null)
                {
                    _itemDecoration.Dispose();
                    _itemDecoration = null;
                }
            }

            base.Dispose(disposing);
        }
コード例 #4
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;
                _carouselViewLoopManager?.SetItemsSource(null);
                _carouselViewLoopManager = null;

                if (_itemDecoration != null)
                {
                    _itemDecoration.Dispose();
                    _itemDecoration = null;
                }

                ClearLayoutListener();
            }

            base.Dispose(disposing);
        }
コード例 #5
0
 // Input data and decoration for cell
 private void listItems_FormatCell(object sender, BrightIdeasSoftware.FormatCellEventArgs e)
 {
     try
     {
         ItemMasterRow item = (ItemMasterRow)e.Model;
         if (e.ColumnIndex == 0)
         {
             BrightIdeasSoftware.ImageDecoration imageDeco = new BrightIdeasSoftware.ImageDecoration();
             imageDeco.Image = listIcons.Images[item.ItemTypeID.ToString()];
             imageDeco.Transparency = 255;
             imageDeco.Alignment = ContentAlignment.MiddleCenter;
             imageDeco.ShrinkToWidth = true;
             e.SubItem.Decoration = imageDeco;
         }
         else if (e.ColumnIndex == 1)
         {
             ItemDecoration decoration = new ItemDecoration();
             decoration.Title = item.Title;
             if (item.PubYear == "-1" || item.PubYear == null)
             {
                 if (Regex.Match(item.PubDate, @"\d{4}").Success)
                     decoration.Year = Regex.Match(item.PubDate, @"\d{4}").Value;
                 else
                     decoration.Year = "";
             }
             else
                 decoration.Year = item.PubYear;
             decoration.Authors = item.Author = CitationTools.GetAuthorsString(item.Authors);
             e.SubItem.Decoration = decoration;
         }
         else if (e.ColumnIndex == 2) //如果有 3 行(通常都是 連結 或者 pdf 檔案的圖示)
         {
             if (item.ItemFile.Length > 0 && item.ItemFile != string.Empty)
             {
                 BrightIdeasSoftware.ImageDecoration imageDeco = new BrightIdeasSoftware.ImageDecoration();
                 imageDeco.Image = CitationTools.GetItemFileIcon(item.ItemFile);
                 if (imageDeco.Image != null)
                 {
                     imageDeco.Transparency = 255;
                     imageDeco.Offset = new Size(-5, 0);
                     imageDeco.ShrinkToWidth = true;
                     imageDeco.Alignment = ContentAlignment.MiddleRight;
                     e.SubItem.Decoration = imageDeco;
                 }
             }
             else if (item.ItemTypeID == ItemTypes.WebPage)
             {
                 BrightIdeasSoftware.ImageDecoration imageDeco = new BrightIdeasSoftware.ImageDecoration();
                 imageDeco.Image = CitationTools.GetItemFileIcon("wizfolio.wfweb");
                 if (imageDeco.Image != null)
                 {
                     imageDeco.Transparency = 255;
                     imageDeco.Offset = new Size(-5, 0);
                     imageDeco.ShrinkToWidth = true;
                     imageDeco.Alignment = ContentAlignment.MiddleRight;
                     e.SubItem.Decoration = imageDeco;
                 }
             }
         }
     }
     catch(Exception ex)
     {
         log.WriteLine(LogType.Error, "MasterControl::listItems_FormatCell", ex.ToString());
     }
 }