Exemple #1
0
        public ProjectForm(RootController rootControllerPass)
        {
            rc = rootControllerPass;
            m_warningText = "Are you sure you wish to delete this project?\nThis will delete all components created by this project.";
            m_warningCaption = "Delete Project"; 

            InitializeComponent();

            IDAttribute = XmlSchemaConstants.Display.Component.Id;
            NameAttribute = XmlSchemaConstants.Display.Component.Name;

            this.CancelButton = cancelButton;

            this.listView1.View = View.Details;
            this.listView1.MultiSelect = false;
            this.listView1.Columns.Add(rc.RootComponentType + "s");
            this.listView1.HideSelection = false;
            this.listView1.SelectedIndexChanged += new EventHandler(listView1_SelectedIndexChanged);
            this.listView1.DoubleClick += new EventHandler(listView1_DoubleClick);
            this.listView1.Columns[0].Width = -2;

            this.OKButton.Click += new EventHandler(OKButton_Click);
            this.cancelButton.Click += new EventHandler(cancelButton_Click);
            this.cloneButton.Click += new EventHandler(cloneButton_Click);
            this.VisibleChanged += new EventHandler(ProjectForm_VisibleChanged);
        }
        public ScoringViewComponentPanel()
        {
            myHelper = new ViewPanelHelper(this);

            InitializeComponent();

            vsgController = (VSGController)AMEManager.Instance.Get("VSG");
            projectController = (RootController)AMEManager.Instance.Get("Project");
            vsgController.RegisterForUpdate(this);

            myLinkType = vsgController.ConfigurationLinkType;

            customTreeView1.Controller = vsgController;

            customTreeView1.AddCustomTreeRoot(myLinkType);
            customTreeView1.SetCustomTreeRootXsl(myLinkType, "Scoring.xsl");

            customTreeView1.Level = 3;
            customTreeView1.ShowRoot = false;


            scorePanel = new ScorePanel();
            scorePanel.Controller = vsgController;
            
            scoringRulePanel = new ScoringRulePanel();
            scoringRulePanel.Controller = vsgController;
            
            //scenarioImages1.Controller = vsgController;
            //scenarioInfo1.Controller = vsgController;
            //customCheckedListBox1.Controller = vsgController;
        }
        public ScenarioViewComponentPanel()
        {
            myHelper = new ViewPanelHelper(this, UpdateType.Parameter);

            InitializeComponent();

            vsgController = (VSGController)AMEManager.Instance.Get("VSG");
            projectController = (RootController)AMEManager.Instance.Get("Project");
            vsgController.RegisterForUpdate(this);

            mapPlayfield1.Controller = vsgController;
            iconLibrary1.Controller = vsgController;
            scenarioInfo1.Controller = vsgController;
        }
Exemple #4
0
        private Boolean dbSetup()
        {
            SqlServerExpressSetupForm setup = new SqlServerExpressSetupForm();
            setup.ServerHost = System.Net.Dns.GetHostName() +  @"\SQLEXPRESS";
            setup.Username = "******";
            setup.Database = "vsg";
            setup.StartPosition = FormStartPosition.CenterParent;
            setup.ShowDialog(this);

            // If click OK.
            if (setup.DialogResult == DialogResult.OK)
            {
                this.Cursor = Cursors.WaitCursor;

                // Need these for the db dump
                server = setup.ServerHost;
                username = setup.Username;
                password = setup.Password;
                database = setup.Database;

                try
                {
                    AMEManager gme = AMEManager.Instance;
                    
                    AMEManager.DatabaseConfiguration dbConfiguration = new AMEManager.DatabaseConfiguration();
                    dbConfiguration.Server = setup.ServerHost;
                    dbConfiguration.Database = setup.Database;
                    dbConfiguration.Username = setup.Username;
                    dbConfiguration.Password = setup.Password;

                    gme.CreateModel(AME.AMEManager.DataModelTypes.SqlServerExpress, dbConfiguration, "vsg");
    
                    projectController = (RootController)gme.Get("Project");
                    vsgController = (VSGController)gme.Get("VSG");

                    //vsgController.ValidateAllSchemaLinks();

                    vsgController.RegisterForUpdate(this);

                    // Allow empty string as a legal value for all parameters
                    // do not return parameters that are empty string
                    projectController.IgnoreEmptyString = true;
                    vsgController.IgnoreEmptyString = true;

                    // Close any previously open projects (e.g. did someone already connect to a database?)
                    // to do...

                    // Create screens.
                    createViewComponentPanels();


                    //InitializeScenario(scenarioId);
                    return true;
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message, "DB setup failed");
                    return false;
                }
                finally
                {
                    this.Cursor = Cursors.Default;
                }
            }
            else if (setup.DialogResult == DialogResult.Cancel)
            {
                Application.Exit();
                return false;
            }
            else
            {
                return false;
            }
        }