public AddExistingPipeComponentProperty(PipeComponentTypeProperty pcpt)
        {
            InitializeComponent();
            mPipeComponentTypeProperty = pcpt;
            mPipeComponentPropertyTypeViewModel = new PipeComponentPropertyTypeViewModel(pcpt);

            propertyComboBox.Items.Add(mPipeComponentPropertyTypeViewModel.ComponentProperty);
            propertyComboBox.SelectedItem = mPipeComponentPropertyTypeViewModel.ComponentProperty;

            propertyComboBox.IsEnabled = false;

            this.DataContext = mPipeComponentPropertyTypeViewModel;
        }
        public AddExistingPipeComponentProperty(int componentTypeId)
        {
            InitializeComponent();
            mPipeComponentTypeProperty = new PipeComponentTypeProperty();
            mPipeComponentTypeProperty.ComponentTypeId = componentTypeId;
            mPipeComponentPropertyTypeViewModel = new PipeComponentPropertyTypeViewModel(mPipeComponentTypeProperty);

            //Load Component types
            EventHandler<GetAllPipePropertiesCompletedEventArgs> fetchPipeComponentPropertiesCompleted = null;
            fetchPipeComponentPropertiesCompleted = (s, eventArgs) =>
            {

                List<PipeProperty> pipeComponentProperties = new List<PipeProperty>();

                mCmsWebServiceClient.GetPipePropertiesCompleted +=
                    (s1, e1)
                    =>
                        {
                            List<int> listOfAssignedPropertyIds = new List<int>();
                            e1.Result.ForEach(x => listOfAssignedPropertyIds.Add(x.Id));

                            //Remove already assgned properties
                            foreach (var pipeComponentProperty in eventArgs.Result)
                            {
                                if (!listOfAssignedPropertyIds.Contains(pipeComponentProperty.Id))
                                {
                                    pipeComponentProperties.Add(pipeComponentProperty);
                                }
                            }

                            propertyComboBox.ItemsSource = pipeComponentProperties;

                            if (pipeComponentProperties.Count > 0)
                            {
                                mPipeComponentPropertyTypeViewModel.ComponentProperty = pipeComponentProperties[0];
                                propertyComboBox.SelectedItem = mPipeComponentPropertyTypeViewModel.ComponentProperty;
                            }

                            OKButton.IsEnabled = pipeComponentProperties.Count > 0;
                        };

                mCmsWebServiceClient.GetPipePropertiesAsync(componentTypeId);

            };
            mCmsWebServiceClient.GetAllPipePropertiesCompleted += fetchPipeComponentPropertiesCompleted;
            mCmsWebServiceClient.GetAllPipePropertiesAsync(componentTypeId);

            this.DataContext = mPipeComponentPropertyTypeViewModel;
        }