public void Show()
        {
            if (_callback == null)
            {
                return;
            }

            if (_isClosed)
            {
                _importView = new ImportView();
                _importView.Loaded += (sender, args) =>
                {
                    _isClosed = false;
                    var importViewModel = (ImportViewModel)_importView.DataContext;
                    importViewModel.ImportTablesEvent += (o, eventArgs) => _callback(o, eventArgs);
                };

                _importView.Closed += (sender, args) => _isClosed = true;
                _importView.Show();
            }

            if (!_importView.IsVisible)
            {
                _importView.Focus();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// This function is the callback used to execute a command when the a menu item is clicked.
 /// See the Initialize method to see how the menu item is associated to this function using
 /// the OleMenuCommandService service and the MenuCommand class.
 /// </summary>
 private void MenuItemCallback(object sender, EventArgs e)
 {
     var importView = new ImportView();
     importView.Show();
     var viewModel = importView.GetViewModel();
     viewModel.ImportTablesEvent += (s, a) => ImportTablesEventCallback(s, a);
 }