mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Add device info panel.
This commit is contained in:
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
2
.idea/.idea.DiscImageChef/.idea/contentModel.xml
generated
@@ -1320,6 +1320,8 @@
|
|||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
</e>
|
</e>
|
||||||
|
<e p="pnlDeviceInfo.xeto" t="Include" />
|
||||||
|
<e p="pnlDeviceInfo.xeto.cs" t="Include" />
|
||||||
</e>
|
</e>
|
||||||
<e p="DiscImageChef.Gui.XamMac" t="IncludeRecursive">
|
<e p="DiscImageChef.Gui.XamMac" t="IncludeRecursive">
|
||||||
<e p="DiscImageChef.Gui.XamMac.csproj" t="IncludeRecursive" />
|
<e p="DiscImageChef.Gui.XamMac.csproj" t="IncludeRecursive" />
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
<NrtShowRevision>true</NrtShowRevision>
|
<NrtShowRevision>true</NrtShowRevision>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Claunia.Encoding" Version="1.6.1"/>
|
<PackageReference Include="Claunia.Encoding" Version="1.6.1" />
|
||||||
<PackageReference Include="Eto.Forms" Version="2.4.1"/>
|
<PackageReference Include="Eto.Forms" Version="2.4.1" />
|
||||||
<PackageReference Include="Eto.Serialization.Xaml" Version="2.4.1"/>
|
<PackageReference Include="Eto.Serialization.Xaml" Version="2.4.1" />
|
||||||
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.2-beta"/>
|
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.2.2-beta" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ProjectReference Include="..\DiscImageChef.Core\DiscImageChef.Core.csproj"/>
|
<ProjectReference Include="..\DiscImageChef.Core\DiscImageChef.Core.csproj" />
|
||||||
<ProjectReference Include="..\DiscImageChef.Devices\DiscImageChef.Devices.csproj"/>
|
<ProjectReference Include="..\DiscImageChef.Devices\DiscImageChef.Devices.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
||||||
@@ -35,11 +35,8 @@
|
|||||||
Title="DiscImageChef" ClientSize="600, 450" Padding="10">
|
Title="DiscImageChef" ClientSize="600, 450" Padding="10">
|
||||||
<Splitter Orientation="Horizontal" Panel1MinimumSize="200" FixedPanel="Panel1" ID="splMain">
|
<Splitter Orientation="Horizontal" Panel1MinimumSize="200" FixedPanel="Panel1" ID="splMain">
|
||||||
<Splitter.Panel1>
|
<Splitter.Panel1>
|
||||||
<TreeGridView ID="treeImages"/>
|
<TreeGridView ID="treeImages" SelectedItemChanged="OnTreeImagesSelectedItemChanged"/>
|
||||||
</Splitter.Panel1>
|
</Splitter.Panel1>
|
||||||
<Splitter.Panel2>
|
|
||||||
<GridView ID="grdFiles"/>
|
|
||||||
</Splitter.Panel2>
|
|
||||||
</Splitter>
|
</Splitter>
|
||||||
<Form.Menu>
|
<Form.Menu>
|
||||||
<MenuBar>
|
<MenuBar>
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ namespace DiscImageChef.Gui
|
|||||||
public class frmMain : Form
|
public class frmMain : Form
|
||||||
{
|
{
|
||||||
bool closing;
|
bool closing;
|
||||||
Splitter splMain;
|
GridView grdFiles;
|
||||||
|
Label lblError;
|
||||||
TreeGridView treeImages;
|
TreeGridView treeImages;
|
||||||
TreeGridItemCollection treeImagesItems;
|
TreeGridItemCollection treeImagesItems;
|
||||||
|
|
||||||
@@ -51,6 +52,9 @@ namespace DiscImageChef.Gui
|
|||||||
{
|
{
|
||||||
XamlReader.Load(this);
|
XamlReader.Load(this);
|
||||||
|
|
||||||
|
lblError = new Label();
|
||||||
|
grdFiles = new GridView();
|
||||||
|
|
||||||
ConsoleHandler.Init();
|
ConsoleHandler.Init();
|
||||||
ConsoleHandler.Debug = debug;
|
ConsoleHandler.Debug = debug;
|
||||||
ConsoleHandler.Verbose = verbose;
|
ConsoleHandler.Verbose = verbose;
|
||||||
@@ -140,7 +144,11 @@ namespace DiscImageChef.Gui
|
|||||||
device.Model, device.Vendor, device.Bus, device.Path);
|
device.Model, device.Vendor, device.Bus, device.Path);
|
||||||
devicesRoot.Children.Add(new TreeGridItem
|
devicesRoot.Children.Add(new TreeGridItem
|
||||||
{
|
{
|
||||||
Values = new object[] {$"{device.Vendor} {device.Model} ({device.Bus})", device.Path}
|
Values = new object[]
|
||||||
|
{
|
||||||
|
$"{device.Vendor} {device.Model} ({device.Bus})",
|
||||||
|
device.Path, null
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,10 +172,58 @@ namespace DiscImageChef.Gui
|
|||||||
new dlgEncodings().ShowModal(this);
|
new dlgEncodings().ShowModal(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void OnTreeImagesSelectedItemChanged(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
if(!(sender is TreeGridView tree)) return;
|
||||||
|
|
||||||
|
if(!(tree.SelectedItem is TreeGridItem selectedItem)) return;
|
||||||
|
|
||||||
|
splMain.Panel2 = null;
|
||||||
|
|
||||||
|
if(selectedItem.Parent != devicesRoot) return;
|
||||||
|
|
||||||
|
switch(selectedItem.Values[2])
|
||||||
|
{
|
||||||
|
case null:
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Device dev = new Device((string)selectedItem.Values[1]);
|
||||||
|
if(dev.Error)
|
||||||
|
{
|
||||||
|
selectedItem.Values[2] = $"Error {dev.LastError} opening device";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Core.Devices.Info.DeviceInfo devInfo = new Core.Devices.Info.DeviceInfo(dev);
|
||||||
|
|
||||||
|
selectedItem.Values[2] = new pnlDeviceInfo(devInfo);
|
||||||
|
splMain.Panel2 = (Panel)selectedItem.Values[2];
|
||||||
|
|
||||||
|
dev.Close();
|
||||||
|
}
|
||||||
|
catch(SystemException ex)
|
||||||
|
{
|
||||||
|
selectedItem.Values[2] = ex.Message;
|
||||||
|
lblError.Text = ex.Message;
|
||||||
|
splMain.Panel2 = lblError;
|
||||||
|
DicConsole.ErrorWriteLine(ex.Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
break;
|
||||||
|
case string devErrorMessage:
|
||||||
|
lblError.Text = devErrorMessage;
|
||||||
|
splMain.Panel2 = lblError;
|
||||||
|
break;
|
||||||
|
case Panel devInfoPanel:
|
||||||
|
splMain.Panel2 = devInfoPanel;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#region XAML IDs
|
#region XAML IDs
|
||||||
TreeGridItem devicesRoot;
|
TreeGridItem devicesRoot;
|
||||||
GridView grdFiles;
|
|
||||||
TreeGridItem imagesRoot;
|
TreeGridItem imagesRoot;
|
||||||
|
Splitter splMain;
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
94
DiscImageChef.Gui/pnlDeviceInfo.xeto
Normal file
94
DiscImageChef.Gui/pnlDeviceInfo.xeto
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?><!--
|
||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ============================================================================
|
||||||
|
//
|
||||||
|
// Filename : pnlDeviceInfo.xeto
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// Component : Device information panel.
|
||||||
|
//
|
||||||
|
// ==[ Description ] ==========================================================
|
||||||
|
//
|
||||||
|
// Defines the structure for the device information panel.
|
||||||
|
//
|
||||||
|
// ==[ License ] ==============================================================
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ============================================================================
|
||||||
|
// Copyright © 2011-2018 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
-->
|
||||||
|
<Panel xmlns="http://schema.picoe.ca/eto.forms" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Center">
|
||||||
|
<Label ID="lblDeviceInfo" Text="Device information"/>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch" Expand="True" VerticalAlignment="Stretch">
|
||||||
|
<TabControl ID="tabInfos">
|
||||||
|
<TabPage ID="tabGeneral" Text="General">
|
||||||
|
<StackLayout Orientation="Vertical">
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblType" Text="Device type"/>
|
||||||
|
<TextBox ID="txtType" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblManufacturer" Text="Manufacturer"/>
|
||||||
|
<TextBox ID="txtManufacturer" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblModel" Text="Model"/>
|
||||||
|
<TextBox ID="txtModel" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblRevision" Text="Revision"/>
|
||||||
|
<TextBox ID="txtRevision" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblSerial" Text="Serial number"/>
|
||||||
|
<TextBox ID="txtSerial" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<Label ID="lblScsiType" Text="Peripheral device type"/>
|
||||||
|
<TextBox ID="txtScsiType" ReadOnly="True"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<CheckBox ID="chkRemovable" Text="Removable media"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
<StackLayoutItem HorizontalAlignment="Stretch">
|
||||||
|
<StackLayout Orientation="Horizontal">
|
||||||
|
<CheckBox ID="chkUsb" Text="Connected by USB"/>
|
||||||
|
</StackLayout>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</TabPage>
|
||||||
|
</TabControl>
|
||||||
|
</StackLayoutItem>
|
||||||
|
</StackLayout>
|
||||||
|
</Panel>
|
||||||
75
DiscImageChef.Gui/pnlDeviceInfo.xeto.cs
Normal file
75
DiscImageChef.Gui/pnlDeviceInfo.xeto.cs
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
// /***************************************************************************
|
||||||
|
// The Disc Image Chef
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Filename : pnlDeviceInfo.xeto.cs
|
||||||
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
||||||
|
//
|
||||||
|
// Component : Device information.
|
||||||
|
//
|
||||||
|
// --[ Description ] ----------------------------------------------------------
|
||||||
|
//
|
||||||
|
// Implements the device information panel.
|
||||||
|
//
|
||||||
|
// --[ License ] --------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General public License as
|
||||||
|
// published by the Free Software Foundation, either version 3 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General public License
|
||||||
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// Copyright © 2011-2018 Natalia Portillo
|
||||||
|
// ****************************************************************************/
|
||||||
|
|
||||||
|
using DiscImageChef.Core.Devices.Info;
|
||||||
|
using Eto.Forms;
|
||||||
|
using Eto.Serialization.Xaml;
|
||||||
|
|
||||||
|
namespace DiscImageChef.Gui
|
||||||
|
{
|
||||||
|
public class pnlDeviceInfo : Panel
|
||||||
|
{
|
||||||
|
public pnlDeviceInfo(DeviceInfo devInfo)
|
||||||
|
{
|
||||||
|
XamlReader.Load(this);
|
||||||
|
|
||||||
|
txtType.Text = devInfo.Type.ToString();
|
||||||
|
txtManufacturer.Text = devInfo.Manufacturer;
|
||||||
|
txtModel.Text = devInfo.Model;
|
||||||
|
txtRevision.Text = devInfo.Revision;
|
||||||
|
txtSerial.Text = devInfo.Serial;
|
||||||
|
txtScsiType.Text = devInfo.ScsiType.ToString();
|
||||||
|
chkRemovable.Checked = devInfo.IsRemovable;
|
||||||
|
chkUsb.Checked = devInfo.IsUsb;
|
||||||
|
}
|
||||||
|
|
||||||
|
#region XAML controls
|
||||||
|
Label lblDeviceInfo;
|
||||||
|
TabControl tabInfos;
|
||||||
|
TabPage tabGeneral;
|
||||||
|
Label lblType;
|
||||||
|
TextBox txtType;
|
||||||
|
Label lblManufacturer;
|
||||||
|
TextBox txtManufacturer;
|
||||||
|
Label lblModel;
|
||||||
|
TextBox txtModel;
|
||||||
|
Label lblRevision;
|
||||||
|
TextBox txtRevision;
|
||||||
|
Label lblSerial;
|
||||||
|
TextBox txtSerial;
|
||||||
|
Label lblScsiType;
|
||||||
|
TextBox txtScsiType;
|
||||||
|
CheckBox chkRemovable;
|
||||||
|
CheckBox chkUsb;
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user