public void Loaded(ViewLoadedParams p) { // Save a reference to your loaded parameters. // You'll need these later when you want to use // the supplied workspaces view = p.DynamoWindow as DynamoView; tetrisamoMenuItem = new MenuItem { Header = "Tetrisamo" }; //tetrisamoMenuItem.Icon = new System.Windows.Controls.Image //{ // Source = new BitmapImage(new Uri("pack://application:,,,/DynaThanosViewExtension;component/Resources/thanosEmoji.png")) //}; tetrisamoMenuItem.Click += (sender, args) => { var viewModel = new TetrisamoViewModel(p); var window = new TetrisamoWindow { // Set the data context for the main grid in the window. MainGrid = { DataContext = viewModel }, // Set the owner of the window to the Dynamo window. Owner = p.DynamoWindow }; window.Left = window.Owner.Left + 400; window.Top = window.Owner.Top + 200; // Show a modeless window. window.Show(); }; p.AddMenuItem(MenuBarType.View, tetrisamoMenuItem, 0); }
private void OnClosing(object sender, CancelEventArgs e) { TetrisamoViewModel.UnsubscribeNodePlaced(); }
public TetrisamoWindow() { InitializeComponent(); TetrisamoViewModel.SubscribeNodePlaced(); this.Closing += OnClosing; }