本文整理汇总了C#中Driver类的典型用法代码示例。如果您正苦于以下问题:C# Driver类的具体用法?C# Driver怎么用?C# Driver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Driver类属于命名空间,在下文中一共展示了Driver类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MarshalContext
public MarshalContext(Driver driver)
{
Driver = driver;
SupportBefore = new TextGenerator();
Return = new TextGenerator();
MarshalVarPrefix = string.Empty;
}
示例2: LearnAndTransmitACode
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()));
}
}
示例3: SetupPasses
public override void SetupPasses(Driver driver)
{
driver.Options.GenerateInterfacesForMultipleInheritance = true;
driver.Options.GenerateProperties = true;
driver.Options.GenerateVirtualTables = true;
driver.TranslationUnitPasses.AddPass(new TestAttributesPass());
}
示例4: Main
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();
}
示例5: SetupPasses
public override void SetupPasses(Driver driver)
{
driver.Options.GenerateCopyConstructors = true;
driver.Options.MarshalCharAsManagedChar = true;
driver.Options.GenerateProperties = true;
driver.Options.GenerateConversionOperators = true;
}
示例6: Setup
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));
}
示例7: Add
public void Add(Driver driver)
{
if (_list.Exists(item => item == driver))
return;
_list.Add(driver);
}
示例8: SetupPasses
public override void SetupPasses(Driver driver)
{
driver.Options.MarshalCharAsManagedChar = true;
driver.Options.GenerateProperties = true;
driver.Options.GenerateConversionOperators = true;
driver.Options.GenerateDefaultValuesForArguments = true;
}
示例9: Car
public Car(string name, int numberOfOccupant, string model, Driver driver)
{
Name = name;
NumberOfOccupant = numberOfOccupant;
Model = model;
Driver = driver;
}
示例10: Main
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();
}
示例11: isCarsDriver
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;
}
示例12: Edit
public void Edit(Driver entity)
{
_context.Drivers.Attach(entity);
var entry = _context.Entry(entity);
entry.State = EntityState.Modified;
_context.SaveChanges();
}
示例13: btnEndAdd_Click
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("Выберите режим добавления");
}
示例14: Setup
public override void Setup(Driver driver)
{
base.Setup(driver);
driver.Options.OutputNamespace = "CommonTest";
driver.Options.UnityBuild = true;
}
示例15: Main
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();
}