示例#1
0
 public void setParentandCheckMaterialName(ModelVM parent)
 {
     _parent = parent;
     if (SelectedMaterialSetName == "")
     {
         SelectedMaterialSetName = _parent.MaterialSets[SelectedMaterial].Name;
     }
 }
示例#2
0
 public SelectionSetVM(string selectedMaterialSetName, ModelVM parent)
 {
     _parent = parent;
     SelectedFilterValues    = new List <FilterSelection>();
     ElementsIdsToInclude    = new List <string>();
     ElementsIdsToExclude    = new List <string>();
     SelectedMaterialSetName = selectedMaterialSetName;
 }
示例#3
0
 public SelectionSetVM(int selectedMaterial, ModelVM parent)
 {
     _parent = parent;
     SelectedFilterValues    = new List <FilterSelection>();
     ElementsIdsToInclude    = new List <string>();
     ElementsIdsToExclude    = new List <string>();
     SelectedMaterial        = selectedMaterial;
     SelectedMaterialSetName = _parent.MaterialSets[Math.Max(selectedMaterial, 0)].Name;
 }
示例#4
0
 public FilterSetVM(string name, ModelVM parent, IEnumerable <string> filters)
 {
     _parent     = parent;
     FilterItems = new ObservableCollection <FilterItemVM>();
     foreach (var item in filters)
     {
         FilterItems.Add(new FilterItemVM(item, this));
     }
     Name = name;
 }
示例#5
0
 public ElementVM(Element element, ModelVM parent)
 {
     _element = element;
     _parent  = parent;
     _filters = new List <ElementFilterVM>();
     for (int i = 0; i < _element.Filters.Length; i++)
     {
         var item = _element.Filters[i];
         _filters.Add(new ElementFilterVM(this, _parent, i));
     }
 }
示例#6
0
 public MaterialSetVM(string name, GWPMaterialSet materialSet, ModelVM parent)
 {
     _materials    = materialSet;
     _parent       = parent;
     _materialVMs  = new ObservableCollection <MaterialVM>();
     MaterialNames = new List <string>();
     foreach (var item in materialSet.Materials)
     {
         MaterialNames.Add(item.Name);
         _materialVMs.Add(new MaterialVM(item));
     }
 }
        public MainWindow()
        {
            var myelemset = new ElementSet("Category", "Material");

            myelemset.Elements.Add(new Element("Elem 1", 120d, "Revit123", "Foundation", "Concrete"));
            myelemset.Elements.Add(new Element("Elem 2", 109.4d, "Revit124", "Foundation", "Concrete"));
            myelemset.Elements.Add(new Element("Elem 3", 24.2d, "Revit125", "Walls", "RC40"));
            ModelVM vm = new ModelVM(myelemset);

            DataContext = vm;

            InitializeComponent();
        }
示例#8
0
        void importMaterials()
        {
            bool    outputOK = false;
            ModelVM output   = new ModelVM();
            string  filePath = vm.FilePath;

            try
            {
                var openDialog = new OpenFileDialog();
                openDialog.Filter           = @"Carbon model files |*.JSON";
                openDialog.InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
                openDialog.Multiselect      = false;
                if (openDialog.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
                filePath = openDialog.FileName;
                using (var reader = File.OpenText(openDialog.FileName))
                {
                    var settings = new JsonSerializerSettings();
                    settings.Formatting       = Formatting.Indented;
                    settings.TypeNameHandling = TypeNameHandling.Auto;
                    output = JsonConvert.DeserializeObject <ModelVM>(reader.ReadToEnd(), settings);
                }
                output.initialise();
                output.SetChartColors();
                output.updateCarbonVsCategoryChartValues();
                outputOK = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("oops..." + Environment.NewLine + ex.Message);
            }
            if (outputOK)
            {
                foreach (var item in output.MaterialSets)
                {
                    vm.ElementSet.MaterialSets.Add(item);
                }
                vm.initialise();
                vm.UpdateAll();
                RaisePropertyChanged(nameof(Model));
            }
        }
示例#9
0
 public AppVM(ElementSet elementSet)
 {
     vm = new ModelVM(elementSet);
 }
示例#10
0
 public ElementFilterVM(ElementVM elem, ModelVM model, int ind)
 {
     this.ind = ind;
     _elem    = elem;
     _modelVM = model;
 }
示例#11
0
 public ElementVM(Element element, ModelVM parent)
 {
     _element = element;
     _parent  = parent;
 }