69 lines
1.7 KiB
C#
69 lines
1.7 KiB
C#
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 Xylem.Common.Ui.GenesisToolBox
|
|
{
|
|
public partial class frmCalenderSeconds : Form
|
|
{
|
|
public frmCalenderSeconds()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
private void calc_Click(Object sender, EventArgs e)
|
|
{
|
|
var date = dtpDate.Value.Date;
|
|
date = date.AddHours((Int32)nudHour.Value);
|
|
date = date.AddMinutes((Int32)nudMinute.Value);
|
|
|
|
|
|
var ts = date - new DateTime(2000, 01, 01);
|
|
nudSeconds.Value = (Int32)ts.TotalSeconds;
|
|
|
|
}
|
|
|
|
private void btnCalDate_Click(Object sender, EventArgs e)
|
|
{
|
|
|
|
var date = new DateTime(2000, 01, 01);
|
|
date.AddSeconds((Int32)nudSeconds.Value);
|
|
|
|
dtpDate.Value = date.Date;
|
|
|
|
nudHour.Value = date.Hour;
|
|
nudMinute.Value = date.Minute;
|
|
}
|
|
|
|
private void frmCalenderSeconds_Load(Object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void btnCalFromHEx_Click(Object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
String[] arr = txtHexInput.Text.Split('-');
|
|
Byte[] array = new Byte[arr.Length];
|
|
for (Int32 i = arr.Length - 1; i >= 0; i--) array[i] = Convert.ToByte(arr[i], 16);
|
|
nudSeconds.Value = BitConverter.ToInt32(array,0);
|
|
|
|
|
|
}
|
|
catch (Exception exception)
|
|
{
|
|
Console.WriteLine(exception);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
}
|
|
}
|