-> IPScanner implemented

This commit is contained in:
2022-01-17 22:25:15 +01:00
parent bb6c229875
commit f7b63cb8e1
4 changed files with 28 additions and 37 deletions

View File

@@ -6,7 +6,7 @@
xmlns:local="clr-namespace:Networking.Pages" xmlns:local="clr-namespace:Networking.Pages"
mc:Ignorable="d" mc:Ignorable="d"
d:DesignHeight="450" d:DesignWidth="800" Background="White"> d:DesignHeight="450" d:DesignWidth="800" Background="White">
<WindowsFormsHost HorizontalAlignment="Left" Height="450" VerticalAlignment="Top" Width="800"> <WindowsFormsHost>
<local:WF_IPScanner/> <local:WF_IPScanner/>
</WindowsFormsHost> </WindowsFormsHost>
</UserControl> </UserControl>

View File

@@ -1,7 +1,9 @@
using IPScanner; using IPScanner;
using PTConverter.Plugin; using PTConverter.Plugin;
using System; using System;
using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using System.Net; using System.Net;
using System.Text; using System.Text;
@@ -19,45 +21,30 @@ using System.Windows.Shapes;
namespace Networking.Pages namespace Networking.Pages
{ {
public class Device
{
public string IP { get; set; }
public string Ping { get; set; }
public string Host { get; set; }
public string Identification { get; set; }
}
/// <summary> /// <summary>
/// Interaktionslogik für Networking.xaml /// Interaktionslogik für Networking.xaml
/// </summary> /// </summary>
public partial class IPScanner : UserControl, IPage public partial class IPScanner : UserControl, IPage
{ {
public IPScanner() public IPScanner()
{ {
InitializeComponent(); InitializeComponent();
} }
public string GetCategory() => ""; public string GetCategory() => "Networking";
public UserControl GetPage() => new IPScanner(); public UserControl GetPage() => new IPScanner();
public string GetUnderCategory() => ""; public string GetUnderCategory() => "IPScanner";
string IPtoString(byte[] array)
{
//
// Concatenate all the elements into a StringBuilder.
//
StringBuilder strinbuilder = new StringBuilder();
for (int i = 0; i < array.Count(); i++)
{
strinbuilder.Append(array[i]);
if (i != array.Count() - 1)
strinbuilder.Append('.');
}
return strinbuilder.ToString();
}
private string GetPingTime(IPScanResult result)
{
if (result.ping > -1)
return result.ping + " ms";
return "N/A";
}
} }
} }

View File

@@ -41,6 +41,7 @@ namespace Networking.Pages
// //
// lvIPList // lvIPList
// //
this.lvIPList.Activation = System.Windows.Forms.ItemActivation.OneClick;
this.lvIPList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) this.lvIPList.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
@@ -50,11 +51,14 @@ namespace Networking.Pages
this.chHost, this.chHost,
this.chRecognized}); this.chRecognized});
this.lvIPList.FullRowSelect = true; this.lvIPList.FullRowSelect = true;
this.lvIPList.GridLines = true;
this.lvIPList.HideSelection = false; this.lvIPList.HideSelection = false;
this.lvIPList.Location = new System.Drawing.Point(12, 87); this.lvIPList.HoverSelection = true;
this.lvIPList.Location = new System.Drawing.Point(0, 32);
this.lvIPList.MultiSelect = false; this.lvIPList.MultiSelect = false;
this.lvIPList.Name = "lvIPList"; this.lvIPList.Name = "lvIPList";
this.lvIPList.Size = new System.Drawing.Size(714, 282); this.lvIPList.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.lvIPList.Size = new System.Drawing.Size(800, 418);
this.lvIPList.TabIndex = 1; this.lvIPList.TabIndex = 1;
this.lvIPList.UseCompatibleStateImageBehavior = false; this.lvIPList.UseCompatibleStateImageBehavior = false;
this.lvIPList.View = System.Windows.Forms.View.Details; this.lvIPList.View = System.Windows.Forms.View.Details;
@@ -62,7 +66,7 @@ namespace Networking.Pages
// chIP // chIP
// //
this.chIP.Text = "IP"; this.chIP.Text = "IP";
this.chIP.Width = 93; this.chIP.Width = 191;
// //
// chPing // chPing
// //
@@ -71,18 +75,18 @@ namespace Networking.Pages
// chHost // chHost
// //
this.chHost.Text = "Host"; this.chHost.Text = "Host";
this.chHost.Width = 88; this.chHost.Width = 241;
// //
// chRecognized // chRecognized
// //
this.chRecognized.Text = "Recognized as"; this.chRecognized.Text = "Recognized as";
this.chRecognized.Width = 119; this.chRecognized.Width = 296;
// //
// btnScan // btnScan
// //
this.btnScan.Location = new System.Drawing.Point(323, 58); this.btnScan.Location = new System.Drawing.Point(319, 4);
this.btnScan.Name = "btnScan"; this.btnScan.Name = "btnScan";
this.btnScan.Size = new System.Drawing.Size(75, 23); this.btnScan.Size = new System.Drawing.Size(112, 23);
this.btnScan.TabIndex = 7; this.btnScan.TabIndex = 7;
this.btnScan.Text = "Scan"; this.btnScan.Text = "Scan";
this.btnScan.UseVisualStyleBackColor = true; this.btnScan.UseVisualStyleBackColor = true;
@@ -91,7 +95,7 @@ namespace Networking.Pages
// label1 // label1
// //
this.label1.AutoSize = true; this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(9, 64); this.label1.Location = new System.Drawing.Point(5, 9);
this.label1.Name = "label1"; this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(50, 13); this.label1.Size = new System.Drawing.Size(50, 13);
this.label1.TabIndex = 6; this.label1.TabIndex = 6;
@@ -99,7 +103,7 @@ namespace Networking.Pages
// //
// tbIPRange // tbIPRange
// //
this.tbIPRange.Location = new System.Drawing.Point(66, 61); this.tbIPRange.Location = new System.Drawing.Point(62, 6);
this.tbIPRange.Name = "tbIPRange"; this.tbIPRange.Name = "tbIPRange";
this.tbIPRange.Size = new System.Drawing.Size(251, 20); this.tbIPRange.Size = new System.Drawing.Size(251, 20);
this.tbIPRange.TabIndex = 8; this.tbIPRange.TabIndex = 8;

View File

@@ -9,7 +9,7 @@
Title="MainWindow" Height="450" Width="800"> Title="MainWindow" Height="450" Width="800">
<Grid> <Grid>
<Pages:IPScanner HorizontalAlignment="Left" Height="336" Margin="0,55,0,0" VerticalAlignment="Top" Width="782"/> <Pages:IPScanner Margin="0,0,34,10"/>
</Grid> </Grid>
</Window> </Window>