mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-11 02:18:29 -04:00
planner cleanup
This commit is contained in:
parent
e06a0d81db
commit
91ba8fdb83
@ -1,64 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
public partial class ProgressReporter : Form
|
||||
{
|
||||
bool cancel = false;
|
||||
|
||||
public ProgressReporter()
|
||||
{
|
||||
InitializeComponent();
|
||||
cancel = false;
|
||||
}
|
||||
|
||||
private void btnCancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
cancel = true;
|
||||
this.Close();
|
||||
}
|
||||
|
||||
public void updateProgressAndStatus(int progress, string status)
|
||||
{
|
||||
//Console.WriteLine(progress + " " + status);
|
||||
|
||||
if (cancel)
|
||||
{
|
||||
throw new Exception("User Canceled");
|
||||
}
|
||||
|
||||
if (this.IsDisposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
this.Invoke((MethodInvoker)delegate
|
||||
{
|
||||
|
||||
lblProgressMessage.Text = status;
|
||||
if (progress == -1)
|
||||
{
|
||||
this.progressBar1.Style = ProgressBarStyle.Marquee;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.progressBar1.Style = ProgressBarStyle.Continuous;
|
||||
this.progressBar1.Value = progress;
|
||||
}
|
||||
});
|
||||
}
|
||||
catch { }
|
||||
|
||||
System.Windows.Forms.Application.DoEvents();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
partial class ProgressReporter
|
||||
{
|
||||
/// <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 Windows Form 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.progressBar1 = new System.Windows.Forms.ProgressBar();
|
||||
this.lblProgressMessage = new System.Windows.Forms.Label();
|
||||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// progressBar1
|
||||
//
|
||||
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.progressBar1.Location = new System.Drawing.Point(12, 82);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(277, 13);
|
||||
this.progressBar1.TabIndex = 0;
|
||||
//
|
||||
// lblProgressMessage
|
||||
//
|
||||
this.lblProgressMessage.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.lblProgressMessage.Location = new System.Drawing.Point(13, 13);
|
||||
this.lblProgressMessage.Name = "lblProgressMessage";
|
||||
this.lblProgressMessage.Size = new System.Drawing.Size(276, 66);
|
||||
this.lblProgressMessage.TabIndex = 1;
|
||||
this.lblProgressMessage.Text = "label1";
|
||||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(213, 109);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.TabIndex = 2;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
|
||||
//
|
||||
// ProgressReporter
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(306, 144);
|
||||
this.ControlBox = false;
|
||||
this.Controls.Add(this.btnCancel);
|
||||
this.Controls.Add(this.lblProgressMessage);
|
||||
this.Controls.Add(this.progressBar1);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||
this.MaximizeBox = false;
|
||||
this.MinimizeBox = false;
|
||||
this.Name = "ProgressReporter";
|
||||
this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide;
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "Progress";
|
||||
this.ResumeLayout(false);
|
||||
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private ProgressBar progressBar1;
|
||||
private System.Windows.Forms.Label lblProgressMessage;
|
||||
private Button btnCancel;
|
||||
}
|
||||
}
|
@ -1,120 +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>
|
||||
</root>
|
@ -1,132 +0,0 @@
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
using ArdupilotMega.Controls;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
public static class CustomMessageBox
|
||||
{
|
||||
const int FORM_Y_MARGIN = 10;
|
||||
const int FORM_X_MARGIN = 16;
|
||||
|
||||
public static DialogResult Show(string text)
|
||||
{
|
||||
return Show(text, string.Empty, MessageBoxButtons.OK, MessageBoxIcon.None);
|
||||
}
|
||||
|
||||
public static DialogResult Show(string text, string caption)
|
||||
{
|
||||
return Show(text, caption, MessageBoxButtons.OK, MessageBoxIcon.None);
|
||||
}
|
||||
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons)
|
||||
{
|
||||
return Show(text, caption, buttons, MessageBoxIcon.None);
|
||||
}
|
||||
|
||||
public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon)
|
||||
{
|
||||
var msgBoxFrm = new Form
|
||||
{
|
||||
FormBorderStyle = FormBorderStyle.FixedDialog,
|
||||
ShowInTaskbar = false,
|
||||
StartPosition = FormStartPosition.CenterScreen,
|
||||
Text = caption,
|
||||
MaximizeBox = false,
|
||||
MinimizeBox = false,
|
||||
Width = 400,
|
||||
Height = 170
|
||||
};
|
||||
|
||||
Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
|
||||
int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
|
||||
|
||||
var lblMessage = new Label
|
||||
{
|
||||
Left = 58,
|
||||
Top = 15,
|
||||
Width = 300,
|
||||
Text = text,
|
||||
AutoSize = true,
|
||||
};
|
||||
|
||||
|
||||
|
||||
msgBoxFrm.Controls.Add(lblMessage);
|
||||
|
||||
var actualIcon = getMessageBoxIcon(icon);
|
||||
|
||||
if (actualIcon == null)
|
||||
{
|
||||
lblMessage.Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN);
|
||||
}
|
||||
else
|
||||
{
|
||||
var iconPbox = new PictureBox
|
||||
{
|
||||
Image = actualIcon.ToBitmap(),
|
||||
Location = new Point(FORM_X_MARGIN, FORM_Y_MARGIN)
|
||||
};
|
||||
msgBoxFrm.Controls.Add(iconPbox);
|
||||
}
|
||||
|
||||
|
||||
AddButtonsToForm(msgBoxFrm, buttons);
|
||||
|
||||
ThemeManager.ApplyThemeTo(msgBoxFrm);
|
||||
|
||||
msgBoxFrm.ShowDialog();
|
||||
|
||||
return DialogResult.OK;
|
||||
}
|
||||
|
||||
private static void AddButtonsToForm(Form msgBoxFrm, MessageBoxButtons buttons)
|
||||
{
|
||||
Rectangle screenRectangle = msgBoxFrm.RectangleToScreen(msgBoxFrm.ClientRectangle);
|
||||
int titleHeight = screenRectangle.Top - msgBoxFrm.Top;
|
||||
|
||||
switch (buttons)
|
||||
{
|
||||
case MessageBoxButtons.OK:
|
||||
var but = new CustomButton
|
||||
{
|
||||
Size = new Size(75, 23),
|
||||
Text = "OK",
|
||||
Left = msgBoxFrm.Width - 75 - FORM_X_MARGIN,
|
||||
Top = msgBoxFrm.Height - 23 - FORM_Y_MARGIN - titleHeight
|
||||
};
|
||||
|
||||
but.Click += delegate { msgBoxFrm.Close(); };
|
||||
msgBoxFrm.Controls.Add(but);
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new NotImplementedException("Only MessageBoxButtons.OK supported at this time");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get system icon for MessageBoxIcon.
|
||||
/// </summary>
|
||||
/// <param name="icon">The MessageBoxIcon value.</param>
|
||||
/// <returns>SystemIcon type Icon.</returns>
|
||||
private static Icon getMessageBoxIcon(MessageBoxIcon icon)
|
||||
{
|
||||
switch (icon)
|
||||
{
|
||||
case MessageBoxIcon.Asterisk:
|
||||
return SystemIcons.Asterisk;
|
||||
case MessageBoxIcon.Error:
|
||||
return SystemIcons.Error;
|
||||
case MessageBoxIcon.Exclamation:
|
||||
return SystemIcons.Exclamation;
|
||||
case MessageBoxIcon.Question:
|
||||
return SystemIcons.Question;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
@ -1,64 +0,0 @@
|
||||
//this file contains some simple extension methods
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Globalization;
|
||||
using System.ComponentModel;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace ArdupilotMega
|
||||
{
|
||||
static class CultureInfoEx
|
||||
{
|
||||
public static CultureInfo GetCultureInfo(string name)
|
||||
{
|
||||
try { return new CultureInfo(name); }
|
||||
catch (Exception) { return null; }
|
||||
}
|
||||
|
||||
public static bool IsChildOf(this CultureInfo cX, CultureInfo cY)
|
||||
{
|
||||
|
||||
if (cX == null || cY == null)
|
||||
return false;
|
||||
|
||||
CultureInfo c = cX;
|
||||
while (!c.Equals(CultureInfo.InvariantCulture))
|
||||
{
|
||||
if (c.Equals(cY))
|
||||
return true;
|
||||
c = c.Parent;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
static class ComponentResourceManagerEx
|
||||
{
|
||||
public static void ApplyResource(this ComponentResourceManager rm, Control ctrl)
|
||||
{
|
||||
rm.ApplyResources(ctrl, ctrl.Name);
|
||||
foreach (Control subctrl in ctrl.Controls)
|
||||
ApplyResource(rm, subctrl);
|
||||
|
||||
if (ctrl.ContextMenu != null)
|
||||
ApplyResource(rm, ctrl.ContextMenu);
|
||||
|
||||
|
||||
if (ctrl is DataGridView)
|
||||
{
|
||||
foreach (DataGridViewColumn col in (ctrl as DataGridView).Columns)
|
||||
rm.ApplyResources(col, col.Name);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ApplyResource(this ComponentResourceManager rm, Menu menu)
|
||||
{
|
||||
rm.ApplyResources(menu, menu.Name);
|
||||
foreach (MenuItem submenu in menu.MenuItems)
|
||||
ApplyResource(rm, submenu);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user