Example #1
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();
        }