public static new DialogResult Show()
        {
            RemoveConfigurationsForm rcf = new RemoveConfigurationsForm();

            rcf.StartPosition = FormStartPosition.CenterScreen;
            return(rcf.ShowDialog());
        }
Beispiel #2
0
        public override void Uninstall(IDictionary mySavedState)
        {
#if DEBUG_SETUP
            System.Diagnostics.Debugger.Launch();
#endif
            if (mySavedState != null)
            {
                try
                {
                    // for permanent commandbars, toolbar and menu must be removed explicitely
                    if (mySavedState.Contains("permanentbars") && (bool)mySavedState["permanentbars"] == true)
                    {
                        // collect a list of all IDEs for which add-in has been installed
                        StringCollection devEnvironmentNames = new StringCollection();
                        foreach (DevEnvironmentVersion devEnvironmentVersion in DevEnvironmentVersions)
                        {
                            // check if toolbar was originally installed for the enviromnment,
                            // if environment was started at all since add-in was installed and
                            // if this environment still exists
                            if (mySavedState.Contains(devEnvironmentVersion.LaunchCondition) && IsDevEnvironmentInstalled(devEnvironmentVersion))
                            {
                                devEnvironmentNames.Add(devEnvironmentVersion.Name);
                            }
                        }
                        if (devEnvironmentNames.Count > 0)
                        {
                            RemoveToolbarsForm.Show(devEnvironmentNames);
                            foreach (DevEnvironmentVersion devEnvironmentVersion in DevEnvironmentVersions)
                            {
                                // remove permanent UI entries for selected environments only
                                if (devEnvironmentNames.Contains(devEnvironmentVersion.Name))
                                {
                                    RemovePermamanentUI(devEnvironmentVersion);
                                }
                            }
                        }
                    }

                    foreach (DevEnvironmentVersion devEnvironmentVersion in DevEnvironmentVersions)
                    {
                        // clean-up PreloadAddinState registry entries
                        if (mySavedState.Contains(devEnvironmentVersion.LaunchCondition) && devEnvironmentVersion.AddInIsComRegistered && PreloadAddinStateExists(devEnvironmentVersion) && IsDevEnvironmentInstalled(devEnvironmentVersion))
                        {
                            DeletePreloadAddinState(devEnvironmentVersion);
                            mySavedState.Remove(devEnvironmentVersion.LaunchCondition);
                        }
                    }
                    // delete AddIn files
                    foreach (DevEnvironmentVersion devEnvironmentVersion in DevEnvironmentVersions)
                    {
                        string addinFileKey = string.Format("{0}.AddInFile", devEnvironmentVersion.Version);
                        if (mySavedState.Contains(addinFileKey))
                        {
                            string addInFilename = (string)mySavedState[addinFileKey];
                            File.Delete(addInFilename);
                        }
                    }
                }
                catch (Exception e)
                {
                    ExceptionForm.Show(e, UnistallErrorCaption);
                }
                DeleteUiSettings();
                if (RemoveConfigurationsForm.Show() == DialogResult.Yes)
                {
                    DeleteConfigurations();
                }
            }
            base.Uninstall(mySavedState);
        }