Add project files.
This commit is contained in:
parent
e1e6569e93
commit
ddc5e8ff39
|
@ -0,0 +1,25 @@
|
||||||
|
|
||||||
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
|
# Visual Studio Version 16
|
||||||
|
VisualStudioVersion = 16.0.31702.278
|
||||||
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dummy_drone", "dummy_drone\dummy_drone.csproj", "{3A1775D1-D2DC-464A-88D0-01B93C142357}"
|
||||||
|
EndProject
|
||||||
|
Global
|
||||||
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
Release|Any CPU = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
|
{3A1775D1-D2DC-464A-88D0-01B93C142357}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{3A1775D1-D2DC-464A-88D0-01B93C142357}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{3A1775D1-D2DC-464A-88D0-01B93C142357}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{3A1775D1-D2DC-464A-88D0-01B93C142357}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
|
HideSolutionNode = FALSE
|
||||||
|
EndGlobalSection
|
||||||
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
SolutionGuid = {880CC511-2400-485E-B5B5-502D09454F75}
|
||||||
|
EndGlobalSection
|
||||||
|
EndGlobal
|
Binary file not shown.
|
@ -0,0 +1,16 @@
|
||||||
|
<Application x:Class="dummy_drone.App"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:local="clr-namespace:dummy_drone"
|
||||||
|
StartupUri="MainWindow.xaml">
|
||||||
|
<Application.Resources>
|
||||||
|
<ResourceDictionary>
|
||||||
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<materialDesign:BundledTheme BaseTheme="Dark" PrimaryColor="Yellow" SecondaryColor="DeepOrange"
|
||||||
|
ColorAdjustment="{materialDesign:ColorAdjustment}" />
|
||||||
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
||||||
|
</ResourceDictionary.MergedDictionaries>
|
||||||
|
</ResourceDictionary>
|
||||||
|
</Application.Resources>
|
||||||
|
</Application>
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Configuration;
|
||||||
|
using System.Data;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
namespace dummy_drone
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for App.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class App : Application
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System.Windows;
|
||||||
|
|
||||||
|
[assembly: ThemeInfo(
|
||||||
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// or application resource dictionaries)
|
||||||
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
|
//(used if a resource is not found in the page,
|
||||||
|
// app, or any theme specific resource dictionaries)
|
||||||
|
)]
|
|
@ -0,0 +1,406 @@
|
||||||
|
<Window
|
||||||
|
x:Class="dummy_drone.MainWindow"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:local="clr-namespace:dummy_drone"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:smtx="clr-namespace:ShowMeTheXAML;assembly=ShowMeTheXAML"
|
||||||
|
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
|
||||||
|
TextElement.FontWeight="Regular"
|
||||||
|
TextElement.FontSize="13"
|
||||||
|
TextOptions.TextFormattingMode="Ideal"
|
||||||
|
TextOptions.TextRenderingMode="Auto"
|
||||||
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
|
FontFamily="{DynamicResource MaterialDesignFont}"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Title="Drone Control" Height="800" Width="800">
|
||||||
|
|
||||||
|
<Window.Resources>
|
||||||
|
<Style TargetType="{x:Type TextBox}" BasedOn="{StaticResource MaterialDesignTextBox}">
|
||||||
|
<Setter Property="Margin" Value="0,8"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
<Style TargetType="{x:Type Viewbox}">
|
||||||
|
<Setter Property="Width" Value="18"/>
|
||||||
|
<Setter Property="Height" Value="18"/>
|
||||||
|
<Setter Property="Margin" Value="0 0 8 0"/>
|
||||||
|
<Setter Property="VerticalAlignment" Value="Center"/>
|
||||||
|
</Style>
|
||||||
|
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<StackPanel Margin="20 25 20 20">
|
||||||
|
<Grid>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="100"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="10"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
<ColumnDefinition Width="Auto"/>
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="40"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
<RowDefinition Height="Auto"/>
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="0"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Style="{StaticResource MaterialDesignHeadline6TextBlock}"
|
||||||
|
Text="Open Connection"/>
|
||||||
|
|
||||||
|
<materialDesign:PackIcon
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="0"
|
||||||
|
Kind="Web"
|
||||||
|
Foreground="{Binding BorderBrush, ElementName=IPTextBox}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="IPTextBox"
|
||||||
|
Text="192.168.1.4"
|
||||||
|
materialDesign:HintAssist.Hint="IP Address"/>
|
||||||
|
|
||||||
|
<materialDesign:PackIcon
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="2"
|
||||||
|
Kind="Door"
|
||||||
|
Foreground="{Binding BorderBrush, ElementName=PortTextBox}"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="3"
|
||||||
|
x:Name="PortTextBox"
|
||||||
|
Text="8080"
|
||||||
|
materialDesign:HintAssist.Hint="Port"
|
||||||
|
VerticalAlignment="Center"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonConnect"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="4"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="Start Server"
|
||||||
|
Click="btnStart_Click"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="LanConnect"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonDisconnect"
|
||||||
|
Grid.Row="1"
|
||||||
|
Grid.Column="5"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="Close Server"
|
||||||
|
Click="btnStop_Click"
|
||||||
|
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="LanDisconnect"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="10"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Style="{StaticResource MaterialDesignSubtitle1TextBlock}"
|
||||||
|
Text="Messages Box"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="statusButton"
|
||||||
|
Grid.Row="2"
|
||||||
|
Grid.Column="1"
|
||||||
|
ToolTip="get drone info"
|
||||||
|
Click="btnGet_Info"
|
||||||
|
Height="25"
|
||||||
|
Width="70">
|
||||||
|
<materialDesign:PackIcon Kind="Information"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<RichTextBox
|
||||||
|
x:Name="rtbx"
|
||||||
|
Grid.Row="3"
|
||||||
|
Grid.Column="10"
|
||||||
|
materialDesign:HintAssist.Hint=""
|
||||||
|
Height="Auto"
|
||||||
|
Width="Auto">
|
||||||
|
<FlowDocument>
|
||||||
|
<Paragraph/>
|
||||||
|
</FlowDocument>
|
||||||
|
</RichTextBox>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="5"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="MSGTextBox"
|
||||||
|
Text="Hello"
|
||||||
|
materialDesign:HintAssist.Hint="IP Address"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="MSGSetSpeed"
|
||||||
|
materialDesign:HintAssist.Hint="Speed (0-15.0m/s)"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonConfigWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="2"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="Send config"
|
||||||
|
Click="btnSend_ConfigWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Settings"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="4"
|
||||||
|
x:Name="SetAltitudeWP"
|
||||||
|
materialDesign:HintAssist.Hint="Altitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="6"
|
||||||
|
x:Name="SetLatitudeWP"
|
||||||
|
materialDesign:HintAssist.Hint="Latitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="8"
|
||||||
|
x:Name="SetLongitudeWP"
|
||||||
|
materialDesign:HintAssist.Hint="Longitude"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonCreateWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="9"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="create WP"
|
||||||
|
Click="btnSend_CreateWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Tools"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonUploadeWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="10"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="upload WP"
|
||||||
|
Click="btnSend_UploadWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Upload"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonStartWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="11"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="start WP"
|
||||||
|
Click="btnSend_startWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="DirectionsBoat"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonPauseWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="12"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="pause WP"
|
||||||
|
Click="btnSend_pauseWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Pause"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonResWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="13"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="resume WP"
|
||||||
|
Click="btnSend_resumeWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30" RenderTransformOrigin="1.887,0.538">
|
||||||
|
<materialDesign:PackIcon Kind="Resume"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonStopWP"
|
||||||
|
Grid.Row="6"
|
||||||
|
Grid.Column="14"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="stop WP"
|
||||||
|
Click="btnSend_stopWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30" Grid.ColumnSpan="2" HorizontalAlignment="Left" Margin="30,5,0,5">
|
||||||
|
<materialDesign:PackIcon Kind="Stop" RenderTransformOrigin="3.413,0.321"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonDelWP"
|
||||||
|
Grid.Row="7"
|
||||||
|
Grid.Column="14"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="del WP"
|
||||||
|
Click="btnSend_delWP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Delete"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonStartHP"
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="9"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="start HP"
|
||||||
|
Click="btnSend_startHP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="PlayArrow"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonPauseHP"
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="10"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="pause HP"
|
||||||
|
Click="btnSend_pauseHP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="MotionPause"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonResumeHP"
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="11"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="pause HP"
|
||||||
|
Click="btnSend_resumeHP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Resume"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonStopHP"
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="12"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="stop HP"
|
||||||
|
Click="btnSend_stopHP"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Stop"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="SetAltitudeHP"
|
||||||
|
materialDesign:HintAssist.Hint="Altitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="3"
|
||||||
|
x:Name="SetLatitudeHP"
|
||||||
|
materialDesign:HintAssist.Hint="Latitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="5"
|
||||||
|
x:Name="SetLongitudeHP"
|
||||||
|
materialDesign:HintAssist.Hint="Longitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="8"
|
||||||
|
Grid.Column="8"
|
||||||
|
x:Name="SetRadiusHP"
|
||||||
|
materialDesign:HintAssist.Hint="Radius"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="9"
|
||||||
|
Grid.Column="1"
|
||||||
|
x:Name="SetAltitudeFM"
|
||||||
|
materialDesign:HintAssist.Hint="Altitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="9"
|
||||||
|
Grid.Column="3"
|
||||||
|
x:Name="SetLatitudeFM"
|
||||||
|
materialDesign:HintAssist.Hint="Latitude"/>
|
||||||
|
|
||||||
|
<TextBox
|
||||||
|
Grid.Row="9"
|
||||||
|
Grid.Column="5"
|
||||||
|
x:Name="SetLongitudeFM"
|
||||||
|
materialDesign:HintAssist.Hint="Longitude"/>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonStartFM"
|
||||||
|
Grid.Row="9"
|
||||||
|
Grid.Column="8"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="start HP"
|
||||||
|
Click="btnSend_startFM"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="PlayArrow"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
x:Name="ButtonStopFM"
|
||||||
|
Grid.Row="9"
|
||||||
|
Grid.Column="9"
|
||||||
|
Style="{StaticResource MaterialDesignFloatingActionMiniDarkButton}"
|
||||||
|
ToolTip="stop HP"
|
||||||
|
Click="btnSend_stopFM"
|
||||||
|
Height="30"
|
||||||
|
Width="30">
|
||||||
|
<materialDesign:PackIcon Kind="Stop"/>
|
||||||
|
</Button>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
</Window>
|
|
@ -0,0 +1,192 @@
|
||||||
|
using NadLibrary;
|
||||||
|
using System;
|
||||||
|
using System.Windows;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Windows.Threading;
|
||||||
|
using System.Threading;
|
||||||
|
|
||||||
|
namespace dummy_drone
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Interaction logic for MainWindow.xaml
|
||||||
|
/// </summary>
|
||||||
|
public partial class MainWindow : Window
|
||||||
|
{
|
||||||
|
public MainWindow()
|
||||||
|
{
|
||||||
|
InitializeComponent();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
DispatcherTimer timer = new DispatcherTimer();
|
||||||
|
NadSystem nad = new NadSystem();
|
||||||
|
|
||||||
|
List<string> remoteIp = null;
|
||||||
|
double latitude_f = 43.719259015524976;
|
||||||
|
double longitude_f = 10.421048893480233;
|
||||||
|
double latitude_up;
|
||||||
|
double longitude_up;
|
||||||
|
int altitude;
|
||||||
|
double a = (Math.PI / 180.0) * 45.0;
|
||||||
|
Random r = new Random();
|
||||||
|
|
||||||
|
public void initializeTimer()
|
||||||
|
{
|
||||||
|
timer.Interval = TimeSpan.FromSeconds(10);
|
||||||
|
timer.Tick += timer_Tick;
|
||||||
|
timer.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void timer_Tick(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
double lat0 = Math.Cos(Math.PI / 180.0 * latitude_f);
|
||||||
|
|
||||||
|
latitude_up = latitude_f + (180.0 / Math.PI) * (10.0 / 6378137.0) * Math.Sin(a);
|
||||||
|
longitude_up = longitude_f + (180 / Math.PI) * (10.0 / 6378137.0) / Math.Cos(lat0) * Math.Cos(a);
|
||||||
|
altitude = r.Next(10, 60);
|
||||||
|
|
||||||
|
latitude_f = latitude_up;
|
||||||
|
longitude_f = longitude_up;
|
||||||
|
showmsg();
|
||||||
|
nad.NADPopulateListCoordinate(latitude_f.ToString(), longitude_f.ToString(), altitude.ToString());
|
||||||
|
|
||||||
|
//nad.NADUpdateShipCoord(latitude_f.ToString(), longitude_f.ToString());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnStart_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADOpenConnection(IPTextBox.Text, PortTextBox.Text);
|
||||||
|
nad.NADPopulateListCoordinate("43.71967438461098", "10.420797021964137", "40");
|
||||||
|
nad.NADPopulateListCoordinate("43.71968213866057", "10.421413929976033", "30");
|
||||||
|
nad.NADPopulateListCoordinate("43.72014350280539", "10.4228730515346", "20");
|
||||||
|
nad.NADPopulateListCoordinate("43.720825039296045", "10.424706602137107", "20");
|
||||||
|
nad.NADPopulateListCoordinate("43.72266628185771", "10.422610492949717", "20");
|
||||||
|
//initializeTimer();
|
||||||
|
//showmsg();
|
||||||
|
//Thread thread = new Thread(showmsg);
|
||||||
|
//thread.IsBackground = true;
|
||||||
|
//thread.Start();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnStop_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//showmsg(MSGTextBox.Text);
|
||||||
|
//nad.Send_tcp_msg(MSGTextBox.Text + "\r\n");
|
||||||
|
//nad.NADGetDroneStatus();
|
||||||
|
nad.NADCloseConnection();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_ConfigWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//showmsg(MSGSetSpeed.Text);
|
||||||
|
//nad.NADUpdateShip(MSGSetSpeed.Text);
|
||||||
|
nad.NADSetSpeed(MSGSetSpeed.Text);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_CreateWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//nad.NADSendCoordinate(SetLatitudeWP.Text, SetLongitudeWP.Text, SetAltitudeWP.Text);
|
||||||
|
//nad.NADSendListCoord();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_UploadWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
//nad.NADUploadMobMission();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_startWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADStartMobMission();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnGet_Info(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
string msg = nad.NADGetDroneStatus();
|
||||||
|
System.Diagnostics.Trace.WriteLine("Message from client " + msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_pauseWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADPauseMobMission();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_resumeWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADResumeMobMission();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_stopWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADStopMobMission();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_delWP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADDelPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_startHP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADSearchAtPos(SetLatitudeHP.Text, SetLongitudeHP.Text, SetAltitudeHP.Text, SetRadiusHP.Text);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_pauseHP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADPauseSearchAt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_resumeHP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADResumeSearchAt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_stopHP(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
nad.NADStopSearchAt();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_startFM(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
|
||||||
|
latitude_f = double.Parse(SetLatitudeFM.Text, System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
longitude_f = double.Parse(SetLongitudeFM.Text, System.Globalization.CultureInfo.InvariantCulture);
|
||||||
|
System.Diagnostics.Trace.WriteLine("Longitude init " + longitude_f);
|
||||||
|
System.Diagnostics.Trace.WriteLine("Latitude init " + latitude_f);
|
||||||
|
nad.NADFollowShip(SetLatitudeFM.Text, SetLongitudeFM.Text, SetAltitudeFM.Text);
|
||||||
|
initializeTimer();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void btnSend_stopFM(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
timer.Stop();
|
||||||
|
nad.NADStopFollowShip();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void showmsg()
|
||||||
|
{
|
||||||
|
string p = nad.GetMSG();
|
||||||
|
System.Diagnostics.Trace.WriteLine("Message from client " + p);
|
||||||
|
if (string.IsNullOrEmpty(p))
|
||||||
|
{
|
||||||
|
p = "Nessun messaggio";
|
||||||
|
}
|
||||||
|
System.Diagnostics.Trace.WriteLine("Message from client " + p);
|
||||||
|
|
||||||
|
|
||||||
|
Dispatcher.BeginInvoke(new Action(() =>
|
||||||
|
{
|
||||||
|
//rtbx.AppendText(p + "\r\n");
|
||||||
|
MSGTextBox.Text = p;
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,25 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<OutputType>WinExe</OutputType>
|
||||||
|
<TargetFramework>net5.0-windows</TargetFramework>
|
||||||
|
<UseWPF>true</UseWPF>
|
||||||
|
<ApplicationIcon />
|
||||||
|
<StartupObject></StartupObject>
|
||||||
|
<Win32Resource />
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="MaterialDesignColors" Version="2.0.3" />
|
||||||
|
<PackageReference Include="MaterialDesignThemes" Version="4.2.1" />
|
||||||
|
<PackageReference Include="MaterialDesignThemes.MahApps" Version="0.1.9" />
|
||||||
|
<PackageReference Include="ShowMeTheXAML.MSBuild" Version="2.0.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Reference Include="NadLibrary">
|
||||||
|
<HintPath>bin\Debug\net5.0-windows\NadLibrary.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
Loading…
Reference in New Issue