Ejemplo n.º 1
0
        /// <summary>
        ///     Creates a new central control panel using a given core
        /// </summary>
        public ControlPanel(StreamlineCore core)
        {
            Core = core;
            InitializeComponent();

            // Don't show debug if not a dev
            if (!Core.Settings.DebugMode)
            {
                debugToolStripMenuItem.Dispose();
            }

            // Hide the components until something is selected
            BlockViewer.Hide();
            IOBlockViewer.Hide();

            // Set up the block editor
            BlockSchematic.SetCore(Core);
            BlockSchematic.OnBlockSelected += DetermineViewingComponent;
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Determines which block viewer should be shown for the user
        /// </summary>
        private void DetermineViewingComponent(object owner, IConnectable c)
        {
            var dc = c as DataConnection;

            if (dc != null)
            {
                // Treat as Data Connection
                BlockViewer.SetViewingComponent(null);
                IOBlockViewer.SetViewingComponent(dc);
                IOBlockViewer.UpdateAllComponents();
                BlockViewer.Hide();
                IOBlockViewer.Show();
            }
            else
            {
                // Treat as generic block
                BlockViewer.SetViewingComponent(c);
                IOBlockViewer.SetViewingComponent(null);
                BlockViewer.Show();
                IOBlockViewer.Hide();
            }
        }