Browse Source
git-svn-id: https://arducopter.googlecode.com/svn/trunk@1665 f9c3cf11-9bcb-44bc-f272-b75c42450872master
mandrolic
14 years ago
12 changed files with 352 additions and 548 deletions
@ -1,80 +0,0 @@
@@ -1,80 +0,0 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.Diagnostics; |
||||
|
||||
namespace ArducopterConfigurator.PresentationModels |
||||
{ |
||||
public class CalibrationOffsetsDataVm : NotifyProperyChangedBase, IPresentationModel |
||||
{ |
||||
private readonly string[] PropsInUpdateOrder = new[] |
||||
{ |
||||
"GyroRollOffset", |
||||
"GyroPitchOffset", |
||||
"GyroYawOffset", |
||||
"AccelRollOffset", |
||||
"AccelPitchOffset", |
||||
"AccelZOffset" |
||||
}; |
||||
|
||||
public CalibrationOffsetsDataVm() |
||||
{ |
||||
|
||||
|
||||
RefreshCommand = new DelegateCommand(_ => RefreshValues()); |
||||
UpdateCommand = new DelegateCommand(_ => UpdateValues()); |
||||
} |
||||
|
||||
public ICommand RefreshCommand { get; private set; } |
||||
|
||||
public ICommand UpdateCommand { get; private set; } |
||||
|
||||
public float GyroRollOffset { get; set; } |
||||
public float GyroPitchOffset { get; set; } |
||||
public float GyroYawOffset { get; set; } |
||||
|
||||
public float AccelRollOffset { get; set; } |
||||
public float AccelPitchOffset { get; set; } |
||||
public float AccelZOffset { get; set; } |
||||
|
||||
private void RefreshValues() |
||||
{ |
||||
if (sendTextToApm != null) |
||||
sendTextToApm(this, new sendTextToApmEventArgs("J")); |
||||
} |
||||
|
||||
public void UpdateValues() |
||||
{ |
||||
if (sendTextToApm != null) |
||||
{ |
||||
var apmString = PropertyHelper.ComposePropValuesWithCommand(this, PropsInUpdateOrder, "I"); |
||||
sendTextToApm(this, new sendTextToApmEventArgs(apmString)); |
||||
} |
||||
} |
||||
|
||||
public string Name |
||||
{ |
||||
get { return "Calibration"; } |
||||
} |
||||
|
||||
public void Activate() |
||||
{ |
||||
RefreshValues(); |
||||
} |
||||
|
||||
public void DeActivate() |
||||
{ |
||||
} |
||||
|
||||
public event EventHandler updatedByApm; |
||||
|
||||
public void handleLineOfText(string strRx) |
||||
{ |
||||
PropertyHelper.PopulatePropsFromUpdate(this, PropsInUpdateOrder, strRx, true); |
||||
|
||||
if (updatedByApm != null) |
||||
updatedByApm(this, EventArgs.Empty); |
||||
} |
||||
|
||||
public event EventHandler<sendTextToApmEventArgs> sendTextToApm; |
||||
} |
||||
} |
@ -1,251 +0,0 @@
@@ -1,251 +0,0 @@
|
||||
namespace ArducopterConfigurator.Views |
||||
{ |
||||
partial class CalibrationView |
||||
{ |
||||
/// <summary> |
||||
/// Required designer variable. |
||||
/// </summary> |
||||
private System.ComponentModel.IContainer components = null; |
||||
|
||||
/// <summary> |
||||
/// Clean up any resources being used. |
||||
/// </summary> |
||||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> |
||||
protected override void Dispose(bool disposing) |
||||
{ |
||||
if (disposing && (components != null)) |
||||
{ |
||||
components.Dispose(); |
||||
} |
||||
base.Dispose(disposing); |
||||
} |
||||
|
||||
#region Component Designer generated code |
||||
|
||||
/// <summary> |
||||
/// Required method for Designer support - do not modify |
||||
/// the contents of this method with the code editor. |
||||
/// </summary> |
||||
private void InitializeComponent() |
||||
{ |
||||
this.components = new System.ComponentModel.Container(); |
||||
this.groupBox1 = new System.Windows.Forms.GroupBox(); |
||||
this.label3 = new System.Windows.Forms.Label(); |
||||
this.textBox3 = new System.Windows.Forms.TextBox(); |
||||
this.calibrationOffsetsDataVmBindingSource = new System.Windows.Forms.BindingSource(this.components); |
||||
this.label2 = new System.Windows.Forms.Label(); |
||||
this.textBox2 = new System.Windows.Forms.TextBox(); |
||||
this.label1 = new System.Windows.Forms.Label(); |
||||
this.textBox1 = new System.Windows.Forms.TextBox(); |
||||
this.label4 = new System.Windows.Forms.Label(); |
||||
this.groupBox2 = new System.Windows.Forms.GroupBox(); |
||||
this.textBox4 = new System.Windows.Forms.TextBox(); |
||||
this.label5 = new System.Windows.Forms.Label(); |
||||
this.textBox5 = new System.Windows.Forms.TextBox(); |
||||
this.label6 = new System.Windows.Forms.Label(); |
||||
this.textBox6 = new System.Windows.Forms.TextBox(); |
||||
this.button2 = new System.Windows.Forms.Button(); |
||||
this.button1 = new System.Windows.Forms.Button(); |
||||
this.groupBox1.SuspendLayout(); |
||||
((System.ComponentModel.ISupportInitialize)(this.calibrationOffsetsDataVmBindingSource)).BeginInit(); |
||||
this.groupBox2.SuspendLayout(); |
||||
this.SuspendLayout(); |
||||
// |
||||
// groupBox1 |
||||
// |
||||
this.groupBox1.Controls.Add(this.label3); |
||||
this.groupBox1.Controls.Add(this.textBox3); |
||||
this.groupBox1.Controls.Add(this.label2); |
||||
this.groupBox1.Controls.Add(this.textBox2); |
||||
this.groupBox1.Controls.Add(this.label1); |
||||
this.groupBox1.Controls.Add(this.textBox1); |
||||
this.groupBox1.Location = new System.Drawing.Point(3, 3); |
||||
this.groupBox1.Name = "groupBox1"; |
||||
this.groupBox1.Size = new System.Drawing.Size(141, 107); |
||||
this.groupBox1.TabIndex = 0; |
||||
this.groupBox1.TabStop = false; |
||||
this.groupBox1.Text = "Gyro Offset"; |
||||
// |
||||
// label3 |
||||
// |
||||
this.label3.AutoSize = true; |
||||
this.label3.Location = new System.Drawing.Point(6, 84); |
||||
this.label3.Name = "label3"; |
||||
this.label3.Size = new System.Drawing.Size(28, 13); |
||||
this.label3.TabIndex = 5; |
||||
this.label3.Text = "Yaw"; |
||||
// |
||||
// textBox3 |
||||
// |
||||
this.textBox3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.calibrationOffsetsDataVmBindingSource, "GyroYawOffset", true)); |
||||
this.textBox3.Location = new System.Drawing.Point(59, 77); |
||||
this.textBox3.Name = "textBox3"; |
||||
this.textBox3.Size = new System.Drawing.Size(71, 20); |
||||
this.textBox3.TabIndex = 4; |
||||
// |
||||
// calibrationOffsetsDataVmBindingSource |
||||
// |
||||
this.calibrationOffsetsDataVmBindingSource.DataSource = typeof(ArducopterConfigurator.PresentationModels.CalibrationOffsetsDataVm); |
||||
// |
||||
// label2 |
||||
// |
||||
this.label2.AutoSize = true; |
||||
this.label2.Location = new System.Drawing.Point(6, 58); |
||||
this.label2.Name = "label2"; |
||||
this.label2.Size = new System.Drawing.Size(31, 13); |
||||
this.label2.TabIndex = 3; |
||||
this.label2.Text = "Pitch"; |
||||
// |
||||
// textBox2 |
||||
// |
||||
this.textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.calibrationOffsetsDataVmBindingSource, "GyroPitchOffset", true)); |
||||
this.textBox2.Location = new System.Drawing.Point(59, 51); |
||||
this.textBox2.Name = "textBox2"; |
||||
this.textBox2.Size = new System.Drawing.Size(71, 20); |
||||
this.textBox2.TabIndex = 2; |
||||
// |
||||
// label1 |
||||
// |
||||
this.label1.AutoSize = true; |
||||
this.label1.Location = new System.Drawing.Point(6, 32); |
||||
this.label1.Name = "label1"; |
||||
this.label1.Size = new System.Drawing.Size(25, 13); |
||||
this.label1.TabIndex = 1; |
||||
this.label1.Text = "Roll"; |
||||
// |
||||
// textBox1 |
||||
// |
||||
this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.calibrationOffsetsDataVmBindingSource, "GyroRollOffset", true)); |
||||
this.textBox1.Location = new System.Drawing.Point(59, 25); |
||||
this.textBox1.Name = "textBox1"; |
||||
this.textBox1.Size = new System.Drawing.Size(71, 20); |
||||
this.textBox1.TabIndex = 0; |
||||
// |
||||
// label4 |
||||
// |
||||
this.label4.AutoSize = true; |
||||
this.label4.Location = new System.Drawing.Point(6, 84); |
||||
this.label4.Name = "label4"; |
||||
this.label4.Size = new System.Drawing.Size(14, 13); |
||||
this.label4.TabIndex = 5; |
||||
this.label4.Text = "Z"; |
||||
// |
||||
// groupBox2 |
||||
// |
||||
this.groupBox2.Controls.Add(this.label4); |
||||
this.groupBox2.Controls.Add(this.textBox4); |
||||
this.groupBox2.Controls.Add(this.label5); |
||||
this.groupBox2.Controls.Add(this.textBox5); |
||||
this.groupBox2.Controls.Add(this.label6); |
||||
this.groupBox2.Controls.Add(this.textBox6); |
||||
this.groupBox2.Location = new System.Drawing.Point(150, 3); |
||||
this.groupBox2.Name = "groupBox2"; |
||||
this.groupBox2.Size = new System.Drawing.Size(141, 107); |
||||
this.groupBox2.TabIndex = 6; |
||||
this.groupBox2.TabStop = false; |
||||
this.groupBox2.Text = "Accel Offset"; |
||||
// |
||||
// textBox4 |
||||
// |
||||
this.textBox4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.calibrationOffsetsDataVmBindingSource, "AccelZOffset", true)); |
||||
this.textBox4.Location = new System.Drawing.Point(59, 77); |
||||
this.textBox4.Name = "textBox4"; |
||||
this.textBox4.Size = new System.Drawing.Size(71, 20); |
||||
this.textBox4.TabIndex = 4; |
||||
// |
||||
// label5 |
||||
// |
||||
this.label5.AutoSize = true; |
||||
this.label5.Location = new System.Drawing.Point(6, 58); |
||||
this.label5.Name = "label5"; |
||||
this.label5.Size = new System.Drawing.Size(31, 13); |
||||
this.label5.TabIndex = 3; |
||||
this.label5.Text = "Pitch"; |
||||
// |
||||
// textBox5 |
||||
// |
||||
this.textBox5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.calibrationOffsetsDataVmBindingSource, "AccelPitchOffset", true)); |
||||
this.textBox5.Location = new System.Drawing.Point(59, 51); |
||||
this.textBox5.Name = "textBox5"; |
||||
this.textBox5.Size = new System.Drawing.Size(71, 20); |
||||
this.textBox5.TabIndex = 2; |
||||
// |
||||
// label6 |
||||
// |
||||
this.label6.AutoSize = true; |
||||
this.label6.Location = new System.Drawing.Point(6, 32); |
||||
this.label6.Name = "label6"; |
||||
this.label6.Size = new System.Drawing.Size(25, 13); |
||||
this.label6.TabIndex = 1; |
||||
this.label6.Text = "Roll"; |
||||
// |
||||
// textBox6 |
||||
// |
||||
this.textBox6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.calibrationOffsetsDataVmBindingSource, "AccelRollOffset", true)); |
||||
this.textBox6.Location = new System.Drawing.Point(59, 25); |
||||
this.textBox6.Name = "textBox6"; |
||||
this.textBox6.Size = new System.Drawing.Size(71, 20); |
||||
this.textBox6.TabIndex = 0; |
||||
// |
||||
// button2 |
||||
// |
||||
this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
||||
this.button2.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.calibrationOffsetsDataVmBindingSource, "RefreshCommand", true)); |
||||
this.button2.Location = new System.Drawing.Point(143, 117); |
||||
this.button2.Name = "button2"; |
||||
this.button2.Size = new System.Drawing.Size(74, 23); |
||||
this.button2.TabIndex = 14; |
||||
this.button2.Text = "Refresh"; |
||||
this.button2.UseVisualStyleBackColor = true; |
||||
// |
||||
// button1 |
||||
// |
||||
this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
||||
this.button1.DataBindings.Add(new System.Windows.Forms.Binding("Tag", this.calibrationOffsetsDataVmBindingSource, "UpdateCommand", true)); |
||||
this.button1.Location = new System.Drawing.Point(223, 117); |
||||
this.button1.Name = "button1"; |
||||
this.button1.Size = new System.Drawing.Size(74, 23); |
||||
this.button1.TabIndex = 13; |
||||
this.button1.Text = "Update"; |
||||
this.button1.UseVisualStyleBackColor = true; |
||||
// |
||||
// CalibrationView |
||||
// |
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); |
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
||||
this.Controls.Add(this.button2); |
||||
this.Controls.Add(this.button1); |
||||
this.Controls.Add(this.groupBox2); |
||||
this.Controls.Add(this.groupBox1); |
||||
this.Name = "CalibrationView"; |
||||
this.Size = new System.Drawing.Size(300, 143); |
||||
this.groupBox1.ResumeLayout(false); |
||||
this.groupBox1.PerformLayout(); |
||||
((System.ComponentModel.ISupportInitialize)(this.calibrationOffsetsDataVmBindingSource)).EndInit(); |
||||
this.groupBox2.ResumeLayout(false); |
||||
this.groupBox2.PerformLayout(); |
||||
this.ResumeLayout(false); |
||||
|
||||
} |
||||
|
||||
#endregion |
||||
|
||||
private System.Windows.Forms.GroupBox groupBox1; |
||||
private System.Windows.Forms.Label label3; |
||||
private System.Windows.Forms.TextBox textBox3; |
||||
private System.Windows.Forms.Label label2; |
||||
private System.Windows.Forms.TextBox textBox2; |
||||
private System.Windows.Forms.Label label1; |
||||
private System.Windows.Forms.TextBox textBox1; |
||||
private System.Windows.Forms.Label label4; |
||||
private System.Windows.Forms.GroupBox groupBox2; |
||||
private System.Windows.Forms.TextBox textBox4; |
||||
private System.Windows.Forms.Label label5; |
||||
private System.Windows.Forms.TextBox textBox5; |
||||
private System.Windows.Forms.Label label6; |
||||
private System.Windows.Forms.TextBox textBox6; |
||||
private System.Windows.Forms.BindingSource calibrationOffsetsDataVmBindingSource; |
||||
private System.Windows.Forms.Button button2; |
||||
private System.Windows.Forms.Button button1; |
||||
} |
||||
} |
@ -1,32 +0,0 @@
@@ -1,32 +0,0 @@
|
||||
using System; |
||||
using System.Collections.Generic; |
||||
using System.ComponentModel; |
||||
using System.Drawing; |
||||
using System.Data; |
||||
using System.Text; |
||||
using System.Windows.Forms; |
||||
using ArducopterConfigurator.PresentationModels; |
||||
|
||||
namespace ArducopterConfigurator.Views |
||||
{ |
||||
public partial class CalibrationView : CalibrationViewDesignable |
||||
{ |
||||
public CalibrationView() |
||||
{ |
||||
InitializeComponent(); |
||||
BindButtons(); |
||||
} |
||||
|
||||
public override void SetDataContext(CalibrationOffsetsDataVm vm) |
||||
{ |
||||
calibrationOffsetsDataVmBindingSource.DataSource = vm; |
||||
|
||||
|
||||
if (Program.IsMonoRuntime) |
||||
vm.PropertyChanged += ((sender, e) => calibrationOffsetsDataVmBindingSource.ResetBindings(false)); |
||||
} |
||||
} |
||||
|
||||
// Required for VS2008 designer. No functional value |
||||
public class CalibrationViewDesignable : ViewCommon<CalibrationOffsetsDataVm> { } |
||||
} |
@ -1,123 +0,0 @@
@@ -1,123 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?> |
||||
<root> |
||||
<!-- |
||||
Microsoft ResX Schema |
||||
|
||||
Version 2.0 |
||||
|
||||
The primary goals of this format is to allow a simple XML format |
||||
that is mostly human readable. The generation and parsing of the |
||||
various data types are done through the TypeConverter classes |
||||
associated with the data types. |
||||
|
||||
Example: |
||||
|
||||
... ado.net/XML headers & schema ... |
||||
<resheader name="resmimetype">text/microsoft-resx</resheader> |
||||
<resheader name="version">2.0</resheader> |
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader> |
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader> |
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data> |
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data> |
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64"> |
||||
<value>[base64 mime encoded serialized .NET Framework object]</value> |
||||
</data> |
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> |
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value> |
||||
<comment>This is a comment</comment> |
||||
</data> |
||||
|
||||
There are any number of "resheader" rows that contain simple |
||||
name/value pairs. |
||||
|
||||
Each data row contains a name, and value. The row also contains a |
||||
type or mimetype. Type corresponds to a .NET class that support |
||||
text/value conversion through the TypeConverter architecture. |
||||
Classes that don't support this are serialized and stored with the |
||||
mimetype set. |
||||
|
||||
The mimetype is used for serialized objects, and tells the |
||||
ResXResourceReader how to depersist the object. This is currently not |
||||
extensible. For a given mimetype the value must be set accordingly: |
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format |
||||
that the ResXResourceWriter will generate, however the reader can |
||||
read any of the formats listed below. |
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64 |
||||
value : The object must be serialized with |
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter |
||||
: and then encoded with base64 encoding. |
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64 |
||||
value : The object must be serialized into a byte array |
||||
: using a System.ComponentModel.TypeConverter |
||||
: and then encoded with base64 encoding. |
||||
--> |
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"> |
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" /> |
||||
<xsd:element name="root" msdata:IsDataSet="true"> |
||||
<xsd:complexType> |
||||
<xsd:choice maxOccurs="unbounded"> |
||||
<xsd:element name="metadata"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" use="required" type="xsd:string" /> |
||||
<xsd:attribute name="type" type="xsd:string" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="assembly"> |
||||
<xsd:complexType> |
||||
<xsd:attribute name="alias" type="xsd:string" /> |
||||
<xsd:attribute name="name" type="xsd:string" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="data"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" /> |
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" /> |
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" /> |
||||
<xsd:attribute ref="xml:space" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
<xsd:element name="resheader"> |
||||
<xsd:complexType> |
||||
<xsd:sequence> |
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" /> |
||||
</xsd:sequence> |
||||
<xsd:attribute name="name" type="xsd:string" use="required" /> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:choice> |
||||
</xsd:complexType> |
||||
</xsd:element> |
||||
</xsd:schema> |
||||
<resheader name="resmimetype"> |
||||
<value>text/microsoft-resx</value> |
||||
</resheader> |
||||
<resheader name="version"> |
||||
<value>2.0</value> |
||||
</resheader> |
||||
<resheader name="reader"> |
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<resheader name="writer"> |
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value> |
||||
</resheader> |
||||
<metadata name="calibrationOffsetsDataVmBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> |
||||
<value>17, 17</value> |
||||
</metadata> |
||||
</root> |
Loading…
Reference in new issue