Example #1
0
 // class constructor logic here
 public ws2300bg(ContainerControl sender, Delegate senderDelegate, params object[] list)
 {
     m_sender         = sender;
     m_senderDelegate = senderDelegate;
     m_ws2300         = (WS2300base)list.GetValue(0);
     m_config         = (WS2300base.config_type)list.GetValue(1);
     m_variables      = (string)list.GetValue(2);
 }
Example #2
0
        /* Revision History
         * 1.0 2007-04-26 initial release
         * 2007-05-02 sample using threads
         * 2007-05-04 history using threads; history writes History.sql
         * 2007-05-07 graphics added
         * 2007-05-08 minor changes
         * 2007-05-11 history save to and read from a CSV file
         * 2007-05-13 Mean max min T_ext
         * 2007-05-14 Mean and mean of means T_ext
         * 2007-05-22 No line symbol; line color pickup
         * 2007-05-24 Open/Close COM
         * 2008-06-17 Converted to VS2008
         *            max/min/mean on each year (2007, 2008)
         *            comboBox to choice COM1, COM2,...COM6
         * 2008-11-25 read and reset min/max
         * 2008-12-19 set time scale to last 2 months
         * @@ TODO: read/write config values from an ini/cfg file
         */

        public WS2300()
        {
            InitializeComponent();
            this.Text = VER;
            config    = new WS2300base.config_type();
            // TODO: values to be read from a config file
            config.wind_speed_conv_factor = 1.0;                   // Speed dimention, m/s is default
            config.temperature_conv       = 0;                     // Temperature in Celsius
            config.rain_conv_factor       = 1.0;                   // Rain in mm
            config.pressure_conv_factor   = 1.0;                   // Pressure in hPa (same as millibar)
            config.history_log_type       = "csv";
            //config.history_log_type = "sql";
            config.port = "COM1";

            LogFile = Application.StartupPath + "\\History";
            if (config.history_log_type == "csv")
            {
                lblHistory.Text += ".csv";
                LogFile         += ".csv";
            }
            else
            {
                lblHistory.Text += ".sql";
                LogFile         += ".sql";
            }
            this.toolStripStatusLabel.Text = "Click on OPEN COM";
            lblIntTemp.Text = "";
            DateTime dt = this.dateTimePicker1.Value;
            long     s;

            // set max val all'ora precedente
            // s = 3600 + dt.Minute * 60 + dt.Second
            // set max val al minuto precedente
            s = 60 + dt.Second;
            this.dateTimePicker1.Value   = new DateTime(dt.Ticks - s * 10000000);
            this.dateTimePicker1.MaxDate = this.dateTimePicker1.Value;
        }