public void LoadingDataDrawPanel() { int tabIndex = 0; SuspendLayout(); // // ChooseDataSourceMessage // if (DataloadingMessage == null) { DataloadingMessage = new System.Windows.Forms.Label(); } DataloadingMessage.Name = "DataloadingMessage"; DataloadingMessage.AutoSize = false; DataloadingMessage.TabIndex = tabIndex++; DataloadingMessage.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); DataloadingMessage.Text = "Loading data, please wait..."; DataloadingMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; Controls.Add(DataloadingMessage); // // DataLoadProgressBar1 // if (DataLoadProgressBar1 == null) { DataLoadProgressBar1 = new ProgressBar(); } DataLoadProgressBar1.Location = new System.Drawing.Point(192, 180); DataLoadProgressBar1.Name = "DataLoadProgressBar1"; DataLoadProgressBar1.Size = new System.Drawing.Size(235, 23); DataLoadProgressBar1.TabIndex = tabIndex++; DataLoadProgressBar1.Value = 0; Controls.Add(DataLoadProgressBar1); // // DataLoadProgressBar1 // if (DataloadingErrorMessage == null) { DataloadingErrorMessage = new System.Windows.Forms.Label(); } DataloadingErrorMessage.Name = "DataloadingErrorMessage"; DataloadingErrorMessage.AutoSize = false; DataloadingErrorMessage.TabIndex = tabIndex++; DataloadingErrorMessage.Text = ""; DataloadingErrorMessage.Visible = false; DataloadingErrorMessage.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; Controls.Add(DataloadingErrorMessage); LoadingDataPanelResize(); ResumeLayout(false); NextButton.Visible = true; NextButton.Enabled = false; PrevButton.Visible = true; PrevButton.TabIndex = tabIndex++; NextButton.TabIndex = tabIndex++; if (FromFileRadioButton.Checked) { DataloadingMessage.Text = "Loading data from file, please wait..."; CSVDataloadProcess = new BackgroundWorker(); CSVDataloadProcess.WorkerReportsProgress = true; CSVDataloadProcess.DoWork += new DoWorkEventHandler(CSVDataloadProcess_DoWork); CSVDataloadProcess.RunWorkerCompleted += new RunWorkerCompletedEventHandler(CSVDataloadProcess_completed); CSVDataloadProcess.ProgressChanged += new ProgressChangedEventHandler(CSVDataloadProcess_ProgressChanged); CSVDataloadProcess.RunWorkerAsync(null); } else if (FromDeviceRadioButton.Checked) { DataloadingMessage.Text = "Loading data from device, please wait..."; ChoosedWeighScale.LoadDataLogger(DataloggerLoadCompleted, DataloggerLoadProgress, false); } }
public void MonitorPanelDrawPanel() { int tabIndex = 0; SuspendLayout(); // // WarningResetMessage1 // if (MonitorMessage1 == null) { MonitorMessage1 = new System.Windows.Forms.Label(); } MonitorMessage1.Name = "MonitorMessage1"; MonitorMessage1.AutoSize = false; MonitorMessage1.TabIndex = tabIndex++; MonitorMessage1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); MonitorMessage1.Text = "Your device is gathering data at 0.1Hz, let the process run for several days to make sure that day/night temperature cycles are captured, then use this utility to analyze it and compute Temperature compensation. " + (RadioBtMonitor.Checked? " Once datalogger is loaded, you can export data at any time. ":"") + "Click on next to go back to the welcome page. You can also close this application, the capture process will still run in background."; MonitorMessage1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); Controls.Add(MonitorMessage1); if (MonitorGraphContainer == null) { MonitorGraphContainer = new PictureBox(); } MonitorGraphContainer.Name = "MonitorGraphContainer"; MonitorGraphContainer.TabIndex = tabIndex++; Controls.Add(MonitorGraphContainer); // // Export button // if (ExportButton == null) { ExportButton = new Button(); } this.ExportButton.Name = "ExportButton"; this.ExportButton.AutoSize = false; this.ExportButton.Size = new Size(75, 23); this.ExportButton.TabIndex = tabIndex++; this.ExportButton.Text = "Export.."; this.ExportButton.UseVisualStyleBackColor = true; this.ExportButton.Click += ExportButton_Click; ExportButton.Enabled = false; Controls.Add(ExportButton); ResumeLayout(false); NextButton.Visible = true; NextButton.Enabled = true; PrevButton.Visible = false; PrevButton.TabIndex = tabIndex++; NextButton.TabIndex = tabIndex++; MonitorPanelResize(); MonitorGraph = new YGraph(MonitorGraphContainer, null); MonitorGraph.DisableRedraw(); YAxis wAxis = MonitorGraph.addYAxis(); wAxis.showGrid = true; wAxis.visible = true; wAxis.legend.title = "Weight (" + ChoosedWeighScale.sensor.get_unit() + ")"; wAxis.highlightZero = true; YAxis tAxis = MonitorGraph.addYAxis(); tAxis.visible = true; tAxis.legend.title = "Temperature (" + ChoosedWeighScale.tsensor.get_unit() + ")"; tAxis.position = YAxis.HrzPosition.RIGHT; MonitorGraph.navigator.enabled = true; MonitorGraph.navigator.relativeheight = 12; MonitorGraph.xAxis.showGrid = true; monitor_wData = MonitorGraph.addSerie(); monitor_wData.yAxisIndex = wAxis.index; monitor_wData.color = Color.DarkBlue; wAxis.legend.font.color = monitor_wData.color; monitor_tData = MonitorGraph.addSerie(); monitor_tData.yAxisIndex = tAxis.index; monitor_tData.color = Color.DarkRed; tAxis.legend.font.color = monitor_tData.color; progressPanel = MonitorGraph.addDataPanel(); progressPanel.horizontalPosition = DataPanel.HorizontalPosition.RIGHTBORDER; progressPanel.verticalPosition = DataPanel.VerticalPosition.TOPBORDER; progressPanel.horizontalMargin = 5; progressPanel.verticalMargin = 5; progressPanel.panelHrzAlign = DataPanel.HorizontalAlign.LEFTOF; progressPanel.panelVrtAlign = DataPanel.VerticalAlign.BELOW; progressPanel.borderColor = Color.Black; progressPanel.borderthickness = 1; progressPanel.enabled = true; MonitorGraph.AllowRedraw(); WeightData = new List <pointXY>(); TempData = new List <pointXY>(); ChoosedWeighScale.genericSensor.registerTimedReportCallback(newGenericSensorData); ChoosedWeighScale.tsensor.registerTimedReportCallback(newTempSensorData); //MonitorLoadProgress(0); ChoosedWeighScale.LoadDataLogger(MonitorLoadCompleted, MonitorLoadProgress, true); }