Esempio n. 1
0
        private void MenuItemUninstNpgsqlDdexProvider(object sender, EventArgs e)
        {
            if (!CheckNpgsqlStatus.NeedUninst)
            {
                UIUt.Alert(this, "Npgsql ADO.NET Data Provider is not installed in your host config file. \n"
                           + "\n"
                           + CheckNpgsqlStatus.Ut.HostConfig + "\n"
                           , "NpgsqlDdexProvider");

                return;
            }
            if (UIUt.Confirm(this, "Could we modify the host config file in order to uninstall Npgsql ADO.NET Data Provider? \n"
                             + "\n"
                             + CheckNpgsqlStatus.Ut.HostConfig + "\n"
                             , "NpgsqlDdexProvider"))
            {
                try {
                    CheckNpgsqlStatus.DoUninst();
                }
                catch (UnauthorizedAccessException err) {
                    UIUt.Alert(this, "Grant write access to: \n" + CheckNpgsqlStatus.Ut.HostConfig + "\n\nException message:\n---\n" + err + "\n---", "NpgsqlDdexProvider");
                    if (PEUt.GrantEditAccess(CheckNpgsqlStatus.Ut.HostConfig))
                    {
                        CheckNpgsqlStatus.DoUninst();
                    }
                }

                UIUt.Alert(this, "Uninstall successful. \n"
                           + "\n"
                           + "Please restart this VisualStudio."
                           , "NpgsqlDdexProvider");
            }
        }
Esempio n. 2
0
        private void MenuItemSetupNpgsqlDdexProvider(object sender, EventArgs e)
        {
            if (!CheckNpgsqlStatus.NeedInst)
            {
                UIUt.Alert(this, "The host config file has been already modified. \n"
                           + "\n"
                           , "NpgsqlDdexProvider");

                return;
            }
            if (UIUt.Confirm(this, "Could we modify the host config file in order to activate Npgsql ADO.NET Data Provider? \n"
                             + "\n"
                             + CheckNpgsqlStatus.Ut.HostConfig + "\n"
                             + "\n"
                             + "The assembly version: \n"
                             + "\n"
                             + typeof(Npgsql.NpgsqlFactory).Assembly.FullName
                             , "NpgsqlDdexProvider"))
            {
                try {
                    CheckNpgsqlStatus.DoInst();
                }
                catch (UnauthorizedAccessException err) {
                    UIUt.Alert(this, "Grant write access to: \n" + CheckNpgsqlStatus.Ut.HostConfig + "\n\nException message:\n---\n" + err + "\n---", "NpgsqlDdexProvider");
                    if (PEUt.GrantEditAccess(CheckNpgsqlStatus.Ut.HostConfig))
                    {
                        CheckNpgsqlStatus.DoInst();
                    }
                }

                UIUt.Alert(this, "Modification successful. \n"
                           + "\n"
                           + "Please restart this VisualStudio."
                           , "NpgsqlDdexProvider");
            }
        }