Public Overridable Sub ApplyChanges()

in vsintegration/src/FSharp.ProjectSystem.PropertyPages/PropertyPages/PropertyControlData.vb [2136:2220]


        Public Overridable Sub ApplyChanges()
            Dim value As Object = Nothing
            Dim values() As Object = Nothing 
            Dim handled As Boolean

            If Me.IsDirty Then
                Common.Switches.TracePDProperties(TraceLevel.Info, "PropertyControlData.ApplyChanges: " & Me.PropertyName)

                If (Me.PropDesc IsNot Nothing) AndAlso (Not Me.PropDesc.IsReadOnly) AndAlso (Not Me.IsMissing) Then
                    
                    If Me.MultiValueGetCallback IsNot Nothing Then
                        handled = Me.MultiValueGetCallback(Me.FormControl, Me.PropDesc, values)
                        If handled Then
                            Debug.Assert(values IsNot Nothing, "MultiValueGetCallback must return a valid array")
                            Debug.Assert(values.Length = RawPropertiesObjects.Length, "MultiValueGetCallback must return an array of the same length as RawPropertiesObjects")
                        End If
                    End If

                    If Not handled Then
                        If Me.GetCallback IsNot Nothing Then 
                            handled = Me.GetCallback(Me.FormControl, Me.PropDesc, value)
                        Else
                            value = Me.GetControlValueNative()
                            handled = True
                        End If
                    End If

                    If handled Then
#If DEBUG Then
                        If values IsNot Nothing Then
                            Common.Switches.TracePDProperties(TraceLevel.Info, "PropertyControlData.ApplyChanges: " & Me.PropertyName & ": NEW VALUES (multi-value apply):")
                            For i As Integer = 0 To values.Length - 1
                                Common.Switches.TracePDProperties(TraceLevel.Info, "  New Value #" & i & ": " & Common.DebugToString(values(i)))
                            Next
                        Else
                            Common.Switches.TracePDProperties(TraceLevel.Info, "PropertyControlData.ApplyChanges: " & Me.PropertyName & ": NEW VALUE = " & Common.DebugToString(value))
                        End If
#End If

                        OnPropertyChanging() 

                        
                        If values IsNot Nothing Then
                            Me.SetPropertyValueNativeMultipleValues(RawPropertiesObjects, values)
                        Else
                            Me.SetPropertyValueNative(value)
                        End If

                        If m_PropPage.ProjectReloadedDuringCheckout Then
                            
                            
                            
                            Throw New ProjectReloadedException()
                        End If

                        OnPropertyChanged(Me.InitialValue, value) 

                        
                        If values IsNot Nothing Then
                            Me.SetInitialValues(values)
                        Else
                            Me.SetInitialValues(value)
                        End If
                    Else
                        Debug.Fail(Me.PropertyName & " not handled")
                    End If
                    Me.IsDirty = False

                ElseIf Me.PropDesc Is Nothing AndAlso Me.GetCallback IsNot Nothing Then
                    handled = Me.GetCallback(Me.FormControl, Nothing, value)
                    

                ElseIf Me.PropDesc Is Nothing Then
                    If Me.FormControl IsNot Nothing Then
                        Me.FormControl.Enabled = False
                    End If
                    Debug.Fail("PropertyDescriptor for '" & Me.PropertyName & "' cannot be found.")
                Else
                    Common.Switches.TracePDProperties(TraceLevel.Info, "  " & Me.PropertyName & " is ReadOnly or IsMissing and cannot be changed")
                End If
            Else
                
            End If

        End Sub