private void OK_Click(object sender, EventArgs e) { #region SaveLocalSettings myLocalSettings.SerializeXML(); if (myLocalSettings.UseProjectManagement) { if (MessageBox.Show("Das Verwenden der Projektliste setzt folgendes Paket voraus:\n\n'Microsoft Access Database Engine 2010 Redistributable'\n\nSoll dieses jetzt installiert werden?", "Informtion", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { App.ExtractEmbeddedResources("AccessDatabaseEngine.exe", myLocalSettings.LocalSettingsDirectory); try { Process.Start(Path.Combine(myLocalSettings.LocalSettingsDirectory, "AccessDatabaseEngine.exe")); } catch (Exception ex) { MessageBox.Show(ex.Message, MethodInfo.GetCurrentMethod().Name); //Vorgang mit Benutzerkontensteuerung abgebrochen --> Exeption } } } #endregion #region SavePublicSettings if (myNetworkDriveAvailable == false) { MessageBox.Show("Das Netzlaufwerk '" + Path.GetPathRoot(myLocalSettings.PublicSettingsDirectory) + "' ist nicht verfügbar, weshalb die öffentlichen Einstellungen (Maschinen) nicht gespeichert werden.", "Fehler", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { foreach (var machine in myMachines) { if (machine.ControlVersion == Machine.TNCVersions.ab_TNC640) { if (MessageBox.Show("Das Verwenden der Einstellung 'ab_TNC640' setzt folgendes Paket voraus:\n\n'Microsoft Visual C++ 2010 Redistributable Package (x64)'\n\nSoll dieses jetzt installiert werden?", "Informtion", MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button2) == DialogResult.Yes) { App.ExtractEmbeddedResources("vcredist_x64.exe", myLocalSettings.LocalSettingsDirectory); try { Process.Start(Path.Combine(myLocalSettings.LocalSettingsDirectory, "vcredist_x64.exe")); } catch (Exception ex) { MessageBox.Show(ex.Message, MethodInfo.GetCurrentMethod().Name); //Vorgang mit Benutzerkontensteuerung abgebrochen --> Exeption } } break; } } myMachines.SerializeXML(myLocalSettings.PublicSettingsDirectory); } DialogResult = DialogResult.OK; }
public static Machines InitMachines(string path) { try { Machines myMachines = new Machines(); App.ExtractEmbeddedResources(".template", path); if (File.Exists(Path.Combine(path, LocalSettings.PublicSettingsFile))) { myMachines = myMachines.DeserializeXML(path); } else { Machine _machine = new Machine(); _machine.Projects = new List <Project>(); for (int i = 0; i < _machine.MaxToolRange; i++) { Project _project = new Project(i); _machine.Projects.Add(_project); } myMachines.Add(_machine); myMachines.SerializeXML(path); } foreach (var machine in myMachines) { if (machine.ControlVersion == Machine.TNCVersions.ab_TNC640) { LocalSettings myLocalSettings = new LocalSettings(); //MessageBox.Show("Das Verwenden der Einstellung 'ab_TNC640' setzt folgendes Paket voraus:\n\n'Microsoft Visual C++ 2010 Redistributable Package (x64)'", "Informtion", MessageBoxButtons.OK, MessageBoxIcon.Information); App.ExtractEmbeddedResources(".dll", myLocalSettings.LocalSettingsDirectory); App.ExtractEmbeddedResources("TNCSyncPlus.exe", myLocalSettings.LocalSettingsDirectory); break; } } return(myMachines); } catch (Exception ex) { MessageBox.Show(ex.Message, MethodInfo.GetCurrentMethod().Name); return(null); } }
private void OK_Click(object sender, EventArgs e) { myMachines.SerializeXML(myLocalSettings.PublicSettingsDirectory); this.DialogResult = DialogResult.OK; }