Esempio n. 1
0
        /// <summary>
        /// Executes the <see cref="OpenSelectIterationsCommand"/> command
        /// </summary>
        private void ExecuteOpenSelectIterationsCommand()
        {
            var dialogService           = ServiceLocator.Current.GetInstance <IDialogNavigationService>();
            var modelSelectionViewModel = new ModelOpeningDialogViewModel(this.OpenSessions);

            dialogService.NavigateModal(modelSelectionViewModel);
        }
Esempio n. 2
0
 /// <summary>
 /// Opens the Model Selection Dialog
 /// </summary>
 private void OpenModelDialog()
 {
     var sessionsOpening = new List <ISession> {
         this.session
     };
     var modelOpeningDialogViewModel       = new ModelOpeningDialogViewModel(sessionsOpening, null);
     var modelOpeningDialogViewModelResult = this.DialogNavigationService.NavigateModal(modelOpeningDialogViewModel) as DataSourceSelectionResult;
 }
Esempio n. 3
0
        public void VerifyThatCanPreselectSession()
        {
            var sessions = new List <ISession> {
                this.session.Object, this.session2.Object
            };

            var viewmodel = new ModelOpeningDialogViewModel(sessions, this.session2.Object);

            Assert.AreEqual("session2", viewmodel.SelectedRowSession.Session.DataSourceUri);
        }
Esempio n. 4
0
        /// <summary>
        /// Open an <see cref="Iteration"/> of an <see cref="EngineeringModel"/>
        /// </summary>
        private async void OpenIterationInEngineeringModel()
        {
            var sessions = new List <ISession> {
                this.Session
            };

            var viewmodel = new ModelOpeningDialogViewModel(sessions);

            this.DialogNavigationService.NavigateModal(viewmodel);
        }
        public void VerifyThatSelectedItemCanOnlyContainIterationRow()
        {
            var sessions = new List <ISession> {
                this.session.Object
            };
            var viewmodel = new ModelOpeningDialogViewModel(sessions);

            viewmodel.SelectedIterations.Add(new ModelSelectionEngineeringModelSetupRowViewModel(this.model1, this.session.Object));

            Assert.AreEqual(0, viewmodel.SelectedIterations.Count);
        }
        public void VerifyThatExecuteCancelWork()
        {
            var sessions = new List <ISession> {
                this.session.Object
            };
            var viewmodel = new ModelOpeningDialogViewModel(sessions);

            viewmodel.SelectedIterations.Add(new ModelSelectionIterationSetupRowViewModel(this.iteration11, this.participant, this.session.Object));

            viewmodel.CancelCommand.Execute(null);

            var res = viewmodel.DialogResult;

            Assert.IsNotNull(res);
            Assert.IsFalse(res.Result.Value);
            this.session.Verify(x => x.Read(It.IsAny <Iteration>(), It.IsAny <DomainOfExpertise>()), Times.Never);
        }
Esempio n. 7
0
        /// <summary>
        /// Invokes the action as a result of a ribbon control being clicked, selected, etc.
        /// </summary>
        /// <param name="ribbonControlId">
        /// The Id property of the associated RibbonControl
        /// </param>
        /// <param name="ribbonControlTag">
        /// The Tag property of the associated RibbonControl
        /// </param>
        public override async Task OnAction(string ribbonControlId, string ribbonControlTag = "")
        {
            switch (ribbonControlId)
            {
            case "CDP4_Open":
                var dataSelection       = new DataSourceSelectionViewModel(this.DialogNavigationService);
                var dataSelectionResult = this.DialogNavigationService.NavigateModal(dataSelection) as DataSourceSelectionResult;
                break;

            case "CDP4_Close":
                await this.session.Close();

                break;

            case "CDP4_ProxySettings":
                var proxyServerViewModel       = new ProxyServerViewModel();
                var proxyServerViewModelResult = this.DialogNavigationService.NavigateModal(proxyServerViewModel) as DataSourceSelectionResult;
                break;

            case "CDP4_SelectModelToOpen":
                var sessionsOpening = new List <ISession> {
                    this.session
                };
                var modelOpeningDialogViewModel       = new ModelOpeningDialogViewModel(sessionsOpening);
                var modelOpeningDialogViewModelResult = this.DialogNavigationService.NavigateModal(modelOpeningDialogViewModel) as DataSourceSelectionResult;
                break;

            case "CDP4_SelectModelToClose":
                var sessionsClosing = new List <ISession> {
                    this.session
                };
                var modelClosingDialogViewModel       = new ModelClosingDialogViewModel(sessionsClosing);
                var modelClosingDialogViewModelResult = this.DialogNavigationService.NavigateModal(modelClosingDialogViewModel) as DataSourceSelectionResult;
                break;

            case "CDP4_Plugins":
                var modelPluginDialogViewModel = new PluginManagerViewModel <AddinAppSettings>(this.appSettingService);
                var modelPluginDialogResult    = this.DialogNavigationService.NavigateModal(modelPluginDialogViewModel) as DataSourceSelectionResult;
                break;

            default:
                logger.Debug("The ribbon control with Id {0} and Tag {1} is not handled by the current RibbonPart", ribbonControlId, ribbonControlTag);
                break;
            }
        }
Esempio n. 8
0
        public void VerifyThatErrorAreCaught()
        {
            var sessions = new List <ISession> {
                this.session.Object
            };

            this.session.Setup(x => x.Read(It.IsAny <Iteration>(), It.IsAny <DomainOfExpertise>(), It.IsAny <bool>())).Throws(new Exception("test"));

            var viewmodel = new ModelOpeningDialogViewModel(sessions, null);

            viewmodel.SelectedIterations.Add(new ModelSelectionIterationSetupRowViewModel(this.iteration11, this.participant, this.session.Object));

            viewmodel.SelectCommand.Execute(null);
            this.session.Verify(x => x.Read(It.IsAny <Iteration>(), It.IsAny <DomainOfExpertise>(), It.IsAny <bool>()));

            Assert.IsTrue(viewmodel.HasError);
            Assert.AreEqual("test", viewmodel.ErrorMessage);
        }
        public void VerifyThatModelOpeningDialogReturnResult()
        {
            var sessions = new List <ISession> {
                this.session.Object
            };

            var viewmodel = new ModelOpeningDialogViewModel(sessions);

            viewmodel.SelectedIterations.Add(new ModelSelectionIterationSetupRowViewModel(this.iteration11, this.participant, this.session.Object));
            Assert.AreEqual("Iteration Selection", viewmodel.DialogTitle);
            viewmodel.SelectCommand.Execute(null);

            var res = viewmodel.DialogResult;

            Assert.IsNotNull(res);
            Assert.IsTrue(res.Result.Value);

            this.session.Verify(x => x.Read(It.IsAny <Iteration>(), It.IsAny <DomainOfExpertise>()));
        }
Esempio n. 10
0
        /// <summary>
        /// Executes the <see cref="OpenSelectIterationsCommand"/> command
        /// </summary>
        private void ExecuteOpenSelectIterationsCommand(ISession session)
        {
            var modelSelectionViewModel = new ModelOpeningDialogViewModel(this.OpenSessions, session);

            this.dialogNavigationService.NavigateModal(modelSelectionViewModel);
        }