Code cleanup

Offset werte können nun mit Datum versehen werden
This commit is contained in:
HuskyTeufel
2021-03-11 16:39:26 +01:00
parent db742557a5
commit 09ec9b1cd1
5 changed files with 51 additions and 19 deletions

View File

@@ -24,6 +24,8 @@ namespace SanSystem
string projektpfad = "18-850";
public CSVParser.AcceptedCSVFormats AnlageType = CSVParser.AcceptedCSVFormats.BLUELIGHT;
public void BuildNewLinerReste(EventArgs args)
{
EventHandler handler = RequestBuildNewLinerReste;

View File

@@ -198,7 +198,7 @@ namespace SanSystem
private void btn_transfer_ftp_Click(object sender, EventArgs e)
{
if (true)
if (Global.Instance.AnlageType == AcceptedCSVFormats.BLUELIGHT)
{
OpenFileDialog openFileDialog = new OpenFileDialog();
openFileDialog.InitialDirectory = @"\\192.168.2.248";
@@ -211,7 +211,7 @@ namespace SanSystem
File.Delete(source);
}
}
else
else if(Global.Instance.AnlageType == AcceptedCSVFormats.UVRELINING)
{
filenames.Clear();
if (MessageBox.Show("Bitte stellen Sie sicher, dass der Server antwortet und dass nur die Dateien vorhanden sind!, Bitte beachten Sie, dass das fenster einfrieren kann", "WARNUNG", MessageBoxButtons.OKCancel, MessageBoxIcon.Stop) == DialogResult.OK)
@@ -297,10 +297,10 @@ namespace SanSystem
frmOffsetSet frmOffsetSet;
if (inliner.Offset != DateTime.MinValue)
{
frmOffsetSet = new frmOffsetSet(inliner.Offset.TimeOfDay.ToString());
frmOffsetSet = new frmOffsetSet(inliner.Offset);
} else
{
frmOffsetSet = new frmOffsetSet();
frmOffsetSet = new frmOffsetSet(DateTime.MinValue);
}
frmOffsetSet.ShowDialog();
inliner.Offset = frmOffsetSet.Offset;

View File

@@ -31,16 +31,18 @@
this.txt_offset = new System.Windows.Forms.MaskedTextBox();
this.label1 = new System.Windows.Forms.Label();
this.btn_save = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.dateTimePicker = new System.Windows.Forms.DateTimePicker();
this.SuspendLayout();
//
// txt_offset
//
this.txt_offset.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.txt_offset.Location = new System.Drawing.Point(172, 9);
this.txt_offset.Location = new System.Drawing.Point(172, 83);
this.txt_offset.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.txt_offset.Mask = "90:00:00";
this.txt_offset.Name = "txt_offset";
this.txt_offset.Size = new System.Drawing.Size(229, 30);
this.txt_offset.Size = new System.Drawing.Size(107, 26);
this.txt_offset.TabIndex = 0;
this.txt_offset.ValidatingType = typeof(System.DateTime);
//
@@ -48,17 +50,17 @@
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label1.Location = new System.Drawing.Point(18, 14);
this.label1.Location = new System.Drawing.Point(18, 88);
this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(85, 25);
this.label1.Size = new System.Drawing.Size(71, 20);
this.label1.TabIndex = 1;
this.label1.Text = "StartZeit";
//
// btn_save
//
this.btn_save.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btn_save.Location = new System.Drawing.Point(18, 70);
this.btn_save.Location = new System.Drawing.Point(18, 144);
this.btn_save.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btn_save.Name = "btn_save";
this.btn_save.Size = new System.Drawing.Size(384, 80);
@@ -67,19 +69,41 @@
this.btn_save.UseVisualStyleBackColor = true;
this.btn_save.Click += new System.EventHandler(this.Btn_save_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.label2.Location = new System.Drawing.Point(18, 38);
this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(57, 20);
this.label2.TabIndex = 3;
this.label2.Text = "Datum";
//
// dateTimePicker
//
this.dateTimePicker.CustomFormat = "yyyy";
this.dateTimePicker.Location = new System.Drawing.Point(172, 38);
this.dateTimePicker.Name = "dateTimePicker";
this.dateTimePicker.Size = new System.Drawing.Size(275, 26);
this.dateTimePicker.TabIndex = 4;
this.dateTimePicker.Value = new System.DateTime(2021, 3, 11, 12, 12, 12, 0);
//
// frmOffsetSet
//
this.AutoScaleDimensions = new System.Drawing.SizeF(12F, 25F);
this.AutoScaleDimensions = new System.Drawing.SizeF(9F, 20F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(435, 171);
this.ClientSize = new System.Drawing.Size(493, 249);
this.ControlBox = false;
this.Controls.Add(this.dateTimePicker);
this.Controls.Add(this.label2);
this.Controls.Add(this.btn_save);
this.Controls.Add(this.label1);
this.Controls.Add(this.txt_offset);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.Name = "frmOffsetSet";
this.Text = "frmOffsetSet";
this.Text = "Offsetwert anpassen";
this.ResumeLayout(false);
this.PerformLayout();
@@ -90,5 +114,7 @@
private System.Windows.Forms.MaskedTextBox txt_offset;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Button btn_save;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.DateTimePicker dateTimePicker;
}
}

View File

@@ -14,16 +14,20 @@ namespace SanSystem
public partial class frmOffsetSet : Form
{
public DateTime Offset;
public frmOffsetSet(string Uhrzeit = null)
public frmOffsetSet(DateTime off)
{
InitializeComponent();
if(Uhrzeit != null)
txt_offset.Text = Uhrzeit;
if (off != DateTime.MinValue)
{
txt_offset.Text = off.TimeOfDay.ToString();
dateTimePicker.Value = off;
}
}
private void Btn_save_Click(object sender, EventArgs e)
{
Offset = DateTime.Parse(txt_offset.Text);
string s = string.Format("{0} {1}", dateTimePicker.Value.ToShortDateString(), txt_offset.Text);
Offset = DateTime.Parse(s);
this.Close();
}
}