예제 #1
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();
        }
예제 #2
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();
        }
예제 #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();
        }
예제 #4
0
 private void ComponentPorts_DeleteButton_Click(object sender, RoutedEventArgs e)
 {
     componentDefenitionViewController.DeletePortButtonClick();
     AutosarTree.UpdateAutosarTreeView(null);
 }
예제 #5
0
 private void ComponentPorts_PortName_TextEdit_TextChanged(object sender, TextChangedEventArgs e)
 {
     componentDefenitionViewController.RenamePortTextEdit((sender as TextBox).Text);
     AutosarTree.UpdateAutosarTreeView(null);
 }
예제 #6
0
 private void ComplexDataType_NameTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     AutosarTree.UpdateAutosarTreeView(null);
 }
예제 #7
0
 private void SimpleDataTypeMenu_ApplyButton_Click(object sender, RoutedEventArgs e)
 {
     AutosarTree.UpdateAutosarTreeView(null);
 }
예제 #8
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);
        }
예제 #9
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);
                        }
                    }
                }
            }
        }