示例#1
0
        private void dataGridGoalAdd_Click(object sender, RoutedEventArgs e)
        {
            var windowEdit = new GoalEditWindow(Goals.Select(x => new GoalModel(x.ToGoal(), false)));

            if (windowEdit.ShowDialog() == true)
            {
                var goal = windowEdit.Goal;
                currentBS.GoalsIncidenceMatrix.AddVariable(goal);
                foreach (var goalmodel in windowEdit.ProvidedFor)
                {
                    currentBS.GoalsIncidenceMatrix[goal, goalmodel.ToGoal()] = goalmodel.ProvidedBy;
                }
                dataGridGoalsTable.ItemsSource = Goals;
            }
        }
示例#2
0
        private void dataGridGoalEdit_Click(object sender, RoutedEventArgs e)
        {
            //int column = dataGridGoalsTable.Columns.ToList().IndexOf(dataGridGoalsTable.SelectedCells[0].Column);
            //int row = dataGridGoalsTable.Items.IndexOf(dataGridGoalsTable.SelectedCells[0].Item);
            var selected = dataGridGoalsTable.SelectedItem as GoalModelWithProvidings;

            if (selected == null)
            {
                return;
            }
            var goal       = selected.ToGoal();
            var ancestors  = currentBS.GoalsIncidenceMatrix.GetAncestors(goal);
            var windowEdit = new GoalEditWindow(goal, currentBS.GoalsIncidenceMatrix.GetAvailableForProvidingVariables(goal).Select(x => new GoalModel(x, ancestors.Contains(x))));

            if (windowEdit.ShowDialog() == true)
            {
                goal = windowEdit.Goal;
                foreach (var goalmodel in windowEdit.ProvidedFor)
                {
                    currentBS.GoalsIncidenceMatrix[goal, goalmodel.ToGoal()] = goalmodel.ProvidedBy;
                }
            }
            dataGridGoalsTable.ItemsSource = Goals;
        }