def initialize_state(self):
        """ Call this to initialize the state of the UI after everything has been connected. """
        if self.__hardware_source:
            self.__profile_changed_event_listener = self.__hardware_source.profile_changed_event.listen(self.__update_profile_index)
            self.__frame_parameters_changed_event_listener = self.__hardware_source.frame_parameters_changed_event.listen(self.__update_frame_parameters)
            self.__data_item_states_changed_event_listener = self.__hardware_source.data_item_states_changed_event.listen(self.__data_item_states_changed)
            self.__acquisition_state_changed_event_listener = self.__hardware_source.acquisition_state_changed_event.listen(self.__acquisition_state_changed)
            self.__log_messages_event_listener = self.__hardware_source.log_messages_event.listen(self.__log_messages)
        if self.on_display_name_changed:
            self.on_display_name_changed(self.display_name)
        if self.on_binning_values_changed:
            self.on_binning_values_changed(self.__hardware_source.binning_values)
        if self.on_monitor_button_state_changed:
            has_monitor = self.__hardware_source and self.__hardware_source.features.get("has_monitor", False)
            self.on_monitor_button_state_changed(has_monitor, has_monitor)
        self.__update_buttons()
        if self.on_profiles_changed:
            profile_items = self.__hardware_source.modes
            self.on_profiles_changed(profile_items)
            self.__update_profile_index(self.__hardware_source.selected_profile_index)
        if self.on_data_item_states_changed:
            self.on_data_item_states_changed(list())