Source

main / Source / Excel / Excel.AddIn / Excel.AddIn / ViewModels / MetadataListViewModel.cs

Diff from to

Source/Excel/Excel.AddIn/Excel.AddIn/ViewModels/MetadataListViewModel.cs

 
         public ObservableCollection<string> StandardUnitsList { get; set; }
 
+        public ObservableCollection<string> EntityNameList { get; set; }
+
         public ObservableCollection<MetadataViewModel> MetadataList
         {
             get
 
         public bool IsParameterInputBoxOpen { get; set; }
 
+        public int SelectedTabIndex
+        {
+            get;
+            set;
+        }
+
         public ICommand GenerateMetadataCommand
         {
             get
 
             this.TypeList = new ObservableCollection<string>();
             this.StandardUnitsList = new ObservableCollection<string>();
+            this.EntityNameList = new ObservableCollection<string>();
+
+            this.TypeList.Add(" ");
+            this.StandardUnitsList.Add("");
 
             foreach (var item in Common.Constants.ParameterMetadataType.Split(','))
             {
                 this.TypeList.Add(item.Trim());
             }
-
+            
             foreach (var item in Helper.GetStandardUnits())
             {
                 this.StandardUnitsList.Add(item.Trim());
             }
 
+            foreach (var item in Controller.Instance.GetSheetNames())
+            {
+                this.EntityNameList.Add(item.Trim());
+            }
+            SelectedTabIndex = 0;
             InitCommands();
         }
 
                 this.ParameterMetadataList = new ObservableCollection<ParameterMetadataViewModel>();
             }
 
-            this.ParameterMetadataList.Add(new ParameterMetadataViewModel());
+            this.ParameterMetadataList.Add(new ParameterMetadataViewModel() { EntityName = this.EntityNameList[0] });
         }
 
         private void DeleteParameterCommandExecute(ParameterMetadataViewModel item)
                 {
                     this.MetadataList.Add(item);
                 }
-
                 this.ParameterMetadataList.Clear();
                 foreach (var item in metaData.ParameterMetadataList)
                 {
                     isValid = false;
                     break;
                 }
+            }
 
+            foreach (var item in this.ParameterMetadataList)
+            {
+                if (!item.Validate())
+                {
+                    isValid = false;
+                    break;
+                }
             }
             return isValid;
         }