Package Manager View Loader
예제 #1
0
        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;
        }
예제 #2
0
        public PackageManagerView(PackageManagerViewModel viewModel)
        {
            this.DataContext = viewModel;

            if (!Cef.IsInitialized)
            {
                var settings = new CefSettings { RemoteDebuggingPort = 8088 };
                //to fix Fickering set disable-gpu to true
                settings.CefCommandLineArgs.Add("disable-gpu", "1");
                Cef.Initialize(settings);
            }

            //viewModel.PublishPkgCommands.PublishSuccess += PackageViewModelOnPublishSuccess;

            InitializeComponent();

            viewModel.ParentWindow = this;
            //cefHelper object for Explore Packages, Explore Authors and My Packages Tab
            this.cefBrowser.RegisterJsObject("cefHelper", viewModel);
            
            //publishCefHelper for Publish Package Tab 
            //this.cefBrowser.RegisterJsObject("publishCefHelper", viewModel.PublishPkgCommands);

            viewModel.Browser = this.cefBrowser;
            //viewModel.PublishPkgCommands.Browser = this.cefBrowser;

            this.Height = (System.Windows.SystemParameters.PrimaryScreenHeight * 0.95);
            this.Width = (System.Windows.SystemParameters.PrimaryScreenWidth * 0.75);
        }