コード例 #1
0
        /// <summary>
        /// Disconnects an input from the output it's connected to
        /// </summary>
        /// <param name="input">An input typed DeMIMOI_InputOutput object to disconnect</param>
        public static void Unplug(DeMIMOI_InputOutput input)
        {
            // If it's an input
            if (input.Type == DeMIMOI_InputOutputType.INPUT)
            {
                // If the input is connected to something
                if (input.ConnectedTo != null)
                {
                    DeMIMOI_ConnectionEventArgs eventArg = null;

                    // Before disconnecting, pick up the current value and set it to the input (i.e. once it has been disconnected, the input keeps the last value it had before disconnection)
                    input.input_output_value = input.ConnectedTo.Value;

                    // If event signalling is required
                    if (input.Disconnected != null)
                    {
                        // Prepare the event args
                        eventArg = new DeMIMOI_ConnectionEventArgs(input.ConnectedTo, input);
                    }

                    // Disconnect it
                    input.ConnectedTo = null;
                    // Reset the IgnoreConnection so that it will be taken into account for the new connection it may have in the future
                    input.IgnoreConnection = false;

                    // If event signalling is required
                    if (input.Disconnected != null)
                    {
                        input.Disconnected(input, eventArg);
                    }
                }
            }
            else
            {
                throw new Exception("Can't unplug an output !");
            }
        }
コード例 #2
0
ファイル: DeMIMOI_Probe.cs プロジェクト: remyzerems/DeMIMOI
 void ProbeInput_Connected(object sender, DeMIMOI_ConnectionEventArgs e)
 {
     // The name is now the same than the output we want to probe
     ProbeInput.Name = e.From.Name;
 }
コード例 #3
0
 void ConstOutput_Connected(object sender, DeMIMOI_ConnectionEventArgs e)
 {
     // The name is now the same than the input we want to set to the constant
     ConstOutput.Name = e.To.Name;
 }
コード例 #4
0
ファイル: DeMIMOI_Chart.cs プロジェクト: remyzerems/DeMIMOI
        void DeMIMOI_Chart_Connected(object sender, DeMIMOI_ConnectionEventArgs e)
        {
            int seriesIndex = 0;
            // When an input is connected...
            for (int i = 0; i < Inputs.Count; i++)
            {
                for (int j = 0; j < Inputs[i].Count; j++)
                {
                    // Search the input index that has been connected
                    if (e.To == Inputs[i][j])
                    {
                        // Set the series name to the same name as the output at has been connected to
                        string series_name = e.From.Parent.Name + ".";
                        if (e.From.Name != "")
                        {
                            series_name += e.From.Name;
                        }
                        else
                        {
                            int[] indexes = DeMIMOI_InputOutput.GetInputOutputIndexes(e.From);
                            series_name += "o" + indexes[0] + "(t" + (indexes[1] == 0 ? "" : "-" + indexes[1]) + ")";
                        }

                        Chart.Series[seriesIndex].Name = series_name;
                        break;
                    }
                    seriesIndex++;
                }
            }
        }
コード例 #5
0
ファイル: DeMIMOI.cs プロジェクト: remyzerems/DeMIMOI
 void DeMIMOI_Disconnected(object sender, DeMIMOI_ConnectionEventArgs e)
 {
     // A Disconnected event occured on one of the DeMIMOI input or output
     if (Disconnected != null)
     {
         // Pass this event as a DeMIMOI event
         Disconnected(this, e);
     }
 }