/// <summary> /// Class constructor /// </summary> public DynamoController(ExecutionEnvironment env) { dynSettings.Controller = this; this.RunEnabled = true; this.CanRunDynamically = true; Bench = new dynBench(this); dynSettings.Bench = Bench; // custom node loader string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string pluginsPath = Path.Combine(directory, "definitions"); CustomNodeLoader = new CustomNodeLoader(pluginsPath); SearchViewModel = new SearchViewModel(); PackageManagerClient = new PackageManagerClient(this); PackageManagerLoginViewModel = new PackageManagerLoginViewModel(PackageManagerClient); PackageManagerPublishViewModel = new PackageManagerPublishViewModel(PackageManagerClient); FSchemeEnvironment = env; HomeSpace = CurrentSpace = new HomeWorkspace(); Bench.CurrentOffset = new Point(dynBench.CANVAS_OFFSET_X, dynBench.CANVAS_OFFSET_Y); Bench.InitializeComponent(); Bench.Log(String.Format( "Dynamo -- Build {0}.", Assembly.GetExecutingAssembly().GetName().Version)); DynamoLoader.LoadBuiltinTypes(SearchViewModel, this, Bench); DynamoLoader.LoadSamplesMenu(Bench); Bench.settings_curves.IsChecked = true; Bench.settings_curves.IsChecked = false; Bench.LockUI(); Bench.Activated += OnBenchActivated; dynSettings.Workbench = Bench.WorkBench; //run tests if (FScheme.RunTests(Bench.Log)) { if (Bench != null) Bench.Log("All Tests Passed. Core library loaded OK."); } }
public PackageManagerPublishView(PackageManagerPublishViewModel viewModel) { InitializeComponent(); this.DataContext = viewModel; }
/// <summary> /// Class constructor /// </summary> public DynamoController(ExecutionEnvironment env, bool withUI, Type viewModelType, string context) { dynSettings.Controller = this; this.Context = context; //MVVM: don't construct the main window with a reference to the controller //dynSettings.Bench = new dyndynSettings.Bench(this); //MVVM : create the view model to which the main window will bind //the DynamoModel is created therein //this.DynamoViewModel = new DynamoViewModel(this); this.DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(viewModelType,new object[]{this}); // custom node loader string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string pluginsPath = Path.Combine(directory, "definitions"); CustomNodeLoader = new CustomNodeLoader(pluginsPath); if (withUI) { dynSettings.Bench = new DynamoView(); dynSettings.Bench = dynSettings.Bench; dynSettings.Bench.DataContext = DynamoViewModel; } SearchViewModel = new SearchViewModel(); PackageManagerClient = new PackageManagerClient(this); PackageManagerLoginViewModel = new PackageManagerLoginViewModel(PackageManagerClient); PackageManagerPublishViewModel = new PackageManagerPublishViewModel(PackageManagerClient); FSchemeEnvironment = env; //MVVM : moved to proper view constructor on dyndynSettings.Bench //DynamoViewModel.Model.CurrentSpace.CurrentOffset = new Point(DynamoView.CANVAS_OFFSET_X, DynamoView.CANVAS_OFFSET_Y); DynamoViewModel.Model.CurrentSpace.X = DynamoView.CANVAS_OFFSET_X; DynamoViewModel.Model.CurrentSpace.Y = DynamoView.CANVAS_OFFSET_Y; //dynSettings.Bench.CurrentOffset = new Point(dyndynSettings.Bench.CANVAS_OFFSET_X, dyndynSettings.Bench.CANVAS_OFFSET_Y); //dynSettings.Bench.InitializeComponent(); dynSettings.Controller.DynamoViewModel.Log(String.Format( "Dynamo -- Build {0}.", Assembly.GetExecutingAssembly().GetName().Version)); //MVVM : removed parameter dynSettings.Bench DynamoLoader.LoadBuiltinTypes(SearchViewModel, this);//, dynSettings.Bench); if(dynSettings.Bench != null) DynamoLoader.LoadSamplesMenu(dynSettings.Bench); //dynSettings.Bench.settings_curves.IsChecked = true; //dynSettings.Bench.settings_curves.IsChecked = false; if (dynSettings.Bench != null) { //dynSettings.Bench.LockUI(); //MVVM : callback has been restructured so that it sends a command back to the view model //dynSettings.Bench.Activated += OndynSettings.BenchActivated; //MVVM: we've gone to using a model and a model view of a workspace //do not reference a specific workdynSettings.Bench here. //dynSettings.WorkdynSettings.Bench = dynSettings.Bench.WorkdynSettings.Bench; } //run tests if (FScheme.RunTests(dynSettings.Controller.DynamoViewModel.Log)) { if (dynSettings.Bench != null) this.DynamoViewModel.Log("All Tests Passed. Core library loaded OK."); } }
/// <summary> /// Class constructor /// </summary> public DynamoController(ExecutionEnvironment env, Type viewModelType, string context) { dynSettings.Controller = this; this.Context = context; //create the view model to which the main window will bind //the DynamoModel is created therein this.DynamoViewModel = (DynamoViewModel)Activator.CreateInstance(viewModelType,new object[]{this}); // custom node loader string directory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string pluginsPath = Path.Combine(directory, "definitions"); CustomNodeLoader = new CustomNodeLoader(pluginsPath); SearchViewModel = new SearchViewModel(); PackageManagerClient = new PackageManagerClient(this); PackageManagerLoginViewModel = new PackageManagerLoginViewModel(PackageManagerClient); PackageManagerPublishViewModel = new PackageManagerPublishViewModel(PackageManagerClient); FSchemeEnvironment = env; DynamoViewModel.Model.CurrentSpace.X = DynamoView.CANVAS_OFFSET_X; DynamoViewModel.Model.CurrentSpace.Y = DynamoView.CANVAS_OFFSET_Y; dynSettings.Controller.DynamoViewModel.Log(String.Format( "Dynamo -- Build {0}", Assembly.GetExecutingAssembly().GetName().Version)); DynamoLoader.LoadBuiltinTypes(SearchViewModel, this); //run tests if (FScheme.RunTests(dynSettings.Controller.DynamoViewModel.Log)) { dynSettings.Controller.DynamoViewModel.Log("All Tests Passed. Core library loaded OK."); } NodeSubmittedForRendering += new EventHandler(Controller_NodeSubmittedForRendering); NodeRemovedFromRendering += new EventHandler(Controller_NodeRemovedFromRendering); }