Example #1
0
        public SettingsForm(PersistentState state, InternetStreamingStatistics _internetStreamingStatistics)
        {
            if (null == state)
            {
                throw new ArgumentNullException("state");
            }
            State = state;
            InitializeComponent();

            var userGraphValues = (PersistentState.UserCalculatedAttribute[])Enum.GetValues(typeof(PersistentState.UserCalculatedAttribute));

            comboBoxEditUserGraph.Properties.Items.AddRange(userGraphValues);

            comboBoxEditTemp.Properties.Items.AddRange(Enum.GetValues(typeof(TemperatureUnit)));
            comboBoxEditPress.Properties.Items.AddRange(Enum.GetValues(typeof(PressureUnit)));
            comboBoxEditSpeed.Properties.Items.AddRange(Enum.GetValues(typeof(SpeedUnit)));

            SetValuesFromState();


            //rp
            //MessageBox.Show("statistic___ sended: "+_internetStreamingStatistics.m_StreamingServers[0].GetSendetPacekets() + " received" + _internetStreamingStatistics.m_StreamingServers[0].GetReadedPacekets() );
            label_statistic_incomming_packets.Text = "" + _internetStreamingStatistics.m_StreamingServers[0].GetReadedPacekets();
            label_statistic_sendet_packets.Text    = "" + _internetStreamingStatistics.m_StreamingServers[0].GetSendetPacekets();
        }
Example #2
0
        public SettingsForm(PersistentState state, InternetStreamingStatistics _internetStreamingStatistics)
        {
            if(null == state) {
                throw new ArgumentNullException("state");
            }
            State = state;
            InitializeComponent();

            var userGraphValues = (PersistentState.UserCalculatedAttribute[])Enum.GetValues(typeof (PersistentState.UserCalculatedAttribute));
            comboBoxEditUserGraph.Properties.Items.AddRange(userGraphValues);

            comboBoxEditTemp.Properties.Items.AddRange(Enum.GetValues(typeof(TemperatureUnit)));
            comboBoxEditPress.Properties.Items.AddRange(Enum.GetValues(typeof(PressureUnit)));
            comboBoxEditSpeed.Properties.Items.AddRange(Enum.GetValues(typeof(SpeedUnit)));

            SetValuesFromState();

            //rp
            //MessageBox.Show("statistic___ sended: "+_internetStreamingStatistics.m_StreamingServers[0].GetSendetPacekets() + " received" + _internetStreamingStatistics.m_StreamingServers[0].GetReadedPacekets() );
            label_statistic_incomming_packets.Text = ""+_internetStreamingStatistics.m_StreamingServers[0].GetReadedPacekets();
            label_statistic_sendet_packets.Text = "" + _internetStreamingStatistics.m_StreamingServers[0].GetSendetPacekets();
        }
Example #3
0
        public MainForm(ProgramContext appContext)
        {
            if (null == appContext) {
                throw new ArgumentNullException();
            }

            AppContext = appContext;
            InitializeComponent();

            timerWU = new System.Timers.Timer();
            timerWU.Interval = 5000; //pov2500
            timerWU.Elapsed += new System.Timers.ElapsedEventHandler(OnTimedEventWU);
            timerWU.Enabled = false;
            timerWU.Start();

            _advancedSensorValues = new AdvancedSensorValues[10];
            _advancedSensorValues[0] = new AdvancedSensorValues();
            _advancedSensorValues[1] = new AdvancedSensorValues();
            _advancedSensorValues[2] = new AdvancedSensorValues();
            _advancedSensorValues[3] = new AdvancedSensorValues();
            _advancedSensorValues[4] = new AdvancedSensorValues();
            _advancedSensorValues[5] = new AdvancedSensorValues();
            _advancedSensorValues[6] = new AdvancedSensorValues();
            _advancedSensorValues[7] = new AdvancedSensorValues();
            _advancedSensorValues[8] = new AdvancedSensorValues();
            _advancedSensorValues[9] = new AdvancedSensorValues();

            Text = ProgramContext.ProgramFriendlyName;

            ConverterCache = ReadingValuesConverterCache<IReadingValues, ReadingValues>.Default;
            ConverterCacheReadingValues = ReadingValuesConverterCache<ReadingValues>.Default;
            ConverterCacheReadingAggregate = ReadingValuesConverterCache<ReadingAggregate>.Default;
            liveAtmosphericGraph.ConverterCacheReadingValues = ConverterCacheReadingValues;

            _deviceConnection = new UsbDaqConnection(); // new Demo.DemoDaqConnection();

            // create the DB file using the application privilages instead of using the installer
            if (!File.Exists(DatabaseFileName)) {
                using(var dbTemplateDataStream = typeof (DbDataStore).Assembly.GetManifestResourceStream("Atmo." + DatabaseFileName))
                using(var outDbTemplate = File.Create(DatabaseFileName)) {
                    var buffer = new byte[1024];
                    int totalRead;
                    while(0 < (totalRead = dbTemplateDataStream.Read(buffer, 0, buffer.Length)))
                        outDbTemplate.Write(buffer,0, totalRead);
                }

                Thread.Sleep(250); // just to be safe
                Log.InfoFormat("Core DB file created at: {0}", Path.GetFullPath(DatabaseFileName));
            }
            try {
                _dbConnection = new System.Data.SQLite.SQLiteConnection(
                    @"data source=" + DatabaseFileName + @";page size=4096;cache size=4000;journal mode=Off");
                _dbConnection.Open();
            }
            catch(Exception ex) {
                Log.Error("Database connection failure.", ex);
                throw;
            }
            _dbStore = new DbDataStore(_dbConnection);

            _memoryDataStore = new MemoryDataStore();

            _sensorViewPanelControler = new SensorViewPanelController(groupControlSensors) {
                DefaultSelected = true
            };
            _historicSensorViewPanelController = new HistoricSensorViewPanelController(groupControlDbList) {
                DefaultSelected = true,
            };
            _historicSensorViewPanelController.OnDeleteRequested += OnDeleteRequested;
            _historicSensorViewPanelController.OnRenameRequested += OnRenameRequested;

            historicalTimeSelectHeader.CheckEdit.CheckedChanged += histNowChk_CheckedChanged;

            historicalTimeSelectHeader.TimeRange.SelectedIndex = historicalTimeSelectHeader.TimeRange.FindNearestIndex(AppContext.PersistentState.HistoricalTimeScale);
            liveAtmosphericHeader.TimeRange.SelectedIndex = liveAtmosphericHeader.TimeRange.FindNearestIndex(AppContext.PersistentState.LiveTimeScale);

            historicalTimeSelectHeader.TimeRange.ValueChanged += historicalTimeSelectHeader_TimeRangeValueChanged;
            liveAtmosphericHeader.TimeRange.ValueChanged += liveTimeSelectHeader_TimeRangeValueChanged;

            foreach(var view in _historicSensorViewPanelController.Views.Where(v => null != v)) {
                bool selected = false;
                if(
                    null != view.SensorInfo
                    && AppContext.PersistentState.SelectedDatabases.Contains(view.SensorInfo.Name)
                ) {
                    selected = true;
                }
                view.IsSelected = selected;
            }

            //HandleRapidFireSetup();
            HandleDaqTemperatureSourceSet(_deviceConnection.UsingDaqTemp);

            //rp
            HandleWFSetup();

            //rp
            HandleAWSetup();

            //rp
            HandleWeatherSetup();

            //rp
            _internetStreamingStatistics = new InternetStreamingStatistics();

            ReloadHistoric();
            _historicSensorViewPanelController.OnSelectionChanged += RequestHistoricalUpdate;
            historicalGraphBreakdown.OnSelectedPropertyChanged += RequestHistoricalUpdate;
            historicalTimeSelectHeader.OnTimeRangeChanged += RequestHistoricalUpdate;
            windResourceGraph.OnWeibullParamChanged += RequestHistoricalUpdate;
            #if DEBUG
            barSubItemDebug.Visibility = DevExpress.XtraBars.BarItemVisibility.Always;
            #endif
        }