Man kann jetzt einen Ausrduck erzeugen für das ausgeben einer Kalibrierliste
This commit is contained in:
@@ -3,6 +3,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SanSystem.Einstellungen
|
||||
{
|
||||
@@ -10,17 +11,39 @@ namespace SanSystem.Einstellungen
|
||||
{
|
||||
public ObjecteListSetting() : base("ObjecteList") { }
|
||||
|
||||
public override int GetWidth(DataGridViewColumn dataGridViewColumn)
|
||||
{
|
||||
int result = -1;
|
||||
|
||||
try
|
||||
{
|
||||
result = getConfiguration(dataGridViewColumn.HeaderText);
|
||||
}
|
||||
catch(Exception )
|
||||
{
|
||||
result = 20;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
public override void SetWidth(DataGridViewColumn dataGridViewColumn)
|
||||
{
|
||||
setConfig(dataGridViewColumn.HeaderText, dataGridViewColumn.Width);
|
||||
}
|
||||
|
||||
public override void InitDevValues()
|
||||
{
|
||||
// Hausnummer
|
||||
// Von punkt
|
||||
// Bis punkt
|
||||
// Haltungslänge
|
||||
|
||||
configuration.Add("Auswahl", 20);
|
||||
configuration.Add("Hausnummer", 40);
|
||||
configuration.Add("VonPunkt", 100);
|
||||
configuration.Add("BisPunkt", 100);
|
||||
configuration.Add("Haltungslaenge", 40);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,12 +5,13 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace SanSystem.Einstellungen
|
||||
{
|
||||
abstract class Settings : IDisposable
|
||||
{
|
||||
public Dictionary<string, int> configuration = new Dictionary<string, int>();
|
||||
protected Dictionary<string, int> configuration = new Dictionary<string, int>();
|
||||
|
||||
const string pfad = "Settings";
|
||||
|
||||
@@ -33,7 +34,33 @@ namespace SanSystem.Einstellungen
|
||||
}
|
||||
}
|
||||
|
||||
protected int getConfiguration(string keyName, int retry = 0)
|
||||
{
|
||||
if (retry >= 3)
|
||||
throw new Exception("Fehler, zuviele versuche");
|
||||
int result = -1;
|
||||
if(!configuration.TryGetValue(keyName,out result))
|
||||
{
|
||||
configuration.Add(keyName, 20);
|
||||
//return -1;
|
||||
result = getConfiguration(keyName,retry++);
|
||||
SaveSettings();
|
||||
return result;
|
||||
}
|
||||
else
|
||||
{
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
protected void setConfig(string keyName, int value)
|
||||
{
|
||||
configuration[keyName] = value;
|
||||
}
|
||||
|
||||
public abstract void InitDevValues();
|
||||
public abstract int GetWidth(DataGridViewColumn dataGridViewColumn);
|
||||
public abstract void SetWidth(DataGridViewColumn dataGridViewColumn);
|
||||
|
||||
public virtual void SaveSettings()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user