diff --git a/BerichtGen/FrmOptions.Designer.cs b/BerichtGen/FrmOptions.Designer.cs index 8e73558..ee24d87 100644 --- a/BerichtGen/FrmOptions.Designer.cs +++ b/BerichtGen/FrmOptions.Designer.cs @@ -50,6 +50,7 @@ // cb_doc // this.cb_doc.AutoSize = true; + this.cb_doc.Enabled = false; this.cb_doc.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.cb_doc.Location = new System.Drawing.Point(6, 12); this.cb_doc.Name = "cb_doc"; diff --git a/SanSystem/Global.cs b/SanSystem/Global.cs index c950725..2558425 100644 --- a/SanSystem/Global.cs +++ b/SanSystem/Global.cs @@ -3,8 +3,10 @@ using Microsoft.Win32; using SanShared; using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Linq; +using System.Net.NetworkInformation; using System.Reflection; using System.Text; using System.Threading.Tasks; @@ -17,6 +19,8 @@ namespace SanSystem public event EventHandler OnStatusMessageChanged; public static readonly Global instance = new Global(); + + const string userroot = "HKEY_CURRENT_USER\\Software"; const string firmkey = "Cosysda"; const string subkey = "SanManager"; @@ -29,6 +33,8 @@ namespace SanSystem string statusMessage = ""; + + public string StatusMessage { get @@ -171,7 +177,18 @@ namespace SanSystem } } + public static bool CheckNetworkAnlageAvaible() + { + Ping pingSender = new Ping(); + PingOptions options = new PingOptions(); + string data = "aaaaaaaaaaaaa"; + byte[] buffer = Encoding.ASCII.GetBytes(data); + int timeout = 20; + PingReply reply = pingSender.Send("192.168.2.248", timeout, buffer, options); + return reply.Status == IPStatus.Success; + + } public void LoadLanguage() { @@ -181,7 +198,6 @@ namespace SanSystem public Global() { LadeRegistry(); - } ~Global() diff --git a/SanSystem/UCInliner.cs b/SanSystem/UCInliner.cs index d5fe08a..db22865 100644 --- a/SanSystem/UCInliner.cs +++ b/SanSystem/UCInliner.cs @@ -200,7 +200,8 @@ namespace SanSystem if (Global.Instance.AnlageType == AcceptedCSVFormats.BLUELIGHT) { OpenFileDialog openFileDialog = new OpenFileDialog(); - openFileDialog.InitialDirectory = @"\\192.168.2.248"; + if(Global.CheckNetworkAnlageAvaible()) + openFileDialog.InitialDirectory = @"\\192.168.2.248"; if (openFileDialog.ShowDialog() == DialogResult.OK) { string source = openFileDialog.FileName; @@ -218,7 +219,7 @@ namespace SanSystem DownloadFromUV(); } } - } + } private void ListFiles(FtpClient client, string directory) { diff --git a/SanSystem/frmInfo.cs b/SanSystem/frmInfo.cs index f8af9df..809f899 100644 --- a/SanSystem/frmInfo.cs +++ b/SanSystem/frmInfo.cs @@ -15,6 +15,12 @@ namespace SanSystem public frmInfo() { InitializeComponent(); + string copyright = "Dieses Programm wurde von Damian Bodde entwickelt"; + string trenner = ""; + for (int i = 0; i < copyright.Length; i++) + trenner += "#"; + lst_info.Items.Add(copyright); + lst_info.Items.Add(trenner); lst_info.Items.Add("Werte beziehen sich auf DN150"); lst_info.Items.Add("3D Liner => ca 7% Schrumpf"); lst_info.Items.Add("DN125 Liner => ca 3% Schrumpf"); diff --git a/SanSystem/frmOffsetSet.cs b/SanSystem/frmOffsetSet.cs index 7c13182..a40b24d 100644 --- a/SanSystem/frmOffsetSet.cs +++ b/SanSystem/frmOffsetSet.cs @@ -27,7 +27,15 @@ namespace SanSystem private void Btn_save_Click(object sender, EventArgs e) { string s = string.Format("{0} {1}", dateTimePicker.Value.ToShortDateString(), txt_offset.Text); - Offset = DateTime.Parse(s); + try + { + Offset = DateTime.Parse(s); + } + catch(System.FormatException ex) + { + MessageBox.Show("Fehler beim Datum, es wird das jetzige Datum verwendet\n"+ex.Message); + Offset = DateTime.Now; + } this.Close(); } }