From 36ade2aaf6256647f28f6811469b1aadc07593f9 Mon Sep 17 00:00:00 2001 From: mandrolic Date: Thu, 23 Dec 2010 15:59:00 +0000 Subject: [PATCH] Configurator.Net: Added Fake Arducopter comms, Wrapped progress bar into custom control, improved Mono compatibility git-svn-id: https://arducopter.googlecode.com/svn/trunk@1237 f9c3cf11-9bcb-44bc-f272-b75c42450872 --- .../ArducopterConfigurator.csproj | 14 +- Configurator/Configurator.Net/CommsSession.cs | 12 +- .../Configurator.Net/FakeCommsSession.cs | 110 +++++++++++++++ .../PresentationModels/MainVm.cs | 24 ++-- .../PresentationModels/MonitorVm.cs | 1 + Configurator/Configurator.Net/Program.cs | 6 +- .../Test/AcroModeConfigVmTest.cs | 8 +- .../Test/AltitudeHoldVmTest.cs | 10 +- .../Test/ArducopterConfiguratorTest.csproj | 13 +- .../Test/CalibrationOffsetsDataVmTest.cs | 4 +- .../Configurator.Net/Test/MainVmTests.cs | 18 ++- .../Test/MotorCommandsVmTest.cs | 6 +- .../Test/PositionHoldConfigVmTest.cs | 4 +- .../Test/StableModeConfigVmTest.cs | 10 +- .../Configurator.Net/Test/VmTestBase.cs | 14 +- .../Views/FlightDataView.Designer.cs | 119 +++++++++-------- .../controls/LinearSensorIndicatorControl.cs | 111 +++++++++++++++ .../LinearSensorIndicatorControl.resx | 126 ++++++++++++++++++ .../Views/controls/VerticalProgressBar.cs | 24 ++++ .../Views/mainForm.Designer.cs | 32 ++--- .../Configurator.Net/Views/mainForm.cs | 2 + .../Configurator.Net/Views/mainForm.resx | 74 +++++----- 22 files changed, 572 insertions(+), 170 deletions(-) create mode 100644 Configurator/Configurator.Net/FakeCommsSession.cs create mode 100644 Configurator/Configurator.Net/Views/controls/LinearSensorIndicatorControl.cs create mode 100644 Configurator/Configurator.Net/Views/controls/LinearSensorIndicatorControl.resx create mode 100644 Configurator/Configurator.Net/Views/controls/VerticalProgressBar.cs diff --git a/Configurator/Configurator.Net/ArducopterConfigurator.csproj b/Configurator/Configurator.Net/ArducopterConfigurator.csproj index be5dd441b7..93d5e92769 100644 --- a/Configurator/Configurator.Net/ArducopterConfigurator.csproj +++ b/Configurator/Configurator.Net/ArducopterConfigurator.csproj @@ -1,4 +1,4 @@ - + Debug @@ -10,7 +10,7 @@ Properties ArducopterConfigurator ArducopterConfigurator - v2.0 + v3.5 512 @@ -41,6 +41,7 @@ + @@ -70,8 +71,8 @@ Resources.Designer.cs Designer - - SensorDisplay.cs + + LinearSensorIndicatorControl.cs AcroConfigView.cs @@ -120,10 +121,10 @@ Settings.settings True - + Component - + Component @@ -195,6 +196,7 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + + False + + \ No newline at end of file diff --git a/Configurator/Configurator.Net/Views/controls/VerticalProgressBar.cs b/Configurator/Configurator.Net/Views/controls/VerticalProgressBar.cs new file mode 100644 index 0000000000..cf1549a3c3 --- /dev/null +++ b/Configurator/Configurator.Net/Views/controls/VerticalProgressBar.cs @@ -0,0 +1,24 @@ +using System.ComponentModel; +using System.Drawing; +using System.Windows.Forms; + +namespace ArducopterConfigurator +{ + [Description("Vertical Progress Bar")] + [ToolboxBitmap(typeof(ProgressBar))] + public class VerticalProgressBar : ProgressBar + { + protected override CreateParams CreateParams + { + get + { + CreateParams cp = base.CreateParams; + cp.Style |= 0x04; + return cp; + } + } + + + + } +} \ No newline at end of file diff --git a/Configurator/Configurator.Net/Views/mainForm.Designer.cs b/Configurator/Configurator.Net/Views/mainForm.Designer.cs index d68cba5c0f..57536ba307 100644 --- a/Configurator/Configurator.Net/Views/mainForm.Designer.cs +++ b/Configurator/Configurator.Net/Views/mainForm.Designer.cs @@ -1,4 +1,5 @@ -namespace ArducopterConfigurator +using System; +namespace ArducopterConfigurator { partial class mainForm { @@ -32,7 +33,7 @@ System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(mainForm)); this.tabCtrlMonitorVms = new System.Windows.Forms.TabControl(); this.mainVmBindingSource = new System.Windows.Forms.BindingSource(this.components); - this.comboBox1 = new System.Windows.Forms.ComboBox(); + this.cmboComPorts = new System.Windows.Forms.ComboBox(); this.availablePortsBindingSource = new System.Windows.Forms.BindingSource(this.components); this.btnConnect = new System.Windows.Forms.Button(); this.button1 = new System.Windows.Forms.Button(); @@ -61,21 +62,16 @@ // this.mainVmBindingSource.DataSource = typeof(ArducopterConfigurator.PresentationModels.MainVm); // - // comboBox1 + // cmboComPorts // - this.comboBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.comboBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.mainVmBindingSource, "SelectedPort", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); - this.comboBox1.DataSource = this.availablePortsBindingSource; - this.comboBox1.FormattingEnabled = true; - this.comboBox1.Location = new System.Drawing.Point(12, 412); - this.comboBox1.Name = "comboBox1"; - this.comboBox1.Size = new System.Drawing.Size(79, 21); - this.comboBox1.TabIndex = 5; - // - // availablePortsBindingSource - // - this.availablePortsBindingSource.DataMember = "AvailablePorts"; - this.availablePortsBindingSource.DataSource = this.mainVmBindingSource; + this.cmboComPorts.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.cmboComPorts.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.mainVmBindingSource, "SelectedPort", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged)); + this.cmboComPorts.DataSource = this.availablePortsBindingSource; + this.cmboComPorts.FormattingEnabled = true; + this.cmboComPorts.Location = new System.Drawing.Point(12, 412); + this.cmboComPorts.Name = "cmboComPorts"; + this.cmboComPorts.Size = new System.Drawing.Size(79, 21); + this.cmboComPorts.TabIndex = 5; // // btnConnect // @@ -134,7 +130,7 @@ this.Controls.Add(this.lblConnectionStatus); this.Controls.Add(this.button1); this.Controls.Add(this.btnConnect); - this.Controls.Add(this.comboBox1); + this.Controls.Add(this.cmboComPorts); this.Controls.Add(this.tabCtrlMonitorVms); this.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.mainVmBindingSource, "Name", true)); this.Name = "mainForm"; @@ -151,7 +147,7 @@ private System.Windows.Forms.TabControl tabCtrlMonitorVms; private System.Windows.Forms.BindingSource mainVmBindingSource; - private System.Windows.Forms.ComboBox comboBox1; + private System.Windows.Forms.ComboBox cmboComPorts; private System.Windows.Forms.Button btnConnect; private System.Windows.Forms.BindingSource availablePortsBindingSource; private System.Windows.Forms.Button button1; diff --git a/Configurator/Configurator.Net/Views/mainForm.cs b/Configurator/Configurator.Net/Views/mainForm.cs index 04112ec156..7e33681334 100644 --- a/Configurator/Configurator.Net/Views/mainForm.cs +++ b/Configurator/Configurator.Net/Views/mainForm.cs @@ -93,7 +93,9 @@ namespace ArducopterConfigurator { _vm = model; mainVmBindingSource.DataSource = model; + availablePortsBindingSource.DataSource = model.AvailablePorts; + foreach (var monitorVm in _vm.MonitorVms) { var tp = new TabPage(monitorVm.Name) {Tag = monitorVm}; diff --git a/Configurator/Configurator.Net/Views/mainForm.resx b/Configurator/Configurator.Net/Views/mainForm.resx index e7cd64a633..51511c0e03 100644 --- a/Configurator/Configurator.Net/Views/mainForm.resx +++ b/Configurator/Configurator.Net/Views/mainForm.resx @@ -127,17 +127,18 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAJZSURBVDhPlZPdT5JhGMbZ2trczNqiWdnanLnVbNTWhl9I - koSoDTFf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