Exemple #1
0
        private void CancelFilter()
        {
            try
            {
                _preventEvent = true;
                tbFilter.Text = "";
            }
            finally
            {
                _preventEvent = false;
            }

            _isFiltered = false;

            //var ses = (SeriesEpisodesShortInfo)tvSeries.SelectedNode.Tag;

            var treeModel = new SeriesTreeModel();

            tvSeries.Model = treeModel;

            tvSeries.SelectedNode = tvSeries.AllNodes.FirstOrDefault();

            //tvSeries.SelectedNode = ses.IsSeason

            //    ? tvSeries.AllNodes.FirstOrDefault(x => ((SeriesEpisodesShortInfo)x.Tag).Id == ses.Id && ((SeriesEpisodesShortInfo)x.Tag).Season == ses.Season)
            //    : tvSeries.AllNodes.FirstOrDefault(x => ((SeriesEpisodesShortInfo)x.Tag).Id == ses.Id);
            //todo: this ... ^^ ... has only the roots, the selection must be remade from the original path
        }
        private void ReloadTreeView(int?selectedParentd, int?selectedChildId = null)
        {
            //https://sourceforge.net/p/treeviewadv/discussion/568369/thread/9f164a97/
            //^^ not working?

            var treeModel = new SeriesTreeModel(true); //to refresh the tree

            tvCollections.Model = treeModel;

            //tvSeries.FindNodeByTag()
            //no support for finding based on a single property?

            if (selectedParentd != null)
            {
                tvCollections.SelectedNode = tvCollections.AllNodes.FirstOrDefault(x => ((SeriesEpisodesShortInfo)x.Tag).Id == selectedParentd);

                if (selectedChildId != null)
                {
                    tvCollections.SelectedNode.ExpandAll();
                    tvCollections.SelectedNode = tvCollections.AllNodes.FirstOrDefault(x => ((SeriesEpisodesShortInfo)x.Tag).Id == selectedChildId);
                }
            }
            else
            {
                tvCollections.SelectedNode = tvCollections.AllNodes.FirstOrDefault();
            }
            //treeViewAdv1.Focus();
        }
Exemple #3
0
        private void ucSeries_Load(object sender, EventArgs e)
        {
            //AutoSizeColumns? Where?
            //https://sourceforge.net/p/treeviewadv/discussion/568369/thread/b9e687fa/

            var tcTitle = new TreeColumn {
                Header = "Title", Width = 240
            };
            var tbTitle = new NodeTextBox {
                DataPropertyName = "FileName", ParentColumn = tcTitle
            };

            tvSeries.Columns.Add(tcTitle);
            tvSeries.NodeControls.Add(tbTitle);

            var tcTheme = new TreeColumn {
                Header = "Theme/A.summary", Width = 75
            };
            var tbTheme = new NodeTextBox {
                DataPropertyName = "Composed1", ParentColumn = tcTheme
            };

            //tbTheme.Font = new Font(tbTheme.Font.Name, 40);
            tvSeries.Columns.Add(tcTheme);
            tvSeries.NodeControls.Add(tbTheme);

            var tcQuality = new TreeColumn {
                Header = "Quality", Width = 35
            };
            var tbQuality = new NodeTextBox {
                DataPropertyName = "Quality", ParentColumn = tcQuality
            };

            tvSeries.Columns.Add(tcQuality);
            tvSeries.NodeControls.Add(tbQuality);

            tvSeries.FullRowSelect = true;
            tvSeries.GridLineStyle = GridLineStyle.HorizontalAndVertical;
            tvSeries.UseColumns    = true;

            var treeModel = new SeriesTreeModel();

            tvSeries.Model = treeModel;

            if (tvSeries.AllNodes.Any())
            {
                tvSeries.SelectedNode = tvSeries.AllNodes.First();
            }
        }