Ejemplo n.º 1
0
        public ScriptMigration(ScriptMigrationViewModel viewModel)
        {
            InitializeComponent();

            viewModel.CloseAction = Close;

            DataContext = viewModel;
        }
Ejemplo n.º 2
0
        /// <summary>
        /// This function is the callback used to execute the command when the menu item is clicked.
        /// See the constructor to see how the menu item is associated with this function using
        /// OleMenuCommandService service and MenuCommand class.
        /// </summary>
        /// <param name="sender">Event sender.</param>
        /// <param name="e">Event args.</param>
        private void MenuItemCallback(object senderObj, EventArgs args)
        {
            if (senderObj is OleMenuCommand && args is OleMenuCmdEventArgs)
            {
                var solutionProcessor = new SolutionProcessor(_ide);
                var projects          = solutionProcessor.GetAllSolutionProjects();

                var messageBoxService = new MessageBoxService();
                var migrationService  = new MigrationService(messageBoxService);

                var viewModel = new ScriptMigrationViewModel(projects, solutionProcessor, migrationService, messageBoxService);
                var window    = new ScriptMigration(viewModel);

                messageBoxService.ShowInfoMessageFunc =
                    msg => showMessageBox(window, msg, MessageBoxImage.Information);
                messageBoxService.ShowErrorMessageFunc =
                    msg => showMessageBox(window, msg, MessageBoxImage.Error);
                messageBoxService.ShowWarningMessageFunc =
                    msg => showMessageBox(window, msg, MessageBoxImage.Warning);

                window.ShowModal();
            }
        }