Exemple #1
0
        internal MoveToNamespaceDialog(MoveToNamespaceDialogViewModel viewModel) : base()
        {
            _viewModel = viewModel;

            // Set focus to first tab control when the window is loaded
            Loaded += (s, e) => MoveFocus(new TraversalRequest(FocusNavigationDirection.Next));

            InitializeComponent();
            DataContext = viewModel;
        }
        public MoveToNamespaceOptionsResult GetChangeNamespaceOptions(
            string defaultNamespace,
            ImmutableArray<string> availableNamespaces,
            ISyntaxFactsService syntaxFactsService)
        {
            var viewModel = new MoveToNamespaceDialogViewModel(
                defaultNamespace,
                availableNamespaces,
                syntaxFactsService);

            var dialog = new MoveToNamespaceDialog(viewModel);
            var result = dialog.ShowModal();

            if (result == true)
            {
                return new MoveToNamespaceOptionsResult(viewModel.NamespaceName);
            }
            else
            {
                return MoveToNamespaceOptionsResult.Cancelled;
            }
        }
        public MoveToNamespaceOptionsResult GetChangeNamespaceOptions(
            string defaultNamespace,
            ImmutableArray <string> availableNamespaces,
            ISyntaxFacts syntaxFactsService)
        {
            var viewModel = new MoveToNamespaceDialogViewModel(
                defaultNamespace,
                availableNamespaces,
                syntaxFactsService,
                History.WhereNotNull().ToImmutableArray());

            var result = _showDialog(viewModel);

            if (result == true)
            {
                OnSelected(viewModel.NamespaceName);
                return(new MoveToNamespaceOptionsResult(viewModel.NamespaceName));
            }
            else
            {
                return(MoveToNamespaceOptionsResult.Cancelled);
            }
        }