Changeset - 105a3022c22b
[Not reviewed]
default
0 2 0
mkanning@CL-ENS241-10.cedarville.edu - 13 years ago 2013-02-21 15:29:54
mkanning@CL-ENS241-10.cedarville.edu
fixed the chart cross threading issue, renamed items on form
2 files changed with 52 insertions and 14 deletions:
0 comments (0 inline, 0 general)
Demo.WindowsForms/Forms/MainForm.Designer.cs
Show inline comments
 
@@ -1173,771 +1173,771 @@
 
            this.textBoxCacheSize.Size = new System.Drawing.Size(220, 28);
 
            this.textBoxCacheSize.TabIndex = 49;
 
            this.textBoxCacheSize.Text = "...";
 
            // 
 
            // textBoxCacheStatus
 
            // 
 
            this.textBoxCacheStatus.Dock = System.Windows.Forms.DockStyle.Top;
 
            this.textBoxCacheStatus.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
 
            this.textBoxCacheStatus.Location = new System.Drawing.Point(18, 301);
 
            this.textBoxCacheStatus.Name = "textBoxCacheStatus";
 
            this.textBoxCacheStatus.ReadOnly = true;
 
            this.textBoxCacheStatus.Size = new System.Drawing.Size(220, 28);
 
            this.textBoxCacheStatus.TabIndex = 46;
 
            this.textBoxCacheStatus.Text = "...";
 
            // 
 
            // button10
 
            // 
 
            this.button10.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.button10.Location = new System.Drawing.Point(18, 19);
 
            this.button10.Name = "button10";
 
            this.button10.Size = new System.Drawing.Size(220, 20);
 
            this.button10.TabIndex = 5;
 
            this.button10.Text = "Import";
 
            this.button10.UseVisualStyleBackColor = true;
 
            // 
 
            // textBoxMemory
 
            // 
 
            this.textBoxMemory.Dock = System.Windows.Forms.DockStyle.Top;
 
            this.textBoxMemory.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
 
            this.textBoxMemory.Location = new System.Drawing.Point(18, 175);
 
            this.textBoxMemory.Name = "textBoxMemory";
 
            this.textBoxMemory.ReadOnly = true;
 
            this.textBoxMemory.Size = new System.Drawing.Size(220, 28);
 
            this.textBoxMemory.TabIndex = 39;
 
            this.textBoxMemory.Text = "...";
 
            // 
 
            // checkBoxUseRouteCache
 
            // 
 
            this.checkBoxUseRouteCache.AutoSize = true;
 
            this.checkBoxUseRouteCache.Checked = true;
 
            this.checkBoxUseRouteCache.CheckState = System.Windows.Forms.CheckState.Checked;
 
            this.checkBoxUseRouteCache.Location = new System.Drawing.Point(18, 351);
 
            this.checkBoxUseRouteCache.Name = "checkBoxUseRouteCache";
 
            this.checkBoxUseRouteCache.Size = new System.Drawing.Size(160, 17);
 
            this.checkBoxUseRouteCache.TabIndex = 2;
 
            this.checkBoxUseRouteCache.Text = "cache routing/geocodig/etc";
 
            this.checkBoxUseRouteCache.UseVisualStyleBackColor = true;
 
            // 
 
            // button9
 
            // 
 
            this.button9.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.button9.Location = new System.Drawing.Point(18, 45);
 
            this.button9.Name = "button9";
 
            this.button9.Size = new System.Drawing.Size(220, 20);
 
            this.button9.TabIndex = 4;
 
            this.button9.Text = "Export";
 
            this.button9.UseVisualStyleBackColor = true;
 
            // 
 
            // button11
 
            // 
 
            this.button11.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.button11.Location = new System.Drawing.Point(18, 71);
 
            this.button11.Name = "button11";
 
            this.button11.Size = new System.Drawing.Size(220, 20);
 
            this.button11.TabIndex = 38;
 
            this.button11.Text = "Prefetch selected area";
 
            this.button11.UseVisualStyleBackColor = true;
 
            // 
 
            // label10
 
            // 
 
            this.label10.AutoSize = true;
 
            this.label10.Location = new System.Drawing.Point(18, 159);
 
            this.label10.Name = "label10";
 
            this.label10.Size = new System.Drawing.Size(111, 13);
 
            this.label10.TabIndex = 40;
 
            this.label10.Text = "memory cache usage:";
 
            // 
 
            // button2
 
            // 
 
            this.button2.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.button2.Location = new System.Drawing.Point(18, 97);
 
            this.button2.Name = "button2";
 
            this.button2.Size = new System.Drawing.Size(220, 20);
 
            this.button2.TabIndex = 43;
 
            this.button2.Text = "Clear tiles in disk cache";
 
            this.button2.UseVisualStyleBackColor = true;
 
            // 
 
            // label13
 
            // 
 
            this.label13.AutoSize = true;
 
            this.label13.Location = new System.Drawing.Point(18, 285);
 
            this.label13.Name = "label13";
 
            this.label13.Size = new System.Drawing.Size(93, 13);
 
            this.label13.TabIndex = 44;
 
            this.label13.Text = "disk cache status:";
 
            // 
 
            // label14
 
            // 
 
            this.label14.AutoSize = true;
 
            this.label14.Location = new System.Drawing.Point(18, 222);
 
            this.label14.Name = "label14";
 
            this.label14.Size = new System.Drawing.Size(83, 13);
 
            this.label14.TabIndex = 47;
 
            this.label14.Text = "disk cache size:";
 
            // 
 
            // button17
 
            // 
 
            this.button17.Dock = System.Windows.Forms.DockStyle.Fill;
 
            this.button17.Location = new System.Drawing.Point(17, 122);
 
            this.button17.Margin = new System.Windows.Forms.Padding(2);
 
            this.button17.Name = "button17";
 
            this.button17.Size = new System.Drawing.Size(222, 19);
 
            this.button17.TabIndex = 50;
 
            this.button17.Text = "Open cache location";
 
            this.button17.UseVisualStyleBackColor = true;
 
            // 
 
            // tabControl
 
            // 
 
            this.tabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.tabControl.Controls.Add(this.tabMap);
 
            this.tabControl.Controls.Add(this.tabGraphs);
 
            this.tabControl.Controls.Add(this.tabData);
 
            this.tabControl.Location = new System.Drawing.Point(0, 0);
 
            this.tabControl.Name = "tabControl";
 
            this.tabControl.SelectedIndex = 0;
 
            this.tabControl.Size = new System.Drawing.Size(871, 451);
 
            this.tabControl.TabIndex = 45;
 
            // 
 
            // tabGraphs
 
            // 
 
            this.tabGraphs.Controls.Add(this.pnlDataListDisplay);
 
            this.tabGraphs.Controls.Add(this.ctnParentChartHolder);
 
            this.tabGraphs.Location = new System.Drawing.Point(4, 22);
 
            this.tabGraphs.Name = "tabGraphs";
 
            this.tabGraphs.Padding = new System.Windows.Forms.Padding(3);
 
            this.tabGraphs.Size = new System.Drawing.Size(863, 425);
 
            this.tabGraphs.TabIndex = 2;
 
            this.tabGraphs.Text = "Graphs";
 
            this.tabGraphs.UseVisualStyleBackColor = true;
 
            // 
 
            // pnlDataListDisplay
 
            // 
 
            this.pnlDataListDisplay.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.pnlDataListDisplay.Controls.Add(this.tboxChartData);
 
            this.pnlDataListDisplay.Controls.Add(this.lblChartData);
 
            this.pnlDataListDisplay.Controls.Add(this.tboxCurrent);
 
            this.pnlDataListDisplay.Controls.Add(this.lblCurrent);
 
            this.pnlDataListDisplay.Controls.Add(this.tboxMin);
 
            this.pnlDataListDisplay.Controls.Add(this.lblAverage);
 
            this.pnlDataListDisplay.Controls.Add(this.tboxMax);
 
            this.pnlDataListDisplay.Controls.Add(this.lblMax);
 
            this.pnlDataListDisplay.Controls.Add(this.tboxAverage);
 
            this.pnlDataListDisplay.Controls.Add(this.lblMin);
 
            this.pnlDataListDisplay.Location = new System.Drawing.Point(6, 6);
 
            this.pnlDataListDisplay.Name = "pnlDataListDisplay";
 
            this.pnlDataListDisplay.Size = new System.Drawing.Size(851, 26);
 
            this.pnlDataListDisplay.TabIndex = 29;
 
            // 
 
            // tboxChartData
 
            // 
 
            this.tboxChartData.Enabled = false;
 
            this.tboxChartData.Location = new System.Drawing.Point(85, 3);
 
            this.tboxChartData.Name = "tboxChartData";
 
            this.tboxChartData.Size = new System.Drawing.Size(100, 20);
 
            this.tboxChartData.TabIndex = 29;
 
            // 
 
            // lblChartData
 
            // 
 
            this.lblChartData.AutoSize = true;
 
            this.lblChartData.Location = new System.Drawing.Point(3, 6);
 
            this.lblChartData.Name = "lblChartData";
 
            this.lblChartData.Size = new System.Drawing.Size(76, 13);
 
            this.lblChartData.TabIndex = 28;
 
            this.lblChartData.Text = "Data for Chart:";
 
            // 
 
            // tboxCurrent
 
            // 
 
            this.tboxCurrent.Enabled = false;
 
            this.tboxCurrent.Location = new System.Drawing.Point(241, 3);
 
            this.tboxCurrent.Name = "tboxCurrent";
 
            this.tboxCurrent.Size = new System.Drawing.Size(100, 20);
 
            this.tboxCurrent.TabIndex = 24;
 
            // 
 
            // lblCurrent
 
            // 
 
            this.lblCurrent.AutoSize = true;
 
            this.lblCurrent.Location = new System.Drawing.Point(191, 6);
 
            this.lblCurrent.Name = "lblCurrent";
 
            this.lblCurrent.Size = new System.Drawing.Size(44, 13);
 
            this.lblCurrent.TabIndex = 20;
 
            this.lblCurrent.Text = "Current:";
 
            // 
 
            // tboxMin
 
            // 
 
            this.tboxMin.BackColor = System.Drawing.SystemColors.Window;
 
            this.tboxMin.Enabled = false;
 
            this.tboxMin.ForeColor = System.Drawing.SystemColors.WindowText;
 
            this.tboxMin.Location = new System.Drawing.Point(684, 3);
 
            this.tboxMin.Name = "tboxMin";
 
            this.tboxMin.Size = new System.Drawing.Size(100, 20);
 
            this.tboxMin.TabIndex = 27;
 
            // 
 
            // lblAverage
 
            // 
 
            this.lblAverage.AutoSize = true;
 
            this.lblAverage.Location = new System.Drawing.Point(347, 6);
 
            this.lblAverage.Name = "lblAverage";
 
            this.lblAverage.Size = new System.Drawing.Size(50, 13);
 
            this.lblAverage.TabIndex = 21;
 
            this.lblAverage.Text = "Average:";
 
            // 
 
            // tboxMax
 
            // 
 
            this.tboxMax.Enabled = false;
 
            this.tboxMax.Location = new System.Drawing.Point(545, 3);
 
            this.tboxMax.Name = "tboxMax";
 
            this.tboxMax.Size = new System.Drawing.Size(100, 20);
 
            this.tboxMax.TabIndex = 26;
 
            // 
 
            // lblMax
 
            // 
 
            this.lblMax.AutoSize = true;
 
            this.lblMax.Location = new System.Drawing.Point(509, 6);
 
            this.lblMax.Name = "lblMax";
 
            this.lblMax.Size = new System.Drawing.Size(30, 13);
 
            this.lblMax.TabIndex = 22;
 
            this.lblMax.Text = "Max:";
 
            // 
 
            // tboxAverage
 
            // 
 
            this.tboxAverage.Enabled = false;
 
            this.tboxAverage.Location = new System.Drawing.Point(403, 3);
 
            this.tboxAverage.Name = "tboxAverage";
 
            this.tboxAverage.Size = new System.Drawing.Size(100, 20);
 
            this.tboxAverage.TabIndex = 25;
 
            // 
 
            // lblMin
 
            // 
 
            this.lblMin.AutoSize = true;
 
            this.lblMin.Location = new System.Drawing.Point(651, 6);
 
            this.lblMin.Name = "lblMin";
 
            this.lblMin.Size = new System.Drawing.Size(27, 13);
 
            this.lblMin.TabIndex = 23;
 
            this.lblMin.Text = "Min:";
 
            // 
 
            // ctnParentChartHolder
 
            // 
 
            this.ctnParentChartHolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.ctnParentChartHolder.Location = new System.Drawing.Point(6, 38);
 
            this.ctnParentChartHolder.Name = "ctnParentChartHolder";
 
            this.ctnParentChartHolder.Orientation = System.Windows.Forms.Orientation.Horizontal;
 
            // 
 
            // ctnParentChartHolder.Panel1
 
            // 
 
            this.ctnParentChartHolder.Panel1.Controls.Add(this.ctnTopChartHolder);
 
            // 
 
            // ctnParentChartHolder.Panel2
 
            // 
 
            this.ctnParentChartHolder.Panel2.Controls.Add(this.ctnBottomChartHolder);
 
            this.ctnParentChartHolder.Size = new System.Drawing.Size(851, 381);
 
            this.ctnParentChartHolder.SplitterDistance = 170;
 
            this.ctnParentChartHolder.TabIndex = 28;
 
            // 
 
            // ctnTopChartHolder
 
            // 
 
            this.ctnTopChartHolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.ctnTopChartHolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
 
            this.ctnTopChartHolder.Location = new System.Drawing.Point(3, 3);
 
            this.ctnTopChartHolder.Name = "ctnTopChartHolder";
 
            // 
 
            // ctnTopChartHolder.Panel1
 
            // 
 
            this.ctnTopChartHolder.Panel1.Controls.Add(this.lblTopLeftChartTitle);
 
            this.ctnTopChartHolder.Panel1.Controls.Add(this.chrtTopLeft);
 
            // 
 
            // ctnTopChartHolder.Panel2
 
            // 
 
            this.ctnTopChartHolder.Panel2.Controls.Add(this.lblTopRightChartTitle);
 
            this.ctnTopChartHolder.Panel2.Controls.Add(this.chrtTopRight);
 
            this.ctnTopChartHolder.Size = new System.Drawing.Size(845, 164);
 
            this.ctnTopChartHolder.SplitterDistance = 407;
 
            this.ctnTopChartHolder.TabIndex = 0;
 
            // 
 
            // lblTopLeftChartTitle
 
            // 
 
            this.lblTopLeftChartTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
 
            this.lblTopLeftChartTitle.AutoSize = true;
 
            this.lblTopLeftChartTitle.Location = new System.Drawing.Point(0, 149);
 
            this.lblTopLeftChartTitle.Name = "lblTopLeftChartTitle";
 
            this.lblTopLeftChartTitle.Size = new System.Drawing.Size(42, 13);
 
            this.lblTopLeftChartTitle.TabIndex = 2;
 
            this.lblTopLeftChartTitle.Text = "Altitude";
 
            // 
 
            // chrtTopLeft
 
            // 
 
            this.chrtTopLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.chrtTopLeft.Location = new System.Drawing.Point(3, 3);
 
            this.chrtTopLeft.Name = "chrtTopLeft";
 
            this.chrtTopLeft.Size = new System.Drawing.Size(399, 156);
 
            this.chrtTopLeft.TabIndex = 1;
 
            this.chrtTopLeft.Text = "chart4";
 
            this.chrtTopLeft.Click += new System.EventHandler(this.chrtTopLeft_Click);
 
            // 
 
            // lblTopRightChartTitle
 
            // 
 
            this.lblTopRightChartTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
 
            this.lblTopRightChartTitle.AutoSize = true;
 
            this.lblTopRightChartTitle.Location = new System.Drawing.Point(0, 149);
 
            this.lblTopRightChartTitle.Name = "lblTopRightChartTitle";
 
            this.lblTopRightChartTitle.Size = new System.Drawing.Size(47, 13);
 
            this.lblTopRightChartTitle.TabIndex = 1;
 
            this.lblTopRightChartTitle.Text = "Humidity";
 
            // 
 
            // chrtTopRight
 
            // 
 
            this.chrtTopRight.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.chrtTopRight.Location = new System.Drawing.Point(3, 3);
 
            this.chrtTopRight.Name = "chrtTopRight";
 
            this.chrtTopRight.Size = new System.Drawing.Size(426, 156);
 
            this.chrtTopRight.TabIndex = 0;
 
            this.chrtTopRight.Text = "chart4";
 
            this.chrtTopRight.Click += new System.EventHandler(this.chrtTopRight_Click);
 
            // 
 
            // ctnBottomChartHolder
 
            // 
 
            this.ctnBottomChartHolder.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.ctnBottomChartHolder.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
 
            this.ctnBottomChartHolder.Location = new System.Drawing.Point(3, 3);
 
            this.ctnBottomChartHolder.Name = "ctnBottomChartHolder";
 
            // 
 
            // ctnBottomChartHolder.Panel1
 
            // 
 
            this.ctnBottomChartHolder.Panel1.Controls.Add(this.lblBottomLeftChartTitle);
 
            this.ctnBottomChartHolder.Panel1.Controls.Add(this.chrtBottomLeft);
 
            // 
 
            // ctnBottomChartHolder.Panel2
 
            // 
 
            this.ctnBottomChartHolder.Panel2.Controls.Add(this.lblBottomRightChartTitle);
 
            this.ctnBottomChartHolder.Panel2.Controls.Add(this.chrtBottomRight);
 
            this.ctnBottomChartHolder.Size = new System.Drawing.Size(845, 201);
 
            this.ctnBottomChartHolder.SplitterDistance = 407;
 
            this.ctnBottomChartHolder.TabIndex = 0;
 
            // 
 
            // lblBottomLeftChartTitle
 
            // 
 
            this.lblBottomLeftChartTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
 
            this.lblBottomLeftChartTitle.AutoSize = true;
 
            this.lblBottomLeftChartTitle.Location = new System.Drawing.Point(0, 186);
 
            this.lblBottomLeftChartTitle.Name = "lblBottomLeftChartTitle";
 
            this.lblBottomLeftChartTitle.Size = new System.Drawing.Size(48, 13);
 
            this.lblBottomLeftChartTitle.TabIndex = 1;
 
            this.lblBottomLeftChartTitle.Text = "Pressure";
 
            // 
 
            // chrtBottomLeft
 
            // 
 
            this.chrtBottomLeft.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.chrtBottomLeft.Location = new System.Drawing.Point(3, -1);
 
            this.chrtBottomLeft.Name = "chrtBottomLeft";
 
            this.chrtBottomLeft.Size = new System.Drawing.Size(399, 197);
 
            this.chrtBottomLeft.TabIndex = 0;
 
            this.chrtBottomLeft.Text = "chart2";
 
            this.chrtBottomLeft.Click += new System.EventHandler(this.chrtBottomLeft_Click);
 
            // 
 
            // lblBottomRightChartTitle
 
            // 
 
            this.lblBottomRightChartTitle.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
 
            this.lblBottomRightChartTitle.AutoSize = true;
 
            this.lblBottomRightChartTitle.Location = new System.Drawing.Point(0, 186);
 
            this.lblBottomRightChartTitle.Name = "lblBottomRightChartTitle";
 
            this.lblBottomRightChartTitle.Size = new System.Drawing.Size(28, 13);
 
            this.lblBottomRightChartTitle.Size = new System.Drawing.Size(44, 13);
 
            this.lblBottomRightChartTitle.TabIndex = 2;
 
            this.lblBottomRightChartTitle.Text = "Map";
 
            this.lblBottomRightChartTitle.Text = "Velocity";
 
            // 
 
            // chrtBottomRight
 
            // 
 
            this.chrtBottomRight.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
 
            | System.Windows.Forms.AnchorStyles.Left) 
 
            | System.Windows.Forms.AnchorStyles.Right)));
 
            this.chrtBottomRight.Location = new System.Drawing.Point(3, -1);
 
            this.chrtBottomRight.Name = "chrtBottomRight";
 
            this.chrtBottomRight.Size = new System.Drawing.Size(426, 197);
 
            this.chrtBottomRight.TabIndex = 1;
 
            this.chrtBottomRight.Text = "chart2";
 
            this.chrtBottomRight.Click += new System.EventHandler(this.chrtBottomRight_Click);
 
            // 
 
            // tabData
 
            // 
 
            this.tabData.Controls.Add(this.gboxSlaveData);
 
            this.tabData.Controls.Add(this.gboxMasterData);
 
            this.tabData.Location = new System.Drawing.Point(4, 22);
 
            this.tabData.Name = "tabData";
 
            this.tabData.Padding = new System.Windows.Forms.Padding(10);
 
            this.tabData.Size = new System.Drawing.Size(863, 425);
 
            this.tabData.TabIndex = 3;
 
            this.tabData.Text = "Data";
 
            this.tabData.UseVisualStyleBackColor = true;
 
            // 
 
            // gboxSlaveData
 
            // 
 
            this.gboxSlaveData.Controls.Add(this.textBox16);
 
            this.gboxSlaveData.Controls.Add(this.label26);
 
            this.gboxSlaveData.Controls.Add(this.textBox17);
 
            this.gboxSlaveData.Controls.Add(this.label27);
 
            this.gboxSlaveData.Controls.Add(this.label28);
 
            this.gboxSlaveData.Controls.Add(this.textBox15);
 
            this.gboxSlaveData.Controls.Add(this.label25);
 
            this.gboxSlaveData.Controls.Add(this.textBox14);
 
            this.gboxSlaveData.Controls.Add(this.label24);
 
            this.gboxSlaveData.Controls.Add(this.textBox13);
 
            this.gboxSlaveData.Controls.Add(this.label23);
 
            this.gboxSlaveData.Controls.Add(this.label22);
 
            this.gboxSlaveData.Controls.Add(this.textBox12);
 
            this.gboxSlaveData.Controls.Add(this.label21);
 
            this.gboxSlaveData.Controls.Add(this.textBox11);
 
            this.gboxSlaveData.Controls.Add(this.label19);
 
            this.gboxSlaveData.Controls.Add(this.textBox10);
 
            this.gboxSlaveData.Controls.Add(this.label18);
 
            this.gboxSlaveData.Controls.Add(this.textBox9);
 
            this.gboxSlaveData.Controls.Add(this.label17);
 
            this.gboxSlaveData.Controls.Add(this.textBox8);
 
            this.gboxSlaveData.Controls.Add(this.label15);
 
            this.gboxSlaveData.Controls.Add(this.textBox7);
 
            this.gboxSlaveData.Controls.Add(this.label8);
 
            this.gboxSlaveData.Controls.Add(this.label20);
 
            this.gboxSlaveData.Location = new System.Drawing.Point(259, 13);
 
            this.gboxSlaveData.Name = "gboxSlaveData";
 
            this.gboxSlaveData.Padding = new System.Windows.Forms.Padding(10);
 
            this.gboxSlaveData.Size = new System.Drawing.Size(297, 438);
 
            this.gboxSlaveData.TabIndex = 1;
 
            this.gboxSlaveData.TabStop = false;
 
            this.gboxSlaveData.Text = "Slave Modules";
 
            // 
 
            // textBox16
 
            // 
 
            this.textBox16.Location = new System.Drawing.Point(146, 378);
 
            this.textBox16.Name = "textBox16";
 
            this.textBox16.Size = new System.Drawing.Size(100, 20);
 
            this.textBox16.TabIndex = 41;
 
            // 
 
            // label26
 
            // 
 
            this.label26.AutoSize = true;
 
            this.label26.Location = new System.Drawing.Point(40, 381);
 
            this.label26.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label26.Name = "label26";
 
            this.label26.Size = new System.Drawing.Size(69, 13);
 
            this.label26.TabIndex = 40;
 
            this.label26.Text = "Battery Level";
 
            // 
 
            // textBox17
 
            // 
 
            this.textBox17.Location = new System.Drawing.Point(146, 351);
 
            this.textBox17.Name = "textBox17";
 
            this.textBox17.Size = new System.Drawing.Size(100, 20);
 
            this.textBox17.TabIndex = 39;
 
            // 
 
            // label27
 
            // 
 
            this.label27.AutoSize = true;
 
            this.label27.Location = new System.Drawing.Point(40, 354);
 
            this.label27.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label27.Name = "label27";
 
            this.label27.Size = new System.Drawing.Size(98, 13);
 
            this.label27.TabIndex = 38;
 
            this.label27.Text = "Board Temperature";
 
            // 
 
            // label28
 
            // 
 
            this.label28.AutoSize = true;
 
            this.label28.Location = new System.Drawing.Point(15, 327);
 
            this.label28.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label28.Name = "label28";
 
            this.label28.Size = new System.Drawing.Size(81, 13);
 
            this.label28.TabIndex = 37;
 
            this.label28.Text = "Camera Module";
 
            // 
 
            // textBox15
 
            // 
 
            this.textBox15.Location = new System.Drawing.Point(146, 297);
 
            this.textBox15.Name = "textBox15";
 
            this.textBox15.Size = new System.Drawing.Size(100, 20);
 
            this.textBox15.TabIndex = 36;
 
            // 
 
            // label25
 
            // 
 
            this.label25.AutoSize = true;
 
            this.label25.Location = new System.Drawing.Point(40, 300);
 
            this.label25.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label25.Name = "label25";
 
            this.label25.Size = new System.Drawing.Size(52, 13);
 
            this.label25.TabIndex = 35;
 
            this.label25.Text = "Radiation";
 
            // 
 
            // textBox14
 
            // 
 
            this.textBox14.Location = new System.Drawing.Point(146, 270);
 
            this.textBox14.Name = "textBox14";
 
            this.textBox14.Size = new System.Drawing.Size(100, 20);
 
            this.textBox14.TabIndex = 34;
 
            // 
 
            // label24
 
            // 
 
            this.label24.AutoSize = true;
 
            this.label24.Location = new System.Drawing.Point(40, 273);
 
            this.label24.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label24.Name = "label24";
 
            this.label24.Size = new System.Drawing.Size(69, 13);
 
            this.label24.TabIndex = 33;
 
            this.label24.Text = "Battery Level";
 
            // 
 
            // textBox13
 
            // 
 
            this.textBox13.Location = new System.Drawing.Point(146, 243);
 
            this.textBox13.Name = "textBox13";
 
            this.textBox13.Size = new System.Drawing.Size(100, 20);
 
            this.textBox13.TabIndex = 32;
 
            // 
 
            // label23
 
            // 
 
            this.label23.AutoSize = true;
 
            this.label23.Location = new System.Drawing.Point(40, 246);
 
            this.label23.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label23.Name = "label23";
 
            this.label23.Size = new System.Drawing.Size(98, 13);
 
            this.label23.TabIndex = 31;
 
            this.label23.Text = "Board Temperature";
 
            // 
 
            // label22
 
            // 
 
            this.label22.AutoSize = true;
 
            this.label22.Location = new System.Drawing.Point(15, 219);
 
            this.label22.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label22.Name = "label22";
 
            this.label22.Size = new System.Drawing.Size(76, 13);
 
            this.label22.TabIndex = 30;
 
            this.label22.Text = "Geiger Module";
 
            // 
 
            // textBox12
 
            // 
 
            this.textBox12.Location = new System.Drawing.Point(146, 189);
 
            this.textBox12.Name = "textBox12";
 
            this.textBox12.Size = new System.Drawing.Size(100, 20);
 
            this.textBox12.TabIndex = 29;
 
            // 
 
            // label21
 
            // 
 
            this.label21.AutoSize = true;
 
            this.label21.Location = new System.Drawing.Point(40, 192);
 
            this.label21.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label21.Name = "label21";
 
            this.label21.Size = new System.Drawing.Size(42, 13);
 
            this.label21.TabIndex = 28;
 
            this.label21.Text = "Altitude";
 
            // 
 
            // textBox11
 
            // 
 
            this.textBox11.Location = new System.Drawing.Point(146, 108);
 
            this.textBox11.Name = "textBox11";
 
            this.textBox11.Size = new System.Drawing.Size(100, 20);
 
            this.textBox11.TabIndex = 27;
 
            // 
 
            // label19
 
            // 
 
            this.label19.AutoSize = true;
 
            this.label19.Location = new System.Drawing.Point(40, 111);
 
            this.label19.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label19.Name = "label19";
 
            this.label19.Size = new System.Drawing.Size(82, 13);
 
            this.label19.TabIndex = 26;
 
            this.label19.Text = "Air Temperature";
 
            // 
 
            // textBox10
 
            // 
 
            this.textBox10.Location = new System.Drawing.Point(146, 135);
 
            this.textBox10.Name = "textBox10";
 
            this.textBox10.Size = new System.Drawing.Size(100, 20);
 
            this.textBox10.TabIndex = 25;
 
            // 
 
            // label18
 
            // 
 
            this.label18.AutoSize = true;
 
            this.label18.Location = new System.Drawing.Point(40, 138);
 
            this.label18.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label18.Name = "label18";
 
            this.label18.Size = new System.Drawing.Size(47, 13);
 
            this.label18.TabIndex = 24;
 
            this.label18.Text = "Humidity";
 
            // 
 
            // textBox9
 
            // 
 
            this.textBox9.Location = new System.Drawing.Point(146, 162);
 
            this.textBox9.Name = "textBox9";
 
            this.textBox9.Size = new System.Drawing.Size(100, 20);
 
            this.textBox9.TabIndex = 23;
 
            // 
 
            // label17
 
            // 
 
            this.label17.AutoSize = true;
 
            this.label17.Location = new System.Drawing.Point(40, 165);
 
            this.label17.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label17.Name = "label17";
 
            this.label17.Size = new System.Drawing.Size(48, 13);
 
            this.label17.TabIndex = 22;
 
            this.label17.Text = "Pressure";
 
            // 
 
            // textBox8
 
            // 
 
            this.textBox8.Location = new System.Drawing.Point(146, 81);
 
            this.textBox8.Name = "textBox8";
 
            this.textBox8.Size = new System.Drawing.Size(100, 20);
 
            this.textBox8.TabIndex = 21;
 
            // 
 
            // label15
 
            // 
 
            this.label15.AutoSize = true;
 
            this.label15.Location = new System.Drawing.Point(40, 84);
 
            this.label15.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label15.Name = "label15";
 
            this.label15.Size = new System.Drawing.Size(69, 13);
 
            this.label15.TabIndex = 20;
 
            this.label15.Text = "Battery Level";
 
            // 
 
            // textBox7
 
            // 
 
            this.textBox7.Location = new System.Drawing.Point(146, 54);
 
            this.textBox7.Name = "textBox7";
 
            this.textBox7.Size = new System.Drawing.Size(100, 20);
 
            this.textBox7.TabIndex = 19;
 
            // 
 
            // label8
 
            // 
 
            this.label8.AutoSize = true;
 
            this.label8.Location = new System.Drawing.Point(40, 57);
 
            this.label8.Margin = new System.Windows.Forms.Padding(30, 7, 5, 7);
 
            this.label8.Name = "label8";
 
            this.label8.Size = new System.Drawing.Size(98, 13);
 
            this.label8.TabIndex = 18;
 
            this.label8.Text = "Board Temperature";
 
            // 
 
            // label20
 
            // 
 
            this.label20.AutoSize = true;
 
            this.label20.Location = new System.Drawing.Point(15, 30);
 
            this.label20.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label20.Name = "label20";
 
            this.label20.Size = new System.Drawing.Size(101, 13);
 
            this.label20.TabIndex = 18;
 
            this.label20.Text = "Atmosphere Module";
 
            // 
 
            // gboxMasterData
 
            // 
 
            this.gboxMasterData.Controls.Add(this.textBox6);
 
            this.gboxMasterData.Controls.Add(this.label7);
 
            this.gboxMasterData.Controls.Add(this.label6);
 
            this.gboxMasterData.Controls.Add(this.textBox5);
 
            this.gboxMasterData.Controls.Add(this.label3);
 
            this.gboxMasterData.Controls.Add(this.textBox4);
 
            this.gboxMasterData.Controls.Add(this.label2);
 
            this.gboxMasterData.Controls.Add(this.textBox3);
 
            this.gboxMasterData.Controls.Add(this.label16);
 
            this.gboxMasterData.Controls.Add(this.textBox2);
 
            this.gboxMasterData.Controls.Add(this.textBox1);
 
            this.gboxMasterData.Controls.Add(this.label1);
 
            this.gboxMasterData.Location = new System.Drawing.Point(13, 13);
 
            this.gboxMasterData.Name = "gboxMasterData";
 
            this.gboxMasterData.Padding = new System.Windows.Forms.Padding(10);
 
            this.gboxMasterData.Size = new System.Drawing.Size(240, 329);
 
            this.gboxMasterData.TabIndex = 0;
 
            this.gboxMasterData.TabStop = false;
 
            this.gboxMasterData.Text = "Master Module";
 
            // 
 
            // textBox6
 
            // 
 
            this.textBox6.Location = new System.Drawing.Point(120, 162);
 
            this.textBox6.Name = "textBox6";
 
            this.textBox6.Size = new System.Drawing.Size(100, 20);
 
            this.textBox6.TabIndex = 17;
 
            // 
 
            // label7
 
            // 
 
            this.label7.AutoSize = true;
 
            this.label7.Location = new System.Drawing.Point(14, 165);
 
            this.label7.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label7.Name = "label7";
 
            this.label7.Size = new System.Drawing.Size(67, 13);
 
            this.label7.TabIndex = 16;
 
            this.label7.Text = "GPS Altitude";
 
            // 
 
            // label6
 
            // 
 
            this.label6.AutoSize = true;
 
            this.label6.Location = new System.Drawing.Point(15, 138);
 
            this.label6.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label6.Name = "label6";
 
            this.label6.Size = new System.Drawing.Size(44, 13);
 
            this.label6.TabIndex = 15;
 
            this.label6.Text = "Velocity";
 
            // 
 
            // textBox5
 
            // 
 
            this.textBox5.Location = new System.Drawing.Point(121, 135);
 
            this.textBox5.Name = "textBox5";
 
            this.textBox5.Size = new System.Drawing.Size(100, 20);
 
            this.textBox5.TabIndex = 14;
 
            // 
 
            // label3
 
            // 
 
            this.label3.AutoSize = true;
 
            this.label3.Location = new System.Drawing.Point(14, 111);
 
            this.label3.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label3.Name = "label3";
 
            this.label3.Size = new System.Drawing.Size(54, 13);
 
            this.label3.TabIndex = 13;
 
            this.label3.Text = "Longitude";
 
            // 
 
            // textBox4
 
            // 
 
            this.textBox4.Location = new System.Drawing.Point(120, 108);
 
            this.textBox4.Name = "textBox4";
 
            this.textBox4.Size = new System.Drawing.Size(100, 20);
 
            this.textBox4.TabIndex = 12;
 
            // 
 
            // label2
 
            // 
 
            this.label2.AutoSize = true;
 
            this.label2.Location = new System.Drawing.Point(15, 84);
 
            this.label2.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label2.Name = "label2";
 
            this.label2.Size = new System.Drawing.Size(45, 13);
 
            this.label2.TabIndex = 11;
 
            this.label2.Text = "Latitude";
 
            // 
 
            // textBox3
 
            // 
 
            this.textBox3.Location = new System.Drawing.Point(121, 81);
 
            this.textBox3.Name = "textBox3";
 
            this.textBox3.Size = new System.Drawing.Size(100, 20);
 
            this.textBox3.TabIndex = 10;
 
            // 
 
            // label16
 
            // 
 
            this.label16.AutoSize = true;
 
            this.label16.Location = new System.Drawing.Point(14, 57);
 
            this.label16.Margin = new System.Windows.Forms.Padding(5, 7, 5, 7);
 
            this.label16.Name = "label16";
 
            this.label16.Size = new System.Drawing.Size(69, 13);
 
            this.label16.TabIndex = 9;
 
            this.label16.Text = "Battery Level";
 
            // 
 
            // textBox2
 
            // 
 
            this.textBox2.Location = new System.Drawing.Point(120, 54);
 
            this.textBox2.Name = "textBox2";
 
            this.textBox2.Size = new System.Drawing.Size(100, 20);
 
            this.textBox2.TabIndex = 8;
 
            // 
Demo.WindowsForms/Forms/MainForm.cs
Show inline comments
 
using System;
 
using System.Collections.Generic;
 
using System.ComponentModel;
 
using System.Diagnostics;
 
using System.Drawing;
 
using System.Drawing.Drawing2D;
 
using System.Globalization;
 
using System.IO;
 
using System.Net;
 
using System.Net.NetworkInformation;
 
using System.Threading;
 
using System.Windows.Forms;
 
using System.Xml;
 
using Demo.WindowsForms.CustomMarkers;
 
using GMap.NET;
 
using GMap.NET.MapProviders;
 
using GMap.NET.WindowsForms;
 
using GMap.NET.WindowsForms.Markers;
 
using GMap.NET.WindowsForms.ToolTips;
 
using System.IO.Ports;
 
using System.Data;
 
using System.Text;
 
//using System.Linq;
 
 
namespace Demo.WindowsForms
 
{
 
    public partial class MainForm : Form
 
    {
 
        // layers
 
        readonly GMapOverlay top = new GMapOverlay();
 
        internal readonly GMapOverlay objects = new GMapOverlay("objects");
 
        internal readonly GMapOverlay routes = new GMapOverlay("routes");
 
        //internal readonly GMapOverlay polygons = new GMapOverlay("polygons");
 
 
        // marker
 
        GMarkerGoogle currentMarker;
 
 
        // polygons
 
        //GMapPolygon polygon;
 
 
        // etc
 
        readonly Random rnd = new Random();
 
        readonly DescendingComparer ComparerIpStatus = new DescendingComparer();
 
        GMapMarkerRect CurentRectMarker = null;
 
        string mobileGpsLog = string.Empty;
 
        bool isMouseDown = false;
 
        PointLatLng start;
 
        PointLatLng end;
 
        TimeSpan unixTime;
 
 
        public MainForm()
 
        {
 
            InitializeComponent();
 
            unixTime = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0));
 
 
            if (!DesignMode)
 
            {
 
                // add your custom map db provider
 
                //GMap.NET.CacheProviders.MySQLPureImageCache ch = new GMap.NET.CacheProviders.MySQLPureImageCache();
 
                //ch.ConnectionString = @"server=sql2008;User Id=trolis;Persist Security Info=True;database=gmapnetcache;password=trolis;";
 
                //MainMap.Manager.SecondaryCache = ch;
 
 
                // set your proxy here if need
 
                //GMapProvider.WebProxy = new WebProxy("10.2.0.100", 8080);
 
                //GMapProvider.WebProxy.Credentials = new NetworkCredential("ogrenci@bilgeadam.com", "bilgeada");
 
 
                // set cache mode only if no internet avaible
 
                if (!Stuff.PingNetwork("pingtest.net"))
 
                {
 
                    MainMap.Manager.Mode = AccessMode.CacheOnly;
 
                    MessageBox.Show("No internet connection available, going to CacheOnly mode.", "GMap.NET - Demo.WindowsForms", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 
                }
 
 
                // config map - MDKEdit - init values ??
 
                MainMap.MapProvider = GMapProviders.OpenStreetMap;
 
                MainMap.Position = new PointLatLng(39.751248, -83.809848);
 
                MainMap.MinZoom = 0;
 
                MainMap.MaxZoom = 24;
 
                MainMap.Zoom = 15;
 
 
                //MainMap.ScaleMode = ScaleModes.Fractional;
 
 
                // map events
 
                {
 
                    MainMap.OnPositionChanged += new PositionChanged(MainMap_OnPositionChanged);
 
 
                    MainMap.OnTileLoadStart += new TileLoadStart(MainMap_OnTileLoadStart);
 
                    MainMap.OnTileLoadComplete += new TileLoadComplete(MainMap_OnTileLoadComplete);
 
 
                    MainMap.OnMapZoomChanged += new MapZoomChanged(MainMap_OnMapZoomChanged);
 
                    MainMap.OnMapTypeChanged += new MapTypeChanged(MainMap_OnMapTypeChanged);
 
 
                    MainMap.OnMarkerClick += new MarkerClick(MainMap_OnMarkerClick);
 
                    MainMap.OnMarkerEnter += new MarkerEnter(MainMap_OnMarkerEnter);
 
                    MainMap.OnMarkerLeave += new MarkerLeave(MainMap_OnMarkerLeave);
 
 
                    MainMap.OnPolygonEnter += new PolygonEnter(MainMap_OnPolygonEnter);
 
                    MainMap.OnPolygonLeave += new PolygonLeave(MainMap_OnPolygonLeave);
 
 
                    MainMap.OnRouteEnter += new RouteEnter(MainMap_OnRouteEnter);
 
                    MainMap.OnRouteLeave += new RouteLeave(MainMap_OnRouteLeave);
 
 
                    MainMap.Manager.OnTileCacheComplete += new TileCacheComplete(OnTileCacheComplete);
 
                    MainMap.Manager.OnTileCacheStart += new TileCacheStart(OnTileCacheStart);
 
                    MainMap.Manager.OnTileCacheProgress += new TileCacheProgress(OnTileCacheProgress);
 
                }
 
 
                MainMap.MouseMove += new MouseEventHandler(MainMap_MouseMove);
 
                MainMap.MouseDown += new MouseEventHandler(MainMap_MouseDown);
 
                MainMap.MouseUp += new MouseEventHandler(MainMap_MouseUp);
 
                MainMap.MouseDoubleClick += new MouseEventHandler(MainMap_MouseDoubleClick);
 
 
                // get map types
 
#if !MONO   // mono doesn't handle it, so we 'lost' provider list ;]
 
                comboBoxMapType.ValueMember = "Name";
 
                comboBoxMapType.DataSource = GMapProviders.List;
 
                comboBoxMapType.SelectedItem = MainMap.MapProvider;
 
#endif
 
                // acccess mode
 
                comboBoxMode.DataSource = Enum.GetValues(typeof(AccessMode));
 
                comboBoxMode.SelectedItem = MainMap.Manager.Mode;
 
 
                // get position
 
                textBoxLat.Text = MainMap.Position.Lat.ToString(CultureInfo.InvariantCulture);
 
                textBoxLng.Text = MainMap.Position.Lng.ToString(CultureInfo.InvariantCulture);
 
 
                // get cache modes
 
                checkBoxUseRouteCache.Checked = MainMap.Manager.UseRouteCache;
 
 
                MobileLogFrom.Value = DateTime.Today;
 
                MobileLogTo.Value = DateTime.Now;
 
 
                // get zoom  
 
                trackBarZoomLevel.Minimum = MainMap.MinZoom * 100;
 
                trackBarZoomLevel.Maximum = MainMap.MaxZoom * 100;
 
                trackBarZoomLevel.TickFrequency = 100;
 
 
#if DEBUG
 
                xboxGrid.Checked = true;
 
#endif
 
 
                ToolStripManager.Renderer = new BSE.Windows.Forms.Office2007Renderer();
 
 
                #region -- demo workers --
 
                //// flight demo
 
                //{
 
                //    flightWorker.DoWork += new DoWorkEventHandler(flight_DoWork);
 
                //    flightWorker.ProgressChanged += new ProgressChangedEventHandler(flight_ProgressChanged);
 
                //    flightWorker.WorkerSupportsCancellation = true;
 
                //    flightWorker.WorkerReportsProgress = true;
 
                //}
 
 
                //// vehicle demo
 
                //{
 
                //    transportWorker.DoWork += new DoWorkEventHandler(transport_DoWork);
 
                //    transportWorker.ProgressChanged += new ProgressChangedEventHandler(transport_ProgressChanged);
 
                //    transportWorker.WorkerSupportsCancellation = true;
 
                //    transportWorker.WorkerReportsProgress = true;
 
                //}
 
 
                // Connections
 
                //{
 
                //   connectionsWorker.DoWork += new DoWorkEventHandler(connectionsWorker_DoWork);
 
                //   connectionsWorker.ProgressChanged += new ProgressChangedEventHandler(connectionsWorker_ProgressChanged);
 
                //   connectionsWorker.WorkerSupportsCancellation = true;
 
                //   connectionsWorker.WorkerReportsProgress = true;
 
 
                //   ipInfoSearchWorker.DoWork += new DoWorkEventHandler(ipInfoSearchWorker_DoWork);
 
                //   ipInfoSearchWorker.WorkerSupportsCancellation = true;
 
 
                //   iptracerWorker.DoWork += new DoWorkEventHandler(iptracerWorker_DoWork);
 
                //   iptracerWorker.WorkerSupportsCancellation = true;
 
 
                //   //GridConnections.AutoGenerateColumns = false;
 
 
                //   IpCache.CacheLocation = MainMap.CacheLocation;
 
                //}
 
 
                // perf
 
                timerPerf.Tick += new EventHandler(timer_Tick);
 
                #endregion
 
 
                // add custom layers  
 
                {
 
                    MainMap.Overlays.Add(routes);
 
                    //MainMap.Overlays.Add(polygons);
 
                    MainMap.Overlays.Add(objects);
 
                    MainMap.Overlays.Add(top);
 
 
                    routes.Routes.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Routes_CollectionChanged);
 
                    objects.Markers.CollectionChanged += new GMap.NET.ObjectModel.NotifyCollectionChangedEventHandler(Markers_CollectionChanged);
 
                }
 
 
                // set current marker
 
                currentMarker = new GMarkerGoogle(MainMap.Position, GMarkerGoogleType.arrow);
 
                currentMarker.IsHitTestVisible = false;
 
                top.Markers.Add(currentMarker);
 
 
                //MainMap.VirtualSizeEnabled = true;
 
                //if(false)
 
                {
 
                    // add my city location for demo
 
                    //GeoCoderStatusCode status = GeoCoderStatusCode.Unknow;
 
                    {
 
                        //PointLatLng? pos = GMapProviders.GoogleMap.GetPoint("Lithuania, Vilnius", out status);
 
                        //if (pos != null && status == GeoCoderStatusCode.G_GEO_SUCCESS)
 
                        //{
 
                        //    currentMarker.Position = pos.Value;
 
 
                        //    // - MDKEdit
 
                        //    //GMapMarker myCity = new GMarkerGoogle(pos.Value, GMarkerGoogleType.green_small);
 
                        //    //myCity.ToolTipMode = MarkerTooltipMode.Always;
 
                        //    //myCity.ToolTipText = "Welcome to Lithuania! ;}";
 
                        //    //objects.Markers.Add(myCity);
 
                        //}
 
                    }
 
 
                    // add some points in lithuania - MDKEdit
 
                    //AddLocationLithuania("Kaunas");
 
                    //AddLocationLithuania("KlaipÄ—da");
 
                    //AddLocationLithuania("Å iauliai");
 
                    //AddLocationLithuania("Panevėžys");
 
 
                    if (objects.Markers.Count > 0)
 
                    {
 
                        MainMap.ZoomAndCenterMarkers(null);
 
                    }
 
 
                    //RegeneratePolygon();
 
 
                    try
 
                    {
 
                        GMapOverlay overlay = DeepClone<GMapOverlay>(objects);
 
                        Debug.WriteLine("ISerializable status for markers: OK");
 
 
                        //GMapOverlay overlay2 = DeepClone<GMapOverlay>(polygons);
 
                        //Debug.WriteLine("ISerializable status for polygons: OK");
 
 
                        GMapOverlay overlay3 = DeepClone<GMapOverlay>(routes);
 
                        Debug.WriteLine("ISerializable status for routes: OK");
 
                    }
 
                    catch (Exception ex)
 
                    {
 
                        Debug.WriteLine("ISerializable failure: " + ex.Message);
 
 
#if DEBUG
 
                        if (Debugger.IsAttached)
 
                        {
 
                            Debugger.Break();
 
                        }
 
#endif
 
                    }
 
                }
 
            }
 
        }
 
 
        public T DeepClone<T>(T obj)
 
        {
 
            using (var ms = new System.IO.MemoryStream())
 
            {
 
                var formatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
 
 
                formatter.Serialize(ms, obj);
 
 
                ms.Position = 0;
 
 
                return (T)formatter.Deserialize(ms);
 
            }
 
        }
 
 
        void Markers_CollectionChanged(object sender, GMap.NET.ObjectModel.NotifyCollectionChangedEventArgs e)
 
        {
 
            //textBoxMarkerCount.Text = objects.Markers.Count.ToString();
 
        }
 
 
        void Routes_CollectionChanged(object sender, GMap.NET.ObjectModel.NotifyCollectionChangedEventArgs e)
 
        {
 
            textBoxrouteCount.Text = routes.Routes.Count.ToString();
 
        }
 
 
        #region -- performance test --
 
 
        double NextDouble(Random rng, double min, double max)
 
        {
 
            return min + (rng.NextDouble() * (max - min));
 
        }
 
 
        int tt = 0;
 
        void timer_Tick(object sender, EventArgs e)
 
        {
 
            var pos = new PointLatLng(NextDouble(rnd, MainMap.ViewArea.Top, MainMap.ViewArea.Bottom), NextDouble(rnd, MainMap.ViewArea.Left, MainMap.ViewArea.Right));
 
            GMapMarker m = new GMarkerGoogle(pos, GMarkerGoogleType.green_pushpin);
 
            {
 
                m.ToolTipText = (tt++).ToString();
 
                m.ToolTipMode = MarkerTooltipMode.Always;
 
            }
 
 
            objects.Markers.Add(m);
 
 
            if (tt >= 333)
 
            {
 
                timerPerf.Stop();
 
                tt = 0;
 
            }
 
        }
 
 
        System.Windows.Forms.Timer timerPerf = new System.Windows.Forms.Timer();
 
        #endregion
 
 
        #region -- flight demo --
 
        //BackgroundWorker flightWorker = new BackgroundWorker();
 
 
        //readonly List<FlightRadarData> flights = new List<FlightRadarData>();
 
        //readonly Dictionary<int, GMapMarker> flightMarkers = new Dictionary<int, GMapMarker>();
 
 
        //bool firstLoadFlight = true;
 
        //GMapMarker currentFlight;
 
 
        //void flight_ProgressChanged(object sender, ProgressChangedEventArgs e)
 
        //{
 
        //    // stops immediate marker/route/polygon invalidations;
 
        //    // call Refresh to perform single refresh and reset invalidation state
 
        //    MainMap.HoldInvalidation = true;
 
 
        //    lock (flights)
 
        //    {
 
        //        foreach (FlightRadarData d in flights)
 
        //        {
 
        //            GMapMarker marker;
 
 
        //            if (!flightMarkers.TryGetValue(d.Id, out marker))
 
        //            {
 
        //                marker = new GMarkerGoogle(d.point, GMarkerGoogleType.blue_small);
 
        //                marker.Tag = d.Id;
 
        //                marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
 
        //                //(marker as GMapMarkerGoogleGreen).Bearing = (float?)d.bearing;
 
 
        //                flightMarkers[d.Id] = marker;
 
        //                objects.Markers.Add(marker);
 
        //            }
 
        //            else
 
        //            {
 
        //                marker.Position = d.point;
 
        //                //(marker as GMapMarkerGoogleGreen).Bearing = (float?)d.bearing;
 
        //            }
 
        //            marker.ToolTipText = d.name + ", " + d.altitude + ", " + d.speed;
 
 
        //            if (currentFlight != null && currentFlight == marker)
 
        //            {
 
        //                MainMap.Position = marker.Position;
 
        //                //MainMap.Bearing = (float)d.bearing;
 
        //            }
 
        //        }
 
        //    }
 
 
        //    if (firstLoadFlight)
 
        //    {
 
        //        MainMap.Zoom = 5;
 
        //        MainMap.SetZoomToFitRect(new RectLatLng(54.4955675218741, -0.966796875, 28.916015625, 13.3830987326932));
 
        //        firstLoadFlight = false;
 
        //    }
 
        //    MainMap.Refresh();
 
        //}
 
 
        //void flight_DoWork(object sender, DoWorkEventArgs e)
 
        //{
 
        //    bool restartSesion = true;
 
 
        //    while (!flightWorker.CancellationPending)
 
        //    {
 
        //        try
 
        //        {
 
        //            lock (flights)
 
        //            {
 
        //                Stuff.GetFlightRadarData(flights, lastPosition, lastZoom, restartSesion);
 
 
        //                if (flights.Count > 0 && restartSesion)
 
        //                {
 
        //                    restartSesion = false;
 
        //                }
 
        //            }
 
 
        //            flightWorker.ReportProgress(100);
 
        //        }
 
        //        catch (Exception ex)
 
        //        {
 
        //            Debug.WriteLine("flight_DoWork: " + ex.ToString());
 
        //        }
 
        //        Thread.Sleep(5 * 1000);
 
        //    }
 
 
        //    flightMarkers.Clear();
 
        //}
 
 
        #endregion
 
 
        #region -- transport demo --
 
        //BackgroundWorker transportWorker = new BackgroundWorker();
 
 
        //#region -- old vehicle demo --
 
        //readonly List<VehicleData> trolleybus = new List<VehicleData>();
 
        //readonly Dictionary<int, GMapMarker> trolleybusMarkers = new Dictionary<int, GMapMarker>();
 
 
        //readonly List<VehicleData> bus = new List<VehicleData>();
 
        //readonly Dictionary<int, GMapMarker> busMarkers = new Dictionary<int, GMapMarker>();
 
        //#endregion
 
 
        //bool firstLoadTrasport = true;
 
        //GMapMarker currentTransport;
 
 
        //void transport_ProgressChanged(object sender, ProgressChangedEventArgs e)
 
        //{
 
        //    // stops immediate marker/route/polygon invalidations;
 
        //    // call Refresh to perform single refresh and reset invalidation state
 
        //    MainMap.HoldInvalidation = true;
 
 
        //    #region -- vehicle demo --
 
        //    lock (trolleybus)
 
        //    {
 
        //        foreach (VehicleData d in trolleybus)
 
        //        {
 
        //            GMapMarker marker;
 
 
        //            if (!trolleybusMarkers.TryGetValue(d.Id, out marker))
 
        //            {
 
        //                marker = new GMarkerGoogle(new PointLatLng(d.Lat, d.Lng), GMarkerGoogleType.red_small);
 
        //                marker.Tag = d.Id;
 
        //                marker.ToolTipMode = MarkerTooltipMode.OnMouseOver;
 
 
        //                trolleybusMarkers[d.Id] = marker;
 
        //                objects.Markers.Add(marker);
 
        //            }
 
        //            else
 
        //            {
 
@@ -2184,701 +2185,738 @@ namespace Demo.WindowsForms
 
        {
 
            MainMap.Zoom = ((int)(MainMap.Zoom + 0.99)) - 1;
 
        }
 
 
        // engage some live demo
 
        //private void RealTimeChanged(object sender, EventArgs e)
 
        //{
 
        //   objects.Markers.Clear();
 
        //   polygons.Polygons.Clear();
 
        //   routes.Routes.Clear();
 
 
        //   //// start performance test
 
        //   //if(rbtnPerf.Checked)
 
        //   //{
 
        //   //   timerPerf.Interval = 44;
 
        //   //   timerPerf.Start();
 
        //   //}
 
        //   //else
 
        //   //{
 
        //   //   // stop performance test
 
        //   //   timerPerf.Stop();
 
        //   //}
 
 
        //   // start realtime transport tracking demo
 
        //   //if(rbtnFlight.Checked)
 
        //   //{
 
        //   //   if(!flightWorker.IsBusy)
 
        //   //   {
 
        //   //      firstLoadFlight = true;
 
        //   //      flightWorker.RunWorkerAsync();
 
        //   //   }
 
        //   //}
 
        //   //else
 
        //   //{
 
        //   //   if(flightWorker.IsBusy)
 
        //   //   {
 
        //   //      flightWorker.CancelAsync();
 
        //   //   }
 
        //   //}
 
 
        //   // vehicle demo
 
        //   //if(rbtnVehicle.Checked)
 
        //   //{
 
        //   //   if(!transportWorker.IsBusy)
 
        //   //   {
 
        //   //      firstLoadTrasport = true;
 
        //   //      transportWorker.RunWorkerAsync();
 
        //   //   }
 
        //   //}
 
        //   //else
 
        //   //{
 
        //   //   if(transportWorker.IsBusy)
 
        //   //   {
 
        //   //      transportWorker.CancelAsync();
 
        //   //   }
 
        //   //}
 
 
        //   // start live tcp/ip connections demo
 
        //   if(rbtnTcpIp.Checked)
 
        //   {
 
        //      GridConnections.Visible = true;
 
        //      checkBoxTcpIpSnap.Visible = true;
 
        //      checkBoxTraceRoute.Visible = true;
 
        //      GridConnections.Refresh();
 
 
        //      if(!connectionsWorker.IsBusy)
 
        //      {
 
        //         //if(MainMap.Provider != MapType.GoogleMap)
 
        //         //{
 
        //         //   MainMap.MapType = MapType.GoogleMap;
 
        //         //}
 
        //         MainMap.Zoom = 5;
 
 
        //         connectionsWorker.RunWorkerAsync();
 
        //      }
 
        //   }
 
        //   else
 
        //   {
 
        //      CountryStatusView.Clear();
 
        //      GridConnections.Visible = false;
 
        //      checkBoxTcpIpSnap.Visible = false;
 
        //      checkBoxTraceRoute.Visible = false;
 
 
        //      if(connectionsWorker.IsBusy)
 
        //      {
 
        //         connectionsWorker.CancelAsync();
 
        //      }
 
 
        //      if(ipInfoSearchWorker.IsBusy)
 
        //      {
 
        //         ipInfoSearchWorker.CancelAsync();
 
        //      }
 
 
        //      if(iptracerWorker.IsBusy)
 
        //      {
 
        //         iptracerWorker.CancelAsync();
 
        //      }
 
        //   }
 
        //}
 
 
        // export mobile gps log to gpx file
 
        private void buttonExportToGpx_Click(object sender, EventArgs e)
 
        {
 
            try
 
            {
 
                using (SaveFileDialog sfd = new SaveFileDialog())
 
                {
 
                    sfd.Filter = "GPX (*.gpx)|*.gpx";
 
                    sfd.FileName = "mobile gps log";
 
 
                    DateTime? date = null;
 
                    DateTime? dateEnd = null;
 
 
                    if (MobileLogFrom.Checked)
 
                    {
 
                        date = MobileLogFrom.Value.ToUniversalTime();
 
 
                        sfd.FileName += " from " + MobileLogFrom.Value.ToString("yyyy-MM-dd HH-mm");
 
                    }
 
 
                    if (MobileLogTo.Checked)
 
                    {
 
                        dateEnd = MobileLogTo.Value.ToUniversalTime();
 
 
                        sfd.FileName += " to " + MobileLogTo.Value.ToString("yyyy-MM-dd HH-mm");
 
                    }
 
 
                    if (sfd.ShowDialog() == DialogResult.OK)
 
                    {
 
                        var log = Stuff.GetRoutesFromMobileLog(mobileGpsLog, date, dateEnd, 3.3);
 
                        if (log != null)
 
                        {
 
                            if (MainMap.Manager.ExportGPX(log, sfd.FileName))
 
                            {
 
                                MessageBox.Show("GPX saved: " + sfd.FileName, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Information);
 
                            }
 
                        }
 
                    }
 
                }
 
            }
 
            catch (Exception ex)
 
            {
 
                MessageBox.Show("GPX failed to save: " + ex.Message, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
 
            }
 
        }
 
 
        // load gpx file
 
        private void btnLoadGPX_Click(object sender, EventArgs e)
 
        {
 
            using (FileDialog dlg = new OpenFileDialog())
 
            {
 
                dlg.CheckPathExists = true;
 
                dlg.CheckFileExists = false;
 
                dlg.AddExtension = true;
 
                dlg.DefaultExt = "gpx";
 
                dlg.ValidateNames = true;
 
                dlg.Title = "GMap.NET: open gpx log";
 
                dlg.Filter = "gpx files (*.gpx)|*.gpx";
 
                dlg.FilterIndex = 1;
 
                dlg.RestoreDirectory = true;
 
 
                if (dlg.ShowDialog() == DialogResult.OK)
 
                {
 
                    try
 
                    {
 
                        string gpx = File.ReadAllText(dlg.FileName);
 
 
                        gpxType r = MainMap.Manager.DeserializeGPX(gpx);
 
                        if (r != null)
 
                        {
 
                            if (r.trk.Length > 0)
 
                            {
 
                                foreach (var trk in r.trk)
 
                                {
 
                                    List<PointLatLng> points = new List<PointLatLng>();
 
 
                                    foreach (var seg in trk.trkseg)
 
                                    {
 
                                        foreach (var p in seg.trkpt)
 
                                        {
 
                                            points.Add(new PointLatLng((double)p.lat, (double)p.lon));
 
                                        }
 
                                    }
 
 
                                    GMapRoute rt = new GMapRoute(points, string.Empty);
 
                                    {
 
                                        rt.Stroke = new Pen(Color.FromArgb(144, Color.Red));
 
                                        rt.Stroke.Width = 5;
 
                                        rt.Stroke.DashStyle = System.Drawing.Drawing2D.DashStyle.DashDot;
 
                                    }
 
                                    routes.Routes.Add(rt);
 
                                }
 
 
                                MainMap.ZoomAndCenterRoutes(null);
 
                            }
 
                        }
 
                    }
 
                    catch (Exception ex)
 
                    {
 
                        Debug.WriteLine("GPX import: " + ex.ToString());
 
                        MessageBox.Show("Error importing gpx: " + ex.Message, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Warning);
 
                    }
 
                }
 
            }
 
        }
 
 
        // enable/disable host tracing
 
        //private void checkBoxTraceRoute_CheckedChanged(object sender, EventArgs e)
 
        //{
 
        //   TryTraceConnection = checkBoxTraceRoute.Checked;
 
        //   if(!TryTraceConnection)
 
        //   {
 
        //      if(iptracerWorker.IsBusy)
 
        //      {
 
        //         iptracerWorker.CancelAsync();
 
        //      }
 
        //      routes.Routes.Clear();
 
        //   }
 
        //}
 
 
        //private void GridConnections_DoubleClick(object sender, EventArgs e)
 
        //{
 
        //   GridConnections.ClearSelection();
 
        //}
 
 
        // open disk cache location
 
        private void button17_Click(object sender, EventArgs e)
 
        {
 
            try
 
            {
 
                string argument = "/select, \"" + MainMap.CacheLocation + "TileDBv5\"";
 
                System.Diagnostics.Process.Start("explorer.exe", argument);
 
            }
 
            catch (Exception ex)
 
            {
 
                MessageBox.Show("Failed to open: " + ex.Message, "GMap.NET", MessageBoxButtons.OK, MessageBoxIcon.Error);
 
            }
 
        }
 
 
        #endregion
 
 
        #region graph and map functions
 
 
        #region chart coloring
 
        //this method clears the background of all charts
 
        private void ResetChartColors()
 
        {
 
            chrtTopLeft.BackColor = Color.LightGray;
 
            chrtTopRight.BackColor = Color.LightGray;
 
            chrtBottomLeft.BackColor = Color.LightGray;
 
            chrtBottomRight.BackColor = Color.LightGray;
 
        }
 
 
        //highlight Top Left chart on click
 
        //set text box values based on this chart
 
        private void chrtTopLeft_Click(object sender, EventArgs e)
 
        {
 
            ResetChartColors();
 
            chrtTopLeft.BackColor = Color.Gray;
 
            tboxChartData.Text = "Altitude";
 
            tboxCurrent.Text = "";
 
            tboxAverage.Text = "";
 
            tboxMax.Text = "";
 
            tboxMin.Text = "";
 
        }
 
 
        //highlight Top Right chart on click
 
        //set text box values based on this chart
 
        private void chrtTopRight_Click(object sender, EventArgs e)
 
        {
 
            ResetChartColors();
 
            chrtTopRight.BackColor = Color.Gray;
 
            tboxChartData.Text = "Humidity";
 
            tboxCurrent.Text = "";
 
            tboxAverage.Text = "";
 
            tboxMax.Text = "";
 
            tboxMin.Text = "";
 
        }
 
 
        //highlight Bottom Left chart on click
 
        //set text box values based on this chart
 
        private void chrtBottomLeft_Click(object sender, EventArgs e)
 
        {
 
            ResetChartColors();
 
            chrtBottomLeft.BackColor = Color.Gray;
 
            tboxChartData.Text = "Pressure";
 
            tboxCurrent.Text = "";
 
            tboxAverage.Text = "";
 
            tboxMax.Text = "";
 
            tboxMin.Text = "";
 
        }
 
 
        //highlight Bottom Right chart on click
 
        //set text box values based on this chart
 
        private void chrtBottomRight_Click(object sender, EventArgs e)
 
        {
 
            ResetChartColors();
 
            chrtBottomRight.BackColor = Color.Gray;
 
            tboxChartData.Text = "Map";
 
            tboxCurrent.Text = "";
 
            tboxAverage.Text = "";
 
            tboxMax.Text = "";
 
            tboxMin.Text = "";
 
        }
 
 
        #endregion
 
 
        //runs on init 
 
        public void PrepareGraphs(){
 
 
            //set up for graphs MDKEdit
 
            // http://www.youtube.com/watch?v=zTod4-Fg6Ew - split containers
 
            // http://www.youtube.com/watch?v=bMXtgPk875I - chart controls
 
 
            chrtTopLeft.ChartAreas.Add("altitudeArea");
 
            chrtTopLeft.Series.Add("altitudeTrend");
 
 
            chrtTopRight.ChartAreas.Add("humidityArea");
 
            chrtTopRight.Series.Add("humidityTrend");
 
 
            chrtBottomLeft.Series.Add("pressureTrend");
 
            chrtBottomLeft.ChartAreas.Add("pressureArea");
 
 
            chrtBottomRight.ChartAreas.Add("velocityArea");
 
            chrtBottomRight.Series.Add("velocityTrend");
 
 
            // declare all series, data points to be modified dynamically at run
 
 
            //---------prep altitude area BEGIN 
 
            chrtTopLeft.Series["altitudeTrend"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
 
            chrtTopLeft.Series["altitudeTrend"].Color = Color.Green;
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.X.Equals("Time");
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Altitude");
 
            
 
            ///required initial value
 
            chrtTopLeft.Series["altitudeTrend"].Points.AddXY(0, 0);
 
            //---------prep altitude area END 
 
 
 
            //-----------prep humidity area BEGIN
 
            chrtTopRight.Series["humidityTrend"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
 
            chrtTopRight.Series["humidityTrend"].Color = Color.Red;
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.X.Equals("Time");
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Humidity");
 
 
            ///required initial value
 
            chrtTopRight.Series["humidityTrend"].Points.AddXY(0, 0);
 
            //-----------prep humidity area END
 
 
 
            //-----------prep pressure area BEGIN
 
            chrtBottomLeft.Series["pressureTrend"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
 
            chrtBottomLeft.Series["pressureTrend"].Color = Color.Blue;
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.X.Equals("Time");
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Pressure");
 
 
            ///required initial value
 
            chrtBottomLeft.Series["pressureTrend"].Points.AddXY(0, 0);
 
            //-----------prep pressure area END
 
 
 
            //----------prep velocity area BEGIN
 
            chrtBottomRight.Series["velocityTrend"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
 
            chrtBottomRight.Series["velocityTrend"].Color = Color.Green;
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.X.Equals("Time");
 
            System.Windows.Forms.DataVisualization.Charting.AxisName.Y.Equals("Altitude");
 
 
            ///required initial value
 
            chrtBottomRight.Series["velocityTrend"].Points.AddXY(0, 0);
 
            //----------prep velocity area END
 
 
            //put chart displays in a ready state
 
            ResetChartColors();
 
        }
 
        
 
        string latitude;
 
        string longitude;
 
 
        //parses transmissions and saves data to CSV file
 
        public void ParseIncomingData(string rawDataReceived)
 
        {
 
            //check to see if data should be processed
 
            if (!cboxCollectData.Checked && rawDataReceived.StartsWith("KD8TDF"))
 
            {
 
                AddTextDelegate("Bad transmission: " + rawDataReceived);
 
                return;
 
            }
 
 
            /* sample stansmissions
 
             * KD8TDF-9>APRS,WIDE2-1:/191950zN/WO/ T79 S00 V H99.99 _ |
 
             * KD8TDF-9>APRS,WIDE2-1:/151916z3944.87N/08348.75WO005/0.013 SV:09 A-30.5 B45.64 C99542
 
             */
 
 
            //find and store latitude string
 
            int indexStart = rawDataReceived.IndexOf("z");
 
            int indexEnd = rawDataReceived.IndexOf("N/");
 
            latitude = rawDataReceived.Substring(indexStart + 1, indexEnd - indexStart - 1);
 
 
            //find and store longitude string
 
            indexStart = rawDataReceived.IndexOf("N/");
 
            indexEnd = rawDataReceived.IndexOf("WO");
 
            longitude = rawDataReceived.Substring(indexStart + 2, indexEnd - indexStart - 2);
 
            
 
            //remove APRS overhead from string
 
            string transmissionCommentField= rawDataReceived.Substring(rawDataReceived.IndexOf(" ")); 
 
 
            //place each datum in its own variable
 
            string[] dataTransmission;
 
            dataTransmission = transmissionCommentField.Split(' ');
 
 
            //variables for processing datums
 
            string typeCode;
 
            double data;
 
            string csvData = "";
 
 
            //loop through all datums in the transmission and send them to the chart builder
 
            for (int i = 1; i < dataTransmission.Length; i++)
 
            {
 
                //remove unwanted characters
 
                dataTransmission[i] = dataTransmission[i].Trim('\r');
 
 
                //zero not always trasmitted properly so add '0.0' to any transmission with no data
 
                if (dataTransmission[i].Length == 1) 
 
                {
 
                    dataTransmission[i] += "0";
 
                }
 
                
 
                //pull out data and data type and send to processing function
 
                typeCode = dataTransmission[i].Substring(0, 1);
 
                data = double.Parse(dataTransmission[i].Substring(1));
 
                processTransmissionDatum(typeCode, data);
 
 
                //append data to string for CSV write
 
                csvData += typeCode + data + ",";
 
            }
 
 
            //handle case of no GPS fix
 
            if (latitude == "" || longitude == "")
 
            {
 
                AddText("No GPS fix: ");
 
                AddTextDelegate("No GPS fix: ");
 
            }
 
            else
 
            {
 
                //marker added here so extra accuracy can be added
 
                addMarkerFromTransmit(latitude, longitude);
 
            }
 
 
            //display transmission in message box
 
            AddText(rawDataReceived + "\r\n");
 
            AddTextDelegate(rawDataReceived + "\r\n");
 
 
            //write the data to CSV file
 
            WriteToCSV(csvData);
 
        }
 
 
        //write the data to CSV file
 
        private void WriteToCSV(string data)
 
        {
 
            string path = Directory.GetCurrentDirectory();
 
            string filename = path+"\\debug" + unixTime.Milliseconds + ".csv";
 
            using (StreamWriter writer = new StreamWriter(filename, true))
 
            {
 
                writer.WriteLine(data);
 
            }
 
        }
 
        
 
        //method to process data from transmissions (usually chart inserts)
 
        private void processTransmissionDatum(string dataType, double data)
 
        {
 
            //TODO: add inserts for all charts. altitude is finished and is a template
 
            ///data types organized by listing in google doc
 
            //MASTER MODULE DATA VALUES
 
            if (dataType.Equals("t"))  //board temperature
 
            {
 
 
            }
 
            else if (dataType.Equals("L"))  //battery level
 
            {
 
 
            }
 
            else if (dataType.Equals("X"))  //Latitude accuracy
 
            {
 
 
            }
 
            else if (dataType.Equals("Y"))  //Longitude accuracy
 
            {
 
 
            }
 
            else if (dataType.Equals("V"))  //Velocity
 
            {
 
                chrtBottomRight.Series.FindByName("velocityTrend").Points.AddY(data);
 
                bottomRightChartDelegate(dataType, data);
 
            }
 
            else if (dataType.Equals("I"))  //Info/error Message
 
            {
 
                AddText("Info: " + data + "\r\n");
 
                AddTextDelegate("Info: " + data + "\r\n");
 
            }
 
            else if (dataType.Equals("_"))  //extra latitude decimals
 
            {
 
                longitude += data / 1000; //TODO: check math and decimal placement
 
            }
 
            else if (dataType.Equals("|"))  //extra longitude decimals
 
            {
 
                latitude += data / 1000; //TODO: check math and decimal placement
 
            }
 
 
            //ATMOSPHERIC MODULE DATA VALUES
 
            else if (dataType.Equals("l"))  //battery level
 
            {
 
 
            }
 
            else if (dataType.Equals("C"))  //
 
            {
 
 
            }
 
            else if (dataType.Equals("H"))  //Humidity
 
            {
 
                chrtTopRight.Series.FindByName("humidityTrend").Points.AddY(data);
 
                topRightChartDelegate(dataType, data);
 
            }
 
            else if (dataType.Equals("P"))  //Pressure
 
            {
 
                chrtBottomLeft.Series.FindByName("pressureTrend").Points.AddY(data);
 
                bottomLeftChartDelegate(dataType, data);
 
            }
 
            else if (dataType.Equals("A"))  //Altitude
 
            {
 
                chrtTopLeft.Series.FindByName("altitudeTrend").Points.AddY(data);
 
                topLeftChartDelegate(dataType, data);
 
            }
 
 
            //GEIGER MODULE DATA VALUES
 
            else if (dataType.Equals("l"))  //battery level
 
            {
 
 
            }
 
            else if (dataType.Equals("R"))  //radiation (CPM)
 
            {
 
 
            }
 
 
            // CAMERA MODULE DATA VALUES
 
            else if (dataType.Equals("l"))  //battery level
 
            {
 
 
            }
 
 
            //INVALID DATA TYPE
 
            else
 
            {
 
 
            }
 
        }
 
 
        //must change lat/long coords to properly place map marker
 
        float conv_coords(float in_coords)
 
        {
 
            //Initialize the location.
 
            float f = in_coords;
 
            // Get the first two digits by turning f into an integer, then doing an integer divide by 100;
 
            // firsttowdigits should be 77 at this point.
 
            int firsttwodigits = ((int)f) / 100;                               //This assumes that f < 10000.
 
            float nexttwodigits = f - (float)(firsttwodigits * 100);
 
            float theFinalAnswer = (float)(firsttwodigits + nexttwodigits / 60.0);
 
            return theFinalAnswer;
 
        }
 
 
        //must change lat/long coords to properly place map marker
 
        public decimal DmsToDD(double d, double m = 0, double s = 0)
 
        {
 
            return Convert.ToDecimal((d + (m / 60) + (s / 3600)) * (d < 0 ? -1 : 1));
 
        }
 
 
        // add marker from an APRS transmission - MDKEdit
 
        private void addMarkerFromTransmit(string lat, string lng)
 
        {
 
 
            double latitude = double.Parse(lat), longitude = double.Parse(lng);
 
            PointLatLng APRSloc = new PointLatLng();
 
            APRSloc.Lat = conv_coords((float)latitude);
 
            APRSloc.Lng = conv_coords((float)longitude)*-1;
 
 
            GMarkerGoogle m = new GMarkerGoogle(APRSloc, GMarkerGoogleType.blue_small);
 
 
            Placemark? p = null;
 
            if (xboxPlacemarkInfo.Checked)
 
            {
 
                GeoCoderStatusCode status;
 
                var ret = GMapProviders.GoogleMap.GetPlacemark(currentMarker.Position, out status);
 
                if (status == GeoCoderStatusCode.G_GEO_SUCCESS && ret != null)
 
                {
 
                    p = ret;
 
                }
 
            }
 
 
            objects.Markers.Add(m);
 
        }
 
        
 
        #endregion
 
 
        #region cross theading
 
 
        //these are for function calls across threads
 
        delegate void SetTextDelegate(string value);
 
        public void AddText(string value)
 
        public void AddTextDelegate(string value)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new SetTextDelegate(AddText), value);
 
                Invoke(new SetTextDelegate(AddTextDelegate), value);
 
            }
 
            else
 
            {
 
                tboxMessageBox.AppendText(value);// += value;
 
                textBoxMarkerCount.Text = objects.Markers.Count.ToString();
 
            }
 
        }
 
 
        delegate void ChartDataDelegate(string dataType, double data);
 
        public void AddDataToChart(string dataType, double data)
 
        public void topLeftChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(topLeftChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                chrtTopLeft.Series.FindByName("altitudeTrend").Points.AddY(data);
 
            }
 
        }
 
 
        public void topRightChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(AddDataToChart), dataType, data);
 
                Invoke(new ChartDataDelegate(topRightChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                processTransmissionDatum(dataType, data);
 
                chrtTopRight.Series.FindByName("humidityTrend").Points.AddY(data); 
 
            }
 
        }
 
 
        public void bottomLeftChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(bottomLeftChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                chrtBottomLeft.Series.FindByName("pressureTrend").Points.AddY(data);
 
            }
 
        }
 
 
        public void bottomRightChartDelegate(string dataType, double data)
 
        {
 
            if (InvokeRequired)
 
            {
 
                Invoke(new ChartDataDelegate(bottomRightChartDelegate), dataType, data);
 
            }
 
            else
 
            {
 
                chrtBottomRight.Series.FindByName("velocityTrend").Points.AddY(data);
 
            }
 
        }
 
 
        #endregion
 
 
        #region testing
 
        
 
        //click event on the test button
 
        //currently simulates serial inputs
 
        string testData;
 
        int testIteration = 0;
 
        double testLat = 39.751248, testLng = -83.809848, testVelocity = 5.8, testAltitude = 100, testPressure = 700, testHumidity = 38;
 
        private void btnTest_Click(object sender, EventArgs e)
 
        {
 
            testLat += GetRandomNumber(-.005, .015);
 
            testLng += GetRandomNumber(-.005, .015);
 
            testVelocity += GetRandomNumber(1, 15);
 
            testAltitude += GetRandomNumber(50, 150);
 
            testPressure -= GetRandomNumber(10, 50);
 
            testHumidity -= GetRandomNumber(1, 3);
 
 
            switch (testIteration)
 
            {
 
                case 0:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude+" H"+testHumidity+" P"+testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 1:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 2:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 3:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 4:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 5:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 6:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 7:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 8:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                case 9:
 
                    testData = "KD8TDF-9>APRS,WIDE2-1:/151916z" + testLat + "N/" + testLng + "WO005/0.013 V" + testVelocity + " A" + testAltitude + " H" + testHumidity + " P" + testPressure;
 
                    ParseIncomingData(testData);
 
                    break;
 
                default:
 
                    break;
 
            }
 
            testIteration++;
 
        }
 
 
        public double GetRandomNumber(double minimum, double maximum)
 
        {
 
            Random random = new Random();
 
            return random.NextDouble() * (maximum - minimum) + minimum;
 
        }
 
 
        #endregion
 
 
    }
 
}
 
//TODO: CSV logging, offline caching
0 comments (0 inline, 0 general)