public void OnPackageManagerClick() { if (view == null) { var dynamoViewModel = viewLoadedParams.DynamoWindow.DataContext as DynamoViewModel; if (dynamoViewModel == null) throw new Exception("Couldn't get DynamoViewModel"); var dynamoModel = dynamoViewModel.Model; IPackageManagerCommands packageCommands = new PackageManagerCommands(dynamoModel.GetPackageManagerExtension().PackageLoader, dynamoModel); var vm = new PackageManagerViewModel(packageCommands, "packages"); view = new PackageManagerView(vm) { Owner = viewLoadedParams.DynamoWindow, WindowStartupLocation = WindowStartupLocation.CenterOwner }; view.DataContext = vm; view.Closed += (sender, args) => view = null; view.Show(); } view.Focus(); //if (_packageManagerView.IsLoaded && IsLoaded) _packageManagerView.Owner = this; }
/// <summary> /// Constructor /// </summary> /// <param name="dynamoViewModel"></param> /// <param name="model"></param> /// <param name="address"></param> public PackageManagerViewModel(PackageLoader loader, DynamoModel model, string address) { PkgMgrCommands = new PackageManagerCommands(loader, model); var path = this.GetType().Assembly.Location; var config = ConfigurationManager.OpenExeConfiguration(path); this.Address = PACKAGE_MANAGER_URL + "/#/" + address; }