Esempio n. 1
0
        public void AddRunnableButton_Click()
        {
            PeriodicRunnableDefenition runnable = ComponentFabric.GetInstance().CreateRunnableDefenition("Refresh");

            _componentDefenition.Runnables.Add(runnable);
            _componentDefenition.Runnables.DoSort();
            AutosarApplication.GetInstance().SyncronizeRunnables(_componentDefenition);
            RefreshPortsGridView();
            tree.UpdateAutosarTreeView(tree.SelectedItem);
        }
        public void ViewPortImage_Drop(DragEventArgs e, double worldCoordX, double worldCoordY)
        {
            object obj = e.Data.GetData(typeof(ComponentDefenition));

            if (obj is ComponentDefenition)
            {
                ComponentDefenition realDefenition = (ComponentDefenition)obj;
                int count = AutosarApplication.GetInstance().GetComponentDefenitionCount(realDefenition);
                if (realDefenition.MultipleInstantiation || ((count == 0) && (!realDefenition.MultipleInstantiation)))
                {
                    ComponentInstance compInstance = ComponentFabric.GetInstance().CreateComponent(realDefenition, worldCoordX, worldCoordY);
                    compInstance.UpdateAnchorsPositions();
                    CompositionInstance activeComposition = AutosarApplication.GetInstance().ActiveComposition;
                    activeComposition.ComponentInstances.Add(compInstance);
                }
            }
        }
Esempio n. 3
0
        /* Create new component defenition */
        private void AddComponentDefenitionButton_Click(object sender, RoutedEventArgs e)
        {
            string compDefenitionName = "ComponentDefenition";

            int index = 0;

            while (autosarApp.ComponentDefenitionsList.FindObject(compDefenitionName) != null)
            {
                index++;
                compDefenitionName = "ComponentDefenition" + index.ToString();
            }

            ComponentDefenition compDefenition = ComponentFabric.GetInstance().CreateComponentDefenition(compDefenitionName);

            autosarApp.ComponentDefenitionsList.Add(compDefenition);

            componentDefenitionViewController.ComponentDefenition = compDefenition;
            AutosarTree.UpdateAutosarTreeView(compDefenition);
            AutosarTree.Focus();
        }
        public void SyncronizeRunnablesWithDefenition()
        {
            /* Delete non existing */
            for (int i = RunableInstances.Count - 1; i >= 0; i--)
            {
                if (ComponentDefenition.Runnables.FindObject(RunableInstances[i].DefenitionGuid) == null)
                {
                    RunableInstances.RemoveAt(i);
                }
            }

            /* Add new */
            foreach (PeriodicRunnableDefenition runnableDefenition in ComponentDefenition.Runnables)
            {
                if (this.RunableInstances.FindRunnable(runnableDefenition.GUID) == null)
                {
                    /* Create new runnable instance */
                    PeriodicRunnableInstance newRunableInstance = ComponentFabric.GetInstance().CreateRunnableInstance(runnableDefenition);
                    this.RunableInstances.Add(newRunableInstance);
                }
            }
        }