public MainWindow() { _viewModel = new MainViewModel(); DataContext = _viewModel; InitializeComponent(); DocumentsPane.ToggleAutoHide(); LoadWindowLayout(); LoadDockLayout(); }
public MainWindow() { Loaded += OnLoaded; var container = new ContainerConfiguration() .WithAssembly(typeof(MainViewModelBase).Assembly) // RoslynPad.Common.UI .WithAssembly(typeof(MainWindow).Assembly); // RoslynPad var locator = container.CreateContainer().GetExport <IServiceProvider>(); _viewModel = locator.GetService <MainViewModelBase>(); _dispatcher = locator.GetService <IAppDispatcher>(); DataContext = _viewModel; InitializeComponent(); DocumentsPane.ToggleAutoHide(); }
internal MainWindow() { var container = new ContainerConfiguration() .WithAssembly(typeof(MainViewModel).Assembly) // RoslynPad.Common.UI .WithAssembly(typeof(MainWindow).Assembly); // RoslynPad var locator = container.CreateContainer().GetExport <IServiceLocator>(); _viewModel = locator.GetInstance <MainViewModel>(); _viewModel.Initialize(); DataContext = _viewModel; InitializeComponent(); DocumentsPane.ToggleAutoHide(); LoadWindowLayout(); LoadDockLayout(); }
#pragma warning disable CS8618 // Non-nullable field is uninitialized. internal MainWindow() #pragma warning restore CS8618 // Non-nullable field is uninitialized. { Loaded += OnLoaded; var container = new ContainerConfiguration() .WithAssembly(typeof(MainViewModelBase).Assembly) // RoslynPad.Common.UI .WithAssembly(typeof(MainWindow).Assembly); // RoslynPad var locator = container.CreateContainer().GetExport <IServiceProvider>(); _viewModel = locator.GetService <MainViewModelBase>(); DataContext = _viewModel; InitializeComponent(); DocumentsPane.ToggleAutoHide(); LoadWindowLayout(); LoadDockLayout(); }
public MainWindow() { Loaded += OnLoaded; var services = new ServiceCollection(); services.AddLogging(l => l.AddSimpleConsole().AddDebug()); var container = new ContainerConfiguration() .WithProvider(new ServiceCollectionExportDescriptorProvider(services)) .WithAssembly(typeof(MainViewModelBase).Assembly) // RoslynPad.Common.UI .WithAssembly(typeof(MainWindow).Assembly); // RoslynPad var locator = container.CreateContainer().GetExport <IServiceProvider>(); _viewModel = locator.GetRequiredService <MainViewModelBase>(); DataContext = _viewModel; InitializeComponent(); DocumentsPane.ToggleAutoHide(); LoadWindowLayout(); LoadDockLayout(); }
private void DoTransform() { try { if (_preferences.SaveOnTransform) { SourcePane.SaveFile("Sources"); TransformPane.SaveFile("Transforms"); DocumentsPane.SaveFile("Documents"); IncludesPane.SaveFile("Includes"); } var source = SourcePane.JsonContent; var transform = TransformPane.JsonContent; if (string.IsNullOrWhiteSpace(source)) { MessageBox.Show("Load or enter in a source document", "JTranEdit", MessageBoxButton.OK, MessageBoxImage.Error); return; } if (string.IsNullOrWhiteSpace(transform)) { MessageBox.Show("Load or enter in a transform", "JTranEdit", MessageBoxButton.OK, MessageBoxImage.Error); return; } var transformer = new Transformer(_preferences); var result = transformer.Transform(source, transform); OutputPane.JsonContent = result; } catch (Exception ex) { MessageBox.Show(ex.Message, "JTranEdit", MessageBoxButton.OK, MessageBoxImage.Error); } }