예제 #1
0
        public ObserverForm(MainForm mainForm, MyAbstractObserver observer, MyNode declaredOwner)
        {
            InitializeComponent();
            m_mainForm = mainForm;

            Observer = observer;
            observer.TriggerReset();

            Text = MyProject.ShortenNodeTypeName(observer.GetType()) + ": " + observer.GetTargetName(declaredOwner);
        }
예제 #2
0
        public ObserverForm(MainForm mainForm, MyAbstractObserver observer, MyNode declaredOwner)
        {
            InitializeComponent();
            m_mainForm = mainForm;

            Observer = observer;
            observer.TriggerReset();

            Text = MyProject.ShortenNodeTypeName(observer.GetType()) + ": " + observer.GetTargetName(declaredOwner);
        }
예제 #3
0
        private void UpdateTitleAndButtons()
        {
            if (HasMultipleTargets)
            {
                nodeNameTextBox.Rtf = @"{\rtf1\ansi \b " + Targets?.Length + @" \b0 nodes selected.}";
            }
            else if (Target is MyNode)
            {
                MyNode node = Target as MyNode;
                nodeNameTextBox.Rtf = @"{\rtf1\ansi \b " + node.Name + @"\b0  - " + node.GetType().Name + "}";
            }
            else if (Target is MyAbstractObserver)
            {
                MyAbstractObserver observer = Target as MyAbstractObserver;
                nodeNameTextBox.Rtf = @"{\rtf1\ansi \b " + observer.TargetIdentifier + @"\b0  - " + observer.GetType().Name + "}";

                snapshotButton.Checked = observer.AutosaveSnapshop;
            }
            else
            {
                nodeNameTextBox.Rtf = "";
            }

            CanEdit = m_mainForm.SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED;

            // TODO(Premek): Allow help for multiple nodes of the same type.
            helpButton.Enabled = !HasMultipleTargets && (Target is MyWorkingNode || Target is MyAbstractObserver);

            snapshotButton.Enabled = !HasMultipleTargets && (Target is MyAbstractObserver);

            // TODO(Premek): Allow to set SaveOnStop / LoadOnStart for multiple nodes.
            var workingNode   = !HasMultipleTargets ? (Target as MyWorkingNode) : null;
            var isWorkingNode = (workingNode != null);

            saveNodeDataButton.Enabled = isWorkingNode;
            saveNodeDataButton.Checked = workingNode?.SaveOnStop ?? false;

            loadNodeDataButton.Enabled = isWorkingNode;
            loadNodeDataButton.Checked = workingNode?.LoadOnStart ?? false;

            clearDataButton.Enabled = isWorkingNode;

            dashboardButton.Enabled = !HasMultipleTargets && (Target is MyNode);
        }
예제 #4
0
        private void UpdateTitleAndButtons()
        {
            if (Target is MyNode)
            {
                MyNode node = Target as MyNode;
                nodeNameTextBox.Rtf = @"{\rtf1\ansi \b " + node.Name + @"\b0  - " + node.GetType().Name + "}";
            }
            else if (Target is MyAbstractObserver)
            {
                MyAbstractObserver observer = Target as MyAbstractObserver;
                nodeNameTextBox.Rtf = @"{\rtf1\ansi \b " + observer.TargetIdentifier + @"\b0  - " + observer.GetType().Name + "}";

                snapshotButton.Checked = observer.AutosaveSnapshop;
            }
            else
            {
                nodeNameTextBox.Rtf = "";
            }

            CanEdit            = m_mainForm.SimulationHandler.State == MySimulationHandler.SimulationState.STOPPED;
            helpButton.Enabled = Target is MyWorkingNode || Target is MyAbstractObserver;

            snapshotButton.Enabled = Target is MyAbstractObserver;

            if (Target is MyWorkingNode)
            {
                saveNodeDataButton.Enabled = true;
                saveNodeDataButton.Checked = (Target as MyWorkingNode).SaveOnStop;

                loadNodeDataButton.Enabled = true;
                loadNodeDataButton.Checked = (Target as MyWorkingNode).LoadOnStart;

                clearDataButton.Enabled = true;
            }
            else
            {
                saveNodeDataButton.Enabled = false;
                saveNodeDataButton.Checked = false;

                loadNodeDataButton.Enabled = false;
                loadNodeDataButton.Checked = false;

                clearDataButton.Enabled = false;
            }
        }