Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref=driverType/> class.
        /// Must be public for COM registration.
        /// </summary>
        public FilterWheel()
        {
            try
            {
                TL.Enabled = RegistryCommonCode.GetBool(GlobalConstants.SIMULATOR_TRACE, GlobalConstants.SIMULATOR_TRACE_DEFAULT);
                TL.LogMessage("New", "Started");

                //check to see if the profile is ok
                if (ValidateProfile())
                {
                    TL.LogMessage("New", "Validated OK");
                    KeepMoving      = false;
                    LastOffset      = 0;
                    RateOfChange    = 1;
                    MouseDownTime   = DateTime.MaxValue; //Initialise to "don't accelerate" value
                    RandomGenerator = new Random();      //Temperature fluctuation random generator
                    LoadDriverKeyValues();
                    TL.LogMessage("New", "Loaded Key Values");
                    //Handbox = new FilterWheelHandboxForm(this);
                    //Handbox.Hide();
                    //TL.LogMessage("FocusSettingsForm", "Created Handbox");

                    // start a timer that monitors and moves the FilterWheel
                    _moveTimer          = new System.Timers.Timer();
                    _moveTimer.Elapsed += new System.Timers.ElapsedEventHandler(MoveTimer_Tick);
                    _moveTimer.Interval = 100;
                    _moveTimer.Enabled  = true;
                    _lastTemp           = Temperature;
                    Target = _position;

                    TL.LogMessage("New", "Started Simulation");
                }
                else
                {
                    TL.LogMessage("New", "Registering Profile");
                    RegisterWithProfile();
                    TL.LogMessage("New", "Registered OK");
                }

                TL.LogMessage("New", "Completed");
            }
            catch (Exception ex)
            {
                TL.LogMessageCrLf("New Exception", ex.ToString());
                Console.WriteLine($"FilterWheel: {ex}");
            }
        }