コード例 #1
0
 public SensorView()
 {
     InitializeComponent();
     if (!DesignMode)
     {
         TL = OCSimulator.TL;
         TL.LogMessage("SensorView", "This.Name: " + this.Name);
         chkEnabled.CheckedChanged += ChkEnabled_CheckedChanged;
     }
 }
コード例 #2
0
        public SetupDialogForm()
        {
            try
            {
                InitializeComponent();

                util = new Util();
                TL   = OCSimulator.TL;

                numAveragePeriod.ValueChanged += numAveragePeriod_ValueChanged;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "SetupDialogForm");
            }
        }
コード例 #3
0
ファイル: Driver.cs プロジェクト: ytywytyw/ASCOMPlatform
        /// <summary>
        /// Initializes a new instance of the <see cref="OCSimulator"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public ObservingConditions()
        {
            try
            {
                TL = OCSimulator.TL;
                TL.LogMessage("ObservingConditions", "Starting initialisation");

                clientNumber = OCSimulator.GetUniqueClientNumber();
                TL.LogMessage(clientNumber, "ObservingConditions", "This instance's unique client number: " + clientNumber);

                TL.LogMessage(clientNumber, "ObservingConditions", "Completed initialisation");
            }
            catch (Exception ex)
            {
                TL.LogMessageCrLf("ObservingConditions", ex.ToString());
            }
        }
コード例 #4
0
        public SetupDialogForm()
        {
            try
            {
                InitializeComponent();

                numAveragePeriod.ValueChanged             += NumAveragePeriod_ValueChanged;
                numNumberOfReadingsToAverage.ValueChanged += NumNumberOfReadingsToAverage_ValueChanged;

                util = new Util();
                TL   = Hub.TL;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "SetupDialogForm");
            }
        }
コード例 #5
0
ファイル: OCSimulator.cs プロジェクト: jsabby/ASCOMPlatform
        /// <summary>
        /// Static initialiser to set up the objects we need at run time
        /// </summary>
        static OCSimulator()
        {
            try
            {
                // Create sensor objects ready to be populated from the Profile
                // This must be done before reading the Profile
                foreach (string Property in DriverProperties)
                {
                    Sensors.Add(Property, new Sensor(Property));
                }

                TL = new TraceLoggerPlus("", "OCSimulator"); // Trace state is set in ReadProfile, immediately after nbeing read fomr the Profile
                ReadProfile();                               // Read device configuration from the ASCOM Profile store

                TL.LogMessage("OCSimulator", "Simulator initialising");
                sensorQueryTimer            = new System.Timers.Timer();
                sensorQueryTimer.Elapsed   += RefreshTimer_Elapsed;
                averagePeriodTimer          = new System.Timers.Timer();
                averagePeriodTimer.Elapsed += AveragePeriodTimer_Elapsed;

                connectStates        = new ConcurrentDictionary <long, bool>();
                util                 = new Util(); // Create an  ASCOM Utilities object
                mostRecentUpdateTime = DateTime.Now;

                TL.LogMessage("OCSimulator", "Setting sensor initial values");
                foreach (string Property in SimulatedProperties)
                {
                    Sensors[Property].SimCurrentValue     = Sensors[Property].SimFromValue;
                    Sensors[Property].ValueCycleDirection = ValueCycleDirections.FromTowardsTo;
                    Sensors[Property].TimeOfLastUpdate    = DateTime.Now;
                }

                // Dew point is calculated from humidity so initialise that here
                Sensors[PROPERTY_DEWPOINT].IsImplemented    = Sensors[PROPERTY_HUMIDITY].IsImplemented;
                Sensors[PROPERTY_DEWPOINT].SimCurrentValue  = util.Humidity2DewPoint(Sensors[PROPERTY_HUMIDITY].SimCurrentValue, Sensors[PROPERTY_TEMPERATURE].SimCurrentValue);
                Sensors[PROPERTY_DEWPOINT].TimeOfLastUpdate = DateTime.Now;

                TL.LogMessage("OCSimulator", "Simulator initialisation complete.");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), "Error initialising the Observing Conditions Simulator", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
コード例 #6
0
ファイル: Driver.cs プロジェクト: ytywytyw/ASCOMPlatform
        /// <summary>
        /// Initializes a new instance of the <see cref="Hub"/> class.
        /// Must be public for COM registration.
        /// </summary>
        public ObservingConditions()
        {
            try
            {
                TL = Hub.TL;
                TL.LogMessage("ObservingConditions", "Starting initialisation");

                clientNumber = Hub.GetUniqueClientNumber();
                TL.LogMessage(clientNumber, "ObservingConditions", "This instance's unique client number: " + clientNumber);

                testMode      = false;
                testConnected = false;
                TL.LogMessage(clientNumber, "ObservingConditions", "Completed initialisation");
            }
            catch (Exception ex)
            {
                TL.LogMessageCrLf("ObservingConditions", ex.ToString());
            }
        }