Exemplo n.º 1
0
        public Form1()
        {
            try
            {
                initTime = DateTime.Now;
                //Calls calculation method for filters
                highCoeff     = filterCoeff(double.Parse(ConfigurationManager.AppSettings.Get("angleHighPass")), sampFreq / bufferSize, "High");
                lowCoeff      = filterCoeff(double.Parse(ConfigurationManager.AppSettings.Get("angleLowPass")), sampFreq / bufferSize, "Low");
                bandHighCoeff = filterCoeff(double.Parse(ConfigurationManager.AppSettings.Get("velocityHighPass")), sampFreq / bufferSize, "High");
                bandLowCoeff  = filterCoeff(double.Parse(ConfigurationManager.AppSettings.Get("velocityLowPass")), sampFreq / bufferSize, "Low"); //2*10^-2

                InitializeComponent();                                                                                                            // Initializes the visual components
                SetSize();                                                                                                                        // Sets up the size of the window and the corresponding location of the components
                Frameco     = 0;
                dayFrameCo0 = DayNr.GetDayNr(DateTime.Now);

                //Initialization of TwinCAT connection. 851 is the port for PLC runtime 1

                if (twinCatBool)
                {
                    tcAds.Connect(851);
                }

                myStopwatch          = new Stopwatch();
                dataWritingSyncEvent = new SyncEvents();

                consumerd    = new DataConsumerDelegate[2];
                consumerd[0] = new DataConsumerDelegate(new DataConsumerDelegate.outputDelegate(showStatistics), true);
                consumerd[1] = new DataConsumerDelegate(new DataConsumerDelegate.outputDelegate(Pattern), true);
                consumerd[1].myThread.Priority = ThreadPriority.Highest;
                for (int i = 0; i < consumerd.Length; i++)
                {
                    consumerd[i].myThread.Start();
                }
                dataWritingQueue = new Queue <PeakQueueItem>();

                dataWritingThreadBool      = true;
                dataWritingThread          = new Thread(dataWrite);
                dataWritingThread.Priority = ThreadPriority.Highest;
                dataWritingThread.Start();
                Thread.Sleep(10);

                cameraThread          = new Thread(initCamera);
                cameraThread.Priority = ThreadPriority.Highest;
                cameraThread.Start();
                curDirec = System.IO.Path.GetDirectoryName(Application.ExecutablePath);
                System.Diagnostics.Process.Start(curDirec + "\\AffinitySet.bat");
            }
            catch (System.Threading.ThreadAbortException) { }
            catch (Exception ex)
            {
                EmailError.emailAlert(ex);
                throw (ex);
            }
        }
Exemplo n.º 2
0
 private void buRecord_Click(object sender, EventArgs e)
 {
     if (recordBool == false)
     {
         Frameco       = 0;
         dayFrameCo0   = DayNr.GetDayNr(DateTime.Now);
         buRecord.Text = "Stop Recording";
         myDataWriter  = new DataWriting();
         recordBool    = true;
     }
     else
     {
         buRecord.Text = "Record to Disk";
         recordBool    = false;
         myDataWriter.stopit();
     }
 }
        public virtual string GetProperty(string strPropertyName, string strFormat, System.Globalization.CultureInfo formatProvider, DotNetNuke.Entities.Users.UserInfo accessingUser, DotNetNuke.Services.Tokens.Scope accessLevel, ref bool propertyNotFound)
        {
            switch (strPropertyName.ToLower())
            {
            case "sessionid": // Int
                return(SessionId.ToString(strFormat, formatProvider));

            case "conferenceid": // Int
                return(ConferenceId.ToString(strFormat, formatProvider));

            case "locationid": // Int
                if (LocationId == null)
                {
                    return("");
                }
                ;
                return(((int)LocationId).ToString(strFormat, formatProvider));

            case "level": // NVarChar
                if (Level == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Level, strFormat));

            case "sort": // Int
                if (Sort == null)
                {
                    return("");
                }
                ;
                return(((int)Sort).ToString(strFormat, formatProvider));

            case "capacity": // Int
                if (Capacity == null)
                {
                    return("");
                }
                ;
                return(((int)Capacity).ToString(strFormat, formatProvider));

            case "slotid": // Int
                return(SlotId.ToString(strFormat, formatProvider));

            case "title": // NVarChar
                if (Title == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Title, strFormat));

            case "subtitle": // NVarChar
                if (SubTitle == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(SubTitle, strFormat));

            case "description": // NVarCharMax
                if (Description == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Description, strFormat));

            case "status": // Int
                if (Status == null)
                {
                    return("");
                }
                ;
                return(((int)Status).ToString(strFormat, formatProvider));

            case "isplenary": // Bit
                return(IsPlenary.ToString());

            case "daynr": // Int
                return(DayNr.ToString(strFormat, formatProvider));

            case "notes": // NVarCharMax
                if (Notes == null)
                {
                    return("");
                }
                ;
                return(PropertyAccess.FormatString(Notes, strFormat));

            case "trackid": // Int
                if (TrackId == null)
                {
                    return("");
                }
                ;
                return(((int)TrackId).ToString(strFormat, formatProvider));

            default:
                propertyNotFound = true;
                break;
            }

            return(Null.NullString);
        }