コード例 #1
0
        private void Get()
        {
            // Check if save can be triggered
            var allValid = AreAllDependenciesValid();

            if (!allValid)
            {
                UserMessageService.ShowWarning("Please correct all errors before saving.");
                return;
            }

            try
            {
                GetDependencies(TargetsFileData);
            }
            catch (Exception ex)
            {
                // TODO: DependencyService should only throw well-known exceptions
                UserMessageService.ShowError(String.Format("An fatal error occurred while getting the dependencies. See DependencyManager output window for further information!"));

                Logger.LogMsg("\nFatal error occured while fetching dependencies. Aborting ...");
                Logger.LogMsg(String.Format("Exception message: {0}", ex.Message));
                Logger.LogMsg(String.Format("Stacktrace:\n{0}\n", ex.StackTrace));
                Logger.ShowMessages();
            }
        }
コード例 #2
0
        private void Save(TargetsFileData targetsFileData)
        {
            // this is where the actual saving is triggered,
            // including a check to see if we can save at all

            // first check if we can save
            var allValid = AreAllDependenciesValid();

            if (!allValid)
            {
                UserMessageService.ShowWarning("Please correct all errors before saving.");
                return;
            }

            try
            {
                SaveDependencies(targetsFileData);
            }
            catch (Exception ex)
            {
                // TODO: this should throw well-known exceptions only

                UserMessageService.ShowError("An error occurred while saving the dependencies file: " + ex.Message);
            }
        }
コード例 #3
0
        public int CreateEditorInstance(
            uint grfCreateDoc,
            string pszMkDocument,
            string pszPhysicalView,
            IVsHierarchy pvHier,
            uint itemid,
            IntPtr punkDocDataExisting,
            out IntPtr ppunkDocView,
            out IntPtr ppunkDocData,
            out string pbstrEditorCaption,
            out Guid pguidCmdUI,
            out int pgrfCDW)
        {
            Trace.WriteLine(string.Format(CultureInfo.CurrentCulture, "Entering {0} CreateEditorInstance()", ToString()));

            // Initialize to null
            ppunkDocView       = IntPtr.Zero;
            ppunkDocData       = IntPtr.Zero;
            pguidCmdUI         = GuidList.guidAIT_DMF_DependencyEditorFactory;
            pgrfCDW            = 0;
            pbstrEditorCaption = null;

            // Validate inputs
            if ((grfCreateDoc & (VSConstants.CEF_OPENFILE | VSConstants.CEF_SILENT)) == 0)
            {
                return(VSConstants.E_INVALIDARG);
            }
            if (punkDocDataExisting != IntPtr.Zero)
            {
                return(VSConstants.VS_E_INCOMPATIBLEDOCDATA);
            }

            // Create the Document (editor)
            VisualEditorPane newEditor;

            try
            {
                newEditor = new VisualEditorPane(pszMkDocument);
            }
            catch (Exception e)
            {
                // Show Error Dialog and return S_OK to not show the visual studio error dialog!
                UserMessageService.ShowError(e.Message);
                return(VSConstants.S_OK);
            }
            ppunkDocView       = Marshal.GetIUnknownForObject(newEditor);
            ppunkDocData       = Marshal.GetIUnknownForObject(newEditor);
            pbstrEditorCaption = string.Empty;

            return(VSConstants.S_OK);
        }
        /// <summary>
        /// Save settings to team foundation registry
        /// </summary>
        private void Save()
        {
            _settings.PathToSevenZipExe      = PathToSevenZipExe;
            _settings.SelectedMultiSiteEntry = SelectedSite;

            try
            {
                _settings.SaveLocalRegistrySettings();
                SaveSettingsFailed = false;
                RaiseNotifyPropertyChanged(() => SaveSettingsFailed);
            }
            catch (Exception exception)
            {
                UserMessageService.ShowError("Failed to save settings to windows registry.");
                Logger.Instance().Log(TraceLevel.Error, "Failed to save settings to windows registry. Error was {0}", exception.ToString());
            }
            finally
            {
                LoadSettings();
            }
        }
コード例 #5
0
        /// <summary>
        /// Save settings to team foundation registry
        /// </summary>
        private void Save()
        {
            _settings.FetchDependenciesOnLocalSolutionBuild  = FetchDependenciesOnLocalSolutionBuild;
            _settings.ValidDependencyDefinitionFileExtension = FilenameExtension.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
            _settings.RelativeOutputPath          = RelativeOutputPath;
            _settings.BinaryRepositoryTeamProject = BinaryRepositoryTeamProject;
            _settings.IsBinaryRepositoryComponentSettingsEnabled = IsBinaryRepositoryComponentSettingsEnabled;
            _settings.BinaryRepositoryTeamProjectCollectionUrl   = BinaryRepositoryTeamProjectCollectionUri;
            _settings.BinaryRepositoryFilterComponentList        = BinaryRepositoryFilterComponentList;
            _settings.IsZippedDependencyAllowed = IsZippedDependencyAllowed;
            _settings.IsMultiSiteAllowed        = IsMultiSiteAllowed;
            _settings.MultiSiteList             = Sites.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

            // create a comma separated list of disabled resolvers
            _settings.DisabledResolvers = string.Join(",", ResolverTypes.Where(x => x.IsEnabled == false).Select(x => x.ReferenceName));

            try
            {
                _settings.Save();
                SaveSettingsFailed = false;
                RaiseNotifyPropertyChanged(() => SaveSettingsFailed);
            }
            catch (AccessCheckException)
            {
                Logger.Instance().Log(TraceLevel.Error, "You don't have permission to save to the registry.");
                SaveSettingsFailed = true;
                RaiseNotifyPropertyChanged(() => SaveSettingsFailed);
            }
            catch (Exception exception)
            {
                UserMessageService.ShowError("Failed to save settings to team foundation server registry.");
                Logger.Instance().Log(TraceLevel.Error, "Failed to save settings to team foundation server registry. Error was {0}", exception.ToString());
            }
            finally
            {
                LoadSettings();
            }
        }