コード例 #1
0
ファイル: DebugServerFrame.cs プロジェクト: jwnichls/puc
        protected void OpenSpec(string filename)
        {
            ReadSpecFromFile(filename);

            TextReader read = new StringReader(_specification);

            _appliance = new Appliance(_debugConnection);
            Globals.AddFrameMapping(_appliance, this);

            try
            {
                PUC.Parsers.SpecParser.Parse(read, _appliance);

                _debugConnection.MessageReceivedEvent    += new Connection.MessageReceivedHandler(_appliance.MessageReceived);
                _debugConnection.ConnectionRegainedEvent += new Connection.ConnectionRegainedHandler(_appliance.ConnectionRegained);
                this.AddConnection(_debugConnection);

                _appliance.SetUIGenerator(new PUC.UIGeneration.UIGenerator(_rulePhases,
                                                                           _smartCIOManager,
                                                                           _widgetRegistry));

                _appliance.GetUIGenerator().Size     = this.ClientSize;
                _appliance.GetUIGenerator().Location = new System.Drawing.Point(0, 0);

                _appliance.GetUIGenerator().GenerateUI(_appliance);

                this.Controls.Add(_appliance.GetUIGenerator());

                this.Text = _appliance.Name;
                this.Name = _appliance.Name;

                saveItem.Enabled      = true;
                restoreItem.Enabled   = true;
                undefineItem.Enabled  = true;
                sendAlertItem.Enabled = true;

                HideLogPanel();
            }
            catch (Exception)
            {
                _appliance = null;
                ShowLogPanel();
            }
        }