Commit 0668fec0 authored by Vincent's avatar Vincent 💩

Working on rework of the divereader

parent 78ba2f17
......@@ -56,11 +56,12 @@
<Compile Include="Dive.cs" />
<Compile Include="DiveBundle.cs" />
<Compile Include="Request.cs" />
<Compile Include="SelectDives.cs">
<Compile Include="DiveSelector\SelectDive.cs" />
<Compile Include="DiveSelector\DiveSelector.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="SelectDives.Designer.cs">
<DependentUpon>SelectDives.cs</DependentUpon>
<Compile Include="DiveSelector\DiveSelector.Designer.cs">
<DependentUpon>DiveSelector.cs</DependentUpon>
</Compile>
<Compile Include="SessionStore.cs" />
<Compile Include="WebApplicationSession.cs" />
......@@ -88,10 +89,11 @@
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<EmbeddedResource Include="SelectDives.resx">
<DependentUpon>SelectDives.cs</DependentUpon>
<EmbeddedResource Include="DiveSelector\DiveSelector.resx">
<DependentUpon>DiveSelector.cs</DependentUpon>
</EmbeddedResource>
<None Include="packages.config" />
<None Include="Properties\DataSources\SelectDive.datasource" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
......
using DiveLogUploader;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
public class ProgressEventArgs : EventArgs {
public int Maximum;
public int Current;
public float Ratio { get { return (float)Current / Maximum; } }
}
public class DeviceInfoEventArgs : EventArgs {
public uint Model;
public uint Firmware;
public uint Serial;
}
public class DeviceClockEventArgs : EventArgs {
public uint DevTime;
public long SysTime;
}
public class DiveEventArgs : EventArgs {
public Dive Dive;
}
public class CompleteEventArgs : EventArgs {
}
namespace DiveLogUploader {
public delegate void ProgressHandle(object source, ProgressEventArgs args);
public delegate void DeviceInfoHandle(object source, DeviceInfoEventArgs args);
public delegate void ClockInfoHandle(object source, DeviceClockEventArgs args);
public delegate void DiveHandle(object source, DiveEventArgs args);
public delegate void CompleteHandle(object source, CompleteEventArgs args);
public class DiveReader {
public event ProgressHandle OnProgress;
public event DeviceInfoHandle OnDeviceInfo;
public event ClockInfoHandle OnDeviceClock;
public event DiveHandle OnDive;
public event CompleteHandle OnComplete;
public string Fingerprint = null;
}
}
namespace DiveLogUploader {
partial class SelectDives {
namespace DiveLogUploader.DiveSelector {
partial class DiveSelector {
/// <summary>
/// Required designer variable.
/// </summary>
......@@ -26,6 +26,10 @@
this.panel1 = new System.Windows.Forms.Panel();
this.ButtonDone = new System.Windows.Forms.Button();
this.gridDives = new System.Windows.Forms.DataGridView();
this.IsSelected = new System.Windows.Forms.DataGridViewCheckBoxColumn();
this.Date = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.DiveTime = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.MaxDepth = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridDives)).BeginInit();
this.SuspendLayout();
......@@ -34,9 +38,9 @@
//
this.panel1.Controls.Add(this.ButtonDone);
this.panel1.Dock = System.Windows.Forms.DockStyle.Bottom;
this.panel1.Location = new System.Drawing.Point(0, 231);
this.panel1.Location = new System.Drawing.Point(0, 234);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(284, 30);
this.panel1.Size = new System.Drawing.Size(295, 30);
this.panel1.TabIndex = 0;
//
// ButtonDone
......@@ -52,17 +56,48 @@
// gridDives
//
this.gridDives.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridDives.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.IsSelected,
this.Date,
this.DiveTime,
this.MaxDepth});
this.gridDives.Dock = System.Windows.Forms.DockStyle.Fill;
this.gridDives.Location = new System.Drawing.Point(0, 0);
this.gridDives.Name = "gridDives";
this.gridDives.Size = new System.Drawing.Size(284, 231);
this.gridDives.Size = new System.Drawing.Size(295, 234);
this.gridDives.TabIndex = 1;
//
// IsSelected
//
this.IsSelected.HeaderText = "";
this.IsSelected.Name = "IsSelected";
this.IsSelected.Width = 20;
//
// Date
//
this.Date.HeaderText = "Date";
this.Date.Name = "Date";
this.Date.ReadOnly = true;
//
// DiveTime
//
this.DiveTime.HeaderText = "DiveTime";
this.DiveTime.Name = "DiveTime";
this.DiveTime.ReadOnly = true;
this.DiveTime.Width = 80;
//
// MaxDepth
//
this.MaxDepth.HeaderText = "Depth";
this.MaxDepth.Name = "MaxDepth";
this.MaxDepth.ReadOnly = true;
this.MaxDepth.Width = 50;
//
// SelectDives
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(284, 261);
this.ClientSize = new System.Drawing.Size(295, 264);
this.Controls.Add(this.gridDives);
this.Controls.Add(this.panel1);
this.Name = "SelectDives";
......@@ -78,5 +113,9 @@
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Button ButtonDone;
private System.Windows.Forms.DataGridView gridDives;
private System.Windows.Forms.DataGridViewCheckBoxColumn IsSelected;
private System.Windows.Forms.DataGridViewTextBoxColumn Date;
private System.Windows.Forms.DataGridViewTextBoxColumn DiveTime;
private System.Windows.Forms.DataGridViewTextBoxColumn MaxDepth;
}
}
\ No newline at end of file
......@@ -8,13 +8,13 @@ using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DiveLogUploader {
public partial class SelectDives : Form {
namespace DiveLogUploader.DiveSelector {
public partial class DiveSelector : Form {
public delegate void DoneDelegate(object source, DoneEventArgs eventArgs);
public event DoneDelegate OnDone;
public List<SelectedDive> availableDives = new List<SelectedDive>();
public List<DiveSelectorRow> availableDives = new List<DiveSelectorRow>();
public SelectDives() {
public DiveSelector() {
InitializeComponent();
gridDives.DataSource = availableDives;
}
......@@ -23,7 +23,7 @@ namespace DiveLogUploader {
availableDives.Clear();
availableDives.Capacity = dives.Count;
foreach(var d in dives) {
availableDives.Add(new SelectedDive {
availableDives.Add(new DiveSelectorRow {
IsSelected = true,
Dive = d
});
......@@ -36,11 +36,6 @@ namespace DiveLogUploader {
}
}
public class SelectedDive {
public bool IsSelected;
public Dive Dive;
}
public class DoneEventArgs : EventArgs {
public Dive[] dives;
}
......
......@@ -117,4 +117,16 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="IsSelected.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="Date.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="DiveTime.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
<metadata name="MaxDepth.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DiveLogUploader {
public class DiveSelectorRow {
public bool IsSelected;
public Dive Dive;
public string DiveTime {
get {
var ts = new TimeSpan(0, 0, (int)Dive.DiveTime);
return ts.ToString();
}
}
public string MaxDepth {
get {
return Dive.MaxDepth.ToString() + "m";
}
}
public string Date {
get {
return Dive.Date.ToString("yyyy-MM-dd hh:mm:ss");
}
}
}
}
This diff is collapsed.
......@@ -13,6 +13,7 @@ using System.Linq;
using System.Windows.Forms;
using static LibDiveComputer.Context;
using DiveLogUploader.Writers;
using DiveLogUploader.DiveSelector;
namespace divecomputer_test {
......@@ -28,7 +29,7 @@ namespace divecomputer_test {
}
private SessionStore Session = new SessionStore();
private SelectDives DiveSelector = new SelectDives();
private DiveSelector DiveSelector = new DiveSelector();
public Form1() {
InitializeComponent();
......
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="SelectDive" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>DiveLogUploader.SelectDive, DiveLogUploader, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment