コード例 #1
0
    void Update()
    {
        timer += Time.deltaTime;                                  // basic countdown which will get reset after limited time
        float rTime = RandomClass.getRandomTime(2.0f, 4.0f, 100); // this is random average time coming from randomClass

        if (timer >= 1)
        {
            patient = new Patient(RandomPatientType(), Time.realtimeSinceStartup);
            registration.InsertPatientIntoRegistration(patient);
            print("patient in registration area: " + registration.PatientInLine());

            timer = 0;
        }



        // search through patientRegistration and find which patient been waiting for 10 secs. and remove them(renege)
        for (int index = registration.PatientInLine() - 1; index >= 0; index--)
        {
            Patient pat = (Patient)registration.registrationLine[index];
            if (pat.willRenege == true && pat.waitingFor >= 5.0f)
            {
                print(pat.patientType + " type patient reneging");
                registration.registrationLine.RemoveAt(index);
            }
        }
    }
コード例 #2
0
        public void WhenIHaveSeenAll_ShareIcons()
        {
            string[] iconName = { "Facebook", "Twitter", "Skype" };

            int indexOfElement = RandomClass.Rand(infoPage.InfoBoxPageElemList["ShareElements"]);

            if (iconName[indexOfElement] == infoPage.InfoBoxPageElemList["ShareElements"][indexOfElement].GetAttribute("title"))
            {
                Move.HoverMouse(infoPage.InfoBoxPageElemList["ShareElements"][indexOfElement]);
            }
        }
コード例 #3
0
    //create each patient with patient type and give them global timestamp which will tell how long each patient waiting.
    public Patient(PatientType patType, float waitingFor)
    {
        this.patientType = patType.ToString();
        this.waitingFor  = waitingFor;
        this.willRenege  = RandomClass.willRenege();

        //If the patient type is normal then their treatment time will be 5 min to 15 min
        if (this.patientType == PatientType.Normal.ToString())
        {
            //set treatmentTime to random Time
        }
        //If the patient type is emergeny then their treatment time will be 20 min to 45 min
        if (this.patientType == PatientType.Emergency.ToString())
        {
        }
    }
コード例 #4
0
 private void BtnNext_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         User user = DataClass.GetContext().User.FirstOrDefault(u => u.Login == TbLogin.Text);
         if (user == null)
         {
             RunError.Text       = null;
             RunError.Text       = "Пользователя с таким логином не существует";
             TbLogin.BorderBrush = Brushes.OrangeRed;
         }
         else
         {
             try
             {
                 string Code   = RandomClass.Rand(6);
                 string a      = "*****@*****.**";
                 var    client = new SmtpClient("smtp.mail.ru", 25);
                 client.Credentials = new NetworkCredential(a, "WASD1337");
                 client.EnableSsl   = true;
                 client.Send(a, TbLogin.Text, "Код для смены пароля", Code);
                 RandomClass.Saver = Code;
                 ActionWindowClass.MainFrame.Navigate(new PageEmailCode());
                 ActionWindowClass.UserTransition = user;
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
コード例 #5
0
 void Start()
 {
     random       = gameObject.AddComponent <RandomClass>();  // if we dont add this to object then we get null pointer error.
     registration = gameObject.AddComponent <Registration>();
 }
コード例 #6
0
ファイル: Person.cs プロジェクト: ToppeRTheReal/school
 public Kunde()
 {
     this.ID = RandomClass.RandomString(5);
 }
コード例 #7
0
ファイル: Program.cs プロジェクト: dchaves80/ProjectVeronica
        static void Main(string[] args)
        {
            Console.WriteLine("Creando Red Neuronal");
            NeuralOlympus.Network N  = new NeuralOlympus.Network(2, 20, 20, 1, true, false, NeuralOlympus.Network.Activator.TAN, NeuralOlympus.Network.EjecutionMode.SYNC);
            float          error     = 100f;
            ConsoleKeyInfo Salir     = new ConsoleKeyInfo('C', ConsoleKey.C, false, false, false);
            ConsoleKeyInfo ActualKey = new ConsoleKeyInfo();

            while (ActualKey.Key != ConsoleKey.C)
            {
                while (true)
                {
                    float product1 = 0;
                    float product2 = 0;
                    while (product1 * product2 == 0)
                    {
                        try {
                            product1 = RandomClass.R.Next(-DateTime.Now.Second + RandomClass.GetLastMillisecond(), DateTime.Now.Second + RandomClass.GetLastMillisecond());
                            product2 = RandomClass.R.Next(-DateTime.Now.Second + RandomClass.GetLastMillisecond(), DateTime.Now.Second + RandomClass.GetLastMillisecond());
                            if (product1 == 0 || product2 == 0)
                            {
                                product1 = RandomClass.R.Next(1, 20);
                                product2 = RandomClass.R.Next(1, 20);
                            }
                        }
                        catch (Exception E)
                        {
                            product1 = 2f;
                            product2 = 3f;
                        }
                    }



                    float   expected = product1 * product2;
                    float[] inputs   = { product1, product2 };
                    N.SetInputs(inputs);
                    NetworkResult NR = N.Calculate(new float[] { expected });
                    error = NR.ERROR;
                    Console.WriteLine("Operacion:" + product1 + "*" + product2 + "=" + expected + " Resultado: " + NR.RESULTS[0] + " Error:" + NR.ERROR);
                    if (error > -0.01f && error < 0.01f)
                    {
                        break;
                    }
                    N.AdjustNetwork(((int)error * (int)error) / 2f);
                }
                float[] inputs2 = { 2, 2 };
                N.SetInputs(inputs2);
                NetworkResult NR2 = N.Calculate(new float[] { 4 });
                Console.WriteLine("Se espera 4:" + " Resultado: " + NR2.RESULTS[0] + " Error:" + NR2.ERROR);
                float[] inputs3 = { 9, 9 };
                N.SetInputs(inputs3);
                NR2 = N.Calculate(new float[] { 81 });
                Console.WriteLine("Se espera 81:" + " Resultado: " + NR2.RESULTS[0] + " Error:" + NR2.ERROR);
                Thread.Sleep(2000);
                if (NR2.ERROR == 0.1f)
                {
                    ActualKey = Console.ReadKey();
                }
            }
        }
コード例 #8
0
        public IntermecBarcodescanControl5()
        {
            InitializeComponent();
            try
            {
#if RANDOMBADSCANS
                rc=new RandomClass(0.3);
#endif
                addLog("IntermecBarcodescanControl5: setHWTrigger(true)...");
                //enable HW trigger, a workaround as HW trigger is sometimes disabled on BarcodeReader.Dispose()
                //if (!S9CconfigClass.S9Cconfig.HWTrigger.setHWTrigger(true))
                //{
                //    addLog("IntermecBarcodescanControl5: setHWTrigger(true)...FAILED. Trying again");
                //    Thread.Sleep(50);
                //    S9CconfigClass.S9Cconfig.HWTrigger.setHWTrigger(true); //try again
                //}
                //replaced above code with the following, there were problems with load/unload the ADCComInterface inside S9CConfig
                YetAnotherHelperClass.setHWTrigger(true);
                //change number of good read beeps to zero
                YetAnotherHelperClass.setNumberOfGoodReadBeeps(0);
                //as with new NullBarcodeRead events, we do not need to remap to StateLeftScan2 !
                //addLog("IntermecBarcodescanControl5: mapKey()...");
                //ITCTools.KeyBoard.mapKey();
                //we use the standard scan key assignement:
                addLog("IntermecBarcodescanControl5: restoreScanKeyDefault()...");
                ITCTools.KeyBoard.restoreScanKeyDefault();
                addLog("IntermecBarcodescanControl5: mapAllSide2SCAN_Event1() (all side buttons to scan event 1)...");
                ITCTools.KeyBoard.mapAllSide2SCAN_Event1();
            }
            catch (Exception ex)
            {
                addLog("Exception in IntermecBarcodescanControl5: setHWTrigger(true)..." + ex.Message);
            }
            try
            {
                //Cannot use Keydown etc within a usercontrol, we will not get the events!!!!!
                //ITCTools.KeyBoard.createMultiKey2Events();
                addLog("IntermecBarcodescanControl5: new BarcodeReader()...");
                //create a new BarcodeReader instance
                bcr = new BarcodeReader(this, "default");// ();
                try
                {
#if NoBarcodeRead
                    //modded code for new NoBarcodeRead feature
                    bcr.NoBarcodeRead += new NoBarcodeReadEventHandler(bcr_NoBarcodeRead);
                    bcr.EnableNoBarcodeReadEvent = true;
                    addLog("Setting bcr.EnableNoBarcodeReadEvent. OK?");
#endif
                }
                catch (Exception)
                {
                    addLog("Unable to set bcr.EnableNoBarcodeReadEvent. Old DLL?");
                }
                addLog("IntermecBarcodescanControl5: BarcodeReader adding event handlers...");
                bcr.BarcodeRead += new BarcodeReadEventHandler(bcr_BarcodeRead);
                bcr.BarcodeReadCanceled += new BarcodeReadCancelEventHandler(bcr_BarcodeReadCanceled);
                bcr.BarcodeReadError += new BarcodeReadErrorEventHandler(bcr_BarcodeReadError);
                addLog("IntermecBarcodescanControl5: enabling Scanner...");
                bcr.ScannerEnable = true;
                addLog("IntermecBarcodescanControl5: ScannerOn=false...");
                bcr.ScannerOn = false;
                addLog("Enabling event driver scanning");
                bcr.ThreadedRead(true);
            }
            catch (BarcodeReaderException ex)
            {
                bcr = null;
                System.Diagnostics.Debug.WriteLine("BarcodeReaderException in IntermecScanControl(): " + ex.Message);
            }
            catch (Exception ex)
            {
                bcr = null;
                System.Diagnostics.Debug.WriteLine("Exception in IntermecScanControl(): " + ex.Message);
            }
            if (bcr == null)
            {
                addLog("IntermecBarcodescanControl5: BarcodeReader init FAILED");
                throw new System.IO.FileNotFoundException("Intermec.Datacollection.dll or ITCScan.DLL missing");
            }
#if TESTMODE
            //testcodes = new string[8];
            testCodeCount = testcodes.Length;
            testCodePos = 0;
#endif

        }