예제 #1
0
 public ConstraintsWindow(WpfControlsLib.Model.Model model)
 {
     this.constraintsList = new List <ConstraintItem>();
     this.model           = model;
     this.InitializeComponent();
     this.info = new RepoInfo(model.Repo, model.ModelName);
 }
예제 #2
0
        /// <summary>
        /// Initializes model selector with given data model. Models are listed by model selector only of they are
        /// sufficiently low in metalevel hierarchy (i.e. are instances of InfrastructureMetamodel).
        /// </summary>
        /// <param name="dataModel">Model with repository containing models.</param>
        public void Init(WpfControlsLib.Model.Model dataModel)
        {
            bool IsBasedOnInfrastructureMetamodel(Repo.IModel model)
            {
                var metamodel = model.Metamodel;

                while (metamodel != metamodel.Metamodel)
                {
                    if (metamodel.Name == "InfrastructureMetamodel")
                    {
                        return(true);
                    }

                    metamodel = metamodel.Metamodel;
                }

                return(false);
            }

            foreach (var currentModel in dataModel.Repo.Models)
            {
                if (IsBasedOnInfrastructureMetamodel(currentModel))
                {
                    this.ModelNames.Add(currentModel.Name);
                }
            }

            this.modelsComboBox.SelectionChanged += this.OnModelSelectionChanged;
            this.modelsComboBox.SelectedIndex     = 0;
        }
예제 #3
0
        public MainWindow()
        {
            // TODO: Fix sequential coupling here.
            this.DataContext = this;
            this.InitializeComponent();

            this.model = new WpfControlsLib.Model.Model();

            this.model.Reinit         += this.Reinit;
            this.model.FileSaved      += (_, __) => NotifyTitleChanged();
            this.model.UnsavedChanges += (_, __) => NotifyTitleChanged();

            // Notifying window first time, to initialize title.
            NotifyTitleChanged();

            this.palette.SetModel(this.model);

            this.controller = new WpfControlsLib.Controller.Controller();

            this.Closed += this.CloseChildrenWindows;

            this.scene.ElementManipulationDone += (sender, args) => this.palette.ClearSelection();
            this.scene.ElementAdded            += (sender, args) => this.modelExplorer.NewElement(args.Element);
            this.scene.ElementRemoved          += (sender, args) => this.modelExplorer.RemoveElement(args.Element);
            this.scene.NodeSelected            += (sender, args) => this.attributesView.DataContext = args.Node;
            this.scene.EdgeSelected            += (sender, args) => this.attributesView.DataContext = args.Edge;

            this.scene.Init(this.model, this.controller, new PaletteAdapter(this.palette));

            this.SelectModel("GreenhouseTestModel");
            this.testWithRobotSimulation = true;
        }
예제 #4
0
        public MainWindow()
        {
            // TODO: Fix sequential coupling here.
            this.DataContext = this;
            this.InitializeComponent();

            this.model = new WpfControlsLib.Model.Model();

            this.model.Reinit += this.Reinit;

            this.model.FileSaved      += (_, __) => NotifyTitleChanged();
            this.model.UnsavedChanges += (_, __) => NotifyTitleChanged();

            this.appConsole.Pushed += this.AppConsole_Pushed;

            // Notifying window first time, to initialize title.
            NotifyTitleChanged();

            this.palette.SetModel(this.model);

            this.controller = new WpfControlsLib.Controller.Controller();

            this.Closed += this.CloseChildrenWindows;

            this.scene.ElementManipulationDone += (sender, args) => this.palette.ClearSelection();
            this.scene.ElementAdded            += (sender, args) => this.modelExplorer.NewElement(args.Element);
            this.scene.ElementRemoved          += (sender, args) => this.modelExplorer.RemoveElement(args.Element);
            this.scene.NodeSelected            += (sender, args) => this.attributesView.DataContext = args.Node;
            this.scene.EdgeSelected            += (sender, args) => this.attributesView.DataContext = args.Edge;

            this.scene.Init(this.model, this.controller, new PaletteAdapter(this.palette));

            this.modelSelector.Init(this.model);
            this.modelSelector.ChangeModel(2);

            this.libs = new PluginLauncher <PluginConfig>();

            this.InitAndLaunchPlugins();
            this.InitToolbar();
        }
예제 #5
0
 /// <summary>
 /// Sets a model from which palette will be populated.
 /// </summary>
 /// <param name="model">A model with repository from which palette will take elements.</param>
 public void SetModel(WpfControlsLib.Model.Model model)
 => this.paletteViewModel.SetModel(model);