Esempio n. 1
0
        async void PublicationsTreeView_ScrollableItemSelected(object sender, EventArgs e)
        {
            if (DataContext is FormationChoiceViewModel vm)
            {
                var syncTreeViewItem = VisualTreeHelperExtensions.FindLastChild <TreeViewItemAdv>(PublicationsTreeView, i =>
                {
                    if (i is TreeViewItemAdv item)
                    {
                        return(item.IsMouseOver);
                    }
                    return(false);
                });
                if (syncTreeViewItem?.DataContext is ProjectDir folder && folder.Id != -1)
                {
                    if (folder.Id != -1)
                    {
                        folder.IsExpanded = !folder.IsExpanded;
                    }
                    vm.CurrentNode = null;
                }
                else if (syncTreeViewItem?.DataContext is Procedure process)
                {
                    if (process.ProcessId != (vm.TrainingPublication?.ProcessId ?? 0))
                    {
                        vm.CurrentNodeIsChanging = true;
                        await vm.OnCurrentNodeChanged(process);

                        PublicationsTreeView.SelectedTreeItem = vm.CurrentNode;
                    }
                }
                else
                {
                    vm.CurrentNode = null;
                }
            }