Exemplo n.º 1
0
        private void AddClientServerMenu_Click(object sender, RoutedEventArgs e)
        {
            ClientServerInterface csInterface = clientServerInterfaceController.CreateClientServerInterface();

            AutosarTree.UpdateAutosarTreeView(csInterface);
            AutosarTree.Focus();
        }
Exemplo n.º 2
0
 private void NewProject_Click(object sender, RoutedEventArgs e)
 {
     AutosarApplication.GetInstance().Clear();
     AutosarApplication.GetInstance().CreateNewProject();
     openSaveController.Clear();
     AutosarTree.UpdateAutosarTreeView();
 }
Exemplo n.º 3
0
        private void AddSenderReceiverMenu_Click(object sender, RoutedEventArgs e)
        {
            SenderReceiverInterface srInterface = senderReceiverInterfaceController.CreateSenderReceiverInterface();

            AutosarTree.UpdateAutosarTreeView(srInterface);
            AutosarTree.Focus();
        }
Exemplo n.º 4
0
        private void AddPortButton_Click(object sender, RoutedEventArgs e)
        {
            bool portHasBeenAdded = componentDefenitionViewController.AddPortButtonClick();

            if (portHasBeenAdded)
            {
                AutosarTree.UpdateAutosarTreeView(null);
            }
        }
Exemplo n.º 5
0
        private void OpenProject_Click(object sender, RoutedEventArgs e)
        {
            bool openResult = openSaveController.Open();

            if (openResult)
            {
                UpdateMainWindowTitle();
            }
            changeViewportScaleController.FitWorldToImage(ViewPortImage.ActualWidth, ViewPortImage.ActualHeight);
            AutosarTree.UpdateAutosarTreeView(null);
        }
Exemplo n.º 6
0
        public MainWindow()
        {
            InitializeComponent();
            viewPort             = new ViewPort((int)ViewPortImage.Width, (int)ViewPortImage.ActualHeight);
            ViewPortImage.Source = viewPort.WriteableBmp;
            scene = new Scene(viewPort.WriteableBmp);

            simpleDataTypeMenu = new SimpleDataTypeMenu(autosarApp,
                                                        SimpleDataTypeMenu_NameTextBox,
                                                        SimpleDataTypeMenu_DataTypeComboBox,
                                                        SimpleDataTypeMenu_MaxValueTextBox,
                                                        SimpleDataTypeMenu_MinValueTextBox,
                                                        SimpleDataTypeMenu_ApplyButton
                                                        );

            complexDataTypeMenu = new ComplexDataTypeMenu(AutosarTree, ComplexDataTypeGridView, ComplexDataType_NameTextBox);
            enumsMenu           = new EnumsMenu(AutosarTree, Enums_GridView, EnumDataType_NameEdit);
            senderReceiverInterfaceController     = new SenderReceiverInterfaceController(AutosarTree, SenderReceiver_GridView, SenderReceiver_NameTextBox);
            clientServerInterfaceController       = new ClientServerInterfaceController(AutosarTree, ClientServer_GridView, ClientServer_NameTextBox);
            componentDefenitionViewController     = new ComponentDefenitionController(AutosarTree, ComponentDefenitionName_TextBox, ComponentPorts_GridView, ComponentRunnables_GridView, MultipleInstantiation_CheckBox, AddPerInstanceDefenition_Button, PerInstanceDefenition_Grid, CDataDescription_Grid, AddCDataDescription_Button);
            connectionLineController              = new ConnectionLineController(AutosarTree);
            changeViewportScaleController         = new ChangeViewportScaleController(scene, ViewPortImage);
            addComponentInstancesController       = new AddObjectController(AutosarTree);
            SimpleDataTypeMenu_ApplyButton.Click += SimpleDataTypeMenu_ApplyButton_Click;
            componentPropertiesController         = new ComponentPropertiesController(ComponentInstanceName_TextBox, ComponentDefenitionNameTextBox, ComponentInstance_PerInstanceMemory_DataGrid, CDataInstance_DataGrid, AutosarTree);
            compositionInstanceController         = new CompositionInstanceController(AutosarTree, CompositionName_TextBox, CompositionPorts_Grid, AddPortToComposition_Button, CompositionTab);
            arrayDataController = new ArrayDataTypeController(AutosarTree, ArrayDataTypeUpdateButton, ArrayDataTypeMenu_NameTextBox, ArrayDataType_SizeTextBox);
            tabHideHelper       = new TabHiderHelper(MainTabControl);


            autosarApp.ComponentNameFont = new PortableFontDesc(isbold: true);
            autosarApp.UpdateFontAccordingScale(1);

            openSaveController = new OpenSaveController(autosarApp);

            AutosarTree.Autosar = autosarApp;
            String prevProject = SettingsProvider.GetInstance().LastProjectFileName;
            bool   loaded      = autosarApp.LoadFromFile(prevProject);

            if (!loaded)
            {
                AutosarApplication.GetInstance().Clear();
                AutosarApplication.GetInstance().CreateNewProject();
                openSaveController.Clear();
            }
            AutosarTree.UpdateAutosarTreeView(null);
            UpdateMainWindowTitle();
            tabHideHelper.ProcessTabs();
        }
Exemplo n.º 7
0
        private void AddEnumDataTypeMenu_Click(object sender, RoutedEventArgs e)
        {
            string EnumDataTypeTemplateName = "dtEnumDataType";

            if (autosarApp.Enums.FindObject(EnumDataTypeTemplateName) != null)
            {
                int index = 0;
                while (autosarApp.Enums.FindObject(EnumDataTypeTemplateName) != null)
                {
                    index++;
                    EnumDataTypeTemplateName = "dtEnumDataType" + index.ToString();
                }
            }

            EnumDataType datatype = DataTypeFabric.Instance().CreateEnumDataType(EnumDataTypeTemplateName);

            autosarApp.Enums.Add(datatype);
            AutosarTree.UpdateAutosarTreeView(datatype);
            AutosarTree.Focus();
        }
Exemplo n.º 8
0
        private void AddArrayDataTypeMenu_Click(object sender, RoutedEventArgs e)
        {
            string ArrayDataTypeTemplateName = "New_ArrayDataType";

            if (autosarApp.ArrayDataTypes.FindObject(ArrayDataTypeTemplateName) != null)
            {
                int index = 0;
                while (autosarApp.ComplexDataTypes.FindObject(ArrayDataTypeTemplateName) != null)
                {
                    index++;
                    ArrayDataTypeTemplateName = "New_ArrayDataType" + index.ToString();
                }
            }

            ArrayDataType datatype = DataTypeFabric.Instance().CreateArrayDataType(ArrayDataTypeTemplateName);

            autosarApp.ArrayDataTypes.Add(datatype);
            AutosarTree.UpdateAutosarTreeView(datatype);
            AutosarTree.Focus();
        }
Exemplo n.º 9
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();
        }
Exemplo n.º 10
0
 private void ComponentPorts_DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     componentDefenitionViewController.DeletePortButtonClick();
     AutosarTree.UpdateAutosarTreeView(null);
 }
Exemplo n.º 11
0
 private void ComponentPorts_PortName_TextEdit_TextChanged(object sender, TextChangedEventArgs e)
 {
     componentDefenitionViewController.RenamePortTextEdit((sender as TextBox).Text);
     AutosarTree.UpdateAutosarTreeView(null);
 }
Exemplo n.º 12
0
 private void ComplexDataType_NameTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     AutosarTree.UpdateAutosarTreeView(null);
 }
Exemplo n.º 13
0
 private void SimpleDataTypeMenu_ApplyButton_Click(object sender, RoutedEventArgs e)
 {
     AutosarTree.UpdateAutosarTreeView(null);
 }
Exemplo n.º 14
0
        private void Viewport_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            if (e.ClickCount == 1)
            {
                //Scale image with cursor pointer stayed on last plase
                Point currentPoint = e.GetPosition(ViewPortImage);

                //get pointed scene coordinates
                Point sceneCoordinates = scene.MouseToXY(currentPoint);

                autosarApp.UnselectComponents();

                moveObjectsController.Viewport_MouseLeftButtonDown(sceneCoordinates);
                if (moveObjectsController.SelectedObject != null)
                {
                    if (!(moveObjectsController.SelectedObject is CompositionInstance))
                    {
                        AutosarTree.UpdateAutosarTreeView(moveObjectsController.SelectedObject);
                        AutosarTree.Focus();
                    }
                }

                /* Check for creating connection line */
                connectionLineController.Viewport_MouseDown(e, sceneCoordinates);
            }
            else if (e.ClickCount == 2)
            {
                //Scale image with cursor pointer stayed on last plase
                Point currentPoint = e.GetPosition(ViewPortImage);

                //get pointed scene coordinates
                Point sceneCoordinates = scene.MouseToXY(currentPoint);

                autosarApp.UnselectComponents();

                moveObjectsController.Viewport_MouseLeftButtonDown(sceneCoordinates);
                if (moveObjectsController.SelectedObject != null)
                {
                    if (moveObjectsController.SelectedObject is CompositionInstance)
                    {
                        autosarApp.ActiveComposition = moveObjectsController.SelectedObject as CompositionInstance;

                        compositionInstanceController.Composition = autosarApp.ActiveComposition;
                        CompositionProperties_TabItem.IsEnabled   = true;
                        SelectElement(autosarApp.ActiveComposition);

                        AutosarTree.UpdateAutosarTreeView(moveObjectsController.SelectedObject);
                        AutosarTree.Focus();

                        moveObjectsController.SelectedObject = null;
                    }
                    else if (moveObjectsController.SelectedObject is ComponentInstance)
                    {
                        ComponentInstance inst = (moveObjectsController.SelectedObject as ComponentInstance);
                        componentDefenitionViewController.ComponentDefenition = inst.ComponentDefenition;
                        ComponentDefenitionTab.IsEnabled = true;
                        tabHideHelper.ProcessTabs();
                        tabHideHelper.SelectTab(ComponentDefenitionTab);
                    }
                }
            }
            Render(null, null);
        }
Exemplo n.º 15
0
        private void AutosarTree_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.Key == Key.Delete)
            {
                if (AutosarTree.SelectedItem is TreeViewItem)
                {
                    TreeViewItem selectedItem = AutosarTree.SelectedItem as TreeViewItem;

                    if (selectedItem.Tag is IGUID)
                    {
                        if (!CouldItemBeDeleted(selectedItem.Tag))
                        {
                            return;
                        }
                        bool delete = AskToDelete("Do you want to delete " + (selectedItem.Tag as IGUID).Name + "?");
                        if (delete == true)
                        {
                            if (selectedItem.Tag is ComponentInstance)
                            {
                                autosarApp.Delete(selectedItem.Tag as ComponentInstance);
                            }
                            else if (selectedItem.Tag is SimpleDataType)
                            {
                                autosarApp.Delete(selectedItem.Tag as SimpleDataType);
                            }
                            else if (selectedItem.Tag is EnumDataType)
                            {
                                autosarApp.Delete(selectedItem.Tag as EnumDataType);
                            }
                            else if (selectedItem.Tag is ComplexDataType)
                            {
                                autosarApp.Delete(selectedItem.Tag as  ComplexDataType);
                            }
                            else if (selectedItem.Tag is SenderReceiverInterface)
                            {
                                autosarApp.Delete(selectedItem.Tag as  SenderReceiverInterface);
                            }
                            else if (selectedItem.Tag is  ClientServerInterface)
                            {
                                autosarApp.Delete(selectedItem.Tag as ClientServerInterface);
                            }
                            else if (selectedItem.Tag is  CompositionInstance)
                            {
                                autosarApp.Delete(selectedItem.Tag as  CompositionInstance);
                                autosarApp.ActiveComposition = autosarApp.Compositions.GetMainComposition();
                            }
                            else if (selectedItem.Tag is  ComponentDefenition)
                            {
                                autosarApp.Delete(selectedItem.Tag as  ComponentDefenition);
                            }
                            else if (selectedItem.Tag is ArrayDataType)
                            {
                                autosarApp.Delete(selectedItem.Tag as ArrayDataType);
                            }
                            else if (selectedItem.Tag is PortConnection)
                            {
                                autosarApp.Delete(selectedItem.Tag as PortConnection);
                            }
                            AutosarTree.UpdateAutosarTreeView(null);
                        }
                    }
                }
            }
        }