private void ActionButton_Click(object sender, EventArgs e) { string errMsg = string.Empty; if (DriverInstaller.DriverAlreadyExits(ref errMsg)) { string errorMsg = string.Empty; if (DriverInstaller.DeleteDriver(ref errorMsg)) { MessageBox.Show( "Netfilter successfully uninstalled!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show( string.Format("Couldn't uninstall Netfilter..\r\nError: {0}", errorMsg), "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { string errorMsg = string.Empty; DriverInstaller.DriverType driverType = (wfpDriverRadioButton.Checked) ? DriverInstaller.DriverType.WFP : DriverInstaller.DriverType.TDI; if (DriverInstaller.InstallDriver(ref errorMsg, driverType)) { MessageBox.Show( "Netfilter successfully installed!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show( string.Format("Couldn't install Netfilter..\r\nError: {0}", errorMsg), "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (errMsg != string.Empty) { MessageBox.Show( string.Format("Couldn't install Netfilter..\r\nError: {0}", errMsg), "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } Close(); }
private void ActionButton_Click(object sender, EventArgs e) { if (DriverInstaller.Installed()) { string errorMsg = string.Empty; if (DriverInstaller.DeleteDriver(ref errorMsg)) { DialogResult dialogResult = MessageBox.Show( "Netfilter successfully uninstalled!\n" + "For complete uninstallation require reboot.\nReboot now?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dialogResult == DialogResult.Yes) { Process.Start("shutdown", "/r /t 10"); } } else { MessageBox.Show( string.Format("Couldn't uninstall Netfilter..\r\nError: {0}", errorMsg), "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { string errorMsg = string.Empty; DriverInstaller.DriverType driverType = (wfpDriverRadioButton.Checked) ? DriverInstaller.DriverType.WFP : DriverInstaller.DriverType.TDI; if (DriverInstaller.InstallDriver(ref errorMsg, driverType)) { MessageBox.Show( "Netfilter successfully installed!", string.Empty, MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show( string.Format("Couldn't install Netfilter..\r\nError: {0}", errorMsg), "error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } Close(); }
private void Form1_Load(object sender, EventArgs e) { #if !DISABLE_ADMIN_RIGHTS if (!OsProxy.CurrentUserIsAdministrator()) { MessageBox.Show("To continue installing, please run this program as Administrator", "Installation failed..", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); return; } #endif FormStatus status = (DriverInstaller.Installed()) ? FormStatus.Uninstall : FormStatus.Install; UpdateForm(status); }
private void Form1_Load(object sender, EventArgs e) { if (!OsProxy.CurrentUserIsAdministrator()) { MessageBox.Show("To continue installing, please run this program as Administrator", "Installation failed..", MessageBoxButtons.OK, MessageBoxIcon.Error); Close(); } string errMsg = string.Empty; if (DriverInstaller.DriverAlreadyExits(ref errMsg)) { UpdateForm(FormStatus.Uninstall); } if (errMsg != string.Empty) { MessageBox.Show(errMsg, "Installation failed..", MessageBoxButtons.OK, MessageBoxIcon.Error); } }