Esempio n. 1
0
    private void InitializeControls()
    {
        ColumnDefinitions = new ColumnDefinitions("*");
        RowDefinitions    = new RowDefinitions("Auto");      // doesn't work

        HorizontalAlignment = HorizontalAlignment.Stretch;
        VerticalAlignment   = VerticalAlignment.Stretch;

        IsVisible = ShowTasks;

        _tabControlDataGrid = new TabControlDataGrid(TabInstance, TabInstance.Model.Tasks, false)         // don't autogenerate
        {
            HorizontalAlignment = HorizontalAlignment.Stretch,
            VerticalAlignment   = VerticalAlignment.Stretch,
        };

        _tabControlDataGrid.AddButtonColumn(nameof(TaskInstance.Cancel));
        _tabControlDataGrid.AddColumn("Task", nameof(TaskInstance.Label));
        _tabControlDataGrid.AddColumn("   %   ", nameof(TaskInstance.Percent));
        _tabControlDataGrid.AddColumn("Status", nameof(TaskInstance.Status));
        //tabControlDataGrid.AddColumn("Message", nameof(TaskInstance.Message));

        _tabControlDataGrid.OnSelectionChanged += TabData_OnSelectionChanged;
        Children.Add(_tabControlDataGrid);

        if (TabInstance.Model.Tasks.Count > 0)
        {
            SelectLastItem();
        }

        if (TabInstance.Model.Tasks is INotifyCollectionChanged iNotifyCollectionChanged)
        {
            iNotifyCollectionChanged.CollectionChanged += INotifyCollectionChanged_CollectionChanged;
        }
    }
Esempio n. 2
0
    public void Dispose()
    {
        if (_tabControlDataGrid != null)
        {
            _tabControlDataGrid.OnSelectionChanged -= TabData_OnSelectionChanged;
            _tabControlDataGrid.Dispose();
            _tabControlDataGrid = null;
        }

        if (TabInstance.Model.Tasks is INotifyCollectionChanged iNotifyCollectionChanged)
        {
            iNotifyCollectionChanged.CollectionChanged -= INotifyCollectionChanged_CollectionChanged;
        }
    }