示例#1
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FShortcut.PinIsChanged)
            {
                FDestination.SliceCount = SpreadMax;

                string curSource;
                for (int i = 0; i < SpreadMax; i++)
                {
                    FShortcut.GetString(i, out curSource);
                    try
                    {
                        IWshShell    wsh         = new WshShellClass();
                        IWshShortcut curShortcut = (IWshShortcut)wsh.CreateShortcut(curSource);

                        FDestination.SetString(i, curShortcut.TargetPath);
                        FWorkingDir.SetString(i, curShortcut.WorkingDirectory);
                        FIcon.SetString(i, curShortcut.IconLocation);
                    }
                    catch
                    {
                        FHost.Log(TLogType.Error, "couldn't resolve shortcut " + curSource);
                        FDestination.SetString(i, string.Empty);
                        FWorkingDir.SetString(i, string.Empty);
                        FIcon.SetString(i, string.Empty);
                    }
                }
            }
        }
示例#2
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs

            if (FSkeletonInput.PinIsChanged)
            {
                if (FSkeletonInput.IsConnected)
                {
                    object currInterface;
                    FSkeletonInput.GetUpstreamInterface(out currInterface);
                    inputSkeleton = (Skeleton)currInterface;
                }
                else
                {
                    inputSkeleton = null;
                }
            }

            if (FSkeletonInput.PinIsChanged || FJointNameInput.PinIsChanged)
            {
                if (inputSkeleton != null)
                {
                    string jointName;
                    IJoint currJoint;
                    FParentNameOutput.SliceCount         = FJointNameInput.SliceCount;
                    FBaseTransformOutput.SliceCount      = FJointNameInput.SliceCount;
                    FAnimationTransformOutput.SliceCount = FJointNameInput.SliceCount;
                    for (int i = 0; i < FJointNameInput.SliceCount; i++)
                    {
                        FJointNameInput.GetString(i, out jointName);
                        if (inputSkeleton.JointTable.ContainsKey(jointName))
                        {
                            currJoint = (IJoint)inputSkeleton.JointTable[jointName];
                            if (currJoint.Parent != null)
                            {
                                FParentNameOutput.SetString(i, currJoint.Parent.Name);
                            }
                            else
                            {
                                FParentNameOutput.SetString(i, "");
                            }

                            FJointIdOutput.SetValue(i, currJoint.Id);
                            FBaseTransformOutput.SetMatrix(i, VMath.Rotate(currJoint.Rotation) * currJoint.BaseTransform);
                            FAnimationTransformOutput.SetMatrix(i, currJoint.AnimationTransform);
                        }
                        else
                        {
                            FJointIdOutput.SetValue(i, -1);
                            FBaseTransformOutput.SetMatrix(i, VMath.IdentityMatrix);
                            FAnimationTransformOutput.SetMatrix(i, VMath.IdentityMatrix);
                        }
                    }
                }
            }
        }
示例#3
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //compute only on refresh
            if (FRefresh.PinIsChanged)
            {
                //Audio
                List <string> laudioOut  = new List <string>();
                string[]      audioNames = new string[6] {
                    "Description", "Name",
                    "Version", "Manufacturer",
                    "System", "Status"
                };
                laudioOut.AddRange(GetManagementClassProperties("Win32_CodecFile", audioNames, new string[2] {
                    "Group", "Audio"
                }));
                FAudio.SliceCount = laudioOut.Count;
                for (int i = 0; i < laudioOut.Count; i++)
                {
                    FAudio.SetString(i, laudioOut[i]);
                }

                //video
                List <string> lvideoOut = new List <string>();
                lvideoOut.AddRange(GetManagementClassProperties("Win32_CodecFile", audioNames, new string[2] {
                    "Group", "Video"
                }));
                FVideo.SliceCount = lvideoOut.Count;
                for (int i = 0; i < lvideoOut.Count; i++)
                {
                    FVideo.SetString(i, lvideoOut[i]);
                }
            }
        }
示例#4
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //compute only on refresh
            if (FRefresh.PinIsChanged)
            {
                System.Windows.Forms.Screen [] screens = System.Windows.Forms.Screen.AllScreens;

                //set slicecount
                FResolutionOutput.SliceCount       = screens.Length;
                FResolutionOffsetOutput.SliceCount = screens.Length;
                FWorkAreaOutput.SliceCount         = screens.Length;
                FWorkAreaOffsetOutput.SliceCount   = screens.Length;
                FBitsPerPixel.SliceCount           = screens.Length;
                FDeviceName.SliceCount             = screens.Length;
                FIsPrimary.SliceCount = screens.Length;

                //loop for all slices
                for (int i = 0; i <= screens.GetUpperBound(0); i++)
                {
                    //write data to outputs
                    FResolutionOutput.SetValue2D(i, screens[i].Bounds.Width, screens[i].Bounds.Height);
                    FResolutionOffsetOutput.SetValue2D(i, screens[i].Bounds.Left, screens[i].Bounds.Top);
                    FWorkAreaOutput.SetValue2D(i, screens[i].WorkingArea.Width, screens[i].WorkingArea.Height);
                    FWorkAreaOffsetOutput.SetValue2D(i, screens[i].WorkingArea.Left, screens[i].WorkingArea.Top);
                    FBitsPerPixel.SetValue(i, (double)screens[i].BitsPerPixel);
                    FDeviceName.SetString(i, screens[i].DeviceName);
                    FIsPrimary.SetValue(i, (double)screens[i].Primary.GetHashCode());
                }
            }
        }
示例#5
0
        public override void Evaluate(double CurrentTime)
        {
            base.Evaluate(CurrentTime);

            if (CurrentState == null)
            {
                return;
            }

            FCurrentStateOut.SetString(0, CurrentState.Name);

            var stateCount = (FOutputSlices[0] as TLAutomataSlice).KeyFrames.Count - 1;

            FStateTimes.SliceCount = stateCount;
            for (int i = 0; i < (FOutputSlices[0] as TLAutomataSlice).KeyFrames.Count - 1; i++)
            {
                FStateTimes.SetValue(i, (FOutputSlices[0] as TLAutomataSlice).KeyFrames[i].Time);
            }

            FStates.SliceCount = stateCount;
            for (int i = 0; i < (FOutputSlices[0] as TLAutomataSlice).KeyFrames.Count - 1; i++)
            {
                FStates.SetString(i, ((FOutputSlices[0] as TLAutomataSlice).KeyFrames[i] as TLStateKeyFrame).Name);
            }
        }
示例#6
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            FCurrentDate.SliceCount = SpreadMax;
            FUTC.SliceCount         = SpreadMax;

            for (int i = 0; i < SpreadMax; i++)
            {
                if (FUpdate.PinIsChanged)
                {
                    FUpdate.GetValue(i, out FUpdateSlice);
                }

                DateTime CurrentDate = System.DateTime.Now;
                DateTime CurrentUTC  = System.DateTime.UtcNow;

                try
                {
                    if (FUpdateSlice > 0.5 || FFormate.PinIsChanged || FCulturInfo.PinIsChanged)
                    {
                        string currentFormatSlice;
                        string currentCultureInfo;
                        string currentDate = "";
                        string currentUTC  = "";

                        FFormate.GetString(i, out currentFormatSlice);
                        FCulturInfo.GetString(i, out currentCultureInfo);

                        if (currentFormatSlice != null && currentCultureInfo != null)
                        {
                            CultureInfo culture = new CultureInfo(currentCultureInfo);
                            currentDate = CurrentDate.ToString(currentFormatSlice, culture);
                            currentUTC  = CurrentUTC.ToString(currentFormatSlice, culture);
                        }
                        else if (currentFormatSlice != null)
                        {
                            currentDate = CurrentDate.ToString(currentFormatSlice);
                            currentUTC  = CurrentUTC.ToString(currentFormatSlice);
                        }
                        else if (currentCultureInfo != null)
                        {
                            CultureInfo culture = new CultureInfo(currentCultureInfo);
                            currentDate = CurrentDate.ToString(culture);
                            currentUTC  = CurrentUTC.ToString(culture);
                        }
                        else
                        {
                            currentDate = CurrentDate.ToString();
                            currentUTC  = CurrentUTC.ToString();
                        }

                        FCurrentDate.SetString(i, currentDate);
                        FUTC.SetString(i, currentUTC);
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, ex.Message);
                }
            }
        }
示例#7
0
 private void SetMessage(string Message)
 {
     FMessage.SetString(0, Message);
     if (Message != "Please Update")
     {
         FHost.Log(TLogType.Debug, Message);
     }
 }
示例#8
0
        public override void Evaluate(double CurrentTime)
        {
            base.Evaluate(CurrentTime);

            for (int i = 0; i < FOutputSlices.Count; i++)
            {
                FStringOut.SetString(i, (FOutputSlices[i] as TLStringSlice).Output);
            }
        }
示例#9
0
 public override void Flush()
 {
     if (IsChanged)
     {
         FStringOut.SliceCount = Length;
         for (int i = 0; i < Length; i++)
         {
             FStringOut.SetString(i, this[i]);
         }
     }
     base.Flush();
 }
示例#10
0
 public override void Flush(bool force = false)
 {
     if (force || IsChanged)
     {
         FStringOut.SliceCount = Length;
         for (int i = 0; i < Length; i++)
         {
             FStringOut.SetString(i, this[i]);
         }
     }
     base.Flush(force);
 }
示例#11
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable;

            FEnable.GetValue(0, out Enable);
            //if any of the inputs has changed
            //recompute the outputs
            if (FEnable.PinIsChanged)
            {
                if (Enable == 1)
                {
                    m_PhidgetManager.Enable();
                }
                else
                {
                    m_PhidgetManager.Disable();
                }
            }

            if (Enable == 1 || FEnable.PinIsChanged)
            {
                int SliceCount = m_PhidgetManager.Devices.Count;
                FLibraryVersion.SliceCount = 1;
                FLibraryVersion.SetString(0, m_PhidgetManager.LibaryVersion);

                FDevice.SliceCount  = SliceCount;
                FSerial.SliceCount  = SliceCount;
                FVersion.SliceCount = SliceCount;

                for (int i = 0; i <= SliceCount; i++)
                {
                    FDevice.SetString(i, m_PhidgetManager.Devices.ToArray()[i].Name);
                    FSerial.SetValue(i, m_PhidgetManager.Devices.ToArray()[i].SerialNumber);
                    FVersion.SetValue(i, m_PhidgetManager.Devices.ToArray()[i].Version);
                }
            }
            else if (Enable == 0 || FEnable.PinIsChanged)
            {
                //int SliceCount = 1;
                //FDevice.SliceCount = SliceCount;
                //FSerial.SliceCount = SliceCount;
                //FVersion.SliceCount = SliceCount;

                //FDevice.SetString(0, "");
                //FSerial.SetValue(0, -1);
                //FVersion.SetValue(0, -1);
            }
            else
            {
            }
        }
示例#12
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable = 0;

            FSerial.GetValue(0, out m_Serial);
            FEnable.GetValue(0, out Enable);


            if (FEnable.PinIsChanged || FSerial.PinIsChanged)
            {
                if (Enable == 1)
                {
                    m_CTouchData.Enable(m_Serial);
                }
                else
                {
                    m_CTouchData.Close();
                }
            }

            if (true)
            {
                FPress.SliceCount    = 1;
                FPosition.SliceCount = 1;

                FPosition.SetValue(0, m_CTouchData.Position);


                if (FSensitivity.PinIsChanged)
                {
                    double Sense;
                    FSensitivity.GetValue(0, out Sense);
                    m_CTouchData.SetSense(Sense);
                }

                for (int i = 0; i < m_CTouchData.Press.Length; i++)
                {
                    FPress.SliceCount = m_CTouchData.Press.Length;
                    FPress.SetValue(i, m_CTouchData.Press[i]);
                }

                FInfo.SliceCount = m_CTouchData.Info.Length;
                for (int i = 0; i < m_CTouchData.Info.Length; i++)
                {
                    FInfo.SetString(i, m_CTouchData.Info[i]);
                }
            }
        }
示例#13
0
        private void UpdateInfos()
        {
            string info;

            int ver = uEye.GetDLLVersion();

            info = String.Format("uEye SDK Version: {0}.{1}.{2}", (ver >> 24), (ver >> 16 & 0xff), (ver & 0xffff));

            int nrOfCameras = 0;

            uEye.GetNumberOfCameras(ref nrOfCameras);
            info += "\n" + String.Format("Connected cameras: {0}", nrOfCameras);

            // camera infos
            if (FuEyeCam.IsOpen())
            {
                // Sensorinfo
                uEye.SENSORINFO sensorInfo = new uEye.SENSORINFO();
                FuEyeCam.GetSensorInfo(ref sensorInfo);
                info += "\n" + "Sensor: " + sensorInfo.strSensorName;

                // Camerainfo
                uEye.CAMINFO cameraInfo = new uEye.CAMINFO();
                FuEyeCam.GetCameraInfo(ref cameraInfo);
                info += "\n" + "CameraInfo:";
                info += "\n" + "   SerNo: " + cameraInfo.SerNo;
                info += "\n" + "   Date: " + cameraInfo.Date;
                info += "\n" + "   Version: " + cameraInfo.Version;
                info += "\n" + String.Format("   Camera ID: {0}", cameraInfo.id);

                // Memory board query
                if (FuEyeCam.IsMemoryBoardConnected())
                {
                    info += "\n" + "Memoryboard connected";
                }
                else
                {
                    info += "\n" + "No Memoryboard connected";
                }
            }
            FInfoPin.SetString(0, info);
        }
示例#14
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FMyValueInputA.PinIsChanged || FMyValueInputB.PinIsChanged || FMyValueInputC.PinIsChanged || FMyValueInputD.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FMyStringOutput.SliceCount = FMyValueInputA.SliceCount * FMyValueInputB.SliceCount * FMyValueInputC.SliceCount * FMyValueInputD.SliceCount;

                //the variables to fill with the input data
                double currentValueSliceA, currentValueSliceB, currentValueSliceC, currentValueSliceD;
                int    index = 0;

                //loop for all slices
                for (int i = 0; i < FMyValueInputA.SliceCount; i++)
                {
                    //read data from inputs
                    FMyValueInputA.GetValue(i, out currentValueSliceA);

                    for (int j = 0; j < FMyValueInputB.SliceCount; j++)
                    {
                        FMyValueInputB.GetValue(j, out currentValueSliceB);

                        for (int k = 0; k < FMyValueInputC.SliceCount; k++)
                        {
                            FMyValueInputC.GetValue(k, out currentValueSliceC);

                            for (int l = 0; l < FMyValueInputD.SliceCount; l++)
                            {
                                FMyValueInputD.GetValue(l, out currentValueSliceD);

                                //write data to outputs
                                FMyStringOutput.SetString(index, Convert.ToString(currentValueSliceA) + "." + Convert.ToString(currentValueSliceB) + "." + Convert.ToString(currentValueSliceC) + "." + Convert.ToString(currentValueSliceD));
                                index++;
                            }
                        }
                    }
                }
            }
        }
        //called when data for any output pin is requested
        public void Evaluate(int SpreadMax)
        {
            if (FSkeletonInput.PinIsChanged)
            {
                if (FSkeletonInput.IsConnected)
                {
                    object currInterface;
                    FSkeletonInput.GetUpstreamInterface(out currInterface);
                    FSkeleton = (Skeleton)currInterface;
                }
                else
                {
                    FSkeleton = null;
                }
            }

            if (FSkeletonInput.PinIsChanged)
            {
                if (FSkeleton != null)
                {
                    int      key_count = FSkeleton.JointTable.Keys.Count;
                    string[] key_list  = new string[key_count];
                    FSkeleton.JointTable.Keys.CopyTo(key_list, 0);
                    FJointNameOutput.SliceCount  = key_count;
                    FParentNameOutput.SliceCount = key_count;
                    for (int i = 0; i < key_count; i++)
                    {
                        FJointNameOutput.SetString(i, key_list[i]);
                        IJoint joint = null;
                        FSkeleton.JointTable.TryGetValue(key_list[i], out joint);
                        string pname = "";
                        if (joint != null && joint.Parent != null)
                        {
                            pname = joint.Parent.Name;
                        }
                        FParentNameOutput.SetString(i, pname);
                    }
                }
            }
        }
示例#16
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //first set slicecounts for all outputs
            //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
            FBatteryStateOut.SliceCount = 1;
            FPowerStateOut.SliceCount   = 1;
            FPowerMessage.SliceCount    = 1;

            int    currentValueSlice  = 0;
            string currentStringSlice = "hallo";
            string batteryStatus      = "nix los hier";

            //function
            PowerStatus power = SystemInformation.PowerStatus;

            currentValueSlice = (int)(power.BatteryLifePercent * 100);
            batteryStatus     = power.BatteryChargeStatus.ToString();

            switch (power.PowerLineStatus)
            {
            case PowerLineStatus.Online:
                currentStringSlice = "Main";
                break;

            case PowerLineStatus.Offline:
                currentStringSlice = "Battery";
                break;

            case PowerLineStatus.Unknown:
                Console.WriteLine("Unknown");
                break;
            }

            //write data to outputs
            FBatteryStateOut.SetValue(0, currentValueSlice);
            FPowerStateOut.SetString(0, currentStringSlice);
            FPowerMessage.SetString(0, batteryStatus);
        }
示例#17
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable;
            double Serial;

            //FConnected.SliceCount = 1;

            FSerial.GetValue(0, out Serial);
            FEnable.GetValue(0, out Enable);

            try
            {
                if (FSerial.PinIsChanged || FEnable.PinIsChanged)
                {
                    if (FSerial.PinIsChanged)
                    {
                        if (m_IKitData != null)
                        {
                            m_IKitData.Close();
                            m_IKitData = null;
                        }
                    }

                    if (Enable > 0.5)
                    {
                        if (m_IKitData == null)
                        {
                            m_IKitData = new GetEncoderHSData();
                            m_IKitData.Open(Serial);
                        }
                    }
                    else
                    {
                        if (m_IKitData != null)
                        {
                            FInfo.SliceCount = 1;
                            FInfo.SetString(0, "Disabled");
                            m_IKitData.Close();
                            m_IKitData = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FHost.Log(TLogType.Error, "Error by initialising Phidget");
                FHost.Log(TLogType.Error, ex.Message.ToString());
            }



            if (Enable == 1 && m_IKitData.Attached)
            {
                //

                int SliceCountAnalogIn = m_IKitData.InfoDevice.ToArray()[0].EncoderInputs;
                try
                {
                    try
                    {
                        //getting Encoder Position
                        if (m_IKitData.InfoDevice.ToArray()[0].EncoderInputs != 0)
                        {
                            FPositionOut.SliceCount = SliceCountAnalogIn;
                            for (int i = 0; i < SliceCountAnalogIn; i++)
                            {
                                FPositionOut.SetValue(i, m_IKitData.EncoderInputs[i]);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in " + m_IKitData.InfoDevice.ToArray()[0].Name + " getting encoder Position");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }


                    try
                    {
                        // set Position
                        if (FSetPosition.PinIsChanged)
                        {
                            double setPosition;
                            FSetPosition.GetValue(0, out setPosition);

                            if (setPosition > 0.5)
                            {
                                double   SliceCountSense = FPositionIn.SliceCount;
                                double[] tPosition       = new double[SliceCountAnalogIn];
                                for (int i = 0; i < SliceCountAnalogIn; i++)
                                {
                                    double sense;
                                    FPositionIn.GetValue(i, out sense);
                                    tPosition[i] = sense;
                                }
                                m_IKitData.SetPosition(tPosition);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting encoder Position");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }


                    //setting Phidget Infos
                    try
                    {
                        int SpreadSizeInfo = 3;
                        for (int i = 0; i < SpreadSizeInfo; i++)
                        {
                            FInfo.SliceCount = 3;
                            switch (i)
                            {
                            case 0:
                                FInfo.SetString(i, "Name: " + m_IKitData.InfoDevice.ToArray()[0].Name);
                                break;

                            case 1:
                                FInfo.SetString(i, "Serial: " + m_IKitData.InfoDevice.ToArray()[0].SerialNumber.ToString());
                                break;

                            case 2:
                                FInfo.SetString(i, "Version: " + m_IKitData.InfoDevice.ToArray()[0].Version.ToString());
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting Phidget Infos");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name);
                    FHost.Log(TLogType.Error, ex.Message.ToString());
                }
            }
        }
示例#18
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            try
            {
                int maxSlice = 0;
                foreach (IStringIn p in FInList)
                {
                    if (p.PinIsChanged)
                    {
                        evaluate = true;
                    }
                    maxSlice = Math.Max(maxSlice, p.SliceCount);
                }

                if (evaluate || FPrepend.PinIsChanged)
                {
                    evaluate = false;
                    string root;
                    FHost.GetHostPath(out root);
                    root = Path.GetDirectoryName(root);

                    double tmpPrepend;
                    FPrepend.GetValue(0, out tmpPrepend);
                    bool prepend = tmpPrepend > 0.5;

                    FOutput.SliceCount = maxSlice;
                    for (int s = 0; s < maxSlice; s++)
                    {
                        string builder;
                        FInList[0].GetString(s, out builder);
                        if (string.IsNullOrEmpty(builder))
                        {
                            builder = "";
                        }
                        bool isRooted = Path.IsPathRooted(builder);
                        if (!isRooted)
                        {
                            builder = Path.Combine(root, builder);
                        }

                        string curPath;
                        for (int i = 1; i < FInList.Count; i++)
                        {
                            FInList[i].GetString(s, out curPath);
                            if (string.IsNullOrEmpty(curPath))
                            {
                                curPath = "";
                            }
                            builder = Path.Combine(builder, curPath);
                        }

                        builder = Path.GetFullPath(builder);                      // combines c:\foo\bar + ..\fighters -> c:\foo\figthers
                        if (!(isRooted || prepend))                               // but Path.GetFullPath needs a rooted path.
                        {
                            builder = builder.Replace(root + "\\", string.Empty); //want it relative, subtract root again
                        }
                        FOutput.SetString(s, builder);
                    }
                }
            }
            catch (Exception e)
            {
                FHost.Log(TLogType.Debug, e.Message);
                FHost.Log(TLogType.Debug, e.StackTrace);
            }
        }
示例#19
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double pinInputEnable, pinInputDigitizing;

            FPinInputEnable.GetValue(0, out pinInputEnable);
            FPinInputDigitizing.GetValue(0, out pinInputDigitizing);
            if (FPinInputEnable.PinIsChanged)
            {
                if (pinInputEnable == 1d)
                {
                    Enable();
                }
                else
                {
                    Disable();
                }
            }
            if (Tablet == null)
            {
                return;
            }
            if (FPinInputDigitizing.PinIsChanged)
            {
                digitizing = (pinInputDigitizing == 1d);
                if (pinInputEnable == 1d)
                {
                    Disable();
                }
                Disconnect();
                Connect();
                if (pinInputEnable == 1d)
                {
                    Enable();
                }
            }
            if ((pinInputEnable == 1d))
            {
                FPinOutputProximity.SetValue(0, InContext ? 1 : 0);
                FPinOutputX.SetValue(0, X);
                FPinOutputY.SetValue(0, Y);
                FPinOutputPressure.SetValue(0, NormalPressure);
                FPinOutputCursor.SetValue(0, CursorNum);
                FPinOutputSerialNo.SetValue(0, SerialNo);
                FPinOutputCursorType.SetValue(0, CursorType);
                FPinOutputCursorSubtype.SetValue(0, CursorSubtype);
                FPinOutputButtons.SliceCount = NumButtons;
                for (int i = 0; i < NumButtons; i++)
                {
                    FPinOutputButtons.SetValue(i, ((Buttons & (1 << i)) != 0) ? 1 : 0);
                }
                FPinOutputAzimuth.SetValue(0, Azimuth);
                FPinOutputTilt.SetValue(0, Tilt);
                if (FPinDebugButtons != null)
                {
                    FPinDebugButtons.SetValue(0, NumButtons);
                }
                FPinOutputDimensions.SliceCount = 2;
                FPinOutputDimensions.SetValue(0, Tablet.Context.InputExtentX);
                FPinOutputDimensions.SetValue(1, Tablet.Context.InputExtentY);
                FPinOutputCursorName.SetString(0, CursorName);
            }
        }
示例#20
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //compute only on refresh
            if (FRefresh.PinIsChanged)
            {
                //alldevices
                List <string> lallOut  = new List <string>();
                string[]      allNames = new string[9] {
                    "DeviceID", "Name",
                    "Description", "Manufacturer",
                    "Service", "ConfigManagerErrorCode", "Availability", "Status", "StatusInfo"
                };
                lallOut.AddRange(GetManagementClassProperties("Win32_PnPEntity", allNames));
                FDevice.SliceCount = lallOut.Count;
                for (int i = 0; i < lallOut.Count; i++)
                {
                    FDevice.SetString(i, lallOut[i]);
                }


                //MB
                List <string> lmbOut  = new List <string>();
                string[]      bbNames = new string[5] {
                    "Manufacturer", "Product", "Model",
                    "Version", "SerialNumber"
                };
                lmbOut.AddRange(GetManagementClassProperties("Win32_BaseBoard", bbNames));

                string[] mbNames = new string[3] {
                    "PrimaryBusType", "SecondaryBusType", "Status"
                };
                List <string> mb = new List <string>();
                mb.AddRange(GetManagementClassProperties("Win32_MotherboardDevice", mbNames));
                for (int i = 0; i < mb.Count; i++)
                {
                    lmbOut[i % lmbOut.Count] += Environment.NewLine + mb[i];
                }

                FMB.SliceCount = lmbOut.Count;
                for (int i = 0; i < lmbOut.Count; i++)
                {
                    FMB.SetString(i, lmbOut[i]);
                }


                //CPU
                List <string> lcpuOut  = new List <string>();
                string[]      cpuNames = new string[8] {
                    "DeviceID", "Name",
                    "Description", "AddressWidth",
                    "L2CacheSize", "L3CacheSize",
                    "Availability", "CpuStatus"
                };
                lcpuOut.AddRange(GetManagementClassProperties("Win32_Processor", cpuNames));
                FCPU.SliceCount = lcpuOut.Count;
                for (int i = 0; i < lcpuOut.Count; i++)
                {
                    FCPU.SetString(i, lcpuOut[i]);
                }


                //RAM
                List <string> lramOut  = new List <string>();
                string[]      ramNames = new string[7] {
                    "DeviceLocator", "Name",
                    "DataWidth", "Capacity",
                    "FormFactor", "MemoryType",
                    "Status"
                };
                lramOut.AddRange(GetManagementClassProperties("Win32_PhysicalMemory", ramNames));
                FRAM.SliceCount = lramOut.Count;
                for (int i = 0; i < lramOut.Count; i++)
                {
                    FRAM.SetString(i, lramOut[i]);
                }

                //HDD
                List <string> lhddOut  = new List <string>();
                string[]      hddNames = new string[9] {
                    "DeviceID", "Model",
                    "InterfaceType", "Size", "Partitions",
                    "MediaLoaded", "MediaType",
                    "Availability", "Status"
                };
                lhddOut.AddRange(GetManagementClassProperties("Win32_DiskDrive", hddNames));
                FHDD.SliceCount = lhddOut.Count;
                for (int i = 0; i < lhddOut.Count; i++)
                {
                    FHDD.SetString(i, lhddOut[i]);
                }

                //USB
                List <string> lusbOut  = new List <string>();
                string[]      usbNames = new string[4] {
                    "DeviceID", "Name",
                    "ProtocolSupported", "Status"
                };
                lusbOut.AddRange(GetManagementClassProperties("Win32_USBController", usbNames));
                FUSB.SliceCount = lusbOut.Count;
                for (int i = 0; i < lusbOut.Count; i++)
                {
                    FUSB.SetString(i, lusbOut[i]);
                }


                //firewire
                List <string> lfwOut  = new List <string>();
                string[]      fwNames = new string[4] {
                    "DeviceID", "Name",
                    "ProtocolSupported", "Status"
                };
                lfwOut.AddRange(GetManagementClassProperties("Win32_1394Controller", fwNames));
                FFirewire.SliceCount = lfwOut.Count;
                for (int i = 0; i < lfwOut.Count; i++)
                {
                    FFirewire.SetString(i, lfwOut[i]);
                }


                //audio
                List <string> laudioOut  = new List <string>();
                string[]      audioNames = new string[6] {
                    "DeviceID", "Name",
                    "Manufacturer", "ProductName",
                    "Status", "ConfigManagerErrorCode"
                };
                laudioOut.AddRange(GetManagementClassProperties("Win32_SoundDevice", audioNames));
                FAudio.SliceCount = laudioOut.Count;
                for (int i = 0; i < laudioOut.Count; i++)
                {
                    FAudio.SetString(i, laudioOut[i]);
                }

                //video
                List <string> lvideoOut  = new List <string>();
                string[]      videoNames = new string[9] {
                    "DeviceID", "Name",
                    "AdapterCompatibility", "VideoProcessor", "AdapterRAM",
                    "InfFilename", "InstalledDisplayDrivers", "Availability", "Status"
                };
                lvideoOut.AddRange(GetManagementClassProperties("Win32_VideoController", videoNames));
                FVideo.SliceCount = lvideoOut.Count;
                for (int i = 0; i < lvideoOut.Count; i++)
                {
                    FVideo.SetString(i, lvideoOut[i]);
                }


                //test
//              List<string> ltestOut = new List<string>();
//              ltestOut.AddRange(GetManagementClassProperties("Win32_PhysicalMedia"));
//              FTest.SliceCount=ltestOut.Count;
//              for (int i=0; i<ltestOut.Count; i++)
//                  FTest.SetString(i, ltestOut[i]);
            }
        }
示例#21
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            bool doUpdate = false;

            if (FUpdate.PinIsChanged)
            {
                double curUpdate;
                FUpdate.GetValue(0, out curUpdate);
                if (curUpdate == 1)
                {
                    doUpdate = true;
                }
            }

            //if any of the inputs has changed
            //recompute the outputs
            if (FFilename.PinIsChanged ||
                FIndex.PinIsChanged ||
                FCount.PinIsChanged ||
                doUpdate ||
                FLineWiseChanged ||
                FAnsiUtfChanged)
            {
                doUpdate         = false;
                FLineWiseChanged = false;
                FAnsiUtfChanged  = false;

                //outSliceCount
                FContent.SliceCount = SpreadMax;

                //the variables to fill with the input data
                string curFilename;
                int    curIndex, curCount;

                Encoding enc = Encoding.GetEncoding(1252);
                if (FAnsiUtfTog != 0)
                {
                    enc = Encoding.UTF8;
                }

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FFilename.GetString(i, out curFilename);

                    double tmpIndex, tmpCount;
                    FIndex.GetValue(i, out tmpIndex);
                    FCount.GetValue(i, out tmpCount);
                    curIndex = (int)Math.Floor(tmpIndex);
                    curCount = (int)Math.Floor(tmpCount);

                    string outString = string.Empty;

                    if (File.Exists(curFilename))
                    {
                        if (FLineWiseTog == 1)
                        {
                            string[] allLines = File.ReadAllLines(curFilename, enc);
                            int      maxlen   = Math.Min(allLines.Length, curIndex + curCount);
                            for (int j = curIndex; j < maxlen; j++)
                            {
                                outString += allLines[j];
                                if (j != maxlen - 1)
                                {
                                    outString += Environment.NewLine;
                                }
                            }
                        }
                        else
                        {
                            TextReader curFile = new StreamReader(curFilename, enc);
                            for (int j = 0; j < curIndex + curCount; j++)
                            {
                                int v = curFile.Read();
                                if (v == -1)
                                {
                                    break;
                                }
                                else if (j >= curIndex)
                                {
                                    outString += (char)v;
                                }
                            }
                            curFile.Close();
                        }
                    }

                    //write data to outputs
                    FContent.SetString(i, outString);
                }
            }
        }
示例#22
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if the slice count has changed
            if (SpreadMax != FSpreadMax)
            {
                int nClients = TClients.Count;
                //we need a TcpClient instance for every slice
                if (SpreadMax > nClients)
                {
                    for (int i = 0; i < SpreadMax - nClients; i++)
                    {
                        TV4TcpClient newClient = new TV4TcpClient();
                        TClients.Add(newClient);
                    }
                }
                else if (SpreadMax < nClients)
                {
                    //if we have connected TcpClients for extra slices that have been removed, we need to disconnect them
                    for (int i = SpreadMax; i < TClients.Count; i++)
                    {
                        TClients[i].Close(true);
                        //TClients[i] = new TV4TcpClient();
                    }
                }
            }
            //store the slice count so we can check next frame if it has changed
            FSpreadMax = SpreadMax;

            bool anyInputsChanged = FInputStringInput.PinIsChanged || FEnableValueInput.PinIsChanged || FDoSendValueInput.PinIsChanged ||
                                    FRemoteHostStringInput.PinIsChanged || FRemotePortValueInput.PinIsChanged || FHoldOutputInput.PinIsChanged ||
                                    FReceiveBufferSizeInput.PinIsChanged || FReceiveTimeoutInput.PinIsChanged ||
                                    FSendBufferSizeInput.PinIsChanged || FSendTimeoutInput.PinIsChanged;

            //if any of the inputs has changed
            if (anyInputsChanged)
            {
                //set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FOutputStringOutput.SliceCount   = SpreadMax;
                FConnectedValueOutput.SliceCount = SpreadMax;
                FReceivedNewData.SliceCount      = SpreadMax;

                int requiredBufferSize = 1;

                //read and process the new input values
                for (int i = 0; i < SpreadMax; i++)
                {
                    ProcessInputsSlice(i);
                    //keep track of the largest network buffer size on all of the slices
                    if (TClients[i].ReceiveBufferSize > requiredBufferSize)
                    {
                        requiredBufferSize = TClients[i].ReceiveBufferSize;
                    }
                }
            }


            //since we are always listening for TCP traffic, we have work to do even if none of the inputs have changed
            for (int i = 0; i < SpreadMax; i++)
            {
                try
                {
                    TV4TcpClient tcpClientSlice = TClients[i];
                    FReceivedNewData.SetValue(i, 0);

                    //if the connection is enabled
                    if (tcpClientSlice.FEnabled)
                    {
                        //if the connection hasn't been made yet, try to connect asynchronously
                        if (tcpClientSlice.ConnectStatus == TConnectStatus.NeverConnected)
                        {
                            tcpClientSlice.BeginConnectAndTrackStatus();
                        }

                        //if we didn't read anything and we're not holding the last read value,
                        //clear the output pin
                        if (!tcpClientSlice.FHoldOutput)
                        {
                            FOutputStringOutput.SetString(i, "");
                        }


                        if (tcpClientSlice.ConnectStatus == TConnectStatus.Connected)
                        {
                            //set ConnectPin to 1
                            FConnectedValueOutput.SetValue(i, 1);

                            //-- send --
                            if (tcpClientSlice.FInput != null)
                            {
                                if (tcpClientSlice.FDoSend)
                                {
                                    tcpClientSlice.Send();
                                }
                            }


                            // -- Read --
                            if (tcpClientSlice.IsReading == false)
                            {
                                string dataReceived = tcpClientSlice.GetReadData();


                                if (dataReceived != null)
                                {
                                    FReceivedNewData.SetValue(i, 1);
                                    FOutputStringOutput.SetString(i, dataReceived);
                                    //Debug.WriteLine("Length: " + dataReceived.Length);
                                }

                                tcpClientSlice.Read();
                            }
                        }

                        if (tcpClientSlice.ConnectStatus == TConnectStatus.ConnectionLost || tcpClientSlice.ConnectStatus == TConnectStatus.Disconnected)
                        {
                            FConnectedValueOutput.SetValue(i, 0);
                            //the TcpClient object is now useless so we create a new one to try to reconnect next time
                            //we copy all the data values from the old client object, but not the actual tcp stream object
                            TV4TcpClient newClient = new TV4TcpClient(tcpClientSlice);
                            tcpClientSlice.Close(true);
                            tcpClientSlice = TClients[i] = newClient;
                        }
                    }
                    //update the "connected" output pin to show whether we are connected
                    FConnectedValueOutput.SetValue(i, tcpClientSlice.Connected ? 1.0 : 0.0);



                    //Reading Error MEssages formt the TCPClient Class
                    List <string> Errors;
                    Errors = tcpClientSlice.GetErrorMessages();
                    if (Errors != null)
                    {
                        foreach (string Error in Errors)
                        {
                            FHost.Log(TLogType.Error, Error);
                        }
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, ex.Message);
                }
            }
        }
示例#23
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs

            if (FSkeletonInput.PinIsChanged || !initialized)
            {
                jointPositions = new Dictionary <string, Vector3D>();
                object currInterface;
                FSkeletonInput.GetUpstreamInterface(out currInterface);
                try
                {
                    skeleton = (Skeleton)currInterface;
                } catch (Exception e) {
                    FHost.Log(TLogType.Error, e.Message);
                }
                rootJoint = (IJoint)skeleton.Root;

                if (!initialized && configSelectedNames != null)
                {
                    selectedJoints.Clear();
                    IJoint currJoint;
                    for (int i = 0; i < configSelectedNames.Length; i++)
                    {
                        if (string.IsNullOrEmpty(configSelectedNames[i]))
                        {
                            break;
                        }
                        if (skeleton.JointTable.ContainsKey(configSelectedNames[i]))
                        {
                            currJoint = skeleton.JointTable[configSelectedNames[i]];
                            if (currJoint != null)
                            {
                                selectedJoints.Add(currJoint);
                            }
                        }
                    }
                }

                //redraw gui only if anything changed
                Invalidate();
            }


            if (selectedJoints.Count > 0)
            {
                FJointNameOutput.SliceCount = selectedJoints.Count;
                for (int i = 0; i < selectedJoints.Count; i++)
                {
                    FJointNameOutput.SetString(i, selectedJoints[i].Name);
                }
            }
            else
            {
                FJointNameOutput.SetString(0, "");
            }

            buildConfig();



            initialized = true;
        }
示例#24
0
        /// <summary>
        /// The Mainloop
        /// </summary>
        public void Evaluate(int SpreadMax)
        {
            string[] tAvailablePorts = SerialPort.GetPortNames();
            FPortsOut.SliceCount     = tAvailablePorts.Length;
            FConnectedOut.SliceCount = tAvailablePorts.Length;

            for (int i = 0; i < tAvailablePorts.Length; i++)
            {
                FPortsOut.SetValue(i, Convert.ToDouble(tAvailablePorts[i].Substring(3)));
            }


            if (FPortNumberIn.PinIsChanged)
            {
                if (_Driver != null)
                {
                    _Driver.StopThread = false;

                    while (_Driver.ThreadIsAlive())
                    {
                        Thread.Sleep(1);
                    }

                    _Driver.Dispose();
                    _Driver = null;
                }
            }



            double currentSliceEnabled;

            FEnableIn.GetValue(0, out currentSliceEnabled);



            if (currentSliceEnabled > 0.5)
            {
                try
                {
                    if (_Driver == null)
                    {
                        double currentSlicePortNumber;
                        FPortNumberIn.GetValue(0, out currentSlicePortNumber);
                        if ((new List <string>(SerialPort.GetPortNames())).Contains(String.Format("COM{0}", currentSlicePortNumber)))
                        {
                            string currentSliceIndentifier;
                            double currentSliceBaudrate;
                            double currentSliceDataFieldSize;
                            double currentTimeOutTime;

                            FEnableIn.GetValue(0, out currentSliceEnabled);
                            FIdentifier.GetString(0, out currentSliceIndentifier);
                            FDataFieldSize.GetValue(0, out currentSliceDataFieldSize);
                            FTimeOut.GetValue(0, out currentTimeOutTime);
                            FBaudrateIn.GetValue(0, out currentSliceBaudrate);

                            _Driver = new Driver((int)currentSlicePortNumber, (int)currentSliceBaudrate, Parity.None, 8, StopBits.One);

                            _Driver.SetParameters(currentSliceIndentifier, (int)currentSliceDataFieldSize, (int)currentTimeOutTime);

                            _Driver.StartThread();
                        }
                    }
                    else
                    {
                        string currentSliceIndentifier;
                        double currentSliceBaudrate;
                        double currentSliceDataFieldSize;
                        double currentTimeOutTime;


                        FIdentifier.GetString(0, out currentSliceIndentifier);
                        FDataFieldSize.GetValue(0, out currentSliceDataFieldSize);
                        FTimeOut.GetValue(0, out currentTimeOutTime);
                        FBaudrateIn.GetValue(0, out currentSliceBaudrate);

                        if (FBaudrateIn.PinIsChanged)
                        {
                            _Driver.Baudrate = (int)currentSliceBaudrate;
                        }

                        _Driver.SetParameters(currentSliceIndentifier, (int)currentSliceDataFieldSize, (int)currentTimeOutTime);

                        List <string> tData = new List <string>();
                        tData = _Driver.getData();

                        if (tData.Count > 0)
                        {
                            FDataOut.SliceCount = tData.Count;
                            string tSlice = String.Empty;

                            for (int i = 0; i < tData.Count; i++)
                            {
                                System.TimeSpan tDiff = System.DateTime.Now - tStart;

                                Debug.WriteLine(tDiff.TotalMilliseconds);
                                tSlice += tData[i];
                            }

                            FDataOut.SetString(0, tSlice);
                            tStart = System.DateTime.Now;
                        }
                        else
                        {
                            FDataOut.SliceCount = 0;
                            //FDataOut.SetString(0, "");
                        }

                        tData = null;
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, ex.Message);
                }
            }
            else
            {
                if (_Driver != null)
                {
                    _Driver.StopThread = false;

                    while (_Driver.ThreadIsAlive())
                    {
                        Thread.Sleep(1);
                    }

                    _Driver.Dispose();
                    _Driver = null;
                }
            }
        }
示例#25
0
文件: RS232.cs 项目: vnmone/vvvv-sdk
        /// <summary>
        /// The Mainloop
        /// </summary>
        public void Evaluate(int SpreadMax)
        {
            try
            {
                FDataOut.SliceCount      = SpreadMax;
                FOnDataOut.SliceCount    = SpreadMax;
                FConnectedOut.SliceCount = SpreadMax;

                for (int i = 0; i < _AvailablePorts.Length; i++)
                {
                    FPortsOut.SetValue(i, Convert.ToDouble(_AvailablePorts[i].Substring(3)));
                }



                string currentSliceData;
                double currentSliceDoSend;
                double currentSliceEnabled;
                double currentSliceKeepLastData;
                double currentSlicePortNumber;
                double currentSliceBaudrate;
                string currentSliceParity;
                string currentSliceDatabits = "";
                string currentSliceStopbits;
                string currentSliceHandShake;
                double currentReadBufferSize;



                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    FDoSendIn.GetValue(i, out currentSliceDoSend);
                    FEnableIn.GetValue(i, out currentSliceEnabled);
                    FKeepLastDataIn.GetValue(i, out currentSliceKeepLastData);
                    FPortNumberIn.GetValue(i, out currentSlicePortNumber);
                    FBaudrateIn.GetValue(i, out currentSliceBaudrate);
                    FParityIn.GetString(i, out currentSliceParity);
                    FDatabitsIn.GetString(i, out currentSliceDatabits);
                    FStopbitsIn.GetString(i, out currentSliceStopbits);
                    FHandShakeIn.GetString(i, out currentSliceHandShake);
                    FReadBufferIn.GetValue(i, out currentReadBufferSize);

                    Port tPort;

                    if (Convert.ToBoolean(currentSliceEnabled))
                    {
                        tPort = this.GetPort((int)currentSlicePortNumber);

                        if (tPort == null)
                        {
                            if ((new List <string>(SerialPort.GetPortNames())).Contains(String.Format("COM{0}", currentSlicePortNumber)))
                            {
                                tPort = new Port((int)currentSlicePortNumber, (int)currentSliceBaudrate,
                                                 currentSliceParity, Convert.ToInt32(currentSliceDatabits.Replace("Bits", "")), currentSliceStopbits.Replace("Bits", ""), (int)currentReadBufferSize);

                                _Ports.Add(tPort);

                                currentReadBufferSize = (double)tPort.BufferSize;
                                FReadBufferOut.SetValue(i, currentReadBufferSize);
                            }
                        }
                        else
                        {
                            //read data from inputs
                            FDataIn.GetString(i, out currentSliceData);
                            FOnDataOut.SetValue(i, Convert.ToDouble(tPort.OnData));
                            FConnectedOut.SetValue(i, Convert.ToDouble(tPort.Connected));

                            // write data to comport
                            if (currentSliceDoSend == 1.0 && !String.IsNullOrEmpty(currentSliceData))
                            {
                                tPort.Write(currentSliceData);
                            }

                            //read data from comport
                            if (tPort.OnData)
                            {
                                FDataOut.SetString(i, tPort.Read());
                            }
                            else
                            {
                                if (Convert.ToBoolean(currentSliceKeepLastData))
                                {
                                    FDataOut.SetString(i, tPort.Data);
                                }
                                else
                                {
                                    FDataOut.SetString(i, "");
                                }
                            }


                            if (FBaudrateIn.PinIsChanged)
                            {
                                tPort.Baudrate = (int)currentSliceBaudrate;
                            }

                            if (FParityIn.PinIsChanged)
                            {
                                tPort.Parity = currentSliceParity;
                            }

                            if (FDatabitsIn.PinIsChanged)
                            {
                                tPort.DataBits = Convert.ToInt32(currentSliceDatabits);
                            }

                            if (FStopbitsIn.PinIsChanged)
                            {
                                tPort.StopBits = currentSliceStopbits;
                            }

                            if (FHandShakeIn.PinIsChanged)
                            {
                                tPort.HandShake = currentSliceHandShake;
                            }
                            if (FReadBufferIn.PinIsChanged)
                            {
                                tPort.Dispose();
                                _Ports.Remove(tPort);
                            }
                        }
                    }
                    else
                    {
                        tPort = this.GetPort((int)currentSlicePortNumber);

                        if (tPort != null)
                        {
                            tPort.Dispose();
                            _Ports.Remove(tPort);
                        }

                        FOnDataOut.SetValue(i, Convert.ToDouble(0));
                        FConnectedOut.SetValue(i, Convert.ToDouble(0));
                        FDataOut.SetString(i, "");
                    }
                }
            }
            catch (Exception ex)
            {
                FHost.Log(TLogType.Error, ex.Message);
            }
        }
示例#26
0
        /// <summary>
        /// The Mainloop
        /// </summary>
        public void Evaluate(int SpreadMax)
        {
            // Get Node Settings
            string        DirectoryPath         = "";
            double        IncludeSubdirectories = 0;
            List <string> Mask       = new List <string>();
            string        MaskRule   = "";
            string        CountOrder = "";
            bool          Update     = false;

            SetMessage("Please Update");
            double CountIn = 0;

            //Check if any pin is changed and setup a new search;
            if (FDirectory.PinIsChanged || FSubdirectories.PinIsChanged || FMask.PinIsChanged || FMaskRule.PinIsChanged || FCountIn.PinIsChanged || FShortFilenameIn.PinIsChanged || FCountOrder.PinIsChanged || FUpdate.PinIsChanged)
            {
                //Get the DirectoryPath String an check if it null, empty or exist. if not the function is returned
                FDirectory.GetString(0, out DirectoryPath);
                if (String.IsNullOrEmpty(DirectoryPath) || !Directory.Exists(DirectoryPath))
                {
                    FFiles.SliceCount            = 0;
                    FShortFilenameOut.SliceCount = 0;
                    FCountOut.SetValue(0, 0);

                    SetMessage("Please Enter a correct directory Path..");
                    return;
                }

                FSubdirectories.GetValue(0, out IncludeSubdirectories);
                FMaskRule.GetString(0, out MaskRule);;
                FCountIn.GetValue(0, out CountIn);
                FCountOrder.GetString(0, out CountOrder);

                //Get all Serach Masks
                for (int i = 0; i < FMask.SliceCount; i++)
                {
                    string MaskSlice;
                    FMask.GetString(i, out MaskSlice);

                    if (!String.IsNullOrEmpty(MaskSlice))
                    {
                        Mask.Add(MaskSlice);
                    }
                }

                //if there is no Mask create one, otherwise the Function getFiles crashes
                if (Mask.Count == 0)
                {
                    Mask.Add("*.*");
                }

                //Create a new Search with the given setup. If there exist a Search Object we are still Searching.
                if (FSearch == null)
                {
                    //Set if the Subdirectories are included or not and Create a new Search Process Object which handle all Files Searching and Sorting in a new Thread
                    if (IncludeSubdirectories <= 0)
                    {
                        FSearch = new SearchProcess(DirectoryPath, Mask.ToArray(), SearchOption.TopDirectoryOnly, MaskRule, CountIn, CountOrder);
                    }
                    else
                    {
                        FSearch = new SearchProcess(DirectoryPath, Mask.ToArray(), SearchOption.AllDirectories, MaskRule, CountIn, CountOrder);
                    }

                    if (FSearch != null)
                    {
                        //Start the Searching..
                        SetMessage(FSearch.Search());
                    }
                }
                else
                {
                    SetMessage("Still Searching... Please Wait...");
                }
            }

            //Read the Resulte of the SearchProcess
            if (FSearch != null)
            {
                string Message = FSearch.GetStatus();
                SetMessage(Message);

                string[] FullFilesNames = FSearch.GetFullFileNames();


                if (FullFilesNames != null)
                {
                    double IncludeShortFilename = 0;
                    FShortFilenameIn.GetValue(0, out IncludeShortFilename);

                    FFiles.SliceCount = FullFilesNames.Length;
                    FCountOut.SetValue(0, FullFilesNames.Length);

                    for (int i = 0; i < FullFilesNames.Length; i++)
                    {
                        string FilePath = FullFilesNames[i];
                        FFiles.SetString(i, FilePath);

                        if (IncludeShortFilename >= 0.5)
                        {
                            string[] ShortFilename = FSearch.GetShortFileNames();

                            FShortFilenameOut.SliceCount = ShortFilename.Length;
                            FShortFilenameOut.SetString(i, ShortFilename[i]);
                        }
                        else
                        {
                            FShortFilenameOut.SliceCount = 0;
                        }
                    }
                    FSearch = null;
                }
            }
        }
示例#27
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            if (FWindowWidth != this.Width)
            {
                FWindowWidth = this.Width;
                double columns;
                FColumns.GetValue(0, out columns);
                foreach (ComboBoxSpread cb in FComboList)
                {
                    cb.SetBox((int)columns, (int)(FWindowWidth / columns));
                }
                Refresh();
            }

            //set output Slicecount
            FSelectIndex.SliceCount = FComboList.Count;
            FItem.SliceCount        = FComboList.Count;

            if (selectedIndex.Count > FComboList.Count)
            {
                int diff = selectedIndex.Count - FComboList.Count;
                selectedIndex.RemoveRange(FComboList.Count, diff);
                selectedItem.RemoveRange(FComboList.Count, diff);
            }

            //if any of the inputs has changed
            //recompute the outputs
            int binIncrement = 0;

            for (int i = 0; i < FComboList.Count; i++)
            {
                double tmpBinSize;
                FBinSize.GetValue(i, out tmpBinSize);
                int curBinSize = (int)tmpBinSize;
                if (curBinSize < 0)
                {
                    curBinSize = FItems.SliceCount;
                }

                if (FItems.PinIsChanged || FComboList[i].Items.Count != curBinSize)
                {
                    List <string> curStringList = new List <string>();
                    for (int j = 0; j < curBinSize; j++)
                    {
                        string currentStringSlice;
                        FItems.GetString(binIncrement + j, out currentStringSlice);
                        curStringList.Add(currentStringSlice);
                    }

                    if (!FComboList[i].Items.Equals(curStringList))
                    {
                        FComboList[i].Items.Clear();
                        foreach (string s in curStringList)
                        {
                            FComboList[i].Items.Add(s);
                        }
                        curStringList.Clear();
                    }
                }
                binIncrement += curBinSize;

                if (selectedIndex.Count < i + 1)
                {
                    selectedIndex.Add(0);
                    selectedItem.Add("");
                }

                double curBangSelect;
                FDoSelect.GetValue(i, out curBangSelect);
                if (curBangSelect > 0)
                {
                    double currentValueSlice;
                    FSelectItem.GetValue(i, out currentValueSlice);
                    int selectIndex = (int)(currentValueSlice % FComboList[i].Items.Count);
                    FComboList[i].SelectedItem = FComboList[i].Items[selectIndex];
                }

                if (FComboList[i].SelectedItem != null && FComboList[i].isDropDown == false)
                {
                    selectedIndex[i] = FComboList[i].SelectedIndex;
                    selectedItem[i]  = FComboList[i].SelectedItem.ToString();
                }

                if (FComboList[i].SelectedItem == null)
                {
                    double curDefault;
                    FDefault.GetValue(i, out curDefault);
                    FComboList[i].SelectedItem = FComboList[i].Items[(int)curDefault];
                    selectedIndex[i]           = FComboList[i].SelectedIndex;
                    selectedItem[i]            = FComboList[i].SelectedItem.ToString();
                }

                FSelectIndex.SetValue(i, selectedIndex[i]);
                FItem.SetString(i, selectedItem[i]);
            }
        }
示例#28
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            //if any of the inputs has changed
            //recompute the outputs
            if (FMyValueInput.PinIsChanged || FTransType.PinIsChanged || FTransMode.PinIsChanged || FInverse.PinIsChanged)
            {
                //first set slicecounts for all outputs
                //the incoming int SpreadMax is the maximum slicecount of all input pins, which is a good default
                FMyValueOutput.SliceCount  = SpreadMax;
                FMyStringOutput.SliceCount = SpreadMax;


                //the variables to fill with the input data
                double CurrentValueSlice;
                double CurrentTransType;
                double CurrentTransMode;
                double CurrentInverse;
                double X;


                string CurrentStringSlice;

                //loop for all slices
                for (int i = 0; i < SpreadMax; i++)
                {
                    //read data from inputs
                    FMyValueInput.GetValue(i, out CurrentValueSlice);
                    FTransType.GetValue(i, out CurrentTransType);
                    FTransMode.GetValue(i, out CurrentTransMode);
                    FInverse.GetValue(i, out CurrentInverse);
                    // Force The Current TransType to an existing TransType!!
                    // Firsty make it Postive (anyone has a better way?) Than take the Leftover.
                    if (CurrentTransType < 0)
                    {
                        CurrentTransType = CurrentTransType * -1;
                    }
                    CurrentTransType = CurrentTransType % FAmountOfTransitionsmade;

                    // And I want the transmode always be 0,1,2 or 3.
                    if (CurrentTransMode < 0)
                    {
                        CurrentTransMode = CurrentTransMode * -1;
                    }
                    CurrentTransMode = CurrentTransMode % 4;

                    // Make the CurrentValue to something I can work with more easy!!
                    X = CurrentValueSlice;
                    // And Map it with a Clamp, so we only have 0.0000 to 1.0000 as an X
                    X = VMath.Map(X, 0.0000, 1.000, 0.000, 1.000, TMapMode.Clamp);

                    //your function per slice

                    // Nr. 0
                    if (CurrentTransType == 0)
                    {
                        CurrentStringSlice = "Linear Easing";
                    }

                    // -= QUADRATIC EASING =-
                    // Nr. 1 In
                    else if (CurrentTransType == 1 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Quadratic Easing In";
                        X = Tweener.QuadEaseIn(X);
                    }

                    // Nr. 1 Out
                    else if (CurrentTransType == 1 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Quadratic Easing Out";
                        X = Tweener.QuadEaseOut(X);
                    }

                    // Nr. 1 In/Out
                    else if (CurrentTransType == 1 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Quadratic Easing in/Out";
                        X = Tweener.QuadEaseInOut(X);
                    }
                    // Nr. 1 Out/in
                    else if (CurrentTransType == 1 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Quadratic Easing Out/In";
                        X = Tweener.QuadEaseOutIn(X);
                    }

                    // -= CUBIC EASING =-
                    // Nr. 2 In
                    else if (CurrentTransType == 2 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Cubic Easing In";
                        X = Tweener.CubicEaseIn(X);
                    }

                    // Nr.2 Out
                    else if (CurrentTransType == 2 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Cubic Easing Out";
                        X = Tweener.CubicEaseOut(X);
                    }

                    // Nr.2 In/Out
                    else if (CurrentTransType == 2 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Cubic Easing In/Out";
                        X = Tweener.CubicEaseInOut(X);
                    }

                    // Nr.2 Out/In
                    else if (CurrentTransType == 2 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Cubic Easing Out/In";
                        X = Tweener.CubicEaseOutIn(X);
                    }

                    // -= QUARTIC EASING =-
                    // Nr.3 In
                    else if (CurrentTransType == 3 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Quartic Easing In";
                        X = Tweener.QuarticEaseIn(X);
                    }

                    // Nr.3 Out
                    else if (CurrentTransType == 3 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Quartic Easing Out";
                        X = Tweener.QuarticEaseOut(X);
                    }

                    // Nr.3 In/Out
                    else if (CurrentTransType == 3 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Quadric Easing In/Out";
                        X = Tweener.QuarticEaseInOut(X);
                    }

                    // Nr.3  Out/In
                    else if (CurrentTransType == 3 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Quadric Easing Out/In";
                        X = Tweener.QuarticEaseOutIn(X);
                    }

                    // -= QUINTYIC EASING =-
                    // Nr.4 In
                    else if (CurrentTransType == 4 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Quintic Easing In";
                        X = Tweener.QuinticEaseIn(X);
                    }

                    // Nr.4 Out
                    else if (CurrentTransType == 4 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Quintic Easing Out";
                        X = Tweener.QuinticEaseOut(X);
                    }

                    // Nr.4 In/Out
                    else if (CurrentTransType == 4 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Quintic Easing In/Out";
                        X = Tweener.QuinticEaseInOut(X);
                    }

                    // Nr.4 Out/In
                    else if (CurrentTransType == 4 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Quintic Easing Out/In";
                        X = Tweener.QuinticEaseOutIn(X);
                    }

                    // -= SINUSOIDAL EASING =-
                    // Nr.5 In
                    else if (CurrentTransType == 5 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Sinusoidal Easing In";
                        X = Tweener.SinusoidalEaseIn(X);
                    }

                    // Nr.5 In
                    else if (CurrentTransType == 5 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Sinusoidal Easing Out";
                        X = Tweener.SinusoidalEaseOut(X);
                    }

                    // Nr.5 In/Out
                    else if (CurrentTransType == 5 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Sinusoidal Easing In/Out";
                        X = Tweener.SinusoidalEaseInOut(X);
                    }

                    // Nr.5 Out/In
                    else if (CurrentTransType == 5 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Sinusoidal Easing Out/In";
                        X = Tweener.SinusoidalEaseOutIn(X);
                    }

                    // -= Exponential Easing =-
                    // Nr. 6 In
                    else if (CurrentTransType == 6 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Exponential Easing In";
                        X = Tweener.ExponentialEaseIn(X);
                    }
                    // Nr. 6 Out
                    else if (CurrentTransType == 6 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Exponential Easing Out";
                        X = Tweener.ExponentialEaseOut(X);
                    }
                    // Nr. 6 In/Out
                    else if (CurrentTransType == 6 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Exponential Easing In/Out";
                        X = Tweener.ExponentialEaseInOut(X);
                    }

                    // Nr. 6 Out/in
                    else if (CurrentTransType == 6 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Exponential Easing Out/In";
                        X = Tweener.ExponentialEaseOutIn(X);
                    }


                    // -= CIRCULAR EASING =-
                    // Nr. 7 In
                    else if (CurrentTransType == 7 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Circulair Easing In";
                        X = Tweener.CircularEaseIn(X);
                    }

                    // Nr. 7 Out
                    else if (CurrentTransType == 7 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Circulair Easing Out";
                        X = Tweener.CircularEaseOut(X);
                    }

                    // Nr. 7 In/Out
                    else if (CurrentTransType == 7 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Circulair Easing In/Out";
                        X = Tweener.CircularEaseInOut(X);
                    }

                    // Nr. 7 Out/In
                    else if (CurrentTransType == 7 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Circulair Easing Out/In";
                        X = Tweener.CircularEaseOutIn(X);
                    }

                    // -= ELASTIC EASING =-
                    // Nr. 8 In
                    else if (CurrentTransType == 8 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Elastic Easing In";
                        X = Tweener.ElasticEaseIn(X);
                    }

                    // Nr. 8 Out
                    else if (CurrentTransType == 8 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Elastic Easing Out";
                        X = Tweener.ElasticEaseOut(X);
                    }

                    // Nr. 8 In/Out
                    else if (CurrentTransType == 8 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Elastic Easing In/Out";
                        X = Tweener.ElasticEaseInOut(X);
                    }
                    // Nr. 8 Out/In
                    else if (CurrentTransType == 8 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Elastic Easing Out/In";
                        X = Tweener.CubicEaseOutIn(X);
                    }

                    // -= BACK EASING =-
                    // Nr. 9 In
                    else if (CurrentTransType == 9 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Back Easing In";
                        X = Tweener.BackEaseIn(X);
                    }
                    // Nr. 9 Out
                    else if (CurrentTransType == 9 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Back Easing Out";
                        X = Tweener.BackEaseOut(X);
                    }

                    // Nr. 9 In/Out
                    else if (CurrentTransType == 9 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Back Easing In/Out";
                        X = Tweener.BackEaseInOut(X);
                    }

                    // Nr. 9 Out/In
                    else if (CurrentTransType == 9 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Back Easing Out/In";
                        X = Tweener.BackEaseOutIn(X);
                    }

                    // -= BOUNCE EASING =-
                    // Only bugger that didn't fit in 1 line!!

                    // Nr. 10 In
                    else if (CurrentTransType == 10 && CurrentTransMode == 0)
                    {
                        CurrentStringSlice = "Bounce Easing In";
                        X = Tweener.BounceEaseIn(X);
                    }
                    // Nr. 10 Out
                    else if (CurrentTransType == 10 && CurrentTransMode == 1)
                    {
                        CurrentStringSlice = "Bounce Easing Out";
                        X = Tweener.BounceEaseOut(X);
                    }

                    // Nr. 10 In/Out
                    else if (CurrentTransType == 10 && CurrentTransMode == 2)
                    {
                        CurrentStringSlice = "Bounce Easing In/Out";
                        X = Tweener.BounceEaseInOut(X);
                    }

                    // Nr. 10 Out/In
                    else if (CurrentTransType == 10 && CurrentTransMode == 3)
                    {
                        CurrentStringSlice = "Bounce Easing Out/In";
                        X = Tweener.BounceEaseOutIn(X);
                    }

                    // I think not needed, but if I by accident set my TransistionTypecount too high....
                    else
                    {
                        CurrentStringSlice = "Westbam Made an Error :)";
                    }

                    // Inverse The Tweener, as an extra :)
                    if (CurrentInverse == 1)
                    {
                        X = 1 - X;
                        CurrentStringSlice = CurrentStringSlice + " Inversed";
                    }

                    // Set X to the Output...
                    CurrentValueSlice = X;

                    //write data to outputs
                    FMyValueOutput.SetValue(i, CurrentValueSlice);
                    FMyStringOutput.SetString(i, CurrentStringSlice);

                    //
                    // DONT FORGET THE SET THE AMMOUNT OFF FINISHED TWEENERS (TRANSITIONS) ON THE TOP OFF THIS PAGE!!!
                    //
                }
            }
        }
示例#29
0
        //here we go, thats the method called by vvvv each frame
        //all data handling should be in here
        public void Evaluate(int SpreadMax)
        {
            double Enable;
            double Serial;
            double Ratiomatric;

            //FConnected.SliceCount = 1;

            FSerial.GetValue(0, out Serial);
            FEnable.GetValue(0, out Enable);
            FRatiomatric.GetValue(0, out Ratiomatric);



            try
            {
                if (FSerial.PinIsChanged || FEnable.PinIsChanged)
                {
                    if (FSerial.PinIsChanged)
                    {
                        if (m_IKitData != null)
                        {
                            m_IKitData.Close();
                            m_IKitData = null;
                        }
                    }

                    if (Enable > 0.5)
                    {
                        if (m_IKitData == null)
                        {
                            m_IKitData = new GetInterfaceData();
                            m_IKitData.Open(Serial);
                        }
                    }
                    else
                    {
                        if (m_IKitData != null)
                        {
                            FInfo.SliceCount = 1;
                            FInfo.SetString(0, "Disabled");
                            m_IKitData.Close();
                            m_IKitData = null;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                FHost.Log(TLogType.Error, "Error by initialising Phidget");
                FHost.Log(TLogType.Error, ex.Message.ToString());
            }



            if (Enable == 1 && m_IKitData.Attached)
            {
                //

                int SliceCountAnalogIn = m_IKitData.InfoDevice.ToArray()[0].AnalogOutputs;
                try
                {
                    //Setting Values of analog inputs

                    if (m_IKitData.InfoDevice.ToArray()[0].AnalogOutputs != 0)
                    {
                        FAnalogIn.SliceCount = SliceCountAnalogIn;
                        for (int i = 0; i < SliceCountAnalogIn; i++)
                        {
                            FAnalogIn.SetValue(i, m_IKitData.AnalogInputs[i]);
                        }
                    }



                    //setting Sensitivity of Analog Inputs
                    try
                    {
                        if (FSensitivity.PinIsChanged)
                        {
                            double   SliceCountSense = FSensitivity.SliceCount;
                            double[] SenseValue      = new double[SliceCountAnalogIn];
                            for (int i = 0; i < SliceCountAnalogIn; i++)
                            {
                                double sense;
                                FSensitivity.GetValue(i, out sense);
                                SenseValue[i] = sense;
                            }
                            m_IKitData.SetSense(SenseValue);
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting Analog  Output");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }



                    //Setting Values Digital Inputs
                    try
                    {
                        if (m_IKitData.InfoDevice.ToArray()[0].DigitalInputs != 0)
                        {
                            int SliceCountDigitalIn = m_IKitData.InfoDevice.ToArray()[0].DigitalInputs;
                            FDigitalIn.SliceCount = SliceCountDigitalIn;
                            for (int i = 0; i < SliceCountDigitalIn; i++)
                            {
                                FDigitalIn.SetValue(i, m_IKitData.DigitalInputs[i]);
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting Digitial Output");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }



                    try
                    {
                        if (m_IKitData.InfoDevice.ToArray()[0].DigitalOutputs != 0)
                        {
                            int SliceCountDigitalOut = m_IKitData.InfoDevice.ToArray()[0].DigitalOutputs;

                            FDigiOutCount.SetValue(1, SliceCountDigitalOut);
                            double[] digiOut = new double[m_IKitData.InfoDevice.ToArray()[0].DigitalInputs];

                            for (int i = 0; i < SliceCountDigitalOut; i++)
                            {
                                FDigitalOut.GetValue(i, out digiOut[i]);
                            }
                            m_IKitData.SetDigitalOutput(digiOut);
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " getting Digitial Output");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }



                    //setting Phidget Infos
                    try
                    {
                        int SpreadSizeInfo = 3;
                        for (int i = 0; i < SpreadSizeInfo; i++)
                        {
                            FInfo.SliceCount = 3;
                            switch (i)
                            {
                            case 0:
                                FInfo.SetString(i, "Name: " + m_IKitData.InfoDevice.ToArray()[0].Name);
                                break;

                            case 1:
                                FInfo.SetString(i, "Serial: " + m_IKitData.InfoDevice.ToArray()[0].SerialNumber.ToString());
                                break;

                            case 2:
                                FInfo.SetString(i, "Version: " + m_IKitData.InfoDevice.ToArray()[0].Version.ToString());
                                break;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting Phidget Infos");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }



                    // setting Radiometric
                    try
                    {
                        if (m_IKitData != null)
                        {
                            //FConnected.SetValue(0, m_IKitData.Status);
                            if (m_IKitData.InfoDevice.ToArray()[0].Name.Contains("8/8/8"))
                            {
                                m_IKitData.SetRatiometric(Ratiomatric);
                            }
                        }
                        else
                        {
                            //FConnected.SetValue(0, 0);
                        }
                    }
                    catch (Exception ex)
                    {
                        FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name + " setting Radiometric");
                        FHost.Log(TLogType.Error, ex.Message.ToString());
                    }
                }
                catch (Exception ex)
                {
                    FHost.Log(TLogType.Error, "Error in Phidget " + m_IKitData.InfoDevice.ToArray()[0].Name);
                    FHost.Log(TLogType.Error, ex.Message.ToString());
                }
            }
        }
示例#30
0
 private void PrintStatusMessage(string msg)
 {
     FStatusOut.SetString(0, msg);
 }