public MainWindow(MainWindowViewModel viewModel) { InitializeComponent(); this.viewModel = viewModel; viewModel.PropertyChanged += viewModel_PropertyChanged; cbProviders.ItemsSource = this.viewModel.Providers; }
public void Initialize() { Shell.RegisterDocumentCreator<MainWindowViewModel>(() => { var providers = IOC.Current.GetService<IEnumerable<IImitateProvider>>(); var doc = new MainWindowViewModel(Shell, providers) { ContentId = "imitater", Title = "模拟输入" }; return doc; }); var imitaterMenu = new CommandItem("imitater", "模拟", 5); imitaterMenu.Items.Add(new CommandItem("imitaterSetting", "模拟录入", 0, p => { Shell.OpenDocument(typeof(MainWindowViewModel), "imitater"); })); Shell.MainMenu.Items.Add(imitaterMenu); }