示例#1
0
        public void RenderScene()
        {
            _context.Clear();

            /* Draw components */
            if (AutosarApplication.GetInstance().ActiveComposition != null)
            {
                /* Draw another compositions in main composition */
                if (AutosarApplication.GetInstance().ActiveComposition == AutosarApplication.GetInstance().Compositions.GetMainComposition())
                {
                    /* Draw another compositions */
                    foreach (CompositionInstance composition in AutosarApplication.GetInstance().Compositions)
                    {
                        if (composition != AutosarApplication.GetInstance().Compositions.GetMainComposition())
                        {
                            composition.Render(_context);
                        }
                    }
                }

                /* Render composition entrails */
                if (AutosarApplication.GetInstance().ActiveComposition != null)
                {
                    AutosarApplication.GetInstance().ActiveComposition.RenderCompositionEntrails(_context);
                }
            }
        }
 public static AutosarApplication GetInstance()
 {
     if (app == null)
     {
         app = new AutosarApplication();
     }
     return(app);
 }
 public void RefreshComplexDatatypeGridView()
 {
     if (allowUpdater.IsUpdateAllowed)
     {
         AutosarApplication.GetInstance().SyncronizePerInstanceMemory(null, true);
     }
     grid.ItemsSource = null;
     grid.ItemsSource = datatype.Fields;
 }
        public void RenameComplexFieldNameTextEdit(TextBox textbox)
        {
            int index = grid.SelectedIndex;

            if ((index < grid.Items.Count) && (index >= 0))
            {
                datatype.Fields[index].Name = textbox.Text;
                AutosarApplication.GetInstance().SyncronizePerInstanceMemory(null, true);
            }
        }
        public void ChangeDatatypeButtonClick()
        {
            List <IGUID> datatypes = AutosarApplication.GetInstance().GetAllDataTypes(this.datatype.Name);

            System.Windows.Forms.DialogResult result = DatatypeForm.GetInstance().ShowForm(datatypes, datatype.DataTypeGUID);
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                datatype.DataTypeGUID        = DatatypeForm.GetInstance().SelectedDatatype.GUID;
                updateDataTypeButton.Content = datatype.DataTypeName;
            }
        }
        public void ChangeDatatypeButtonClick()
        {
            int index = grid.SelectedIndex;

            List <IGUID> datatypes = AutosarApplication.GetInstance().GetAllDataTypes(this.datatype.Name);

            System.Windows.Forms.DialogResult result = DatatypeForm.GetInstance().ShowForm(datatypes, datatype.Fields[index].DataTypeGUID);
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                datatype.Fields[index].DataTypeGUID = DatatypeForm.GetInstance().SelectedDatatype.GUID;
                RefreshComplexDatatypeGridView();
            }
        }
 void nameTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     if (allowUpdater.IsUpdateAllowed)
     {
         String newName = (sender as TextBox).Text;
         if (NameUtils.CheckComponentName(newName))
         {
             datatype.Name = newName;
             AutosarApplication.GetInstance().SyncronizePerInstanceMemory(null, true);
             autosarTree.UpdateAutosarTreeView(null);
         }
     }
 }
示例#8
0
        public BaseDataType GetBaseDataType()
        {
            IGUID baseGuidObj = AutosarApplication.GetInstance().GetDataType(BaseDataTypeGUID);

            if (baseGuidObj != null)
            {
                return((BaseDataType)baseGuidObj);
            }
            else
            {
                return(null);
            }
        }
示例#9
0
		public SimpleDataTypeMenu(AutosarApplication autosarApp, TextBox nameTextBox, ComboBox baseDataTypeComboBox, 
            TextBox maxValueTextBox, TextBox minValueTextBox, Button applyButton)
        {
            this.autosarApp = autosarApp;
            this.nameTextBox = nameTextBox;
            this.baseDataTypeComboBox = baseDataTypeComboBox;
            this.maxValueTextBox = maxValueTextBox;
            this.minValueTextBox = minValueTextBox;
            applyButton.Click +=applyButton_Click;
            

            baseDataTypeComboBox.SelectedIndex = 0;
		}
示例#10
0
        public void UpdateName()
        {
            String name = "NoName";

            if (Port1 != null)
            {
                name = AutosarApplication.GetInstance().FindComponentInstanceByPort(Port1).Name + "_" + Port1.PortDefenition.Name;
            }
            if (Port2 != null)
            {
                name += "_" + AutosarApplication.GetInstance().FindComponentInstanceByPort(Port2).Name + "_" + Port2.PortDefenition.Name;
            }
            this.Name = name;
        }
示例#11
0
        public void AddConnection(PortConnection newConnection)
        {
            /* Connection cann't be dublicated */
            bool foundSimilarConnection = false;

            foreach (PortConnection connection in this)
            {
                if (connection.Component1.GUID.Equals(newConnection.Component1.GUID) && connection.Port1.GUID.Equals(newConnection.Port1.GUID) &&
                    connection.Component2.GUID.Equals(newConnection.Component2.GUID) && connection.Port2.GUID.Equals(newConnection.Port2.GUID))
                {
                    foundSimilarConnection = true;
                    break;
                }

                if (connection.Component1.GUID.Equals(newConnection.Component2.GUID) && connection.Port1.GUID.Equals(newConnection.Port2.GUID) &&
                    connection.Component2.GUID.Equals(newConnection.Component1.GUID) && connection.Port2.GUID.Equals(newConnection.Port1.GUID))
                {
                    foundSimilarConnection = true;
                    break;
                }
            }

            if (foundSimilarConnection)
            {
                return;
            }

            /* Client and Receiver connections can't have more than one connection */
            PortDefenition portDef1 = AutosarApplication.GetInstance().GetPortDefenition(newConnection.Port1.PortDefenitionGuid);


            if (!newConnection.Port1.IsDelegatePort) /* Port of component */
            {
                if ((portDef1.PortType == PortType.Client) || (portDef1.PortType == PortType.Receiver))
                {
                    if (IsThisPointConnectionExists(newConnection.Component1, newConnection.Port1) == true)
                    {
                        return;
                    }
                }
            }
            else /* Port of composition */
            {
                if ((portDef1.PortType == PortType.Sender) || (portDef1.PortType == PortType.Server))
                {
                    if (IsThisPointConnectionExists(newConnection.Component1, newConnection.Port1) == true)
                    {
                        return;
                    }
                }
            }

            PortDefenition portDef2 = AutosarApplication.GetInstance().GetPortDefenition(newConnection.Port2.PortDefenitionGuid);

            if (!newConnection.Port2.IsDelegatePort) /* Port of component */
            {
                if ((portDef2.PortType == PortType.Client) || (portDef2.PortType == PortType.Receiver))
                {
                    if (IsThisPointConnectionExists(newConnection.Component2, newConnection.Port2) == true)
                    {
                        return;
                    }
                }
            }
            else /* Port of composition */
            {
                if ((portDef2.PortType == PortType.Sender) || (portDef2.PortType == PortType.Server))
                {
                    if (IsThisPointConnectionExists(newConnection.Component2, newConnection.Port2) == true)
                    {
                        return;
                    }
                }
            }


            this.Add(newConnection);
        }