public void UpdateView() { if (userOptions.mainWindow != null) { userOptions.mainWindow.Dispatcher.BeginInvoke( // Invoke does not always work (Action)(() => { if (taskViewParentType == TaskViewParentType.Source) { TreeModel = tasks.taskSource.TaskViewBefore; TreeModel.Items = tasks.taskSource.TaskViewBefore.Items; } else if (taskViewParentType == TaskViewParentType.Target) { TreeModel = tasks.taskTarget.TaskViewBefore; TreeModel.Items = tasks.taskTarget.TaskViewBefore.Items; } TreeView_Before.UpdateLayout(); } ), null); } //ExpandTreeView(TreeView_Before); }
public UCOptimizeRenameOptions(Tasks.Tasks _tasks) { this.tasks = _tasks; ucScriptEntrys = new ObservableCollection <UCOptimizeScriptEntry>(); userOptionsOptimize = tasks.userOptions.userOptionsOptimize; userOptionsOptimize.ucScriptEntrys = ucScriptEntrys; TreeViewModel_After = tasks.taskSource.TaskViewAfter; InitializeComponent(); }