コード例 #1
0
        public void TestReportingProgressCancellationServiceTest_ContinueFalseWhenProgressNotCanceledAndNoeErrorExist()
        {
            var progressService = new Mock <IProgressService>();

            progressService.SetupGet(x => x.ProgressCanceled).Returns(false);
            SyncServiceFactory.RegisterService(progressService.Object);

            var infoStorageService = new Mock <IInfoStorageService>();

            infoStorageService.SetupGet(x => x.UserInformation).
            Returns(new InfoCollection <IUserInformation>()
            {
                new UserInformation()
                {
                    Type = UserInformationType.Warning
                }
            });

            SyncServiceFactory.RegisterService(infoStorageService.Object);
            var cancelTrueServiceInstance = new TestReportingProgressCancellationService(true);

            var shouldContinue = cancelTrueServiceInstance.CheckIfContinue();

            Assert.AreEqual(shouldContinue, true);
        }
コード例 #2
0
        /// <summary>
        /// Table adapter specific load. Loads <c>WordTableWorkItems</c> from tables.
        /// </summary>
        /// <param name="loadCriteria">Selects which items to actually load. This is a performance enhancer...</param>
        protected bool LoadStructure(Func <Table, IConfigurationItem, bool> loadCriteria)
        {
            WorkItems = new WordTableWorkItemCollection();

            if (Document.Tables == null)
            {
                return(true);
            }

            foreach (Table table in Document.Tables)
            {
                try
                {
                    var workItem = CreateWorkItem(table, loadCriteria);

                    // add successfully created items if the id is in the list or no list was set
                    if (workItem != null)
                    {
                        ApplyHeaders(workItem);
                        WorkItems.Add(workItem);

                        // Load embedded work items
                        foreach (var subItem in workItem.CreateLinkedWorkItems())
                        {
                            ApplyHeaders(workItem);
                            WorkItems.Add(subItem);
                        }
                    }
                    else
                    {
                        var header = CreateHeader(table);

                        // If the table was a header, remove all headers of higher or the same level from the stack
                        if (header != null)
                        {
                            while (_headers.Count > 0 && _headers.Peek().Configuration.Level >= header.Configuration.Level)
                            {
                                _headers.Pop();
                            }
                            _headers.Push(header);
                            SyncServiceTrace.D("Found new header, new stack: {0}", string.Join(",", _headers.Select(x => x.Configuration.WorkItemType).ToArray()));
                        }
                    }
                }
                catch (Exception ex)
                {
                    SyncServiceTrace.LogException(ex);
                    var infoStorage = SyncServiceFactory.GetService <IInfoStorageService>();
                    if (infoStorage != null)
                    {
                        infoStorage.NotifyError(Resources.Error_LoadWordWI, ex);
                    }
                    else
                    {
                        throw;
                    }
                }
            }
            return(true);
        }
コード例 #3
0
        /// <summary>
        /// Execute import work items from TFS to Word process.
        /// </summary>
        public void Import()
        {
            SyncServiceTrace.I(Resources.ImportWorkItems);
            SyncServiceFactory.GetService <IInfoStorageService>().ClearAll();

            // check whether cursor is not inside the table
            if (WordSyncHelper.IsCursorInTable(WordDocument.ActiveWindow.Selection))
            {
                SyncServiceTrace.W(Resources.WordToTFS_Error_TableInsertInTable);
                MessageBox.Show(Resources.WordToTFS_Error_TableInsertInTable, Resources.MessageBox_Title, MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            // disable all other functionality
            if (WordRibbon != null)
            {
                WordRibbon.ResetBeforeOperation(DocumentModel);
                WordRibbon.DisableAllControls(DocumentModel);
            }

            // display progress dialog
            var progressService = SyncServiceFactory.GetService <IProgressService>();

            progressService.ShowProgress();
            progressService.NewProgress(Resources.GetWorkItems_Title);
            IsImporting = true;

            // start background thread to execute the import
            var backgroundWorker = new BackgroundWorker();

            backgroundWorker.DoWork             += DoImport;
            backgroundWorker.RunWorkerCompleted += ImportFinished;
            backgroundWorker.RunWorkerAsync(backgroundWorker);
        }
コード例 #4
0
        public void MyTestInitialize()
        {
            var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title");
            var serverConfiguration = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            _testAdapter = SyncServiceFactory.CreateTfsTestAdapter(serverConfiguration.TeamProjectCollectionUrl, serverConfiguration.TeamProjectName, config);
        }
コード例 #5
0
        /// <summary>
        /// Creates hyperlinks to selected work items at the current cursor position.
        /// </summary>
        public void CreateHyperlink()
        {
            SyncServiceTrace.I(Resources.CreateHyperlinks);

            // set actual selected configuration
            var ignoreFormatting  = DocumentModel.Configuration.IgnoreFormatting;
            var conflictOverwrite = DocumentModel.Configuration.ConflictOverwrite;

            DocumentModel.Configuration.ActivateMapping(DocumentModel.MappingShowName);
            DocumentModel.Configuration.IgnoreFormatting  = ignoreFormatting;
            DocumentModel.Configuration.ConflictOverwrite = conflictOverwrite;
            DocumentModel.Configuration.IgnoreFormatting  = ignoreFormatting;

            var source          = SyncServiceFactory.CreateTfs2008WorkItemSyncAdapter(DocumentModel.TfsServer, DocumentModel.TfsProject, null, DocumentModel.Configuration);
            var destination     = SyncServiceFactory.CreateWord2007TableWorkItemSyncAdapter(WordDocument, DocumentModel.Configuration);
            var importWorkItems = (from wim in FoundWorkItems
                                   where wim.IsChecked
                                   select wim.Item).ToList();


            // search for already existing work items in word and ask whether to overide them
            if (!(source.Open(importWorkItems.Select(x => x.TfsItem.Id).ToArray()) && destination.Open(null)))
            {
                return;
            }

            foreach (var workItem in importWorkItems)
            {
                destination.CreateWorkItemHyperlink(workItem.TfsItem.Title, source.GetWorkItemEditorUrl(workItem.TfsItem.Id));
            }
        }
コード例 #6
0
        /// <summary>
        /// Background method to find the work items from TFS.
        /// </summary>
        private void DoFind()
        {
            SyncServiceTrace.D(Resources.DoFindProccessMessage);
            DocumentModel.SaveQueryConfiguration(_queryConfiguration);

            //var config = SyncServiceFactory.GetService<IConfigurationService>().GetConfiguration(WordDocument);
            var config      = DocumentModel.Configuration;
            var tfsService  = SyncServiceFactory.CreateTfs2008WorkItemSyncAdapter(DocumentModel.TfsServer, DocumentModel.TfsProject, _queryConfiguration, config);
            var wordAdapter = SyncServiceFactory.CreateWord2007TableWorkItemSyncAdapter(DocumentModel.WordDocument, DocumentModel.Configuration);

            wordAdapter.Open(null);
            tfsService.Open(null);

            EnsureTfsLazyLoadingFinished(tfsService);

            // Cancel all queries in case there are still some running
            Cancel();
            _cancellationTokenSource = new CancellationTokenSource();
            var token = _cancellationTokenSource.Token;

            var tfsItems = (from wi in tfsService.WorkItems
                            select new DataItemModel <SynchronizedWorkItemViewModel>(new SynchronizedWorkItemViewModel(wi, null, wordAdapter, DocumentModel, token))
            {
                IsChecked = true
            }).ToList();

            var wordItems = (from wi in wordAdapter.WorkItems
                             where wi.IsNew
                             select new DataItemModel <SynchronizedWorkItemViewModel>(new SynchronizedWorkItemViewModel(null, wi, wordAdapter, DocumentModel, token))
            {
                IsChecked = true
            }).ToList();

            FoundWorkItems = tfsItems.Concat(wordItems).ToList();
        }
コード例 #7
0
        /// <summary>
        /// The method generates report by test plan structure.
        /// </summary>
        /// <param name="testSuite"><see cref="ITfsTestSuite"/> is the source of test cases to write out.</param>
        private void CreateReportByTestPlanHierarchy(ITfsTestSuite testSuite)
        {
            SyncServiceTrace.D("Creating report by test plan hierarchy...");
            if (testSuite == null)
            {
                SyncServiceTrace.D("Test suite is null");
                return;
            }
            // Get the necessary objects.
            var config     = SyncServiceFactory.GetService <IConfigurationService>().GetConfiguration(Document);
            var testReport = SyncServiceFactory.CreateWord2007TestReportAdapter(Document, config);
            // Get the detailed test plan.
            var testPlanDetail = TestAdapter.GetTestPlanDetail(testSuite);

            if (testPlanDetail == null)
            {
                return;
            }

            // Create report helper
            var testReportHelper = new TestReportHelper(TestAdapter, testReport, config, CancellationPending);
            // Insert test plan template
            var templateName = config.ConfigurationTest.ConfigurationTestSpecification.TestPlanTemplate;

            testReportHelper.InsertTestPlanTemplate(templateName, testPlanDetail);

            // Common part
            if (IncludeTestConfigurations && SelectedConfigurationPositionType == Contracts.Enums.Model.ConfigurationPositionType.BeneathTestPlan)
            {
                CreateConfigurationPart();
            }

            // Call recursion
            CreateReportByTestSuiteHierarchy(testSuite, 1, true);
        }
コード例 #8
0
ファイル: Program.cs プロジェクト: zero-one01/pass-winmenu
        private static Option <ISyncService> CreateSyncService(IComponentContext context)
        {
            var config              = context.Resolve <GitConfig>();
            var signService         = context.Resolve <ISignService>();
            var passwordStore       = context.ResolveNamed <IDirectoryInfo>("PasswordStore");
            var notificationService = context.Resolve <INotificationService>();
            var strategies          = context.Resolve <GitSyncStrategies>();

            var factory = new SyncServiceFactory(config, passwordStore.FullName, signService, strategies);

            var syncService = factory.BuildSyncService();

            switch (factory.Status)
            {
            case SyncServiceStatus.GitLibraryNotFound:
                notificationService.ShowErrorWindow("The git2 DLL could not be found. Git support will be disabled.");
                break;

            case SyncServiceStatus.GitRepositoryNotFound:
                notificationService.ShowErrorWindow($"Failed to open the password store Git repository ({factory.Exception.GetType().Name}: {factory.Exception.Message}). Git support will be disabled.");
                break;
            }

            return(Option.FromNullable(syncService));
        }
コード例 #9
0
        /// <summary>
        /// Background method to find the work items from TFS.
        /// </summary>
        private void DoFind(object sender, DoWorkEventArgs e)
        {
            SyncServiceTrace.D(Resources.FindWorkItems);

            var progressService = SyncServiceFactory.GetService <IProgressService>();

            progressService.ShowProgress();
            progressService.NewProgress(Resources.GetWorkItems_Title);

            var queryConfiguration = new QueryConfiguration();

            foreach (var workItem in _workItems)
            {
                queryConfiguration.ByIDs.Add(workItem);
            }

            queryConfiguration.ImportOption = QueryImportOption.IDs;

            _source.Open(queryConfiguration.ByIDs.ToArray());

            EnsureTfsLazyLoadingFinished(_source);

            _cancellationTokenSource.Cancel();
            _cancellationTokenSource = new CancellationTokenSource();
            var token = _cancellationTokenSource.Token;

            FoundWorkItems = (from wi in _source.WorkItems
                              select new DataItemModel <SynchronizedWorkItemViewModel>(new SynchronizedWorkItemViewModel(wi, null, _destination, _documentModel, token))
            {
                IsChecked = true
            }).ToList();
        }
コード例 #10
0
        public void IntegrationTest_PublishOfWorkItemWithUnclosedList_ShouldNotBePublished()
        {
            var systemVariableMock = new Mock <ISystemVariableService>();

            _ignoreFailOnUserInforation = true;

            var serverConfig = CommonConfiguration.TfsTestServerConfiguration(_testContext);

            serverConfig.Configuration.IgnoreFormatting = false;
            var requirementConf = serverConfig.Configuration.GetWorkItemConfiguration("Requirement");

            // import an workitems to use the structure as example for the new workitem
            var importItems = GetTfsWorkItems(new[] { serverConfig.HtmlRequirementId }, serverConfig).ToList();

            Refresh(serverConfig, importItems);

            //Add Bullet points to the table.
            _document.Tables[1].Cell(3, 1).Range.ListFormat.ApplyBulletDefault();
            var bulletItems = new[] { "One", "Two", "Three" };

            for (int i = 0; i < bulletItems.Length; i++)
            {
                string bulletItem = bulletItems[i];
                if (i < bulletItems.Length - 1)
                {
                    bulletItem = bulletItem + "\n";
                }
                _document.Tables[1].Cell(3, 1).Range.InsertBefore(bulletItem);
            }

            //delete the id
            _document.Tables[1].Cell(2, 3).Range.Text = string.Empty;
            _document.Tables[1].Cell(2, 1).Range.Text = "TestTitle";

            var createdWorkItem = new WordTableWorkItem(_document.Tables[1], "Requirement", serverConfig.Configuration, requirementConf);

            // publish
            var publishWorkItems = new List <IWorkItem>();

            publishWorkItems.Add(createdWorkItem);

            var configuration = serverConfig.Configuration;
            var tfsAdapter    = new Tfs2012SyncAdapter(serverConfig.TeamProjectCollectionUrl, serverConfig.TeamProjectName, null, configuration);
            var wordAdapter   = new Word2007TableSyncAdapter(_document, configuration);

            var syncService = new WorkItemSyncService(systemVariableMock.Object);

            syncService.Publish(wordAdapter, tfsAdapter, publishWorkItems, false, configuration);

            //Get the information storage
            var informationStorage = SyncServiceFactory.GetService <IInfoStorageService>();
            var error = informationStorage.UserInformation.FirstOrDefault(x => x.Type == UserInformationType.Error);

            //Test that an error was thrown
            Assert.IsNotNull(error);

            //Clear the information storage
            informationStorage.UserInformation.Clear();
        }
コード例 #11
0
        /// <summary>
        /// Method to check if cancellation has been triggered by user or an error already has occured.
        /// Returns <c>true</c> if user has not cancelled and no error has occured yet, otherwise <c>false</c>.
        /// </summary>
        /// <returns></returns>
        public bool CheckIfContinue()
        {
            var infoService     = SyncServiceFactory.GetService <IInfoStorageService>();
            var progressService = SyncServiceFactory.GetService <IProgressService>();

            var check = (_useProgressService && progressService.ProgressCanceled) || infoService.UserInformation.Any(x => x.Type == UserInformationType.Error);

            return(!check);
        }
コード例 #12
0
        /// <summary>
        /// Background method to import the work items from TFS.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="DoWorkEventArgs"/> that contains the event data.</param>
        private void DoImport(object sender, DoWorkEventArgs e)
        {
            SyncServiceTrace.I(Resources.ImportWorkItems);
            var workItemSyncService = SyncServiceFactory.GetService <IWorkItemSyncService>();
            var configService       = SyncServiceFactory.GetService <IConfigurationService>();

            // save query configuration to document
            DocumentModel.SaveQueryConfiguration(_queryConfiguration);
            DocumentModel.Save();

            // set actual selected configuration
            var configuration = configService.GetConfiguration(WordDocument);

            var ignoreFormatting  = configuration.IgnoreFormatting;
            var conflictOverwrite = configuration.ConflictOverwrite;

            configuration.ActivateMapping(DocumentModel.MappingShowName);
            DocumentModel.Configuration.IgnoreFormatting = ignoreFormatting;
            configuration.ConflictOverwrite = conflictOverwrite;
            configuration.IgnoreFormatting  = ignoreFormatting;

            var config = SyncServiceFactory.GetService <IConfigurationService>().GetConfiguration(WordDocument);
            var source = SyncServiceFactory.CreateTfs2008WorkItemSyncAdapter(DocumentModel.TfsServer, DocumentModel.TfsProject, null, config);

            _importWordAdapter = SyncServiceFactory.CreateWord2007TableWorkItemSyncAdapter(WordDocument, configuration);

            _importWordAdapter.PrepareDocumentForLongTermOperation();
            //////////
            _importWordAdapter.ProcessOperations(configuration.PreOperations);
            var importWorkItems = (from wim in FoundWorkItems
                                   where wim.IsChecked
                                   select wim.Item).ToList();

            // search for already existing work items in word and ask whether to overide them
            if (!(source.Open(importWorkItems.Select(x => x.TfsItem.Id).ToArray()) && _importWordAdapter.Open(null)))
            {
                return;
            }

            if (importWorkItems.Select(x => x.TfsItem.Id).Intersect(_importWordAdapter.WorkItems.Select(x => x.Id)).Any())
            {
                SyncServiceTrace.W(Resources.TFSExport_ExistingWorkItems);
                if (
                    System.Windows.Forms.MessageBox.Show((IWin32Window)WordRibbon,
                                                         Resources.TFSExport_ExistingWorkItems,
                                                         Resources.MessageBox_Title,
                                                         MessageBoxButtons.YesNo,
                                                         MessageBoxIcon.Question,
                                                         MessageBoxDefaultButton.Button2, 0) == DialogResult.No)
                {
                    return;
                }
            }

            workItemSyncService.Refresh(source, _importWordAdapter, importWorkItems.Select(x => x.TfsItem), configuration);
            _importWordAdapter.ProcessOperations(configuration.PostOperations);
        }
コード例 #13
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        public void Dispose()
        {
            var service = SyncServiceFactory.GetService <IProgressService>();

            if (service != null)
            {
                service.DetachModel();
            }
        }
コード例 #14
0
        /// <summary>
        /// Helper method that catches exceptions and user information raised during publish / refresh
        /// </summary>
        private void FailOnUserInformation()
        {
            var informationStorage = SyncServiceFactory.GetService <IInfoStorageService>();
            var error = informationStorage.UserInformation.FirstOrDefault(x => x.Type == UserInformationType.Error);

            if (error != null)
            {
                Assert.Fail(error.Explanation);
            }
        }
コード例 #15
0
        /// <summary>
        /// Occurs when the background operation has completed, has been canceled, or has raised an exception.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="RunWorkerCompletedEventArgs"/> that contains the event data.</param>
        private void ImportFinished(object sender, RunWorkerCompletedEventArgs e)
        {
            e.Error.NotifyIfException("Failed to import work items.");

            IsImporting = false;
            var progressService = SyncServiceFactory.GetService <IProgressService>();

            progressService.HideProgress();

            SyncServiceTrace.I(Resources.WorkItemsAreImported);
        }
コード例 #16
0
        public static void ClassInitialize(TestContext testContext)
        {
            AIT.TFS.SyncService.Service.AssemblyInit.Instance.Init();
            AIT.TFS.SyncService.Adapter.TFS2012.AssemblyInit.Instance.Init();
            var projectCollection = TfsTeamProjectCollectionFactory.GetTeamProjectCollection(CommonConfiguration.Tfs2013ServerConfiguration(testContext).ServerName, true, false);

            testManagement = projectCollection.GetService <ITestManagementService>().GetTeamProject(CommonConfiguration.Tfs2013ServerConfiguration(testContext).ProjectName);
            var config = CommonConfiguration.GetSimpleFieldConfiguration("Requirement", Direction.OtherToTfs, FieldValueType.PlainText, "System.Title");

            testAdapter = SyncServiceFactory.CreateTfsTestAdapter(CommonConfiguration.Tfs2013ServerConfiguration(testContext).ServerName, CommonConfiguration.Tfs2013ServerConfiguration(testContext).ProjectName, config);
        }
コード例 #17
0
        /// <summary>
        /// Get the necessary services
        /// </summary>
        private void GetService()
        {
            _workItemSyncService = SyncServiceFactory.GetService <IWorkItemSyncService>();
            _configService       = SyncServiceFactory.GetService <IConfigurationService>();
            _configuration       = _configService.GetConfiguration(_wordDocument);


            _tfsService  = SyncServiceFactory.CreateTfsService(_documentModel.TfsServer, _documentModel.TfsProject, _documentModel.Configuration);
            _source      = SyncServiceFactory.CreateTfs2008WorkItemSyncAdapter(_documentModel.TfsServer, _documentModel.TfsProject, null, _configuration);
            _destination = SyncServiceFactory.CreateWord2007TableWorkItemSyncAdapter(_wordDocument, _configuration);
        }
コード例 #18
0
        /// <summary>
        /// Execute method for 'Create Report'.
        /// </summary>
        /// <param name="parameter">Parameter for command.</param>
        private void ExecuteCreateReportCommand(object parameter)
        {
            var infoStorage = SyncServiceFactory.GetService <IInfoStorageService>();

            if (infoStorage != null)
            {
                infoStorage.ClearAll();
            }

            StartBackgroundWorker(true, CreateReport);
        }
コード例 #19
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ProgressWindow"/> class.
        /// </summary>
        /// <remarks>
        /// Call this method in GUI thread.
        /// </remarks>
        public ProgressWindow()
        {
            InitializeComponent();
            var service = SyncServiceFactory.GetService <IProgressService>();

            if (service != null)
            {
                service.AttachModel(_model);
            }
            DataContext = _model;
            KeyDown    += ProgressWindow_KeyDown;
        }
コード例 #20
0
        /// <summary>
        /// Method initializes the assembly.
        /// </summary>
        public void Init()
        {
            SyncServiceFactory.RegisterService <IInfoStorageService>(new InfoStorageService());
            var confService = new ConfigurationService();

            SyncServiceFactory.RegisterService <IConfigurationService>(confService);
            SyncServiceFactory.RegisterService <IProgressService>(new ProgressService());
            var systemVariableService = new SystemVariableService();

            SyncServiceFactory.RegisterService <ISystemVariableService>(systemVariableService);
            SyncServiceFactory.RegisterService <IWorkItemSyncService>(new WorkItemSyncService(systemVariableService));
        }
コード例 #21
0
        /// <summary>
        /// Process an Operation
        /// </summary>
        private void ProcessPostOperations()
        {
            //Process Pre Operations
            // Get the necessary objects.
            var config = SyncServiceFactory.GetService <IConfigurationService>().GetConfiguration(Document);
            // Create Report helper
            var operation        = config.ConfigurationTest.GetPostOperationsForTestSpecification();
            var testReportHelper = new TestReportHelper(TestAdapter, testReportOperation, config, CancellationPending);

            testReportHelper.ProcessOperations(operation);
            testReportOperation.UndoPreparationsDocumentForLongTermOperation();
        }
コード例 #22
0
        /// <summary>
        /// This method creates a word document with the TestResultReport-Command
        /// </summary>
        public void CreateTestResultDocument(DocumentConfiguration documentConfiguration)
        {
            try
            {
                SyncServiceTrace.D(Resources.CreateTestResultDoc);
                _documentConfiguration = documentConfiguration;
                Initialize();
                var testResultSettings = _documentConfiguration.TestResultSettings;
                var testAdapter        = SyncServiceFactory.CreateTfsTestAdapter(_documentModel.TfsServer, _documentModel.TfsProject, _documentModel.Configuration);
                TestCaseSortType testCaseSortType;
                Enum.TryParse(testResultSettings.SortTestCasesBy, out testCaseSortType);
                DocumentStructureType documentStructure;
                Enum.TryParse(testResultSettings.DocumentStructure, out documentStructure);
                ConfigurationPositionType configurationPositionType;
                Enum.TryParse(testResultSettings.TestConfigurationsPosition, out configurationPositionType);
                var testPlan = testAdapter.GetTestPlans(null).Where(plan => plan.Name == testResultSettings.TestPlan).FirstOrDefault();
                if (testPlan == null)
                {
                    SyncServiceTrace.D(Resources.TestSettingsInvalidTestPlan);
                    throw new ArgumentException(Resources.TestSettingsInvalidTestPlan);
                }
                var testSuiteSearcher = new TestSuiteSearcher(testPlan);
                var testSuite         = testSuiteSearcher.SearchTestSuiteWithinTestPlan(testResultSettings.TestSuite);

                var reportModel = new TestResultReportModel(_documentModel,
                                                            testAdapter,
                                                            testPlan,
                                                            testSuite,
                                                            testResultSettings.CreateDocumentStructure,
                                                            testResultSettings.SkipLevels,
                                                            documentStructure,
                                                            testCaseSortType,
                                                            testResultSettings.IncludeTestConfigurations,
                                                            configurationPositionType,
                                                            testResultSettings.IncludeOnlyMostRecentResults,
                                                            testResultSettings.MostRecentForAllConfigurations,
                                                            testResultSettings.Build,
                                                            testResultSettings.TestConfiguration,
                                                            new TestReportingProgressCancellationService(false));

                reportModel.CreateReport();
                FinalizeDocument();
            }
            catch
            {
                if (_wordApplication != null)
                {
                    _wordApplication.Quit();
                }
                // ReSharper disable once PossibleIntendedRethrow
                throw;
            }
        }
コード例 #23
0
        private void SetRealmConnection()
        {
            syncService = SyncServiceFactory.CreateUsingSignalR(
                GetRealm,
                new Uri(hostUrl + "/Realmius" + (needAuthorisation
                            ? "?userLogin="******"&pass=" + CurrentUser.Password
                            : null)),
                TypesToSync);

            syncService.Logger = _logger;

            //InitStartData();
        }
コード例 #24
0
ファイル: ExceptionHelper.cs プロジェクト: qanh96/WordToTFS
        /// <summary>
        /// Logs an exception to file and creates an entry in the info storage service.
        /// If the exception is null, nothing is logged.
        /// </summary>
        /// <param name="exception">Exception that occurred or null.</param>
        /// <param name="title">Title of the user information entry.</param>
        public static void NotifyIfException(this Exception exception, string title)
        {
            if (exception != null)
            {
                SyncServiceTrace.LogException(exception);

                var infoStorage = SyncServiceFactory.GetService <IInfoStorageService>();
                if (infoStorage != null)
                {
                    infoStorage.NotifyError(title, exception);
                }
            }
        }
コード例 #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="PublishingStateControl"/> class.
        /// </summary>
        /// <param name="document">The document this panel is attached to.</param>
        public PublishingStateControl(Document document)
        {
            InitializeComponent();

            AttachedDocument = document;
            var syncService = SyncServiceFactory.GetService <ISyncServiceModel>();

            DocumentModel = syncService.GetModel(document);

            _storageService = SyncServiceFactory.GetService <IInfoStorageService>();
            _storageService.ClearAll();
            DataContext = this;
        }
コード例 #26
0
ファイル: MainForm.cs プロジェクト: viktortat/Realmius
        protected internal virtual IRealmiusSyncService CreateSyncService()
        {
            var clientId = clientID.Text;

            var syncService = SyncServiceFactory.CreateUsingSignalR(
                GetRealm,
                new Uri(_serverUrl + $"/Realmius?clientId={clientId}"),
                new[]
            {
                typeof(Message)
            });

            return(syncService);
        }
コード例 #27
0
        /// <summary>
        /// Execute find work items process to fill up the Find list box.
        /// </summary>
        public void FindWorkItems()
        {
            SaveQueryConfiguration();
            SyncServiceTrace.I(Resources.FindWorkItems);

            // check whether is at least one link type selected
            if (QueryConfiguration.UseLinkedWorkItems && IsCustomLinkType && QueryConfiguration.LinkTypes.Count == 0)
            {
                MessageBox.Show(Resources.WordToTFS_Error_LinkTypesNotSelected, Resources.MessageBox_Title, MessageBoxButton.OK, MessageBoxImage.Exclamation);
                return;
            }

            // parse IDs
            if (ImportOption == QueryImportOption.IDs && !ParseIDs(QueryConfiguration.ByIDs))
            {
                return;
            }

            if (ImportOption == QueryImportOption.TitleContains)
            {
                QueryConfiguration.ByTitle = ImportTitleContains;
            }

            // disable all other functionality
            if (WordRibbon != null)
            {
                WordRibbon.ResetBeforeOperation(DocumentModel);
                WordRibbon.DisableAllControls(DocumentModel);
            }

            // display progress dialog
            var progressService = SyncServiceFactory.GetService <IProgressService>();

            progressService.ShowProgress();
            progressService.NewProgress(Resources.GetWorkItems_Title);
            IsFinding = true;

            TaskScheduler scheduler = null;

            try
            {
                scheduler = TaskScheduler.FromCurrentSynchronizationContext();
            }
            catch (InvalidOperationException)
            {
                scheduler = TaskScheduler.Current;
            }

            Task.Factory.StartNew(DoFind).ContinueWith(FindFinished, scheduler);
        }
コード例 #28
0
        /// <summary>
        /// Occurs when the background operation has completed, has been canceled, or has raised an exception.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">A <see cref="RunWorkerCompletedEventArgs"/> that contains the event data.</param>
        private void ImportFinished(object sender, RunWorkerCompletedEventArgs e)
        {
            e.Error.NotifyIfException("Failed to import work items.");

            IsImporting = false;
            _importWordAdapter.UndoPreparationsDocumentForLongTermOperation();
            var progressService = SyncServiceFactory.GetService <IProgressService>();

            progressService.HideProgress();

            // enable all other functionality
            WordRibbon?.EnableAllControls(DocumentModel);
            SyncServiceTrace.I(Resources.ImportFinished);
        }
コード例 #29
0
        /// <summary>
        /// Occurs when the background operation has completed, has been canceled, or has raised an exception.
        /// </summary>
        private void FindFinished(Task task)
        {
            IsFinding = false;
            var progressService = SyncServiceFactory.GetService <IProgressService>();

            progressService.HideProgress();

            // enable all other functionality
            if (WordRibbon != null)
            {
                WordRibbon.EnableAllControls(DocumentModel);
            }

            SyncServiceTrace.I(Resources.FindFinished);
        }
コード例 #30
0
        /// <summary>
        /// Call this method to bind the active document to the TFS project.
        /// </summary>
        public void BindProject()
        {
            if (TfsDocumentBound)
            {
                return;
            }

            var tfs = SyncServiceFactory.GetService <ITeamFoundationServerMaintenance>();

            if (tfs == null)
            {
                return;
            }

            var serverUrl   = string.Empty;
            var projectName = string.Empty;

            if (!string.IsNullOrEmpty(Configuration.DefaultProjectName) && !string.IsNullOrEmpty(Configuration.DefaultServerUrl))
            {
                if (!tfs.ValidateConnectionSettings(Configuration.DefaultServerUrl, Configuration.DefaultProjectName, out serverUrl, out projectName))
                {
                    //Publish error if connection fails
                    PublishConnectionError(Resources.Error_Wrong_Connection_Short, Resources.Error_Wrong_Connection_Long);
                    return;
                }
            }
            else
            {
                try
                {
                    if (!tfs.SelectOneTfsProject(out serverUrl, out projectName))
                    {
                        return;
                    }
                }
                catch (Exception e)
                {
                    PublishConnectionError(Resources.Error_TeamPickerFailed_Short, Resources.Error_TeamPickerFailed_Long);
                    SyncServiceTrace.W(Resources.Error_TeamPickerFailed_Long);
                    SyncServiceTrace.W(e.Message);
                    return;
                }
            }

            SetDocumentVariableValue(ConstTfsBound, ConstTfsBound, null);
            SetDocumentVariableValue(ConstTfsServer, serverUrl, null);
            SetDocumentVariableValue(ConstTfsProject, projectName, null);
        }