Ejemplo n.º 1
0
        public void OpenMethodFromAras(string openRequestString)
        {
            OpenMethodContext openContext = openContextParser.Parse(openRequestString);

            if (openContext == null)
            {
                return;
            }

            IMessageBoxWindow   messageBox = dialogFactory.GetMessageBoxWindow();
            MessageDialogResult result     = messageBox.ShowDialog(messageManager.GetMessage("CreateNewOrOpenExistingProject"),
                                                                   messageManager.GetMessage("ArasVSMethodPlugin"), MessageButtons.YesNo, MessageIcon.Question);

            if (result == MessageDialogResult.Yes)
            {
                projectManager.ExecuteCommand("File.NewProject");
            }
            else
            {
                projectManager.ExecuteCommand("File.OpenProject");
            }

            if (projectManager.SolutionHasProject && projectManager.IsArasProject)
            {
                Commands.OpenFromArasCmd.Instance.ExecuteCommand(this, openContext);
            }
        }
        public void SaveDirtyFiles_ShouldReturnTrue()
        {
            //Arange
            InitTestprojectStructure();
            this.mainMethodFileProjectItem.IsDirty.Returns(true);

            IVsUIShell vsUIShell = Substitute.For <IVsUIShell>();

            this.serviceProvider.GetService(typeof(SVsUIShell)).Returns(vsUIShell);

            IMessageBoxWindow messageBoxWindow = Substitute.For <IMessageBoxWindow>();

            this.dialogFactory.GetMessageBoxWindow().Returns(messageBoxWindow);
            messageBoxWindow.ShowDialog("One or more method files is not saved. Do you want to save changes?",
                                        "Aras VS method plugin",
                                        MessageButtons.YesNoCancel,
                                        MessageIcon.Question).Returns(MessageDialogResult.No);

            MethodInfo methodInfo = new MethodInfo()
            {
                MethodName     = "TestMethodName",
                PartialClasses = new List <string>(),
                ExternalItems  = new List <string>()
            };

            List <MethodInfo> methodInfos = new List <MethodInfo>();

            methodInfos.Add(methodInfo);

            //Act
            bool result = this.projectManager.SaveDirtyFiles(methodInfos);

            //Assert
            Assert.IsTrue(result);
        }
        public void SaveDirtyFiles_ShouldReturnTrue()
        {
            //Arange
            InitTestprojectStructure();
            this.mainMethodFileProjectItem.IsDirty.Returns(true);

            IVsUIShell vsUIShell = Substitute.For <IVsUIShell>();

            this.serviceProvider.GetService(typeof(SVsUIShell)).Returns(vsUIShell);

            IMessageBoxWindow messageBoxWindow = Substitute.For <IMessageBoxWindow>();

            this.dialogFactory.GetMessageBoxWindow().Returns(messageBoxWindow);
            messageBoxWindow.ShowDialog(messageManager.GetMessage("OneOrMoreMethodFilesIsNotSavedDoYouWantToSaveChanges"),
                                        messageManager.GetMessage("ArasVSMethodPlugin"),
                                        MessageButtons.YesNoCancel,
                                        MessageIcon.Question).Returns(MessageDialogResult.No);

            MethodInfo methodInfo = new MethodInfo()
            {
                MethodName = "TestMethodName"
            };

            List <MethodInfo> methodInfos = new List <MethodInfo>();

            methodInfos.Add(methodInfo);

            //Act
            bool result = this.projectManager.SaveDirtyFiles(this.dialogFactory, methodInfos);

            //Assert
            Assert.IsTrue(result);
        }
Ejemplo n.º 4
0
        public override void ExecuteCommandImpl(object sender, EventArgs args)
        {
            dynamic result = authManager.InnovatorInstance.applyAML(Properties.Resources.ImportOpenInVSActionAML);

            IMessageBoxWindow messageBox = dialogFactory.GetMessageBoxWindow();
            string            title      = messageManager.GetMessage("ArasVSMethodPlugin");

            if (result.isError())
            {
                string errorMessage = messageManager.GetMessage("OpenInVSActionImportFailed", result.getErrorString());
                messageBox.ShowDialog(errorMessage, title, MessageButtons.OK, MessageIcon.Error);
            }
            else
            {
                messageBox.ShowDialog(messageManager.GetMessage("OpenInVSActionImported"), title, MessageButtons.OK, MessageIcon.Information);
            }
        }