Exemplo n.º 1
0
 public override void SetupPasses(Driver driver)
 {
     driver.Options.MarshalCharAsManagedChar = true;
     driver.Options.GenerateProperties = true;
     driver.Options.GenerateConversionOperators = true;
     driver.Options.GenerateDefaultValuesForArguments = true;
 }
Exemplo n.º 2
0
 protected void OnDriverSelected(Driver item)
 {
     if (DriverSelected != null)
     {
         DriverSelected(this, item);
     }
 }
Exemplo n.º 3
0
        public ActionResult AddDriver(DriverModel driver)
        {
            /* This method adds the new driver to the database */

            if(ModelState.IsValid)
            {
                var newDriver = new Driver
                {
                    driverId = driver.driverID,
                    firstName = driver.firstName,
                    lastName = driver.lastName,
                    age = Convert.ToInt32(driver.age),
                    nationality = driver.nationality,
                    weight = driver.weight,
                    height = driver.height,
                    championshipsWon = driver.championshipsWon,
                    championshipPoints = driver.championshipPoints,
                    profileImageUrl = driver.profileImage,
                    teamId = driver.teamId
                };

                db.Drivers.InsertOnSubmit(newDriver);
                db.SubmitChanges();
            }
            else
            {
                return View(driver);
            }

            return Redirect("/");
        }
Exemplo n.º 4
0
 public Car(string name, int numberOfOccupant, string model, Driver driver)
 {
     Name = name;
     NumberOfOccupant = numberOfOccupant;
     Model = model;
     Driver = driver;
 }
Exemplo n.º 5
0
 public override void SetupPasses(Driver driver)
 {
     driver.Options.GenerateInterfacesForMultipleInheritance = true;
     driver.Options.GenerateProperties = true;
     driver.Options.GenerateVirtualTables = true;
     driver.TranslationUnitPasses.AddPass(new TestAttributesPass());
 }
Exemplo n.º 6
0
        public static void AddPlainEnumProprety(Driver driver, byte no, string propertyName, byte offset, string parameter1Name, string parameter2Name, int startValue = 0,
			int minBit = 0, int maxBit = 0, bool useMask = false, bool highByte = false, bool mptHighByte = false, bool mptLowByte = false)
        {
            var property = new DriverProperty()
            {
                IsAUParameter = true,
                No = no,
                Name = propertyName,
                Caption = propertyName,
                Default = "0",
                BitOffset = offset,
                MinBit = minBit,
                MaxBit = maxBit,
                UseMask = useMask,
                HighByte = highByte,
                MptHighByte = mptHighByte,
                MptLowByte = mptLowByte
            };
            var parameter1 = new DriverPropertyParameter()
            {
                Name = parameter1Name,
                Value = startValue.ToString()
            };
            var parameter2 = new DriverPropertyParameter()
            {
                Name = parameter2Name,
                Value = (startValue + 1).ToString()
            };
            property.Parameters.Add(parameter1);
            property.Parameters.Add(parameter2);
            driver.Properties.Add(property);
        }
        private static void LearnAndTransmitACode()
        {
            using (var driver = new Driver())
            {
                Console.WriteLine(Driver.GetVersion(driver).ToString());

                Console.WriteLine("Receiving...");
                var receiver = new Receiver(driver);
                receiver.GenerateLegacyCodes = false;
                receiver.Received += OnReceive;

                var learner = new Learner(driver);
                learner.Learning += OnLearning;
                Console.WriteLine("Learning...");
                var result = learner.Learn();
                Console.WriteLine("Learned code: " + result);

                Console.WriteLine("Hit enter to Transmit");
                Console.ReadLine();
                var transmitter = new Transmitter(driver);
                transmitter.TransmitCompleted += OnTransmitComplete;
                transmitter.TransmitAsync(result, emitter: Emitter.Internal)
                    .ContinueWith(t => Console.WriteLine(t.Exception == null
                                        ? "Transmit Complete - from task"
                                        : t.Exception.ToString()));
            }
        }
Exemplo n.º 8
0
 protected ElementFinder(Driver driver, string locator, DriverScope scope, Options options)
 {
     Driver = driver;
     this.locator = locator;
     Scope = scope;
     this.options = options;
 }
Exemplo n.º 9
0
 public override void SetupPasses(Driver driver)
 {
     driver.Options.GenerateCopyConstructors = true;
     driver.Options.MarshalCharAsManagedChar = true;
     driver.Options.GenerateProperties = true;
     driver.Options.GenerateConversionOperators = true;
 }
Exemplo n.º 10
0
        public DriverSessionResults(Driver driver, int sessionNumber)
        {
            _driver = driver;
            _sessionNumber = sessionNumber;

            this.IsEmpty = true;
        }
Exemplo n.º 11
0
        static void Main(string[] args)
        {
            Car car= new Car("Lada", "D");
            car.Color= Color.Brown;

            try
            {
                Console.WriteLine(car.CarPassport.Owner.Name);
            }
            catch (NullReferenceException)
            {
                Console.WriteLine("Водитель не назначен");
            }

            Driver dr= new Driver(new DateTime(1998, 11, 22), "Voldemar");
            dr.Category= new List<string>() {"B", "C"};
            try
            {
                car.ChangeOwner(dr, "o777oo");
            }
            catch (NoCategoryException ex)
            {

                Console.WriteLine(ex.Message);
            }

            dr.Category.Add("D");
            car.ChangeOwner(dr, "o777oo");
            Console.WriteLine(dr.Car.CarNumber);
            Console.WriteLine(car.CarPassport.Owner.Name);

            Console.ReadKey();
        }
Exemplo n.º 12
0
 static void Main()
 {
     try
     {
         Log.Writer = GetLogWriter(logFilename);
         SetApplicationProperties();
         ISettings settings = GetSettings();
         Driver driver = new Driver(settings);
         try
         {
             driver.Load();
         }
         catch(Exception ex)
         {
             notifier.DisplayError(ex, Constants.TimeLogError, Constants.TimeLogCouldNotBeLoaded);
             return;
         }
         try
         {
             Application.Run(new Main(driver,settings));
         }
         catch (Exception ex)
         {
             notifier.DisplayError(ex, Constants.LazyCureError);
         }
         driver.Save();
         Log.Close();
     }
     catch(Exception ex)
     {
         notifier.DisplayError(ex, Constants.LazyCureError);
     }
 }
Exemplo n.º 13
0
        public void Add(Driver driver)
        {
            if (_list.Exists(item => item == driver))
                return;

            _list.Add(driver);
        }
Exemplo n.º 14
0
 public CSharpGenerator(Driver driver)
     : base(driver)
 {
     typePrinter = new CSharpTypePrinter(driver);
     expressionPrinter = new CSharpExpressionPrinter();
     CppSharp.AST.Type.TypePrinterDelegate += type => type.Visit(typePrinter).Type;
 }
 public static void SetDriverInTransaction(Driver driver)
 {
     lock (driversInUse.SyncRoot)
     {
         driversInUse[driver.CurrentTransaction.BaseTransaction.GetHashCode()] = driver;
     }
 }
Exemplo n.º 16
0
 internal WaitThenClick(Driver driver, Options options, Waiter waiter, ElementFinder elementFinder)
     : base(driver, options)
 {
     this.options = options;
     this.waiter = waiter;
     this.elementFinder = elementFinder;
 }
Exemplo n.º 17
0
 // Перегруженный конструктор класса Transport
 public Transport(string number, int route, string model)
 {
     this.number = number;
     this.route = route;
     this.model = model;
     this.driver = null;
 }
Exemplo n.º 18
0
        public void ShouldLogAtDebugLevel()
        {
            //arrange 
            var logger = new ConsoleOutLogger("Testing", LogLevel.Trace, true, true, true, string.Empty);
            var target = new DataContext(Settings.Default.Connection, new DriversEducationMappings(), logger);

            //act
            var firstDriver = new Driver("Devlin", "Liles");
            target.Add(firstDriver);
            target.Add(new Driver("Tim", "Rayburn"));
            target.Add(new Driver("Jay", "Smith"));
            target.Add(new Driver("Brian", "Sullivan"));
            target.Add(new Driver("Cori", "Drew"));

            target.Commit();

            target.Reload(firstDriver);

            foreach (var driver in target.AsQueryable<Driver>())
            {
                target.Remove(driver);
            }


            target.Commit();

            target.ExecuteSqlQuery<Driver>("Select * from Drivers Where LastName = @lastName",
                new DbParameter[] {new SqlParameter("lastName", "Liles")});

            //assert
            //Assert.Inconclusive("We fail here to get the output from console nice and easy");
        }
Exemplo n.º 19
0
        private static void InsertDriver(DSModel db, KeyBinder key, DriverModel model)
        {
            Driver poco = new Driver();
            if (model.DriverCode == string.Empty)
                poco.DriverCode = "D" + DriverRepository.PeekDriverCode(db, "D");
            else
                poco.DriverCode = model.DriverCode;
            poco.FirstName = model.FirstName;
            poco.SecondName = model.SecondName;
            poco.LastName = model.LastName;
            poco.DateOfBirth = model.DateOfBirth;
            poco.DateOfHire = model.DateOfHire;
            poco.CellPhone = model.CellPhone;
            poco.EmergencyPhone = model.EmergencyPhone;
            poco.Email = model.Email;
            poco.PayRateOverride = model.PayRateOverride;
            poco.IsEnabled = model.IsEnabled;
            foreach (var l in model.Locations)
            {
                poco.LocationsDrivers.Add(
                    new LocationsDriver()
                    {
                        LocationID = l.LocationID,
                        Driver = poco,
                        TravelPay = l.TravelPay
                    });
                key.AddKey(poco, l, poco.GetName(p => p.DriverID));
            }
            db.Add(poco);

            key.AddKey(poco, model, poco.GetName(p => p.DriverID));
        }
Exemplo n.º 20
0
        private int route; // Маршрут

        #endregion Fields

        #region Constructors

        // Конструктор по умолчанию класса Transport
        public Transport()
        {
            number = null;
            route = 0;
            model = null;
            driver = null;
        }
Exemplo n.º 21
0
 internal bool isCarsDriver(Driver driver, DateTime date)
 {
     if ((date >= DateTime.Today) && (dateEnd == DateTime.Today))
         return driver.ID == Driver.ID && date >= dateBegin;
     else
         return driver.ID == Driver.ID && date >= dateBegin && date < dateEnd;
 }
Exemplo n.º 22
0
 static void Main(string[] args)
 {
     Car car = new Car("Lada", "D") { Color = Color.DarkMagenta };
     try
     {
         Console.WriteLine(car.CarPassport.Owner.Name);
     }
     catch (NullReferenceException)
     {
         Console.WriteLine("Нет имени владельца");
     }
     Driver driver = new Driver(new DateTime(1990, 10, 10), "Вольдемар") { Category = "BC" };
     try
     {
         car.ChangeOwner(driver, "о777оо");
     }
     catch (CarException carException)
     {
         Console.WriteLine(carException.Message);
     }
     driver.Category = driver.Category.Insert(2, "D");
     car.ChangeOwner(driver, "о777оо");
     Console.WriteLine(driver.Car.CarNumber);
     Console.WriteLine(car.CarPassport.Owner.Name);
     Console.ReadKey();
 }
 public void Edit(Driver entity)
 {
     _context.Drivers.Attach(entity);
     var entry = _context.Entry(entity);
     entry.State = EntityState.Modified;
     _context.SaveChanges();
 }
Exemplo n.º 24
0
        static void Main(string[] args)
        {
            var firstCar = new Car("Лада", 'D')
            {
                Color = Color.BlueViolet
            };
            Console.WriteLine("Приобретена машина {0}, " +
                  "категории: {1}, цвет: {2}",
                  firstCar.Model, firstCar.Category, firstCar.Color);
            try
            {
                Console.WriteLine("Имя владельца: " + firstCar.CarPassport.Owner.Name);
            }
            catch (Exception)
            {
                Console.WriteLine("Ошибка! У владельца отсутствует имя");
            }

            var firstDriver = new Driver(new DateTime(2014, 7, 15), "Вольдемар")
            {
                Category = new [] {'B', 'C'}
            };

            firstCar.ChangeOwner(firstDriver, "oo777o");
            firstDriver.Category = new [] {'B','C','D'};
            firstCar.ChangeOwner(firstDriver, "oo777o");
            Console.WriteLine("Номер машины: " + firstCar.CarNumber);
            Console.WriteLine("Имя водителя Лады: " + firstDriver.Name);
            Console.ReadKey();
        }
Exemplo n.º 25
0
 private void btnEndAdd_Click(object sender, EventArgs e)
 {
     Form1 mainForm = this.Owner as Form1;
     if (rbTransport.Checked)
     {
         if (tbTNumber.Text != "" && tbTRoute.Text != "" && tbTModel.Text != "")
         {
             try
             {
                 Transport currTransport = new Transport(tbTNumber.Text, Convert.ToInt32(tbTRoute.Text), tbTModel.Text);
                 mainForm.transports.Add(currTransport); // Добавления нового транспортного средства в основной список
                 this.Close();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
         else
             MessageBox.Show("Все поля обязательны для заполнения");
     }
     else if (rbDriver.Checked)
     {
         if (tbDFio.Text != "" && tbDCategory.Text != "")
         {
             try
             {
                 Driver currDriver = new Driver(tbDFio.Text, tbDCategory.Text);
                 mainForm.drivers.Add(currDriver); // Добавления нового водителя в основной список
                 this.Close();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
         else
             MessageBox.Show("Все поля обязательны для заполнения");
     }
     else if (rbCompany.Checked)
     {
         if (tbCName.Text != "")
         {
             try
             {
                 Company currCompany = new Company(tbCName.Text);
                 mainForm.companies.Add(currCompany);
                 this.Close();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message);
             }
         }
         else
             MessageBox.Show("Все поля обязательны для заполнения");
     }
     else
         MessageBox.Show("Выберите режим добавления");
 }
Exemplo n.º 26
0
        public override void Setup(Driver driver)
        {
            base.Setup(driver);

            driver.Options.OutputNamespace = "CommonTest";
            driver.Options.UnityBuild = true;
        }
Exemplo n.º 27
0
 public MarshalContext(Driver driver)
 {
     Driver = driver;
     SupportBefore = new TextGenerator();
     Return = new TextGenerator();
     MarshalVarPrefix = string.Empty;
 }
Exemplo n.º 28
0
        public Program()
        {
            driver = new Driver();

            try
            {
                settings = Config.ReadConfig(settingsPath);
            }
            catch (Exception ex)
            {
                Output("Initalization failed: " + ex.Message);
                throw;
            }

            driver.Initalize(settings);
            if (!driver.IsInitalized)
            {
                return;
            }

            driver.OnOutput = Output;
            driver.OnPlayerCountChange = null;
            driver.OnCompletion = null;
            driver.Start();

            while (driver.IsRunning)
            {
                Thread.Sleep(10);
            }
        }
Exemplo n.º 29
0
        public virtual void Setup(Driver driver)
        {
            var options = driver.Options;
            options.LibraryName = name;
            options.GeneratorKind = kind;
            options.OutputDir = Path.Combine(GetOutputDirectory(), "gen", name);
            options.SharedLibraryName = name + ".Native";
            options.Quiet = true;
            options.IgnoreParseWarnings = true;

            driver.Diagnostics.Message("");
            driver.Diagnostics.Message("Generating bindings for {0} ({1})",
                options.LibraryName, options.GeneratorKind.ToString());

            // Workaround for CLR which does not check for .dll if the
            // name already has a dot.
            if (!Platform.IsMono)
                options.SharedLibraryName += ".dll";

            var parserOptions = driver.ParserOptions;
            if (Platform.IsMacOS)
                parserOptions.TargetTriple = Environment.Is64BitProcess ? "x86_64-apple-darwin" : "i686-apple-darwin";

            var path = Path.GetFullPath(GetTestsDirectory(name));
            parserOptions.AddIncludeDirs(path);

            driver.Diagnostics.Message("Looking for tests in: {0}", path);
            var files = Directory.EnumerateFiles(path, "*.h");
            foreach (var file in files)
                options.Headers.Add(Path.GetFileName(file));
        }
Exemplo n.º 30
0
 public CSharpMarshalContext(Driver driver)
     : base(driver)
 {
     Kind = CSharpMarshalKind.Unknown;
     ArgumentPrefix = new TextGenerator();
     Cleanup = new TextGenerator();
 }
Exemplo n.º 31
0
 public SearchResults(Driver driver)
 {
     _driver = driver;
 }
Exemplo n.º 32
0
 public void NoElementFoundWithJQuery()
 {
     Driver.FindElement((By)By.jQuery(".no-such-element"));
 }
Exemplo n.º 33
0
 public DropdownMenu GetActionsDropdown()
 {
     Driver.WaitForAjax();
     return(new DropdownMenu(Driver, Row));
 }
Exemplo n.º 34
0
 public void NoJQueryOnPageThrows()
 {
     Driver.FindElement((By)By.jQuery(".root-marker"));
 }
Exemplo n.º 35
0
 public SearchResultsSection(Driver driver)
 {
     _driver = driver;
 }
Exemplo n.º 36
0
 public void GoToInvoiceCheckout(string invoiceId)
 {
     Driver.FindElement(By.Id("StoreNav-Invoices")).Click();
     Driver.FindElement(By.Id($"invoice-checkout-{invoiceId}")).Click();
     CheckForJSErrors();
 }
Exemplo n.º 37
0
 public string CanRetrieveElementBySelectorWithJQuery(string selector)
 {
     return(Driver.FindElement((By)By.jQuery(selector)).Text);
 }
Exemplo n.º 38
0
 public void Login(string user, string password)
 {
     Driver.FindElement(By.Id("Email")).SendKeys(user);
     Driver.FindElement(By.Id("Password")).SendKeys(password);
     Driver.FindElement(By.Id("LoginButton")).Click();
 }
Exemplo n.º 39
0
 public void GoToUrl(string relativeUrl)
 {
     Driver.Navigate().GoToUrl(new Uri(ServerUri, relativeUrl));
 }
Exemplo n.º 40
0
 public void GoToHome()
 {
     Driver.Navigate().GoToUrl(ServerUri);
 }
Exemplo n.º 41
0
 public void SelectStoreContext(string storeId)
 {
     Driver.FindElement(By.Id("StoreSelectorToggle")).Click();
     Driver.FindElement(By.Id($"StoreSelectorMenuItem-{storeId}")).Click();
 }
Exemplo n.º 42
0
        public void GivenIUpdateMyStartPointToWithTheFollowingInformation(string startPoint, Table startPointInformation)
        {
            var startPointInformatonDT = TableHandling.ConvertGherkinTableToDataTable(startPointInformation);

            // Select start point
            switch (startPoint)
            {
            case "foundations":
            {
                // Select the foundations level
                Driver.FindElement(By.CssSelector("button[value=\"foundations\"]")).Click();
                Driver.WaitUntilPageIsReady();

                var diploma         = TableHandling.getDataTableColumnValues(startPointInformatonDT, "High School Diploma");
                var math            = TableHandling.getDataTableColumnValues(startPointInformatonDT, "Basic Math Skills");
                var computerSkills  = TableHandling.getDataTableColumnValues(startPointInformatonDT, "Basic Computer Skills");
                var laptopOwnership = TableHandling.getDataTableColumnValues(startPointInformatonDT, "Laptop Ownership");

                // Select the basic foundations options
                var checkBoxes              = Driver.FindElements(By.CssSelector("input[id=\"completed_milestone_ids_\"]"));
                var diplomaCheckBox         = checkBoxes[0];
                var mathCheckBox            = checkBoxes[1];
                var computerSkillsCheckBox  = checkBoxes[2];
                var laptopOwnershipCheckBox = checkBoxes[3];

                if (diploma[0] == "Yes")
                {
                    diplomaCheckBox.Click();
                }
                if (math[0] == "Yes")
                {
                    mathCheckBox.Click();
                }
                if (computerSkills[0] == "Yes")
                {
                    computerSkillsCheckBox.Click();
                }
                if (laptopOwnership[0] == "Yes")
                {
                    laptopOwnershipCheckBox.Click();
                }

                break;
            }

            case "experience":
            {
                // etc.
                break;
            }

            case "apply":
            {
                // etc.
                break;
            }

            case "default":
            {
                // etc.
                break;
            }
            }

            Driver.FindElement(By.CssSelector("input[value=\"Continue\"]")).Click();
            Driver.WaitUntilPageIsReady();
            Assert.AreEqual("https://www.launchcode.org/pathways/seekers/dashboard", Driver.Url);
        }
Exemplo n.º 43
0
 public void Logout()
 {
     Driver.FindElement(By.Id("Nav-Account")).Click();
     Driver.FindElement(By.Id("Nav-Logout")).Click();
 }
Exemplo n.º 44
0
 public void GivenIAmOnTheLaunchCodeWebsite()
 {
     // Navigate to the LaunchCode website
     Driver.Navigate().GoToUrl("https://launchcode.org");
     Driver.WaitUntilPageIsReady();
 }
Exemplo n.º 45
0
 public void GoToRegister()
 {
     Driver.Navigate().GoToUrl(Link("/register"));
 }