Esempio n. 1
0
 private void buttonDeleteRule_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         for (int i = dataGridRuleset.SelectedItems.Count - 1; i > -1; i--)
         {
             OpenRuleset ruleset = dataGridRuleset.SelectedItems[i] as OpenRuleset;
             settings.Rulesets.Remove(ruleset);
         }
     }
     catch (Exception ex)
     {
         string message = ex.Message;
     }
 }
 private void buttonDeleteRule_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (dataGridTasks.SelectedIndex > -1 && dataGridRuleset.SelectedItems.Count > 0)
         {
             int taskIndex = dataGridTasks.SelectedIndex;
             for (int i = dataGridRuleset.SelectedItems.Count - 1; i > -1; i--)
             {
                 OpenRuleset ruleset = dataGridRuleset.SelectedItems[i] as OpenRuleset;
                 processUnits[taskIndex].Rulesets.Remove(ruleset);
             }
         }
     }
     catch (Exception ex)
     {
         string message = ex.Message;
     }
 }
        private void buttonDeleteRule_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                for (int i = dataGridRuleset.SelectedItems.Count - 1; i > -1; i--)
                {
                    OpenRuleset ruleSet = dataGridRuleset.SelectedItems[i] as OpenRuleset;
                    commonRuleSets.Remove(ruleSet);
                }

                if (commonRuleSets.Count == 0)
                {
                    //remove bcf path
                    UpdateSettings();
                }

                isEditing = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to delete ruleset items.\n" + ex.Message, "Delete Ruleset Items", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
        }
Esempio n. 4
0
        public static ObservableCollection <ProcessUnit> ExtractProcessUnits(Batch batch)
        {
            ObservableCollection <ProcessUnit> processUnits = new ObservableCollection <ProcessUnit>();

            try
            {
                ProcessUnit unit = new ProcessUnit();
                ObservableCollection <GenericElement> elements = batch.Target.Elements;
                for (int i = 0; i < elements.Count; i++)
                {
                    GenericElement element     = elements[i];
                    string         elementType = element.GetType().Name;
                    switch (elementType)
                    {
                    case "OpenModel":
                        OpenModel openModel = element as OpenModel;
                        if (openModel.FileExtension == ".smc")
                        {
                            unit.OpenSolibri = openModel;
                        }
                        else if (modelExtensions.Contains(openModel.FileExtension))
                        {
                            InputModel modeltoOpen = new InputModel(openModel);
                            unit.Models.Add(modeltoOpen);
                        }
                        break;

                    case "UpdateModel":
                        UpdateModel updateModel   = element as UpdateModel;
                        InputModel  modeltoUpdate = new InputModel(updateModel);
                        unit.Models.Add(modeltoUpdate);
                        break;

                    case "OpenRuleset":
                        OpenRuleset ruleset = element as OpenRuleset;
                        unit.Rulesets.Add(ruleset);
                        break;

                    case "OpenClassification":
                        OpenClassification classification = element as OpenClassification;
                        unit.Classifications.Add(classification);
                        break;

                    case "Check":
                        Check check = element as Check;
                        check.IsSpecified = true;
                        unit.CheckTask    = check;
                        break;

                    case "AutoComment":
                        AutoComment comment = element as AutoComment;
                        comment.IsSpecified = true;
                        unit.CommentTask    = comment;
                        break;

                    case "WriterReport":
                        unit.CheckingReport = element as WriterReport;
                        break;

                    case "CreatePresentation":
                        CreatePresentation createP = element as CreatePresentation;
                        createP.IsSelected      = true;
                        unit.PresentationCreate = createP;
                        break;

                    case "UpdatePresentation":
                        UpdatePresentation updateP = element as UpdatePresentation;
                        updateP.IsSelected      = true;
                        unit.PresentationUpdate = updateP;
                        break;

                    case "GeneralReport":
                        unit.PresentationReport = element as GeneralReport;
                        break;

                    case "BCFReport":
                        unit.BCFReport = element as BCFReport;
                        break;

                    case "CoordinationReport":
                        unit.CoordReport = element as CoordinationReport;
                        break;

                    case "SaveModel":
                        unit.SaveSolibri = element as SaveModel;
                        unit.TaskName    = System.IO.Path.GetFileNameWithoutExtension(unit.SaveSolibri.File);
                        break;

                    case "CloseModel":
                        processUnits.Add(unit);
                        unit = new ProcessUnit();
                        break;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Failed to extract process units.\n" + ex.Message, "Extract Process Unit", MessageBoxButton.OK, MessageBoxImage.Warning);
            }
            return(processUnits);
        }