/////////////////////////////////////////////////////////////////////// public void Activate(ILightFieldApplication app) { // Capture Interface LightFieldApplication = app; experiment_ = app.Experiment; menuEnabled_ = CheckSystem(); processEnabled_ = false; // Create transformation object if we have a camera (via menu enabled) if (menuEnabled_) { CreateTransformationObject(); } // Listen to region of interest result changed and re-compute the buffers to match the // region List <string> settings = new List <string>(); settings.Add(CameraSettings.ReadoutControlRegionsOfInterestResult); experiment_.FilterSettingChanged(settings); experiment_.SettingChanged += experiment__SettingChanged; // Connect to experiment device changed (when camera is added this add-in is active, and // if a camera is removed then this add-in is disabled. experiment_.ExperimentUpdated += experiment__ExperimentUpdated; // Connect to the data received event experiment_.ImageDataSetReceived += experimentDataReady; }
/////////////////////////////////////////////////////////////////////// public void Deactivate() { // Stop listening to device changes experiment_.ExperimentUpdated -= experiment__ExperimentUpdated; // Stop snooping settings experiment_.FilterSettingChanged(new List <string>()); experiment_.SettingChanged -= experiment__SettingChanged; // Disconnect Data Event experiment_.ImageDataSetReceived -= experimentDataReady; }
/////////////////////////////////////////////////////////////////////// // Make a list of settings and set the filter to them as well // as hook the changed event. /////////////////////////////////////////////////////////////////////// public void Activate(ILightFieldApplication app) { // Set the add-ins discovery root directory to be the current directory string addinRoot = AppDomain.CurrentDomain.BaseDirectory; fullName_ = Path.Combine(addinRoot, "SettingSnoopSample.txt"); theExperiment_ = app.Experiment; // Generate a filter with only the valid settings List <string> filteredSettings = new List <string>(); // Load Up The Setting Strings IEnumerable <string> CameraSettings = GetAllNames(typeof(CameraSettings)); IEnumerable <string> ExperimentSettings = GetAllNames(typeof(ExperimentSettings)); IEnumerable <string> FilterSettings = GetAllNames(typeof(FilterWheelSettings)); IEnumerable <string> SpectrometerSettings = GetAllNames(typeof(SpectrometerSettings)); // put them all into the filter // camera foreach (string str in CameraSettings) { filteredSettings.Add(str); } // experiment foreach (string str in ExperimentSettings) { filteredSettings.Add(str); } // filterWheel foreach (string str in FilterSettings) { filteredSettings.Add(str); } // spectrometer foreach (string str in SpectrometerSettings) { filteredSettings.Add(str); } // Connect the setting change handler theExperiment_.SettingChanged += new EventHandler <SettingChangedEventArgs>(Experiment_SettingChanged); // Apply the filter theExperiment_.FilterSettingChanged(filteredSettings); // Also Monitor System building events theExperiment_.ExperimentUpdating += Experiment_ExperimentUpdating; theExperiment_.ExperimentUpdated += Experiment_ExperimentUpdated; }