Exemple #1
0
        private void OnModelChanged()
        {
            if (Model != null)
            {
                FrameListView.Items.Clear();
                var imageList = new ImageList();
                imageList.ImageSize = new Size(50, 50);
                foreach (var dir in Model.Directions)
                {
                    foreach (var frame in dir.Value.Frames)
                    {
                        var imgKey = imageList.Images.Count;
                        imageList.Images.Add(frame.Bitmap);
                        var lvi = new ListViewItem
                        {
                            Name       = imgKey.ToString(),
                            Text       = frame.Id.ToString(),
                            ImageIndex = imgKey,
                            Tag        = Tuple.Create(dir.Key, frame.Id),
                            Group      = FrameListView.Groups[(int)dir.Key]
                        };
                        FrameListView.Items.Add(lvi);
                    }
                }
                FrameListView.LargeImageList = imageList;
                FrameListView.SmallImageList = imageList;
                FrameListView.Refresh();

                OnSelectedFrameChanged?.Invoke(this, SelectedFrame);
            }
        }
Exemple #2
0
 private void FrameListView_SelectedIndexChanged(object sender, EventArgs e)
 {
     OnSelectedFrameChanged?.Invoke(this, SelectedFrame);
 }