Esempio n. 1
0
        public SuggestionsViewModel(SuggestionsModel model)
        {
            Model = model;
            Nodes = new ObservableCollection <SuggestionsNodeViewModel> {
            };

            //Nodes.Add(new SuggestionsNodeViewModel(model) { NodeName = "BB Data" });

            this.Model.DynamoViewModel.Model.CurrentWorkspace.NodeAdded += delegate(NodeModel nodeModel)
            {
                Nodes.Clear();
                var inputName = nodeModel.CreationName;
                if (string.IsNullOrEmpty(inputName))
                {
                    inputName = nodeModel.GetType().FullName;
                }
                string[] predictions = model.Predict(inputName);
                // Hook up with running ML module here and provide nodeModel.CreationName as input
                // Then construct a SuggestionsNodeViewModel based on that info, the panel should update automatically

                foreach (var predictedNode in predictions)
                {
                    Nodes.Add(new SuggestionsNodeViewModel(model)
                    {
                        NodeName = predictedNode.Split('@')[0]
                    });
                }
            };
        }
Esempio n. 2
0
        public void Loaded(ViewLoadedParams p)
        {
            _thesaurusMenuItem = new MenuItem {
                Header = "Thesaurus"
            };
            var dynamoViewModel = p.DynamoWindow.DataContext as DynamoViewModel;

            #region Train Menu Item

            _thesaurusTrainMenuItem = new MenuItem {
                Header = "Train"
            };
            _thesaurusTrainMenuItem.ToolTip = new ToolTip {
                Content = "Whatever description we use..."
            };
            _thesaurusTrainMenuItem.Click += (sender, args) =>
            {
                var m         = new TrainModel();
                var viewModel = new TrainViewModel(m);
                var window    = new TrainView
                {
                    DataContext = viewModel,
                    Owner       = p.DynamoWindow
                };
                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;
                window.Show();
            };
            _thesaurusMenuItem.Items.Add(_thesaurusTrainMenuItem);

            #endregion

            #region Show/Hide

            _thesaurusShowHideMenuItem = new MenuItem {
                Header = "Show/Hide"
            };
            _thesaurusShowHideMenuItem.ToolTip = new ToolTip {
                Content = "Whatever description we use..."
            };
            _thesaurusShowHideMenuItem.Click += (sender, args) =>
            {
                var m         = new SuggestionsModel(dynamoViewModel);
                var viewModel = new SuggestionsViewModel(m);
                var window    = new SuggestionsView
                {
                    DataContext = viewModel,
                    Owner       = p.DynamoWindow
                };
                window.Left = window.Owner.Left + 400;
                window.Top  = window.Owner.Top + 200;
                window.Show();
            };
            _thesaurusMenuItem.Items.Add(_thesaurusShowHideMenuItem);

            #endregion

            p.dynamoMenu.Items.Add(_thesaurusMenuItem);
        }
Esempio n. 3
0
        public SuggestionsViewModel(SuggestionsModel model)
        {
            Model         = model;
            WindowClosing = new RelayCommand(OnWindowClosing);
            Nodes         = new ObservableCollection <SuggestionsNodeViewModel>();

            Model.DynamoViewModel.Model.CurrentWorkspace.NodeAdded += OnNodeAdded;
        }
Esempio n. 4
0
        public SuggestionsNodeViewModel(SuggestionsModel model)
        {
            Model = model;

            PlaceNode = new RelayCommand(OnPlaceNode);
        }