コード例 #1
0
ファイル: Form1.cs プロジェクト: Dyl4n84/DART
        public MainWindow()
        {
            InitializeComponent();

            // Create a material theme manager and add the form to manage (this)
            MaterialSkinManager materialSkinManager = MaterialSkinManager.Instance;

            materialSkinManager.AddFormToManage(this);
            materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT;

            // Configure color schema
            materialSkinManager.ColorScheme = new ColorScheme(
                Primary.Blue400, Primary.LightBlue900,
                Primary.Blue500, Accent.Cyan700,
                TextShade.WHITE
                );

            /***** Trigger updateButton_click Event *****/
            string pathToSolution = @"C:\Users\User\Code\LabRatsProject\VisualStudio\NOAA_Monitor\VSProjectFiles";

            // Run python webscraping script
            run_cmd(pathToSolution + @"\scrape_NOAA_buoy.py");

            // Add timestamp to buoy data file name
            string updatedDataFile = timestampFile(pathToSolution + @"\bin\Debug\tmp.txt");

            // Read in new Buoy data
            Stations = readBuoyData(updatedDataFile);

            // Re-populate buoy data
            string stationNames =
                "PSBM1 CFWM1 44027 ATGM1 44034" +
                "MDRM1 44037 44033 MISM1 44032" +
                "44005 CASM1 44007 44030 WEQM1 WEXM1 WELM1";

            List <Buoy> .Enumerator stationIter = Stations.blist.GetEnumerator();
            Buoy tmpStation = new Buoy();

            ColumnHeader columnHeader1 = new ColumnHeader();

            columnHeader1.Text = "Station List";
            this.stationList.Columns.AddRange(new ColumnHeader[] { columnHeader1 });
            while (stationIter.MoveNext())
            {
                tmpStation = stationIter.Current;
                if (stationNames.Contains(tmpStation.getbname()) && !String.IsNullOrEmpty(tmpStation.getbname()))
                {
                    ListViewItem stationNameItems = new ListViewItem(tmpStation.getbname());
                    stationList.Items.Add(stationNameItems);
                }
            }
            stationList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: Dyl4n84/DART
        private void updateButton_Click(object sender, EventArgs e)
        {
            string pathToSolution = @"C:\Users\User\Code\LabRatsProject\VisualStudio\NOAA_Monitor\VSProjectFiles";

            // Run python webscraping script
            run_cmd(pathToSolution + @"\scrape_NOAA_buoy.py");

            // Add timestamp to buoy data file name
            string updatedDataFile = timestampFile(pathToSolution + @"\bin\Debug\tmp.txt");

            // Read in new Buoy data
            Stations = readBuoyData(updatedDataFile);

            // Re-populate buoy data
            string stationNames =
                "PSBM1 CFWM1 44027 ATGM1 44034 " +
                "MDRM1 44037 44033 MISM1 44032 " +
                "44005 CASM1 44007 44030 WEQM1 WEXM1 WELM1";

            List <Buoy> .Enumerator stationIter = Stations.blist.GetEnumerator();
            Buoy tmpStation = new Buoy();

            ColumnHeader columnHeader1 = new ColumnHeader();

            columnHeader1.Text = "Station List";
            this.stationList.Columns.AddRange(new ColumnHeader[] { columnHeader1 });
            while (stationIter.MoveNext())
            {
                tmpStation = stationIter.Current;
                if (stationNames.Contains(tmpStation.getbname()) && !String.IsNullOrEmpty(tmpStation.getbname()))
                {
                    ListViewItem stationNameItems = new ListViewItem(tmpStation.getbname());
                    stationList.Items.Add(stationNameItems);
                }
            }

            stationList.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);
        }
コード例 #3
0
ファイル: Form1.cs プロジェクト: Dyl4n84/DART
        private void stationList_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selectedStationName = "XXXXX";

            ListView.SelectedListViewItemCollection selectedStations = stationList.SelectedItems;
            if (selectedStations.Count > 0)
            {
                selectedStationName = selectedStations[0].Text;
            }

            /***** Display buoy data according to station name *****/
            // Get selected station name
            for (int i = 0; i < Stations.blist.Count; ++i)
            {
                if (Stations.blist[i].getbname() == selectedStationName)
                {
                    // Get Buoy from BuoyList
                    Buoy tmp = new Buoy();
                    tmp = Stations.blist[i];

                    // Write Buoy data to labels
                    label1.Text  = "Name: " + tmp.getbname();
                    label2.Text  = "Lat/Lon:" + tmp.getlatlon();
                    label3.Text  = "Wind Speed:" + tmp.getwindspeed();
                    label4.Text  = "Gust:" + tmp.getgustspeed();
                    label5.Text  = "Wave Height:" + tmp.getwaveheight();
                    label6.Text  = "Wave Direction:" + tmp.getwavedir();
                    label7.Text  = "Wave Period:" + tmp.getdomwave();
                    label8.Text  = "Mean Tide Level:" + tmp.gettide();
                    label9.Text  = "Sea level Pressure:" + tmp.getseapress();
                    label10.Text = "Pressure Change:" + tmp.getpressten();
                    label11.Text = "Sea Temp.:" + tmp.getseatemp();
                    label12.Text = "Air Temp.:" + tmp.getairtemp();
                    label13.Text = "Dew Point:" + tmp.getdewtemp();
                    label14.Text = "Visibility:" + tmp.getvis();
                }
            }

            changeStationPicture(selectedStationName);
        }
コード例 #4
0
ファイル: graphForm.cs プロジェクト: Dyl4n84/DART
        /**
         * This is the function for when the graph button is clicked on the graphingForm
         **/
        private void button1_Click(object sender, EventArgs e)
        {
            chart1.Series[0].Points.Clear();

            List <Buoy> .Enumerator data = Stations.blist.GetEnumerator();
            int stepper = 0;
            int graphSelection;

            graphSelection = comboBox1.SelectedIndex;

            switch (graphSelection)
            {
            //Wind Speed Graph
            case 0:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getwindspeed());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                windSpeedText();
                break;

            //Wind Direction Graph
            case 1:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getwinddirection());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                windDirectionText();
                break;

            //Dominant Wave Period Graph
            case 2:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getdomwave());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                dominantWavePeriodText();
                break;

            //Average Wave Period Graph
            case 3:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getavewave());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                averageWavePeriodText();
                break;

            //Sea Pressure Graph
            case 4:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getseapress());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                seaPressureText();
                break;

            //Air Tempreature Graph
            case 5:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getairtemp());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                airTemperatureText();
                break;

            //Sea Temperature Graph
            case 6:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getseatemp());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                seaTemperatureText();
                break;

            //Dew Temperature Graph
            case 7:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getdewtemp());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                dewTemperatureText();
                break;

            //Visibility Distance Graph
            case 8:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.getvis());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                visibilityText();
                break;

            //Tide Height Graph
            case 9:
                while (data.MoveNext())
                {
                    tmpBuoy = data.Current;
                    if (maineBuoys.Contains(tmpBuoy.getbname()) && !String.IsNullOrEmpty(tmpBuoy.getbname()))
                    {
                        chart1.Series[0].Points.AddY(tmpBuoy.gettide());
                        chart1.Series[0].Points[stepper].AxisLabel           = tmpBuoy.getbname();
                        chart1.Series[0].Points[stepper].IsValueShownAsLabel = true;
                        stepper++;
                    }
                }
                tideHeightText();
                break;

            default:
                break;
            }

            //Displays the series value to the chart area
            chart1.Series[0].ChartArea = "ChartArea1";

            //Displays each values buoy name as a corresponding x-axis value
            chart1.ChartAreas[0].AxisX.Interval = 1;

            //Explination for the 0 values in the chart
            textBox1.AppendText(Environment.NewLine + Environment.NewLine
                                + "*For all 0 values in the graph assume the buoy or land station did not take a reading");
        }