Beispiel #1
0
        public void UpdateStructureNames(string structureName)
        {
            if (!StructureNames.Contains(structureName))
            {
                StructureNames.Add(structureName);
            }

            if (!ContouredStructureNames.Contains(structureName))
            {
                ContouredStructureNames.Add(structureName);
            }

            SortStructureNames();
        }
        private void ChooseFile(DvhObjectivesViewModel dvhObjectivesViewModel)
        {
            var dialog = new OpenFileDialog
            {
                Title            = "Choose file",
                Filter           = "CSV file (*.csv)|*.csv",
                InitialDirectory = Path.Combine(DvhCheckerDirectoryPath, "templates")
            };

            if (dialog.ShowDialog() == true)
            {
                ProtocolFilePath = dialog.FileName;
            }
            else
            {
                ProtocolFilePath = string.Empty;
                Message          = "\"Choose file\" is canceled";
                return;
            }

            dvhObjectivesViewModel.DvhObjectives = new ObservableCollection <DvhObjective>(DvhObjective.ReadObjectivesFromCsv(ProtocolFilePath));

            var dvhObjectives = dvhObjectivesViewModel.DvhObjectives;

            if (!StructureNames.Contains(StructureNameNone))
            {
                StructureNames.Insert(0, StructureNameNone);
            }
            foreach (var o in dvhObjectives)
            {
                if (StructureNames.Contains(o.StructureName))
                {
                    o.StructureNameTps = o.StructureName;
                    o.InUse            = true;
                }
                else
                {
                    o.StructureNameTps = StructureNameNone;
                }
            }

            if (dvhObjectives.Count > 0)
            {
                dvhObjectivesViewModel.ProtocolId = dvhObjectives[0].ProtocolId;
            }
        }