private void CanelInstallation() { KillConfig(); if (_installed) { if (!_interfaceMgt.UninstallInterface(_definedInterface)) { Program.Log.Write(LogType.Warning, "{Interface} Unregister NT service failed : " + GCError.LastErrorInfor); Program.Log.Write(GCError.LastError); MessageBox.Show(this, "Unregister NT service failed.\r\n\r\n" + GCError.LastErrorInfor, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { _installed = false; } } if (_addedtodatabase) { if (!_interfaceMgt.DeleteInterfaceFromDatabase(_definedInterface)) { Program.Log.Write(LogType.Warning, "{Interface} Delete interface from database failed : " + GCError.LastErrorInfor); Program.Log.Write(GCError.LastError); MessageBox.Show(this, "Delete interface from database failed.\r\n\r\n" + GCError.LastErrorInfor, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { _addedtodatabase = false; } } }
public void UninstallInterface() { base.SetStatus("Uninstalling interface."); GCInterface gcInterface = _interfaceView.GetSelectedInterface(); if (gcInterface == null) { return; } if (MessageBox.Show(frmMain, "Are you sure to uninstall the interface : " + gcInterface.InterfaceName + "?", "Warning", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } bool res = _interfaceManager.UninstallInterface(gcInterface); if (res) { Program.Log.Write("{Interface} uninstall interface (" + gcInterface.ToString() + ") succeed"); res = _interfaceManager.RunDBUninstallScript(gcInterface); if (res) { Program.Log.Write("{Interface} run (" + gcInterface.ToString() + ") DB uninstall script succeed " + gcInterface.FolderPath); res = _interfaceManager.DeleteInterfaceFromDatabase(gcInterface); if (res) { Program.Log.Write("{Interface} remove interface (" + gcInterface.ToString() + ") from database succeed"); res = _interfaceManager.DeleteInterfaceFromFolder(gcInterface); if (res) { Program.Log.Write("{Interface} remove interface (" + gcInterface.ToString() + ") directory succeed " + gcInterface.FolderPath); _interfaceView.RefreshView(); CreateUninstallScript(); } else { Program.Log.Write(LogType.Warning, "{Interface} remove interface (" + gcInterface.ToString() + ") directory failed " + gcInterface.FolderPath); Program.Log.Write(LogType.Error, GCError.LastErrorInfor); Program.Log.Write(GCError.LastError); } } else { Program.Log.Write(LogType.Warning, "{Interface} remove interface (" + gcInterface.ToString() + ") from database failed"); Program.Log.Write(LogType.Error, GCError.LastErrorInfor); Program.Log.Write(GCError.LastError); } } else { Program.Log.Write(LogType.Warning, "{Interface} run (" + gcInterface.ToString() + ") DB uninstall script failed"); Program.Log.Write(LogType.Error, GCError.LastErrorInfor); Program.Log.Write(GCError.LastError); } } else { Program.Log.Write(LogType.Warning, "{Interface} uninstall interface (" + gcInterface.ToString() + ") failed"); Program.Log.Write(LogType.Error, GCError.LastErrorInfor); Program.Log.Write(GCError.LastError); } if (!res) { MessageBox.Show(frmMain, "Uninstall interface failed.\r\n\r\n" + GCError.LastErrorInfor, "Warning", MessageBoxButtons.OK, MessageBoxIcon.Warning); } base.ClearStatus(); }