本文整理汇总了C#中Waiter类的典型用法代码示例。如果您正苦于以下问题:C# Waiter类的具体用法?C# Waiter怎么用?C# Waiter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Waiter类属于命名空间,在下文中一共展示了Waiter类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: WaiterInsert_Click
protected void WaiterInsert_Click(object sender, EventArgs e)
{
//inline version of using MessageUserControl
MessageUserControl.TryRun(() =>
//remainder of the code is what would have gone in the external method of
//(processRequest(MethodName)
{
Waiter item = new Waiter();
item.FirstName = FirstName.Text;
item.LastName = LastName.Text;
item.Address = Address.Text;
item.Phone = Phone.Text;
item.HireDate = DateTime.Parse(HireDate.Text);
//nullable field
if(string.IsNullOrEmpty(ReleaseDate.Text))
{
item.ReleaseDate = null;
}
else
{
item.ReleaseDate = DateTime.Parse(ReleaseDate.Text);
}
AdminController SystemManager = new AdminController();
WaiterID.Text = SystemManager.Waiters_Add(item).ToString();
MessageUserControl.ShowInfo("Waiter added");
RefreshWaiterList(WaiterID.Text);
}
);
}
开发者ID:JordanBandur,项目名称:InClassDemos,代码行数:30,代码来源:WaiterAdmin.aspx.cs
示例2: WaitThenClick
internal WaitThenClick(Driver driver, Options options, Waiter waiter, ElementFinder elementFinder)
: base(driver, options)
{
this.options = options;
this.waiter = waiter;
this.elementFinder = elementFinder;
}
开发者ID:AidenMontgomery,项目名称:coypu,代码行数:7,代码来源:WaitThenClick.cs
示例3: InsertWaiterInfo
//INSERT
public void InsertWaiterInfo()
{
//The code that exists within this method is a standard CRUD insert.
//Similar to what was learned in APPDEV 1
eRestaurantController controller = new eRestaurantController();
//Load an instance of Waiter.
Waiter insertWaiter = new Waiter();
insertWaiter.WaiterID = 0;
insertWaiter.FirstName = FirstName.Text;
insertWaiter.LastName = LastName.Text;
insertWaiter.Phone = Phone.Text;
insertWaiter.Address = Address.Text;
insertWaiter.HireDate = DateTime.Parse(HiredDate.Text);
//Check if the release date is Null/Empty
if (string.IsNullOrEmpty(ReleaseDate.Text))
{
insertWaiter.ReleaseDate = null; //This can be null becuase in the database it is set to "Nullable"
}
else
{
insertWaiter.ReleaseDate = DateTime.Parse(ReleaseDate.Text);
}
//Add waiter to the database.
controller.Waiter_Add(insertWaiter);
//Rebind the dropdown (WaiterList) so the new entry will appear in the list.
WaiterList.DataBind();
}
开发者ID:RelSavo,项目名称:Temp2,代码行数:36,代码来源:WaiterCRUD.aspx.cs
示例4: Main
public static void Main()
{
Cook joe = new Cook();
Waiter suzy = new Waiter(joe);
Customer fred = new Customer(suzy);
fred.PlaceOrder();
}
开发者ID:JnS-Software-LLC,项目名称:CSC153,代码行数:7,代码来源:QuickFood.cs
示例5: InsertWaiterInfo
public void InsertWaiterInfo()
{
//the code that exists within this method
//is a standard CRUD insert which you learned in AppDev 1
eRestaurantController controller = new eRestaurantController();
//load an instance of Waiter
Waiter item = new Waiter();
item.WaiterID = 0; //identity field on SQL therefore set to 0
item.FirstName = FirstName.Text;
item.LastName = LastName.Text;
item.Phone = Phone.Text;
item.Address = Address.Text;
item.HireDate = DateTime.Parse(HiredDate.Text);
if (string.IsNullOrEmpty(ReleaseDate.Text))
{
item.ReleaseDate = null;
}
else
{
item.ReleaseDate = DateTime.Parse(ReleaseDate.Text);
}
//call the controller's Add method for the Waiter
controller.Waiter_Add(item);
//rebind the drop down list (WaiterList) so the new
//waiter will appear in the list
WaiterList.DataBind();
}
开发者ID:kgibson5,项目名称:ClassDemos,代码行数:30,代码来源:WaiterCRUD.aspx.cs
示例6: wait
async Task<bool> wait(CancellationToken token)
{
Waiter<bool> waiter = null;
bool lockTaken = false;
try
{
spinner.Enter(ref lockTaken);
if (!this.IsLocked && this.waiters.Count == 0)
{
this.IsLocked = true;
return true;
}
waiter = new Waiter<bool>(token);
if (token != CancellationToken.None)
waiter.OnCancel += Waiter_OnCancel;
waiters.InsertAtTail(waiter);
}
finally
{
if (lockTaken)
spinner.Exit(false);
}
if (waiter == null)
return false;
bool hasLock = await waiter;
token.ThrowIfCancellationRequested();
return hasLock;
}
开发者ID:zbrad,项目名称:AsyncLib,代码行数:33,代码来源:BinarySemaphore.cs
示例7: Get
public async Task<Dictionary<string, string>> Get([FromUri] int ms)
{
//Sanitize
ms = ms > 2000 ? 1 : ms;
var waiting = new Waiter();
var stopwatch = new Stopwatch();
stopwatch.Start();
stopwatch.Restart();
waiting.DoWork(ms);
var inOrderSpan = stopwatch.Elapsed;
stopwatch.Restart();
await waiting.DoWorkAsync(ms);
var asyncSpan = stopwatch.Elapsed;
var returnDictionary = new Dictionary<string, string>
{
{"processors", Environment.ProcessorCount.ToString()},
{"inOrderSpan", inOrderSpan.ToString()},
{"asyncSpan", asyncSpan.ToString()}
};
var results = JsonConvert.SerializeObject(returnDictionary);
LogManager.GetCurrentClassLogger().Log(LogLevel.Info, results);
return returnDictionary;
}
开发者ID:adamkrieger,项目名称:ConcurrencySandbox,代码行数:30,代码来源:WaitController.cs
示例8: WaitThenClick
internal WaitThenClick(Driver driver, Options options, Waiter waiter, ElementFinder elementFinder, DisambiguationStrategy disambiguationStrategy)
: base(driver, options)
{
waitBeforeClick = options.WaitBeforeClick;
this.waiter = waiter;
this.elementFinder = elementFinder;
this.disambiguationStrategy = disambiguationStrategy;
}
开发者ID:SaintGimp,项目名称:coypu,代码行数:8,代码来源:WaitThenClick.cs
示例9: GetWaiterForCurrentThread
private static Waiter GetWaiterForCurrentThread()
{
Waiter waiter = t_waiterForCurrentThread;
if (waiter == null)
waiter = t_waiterForCurrentThread = new Waiter();
waiter.signalled = false;
return waiter;
}
开发者ID:huamichaelchen,项目名称:corert,代码行数:8,代码来源:Condition.cs
示例10: Input
internal static async Task<string> Input(ConsoleControl.ConsoleControl cons)
{
using (var waitr = new Waiter(cons))
{
await waitr.Completion.Task;
return waitr.Content;
}
}
开发者ID:peterson1,项目名称:ErrH,代码行数:8,代码来源:WaitFor.cs
示例11: AddWaitersScenerio
public void AddWaitersScenerio()
{
Waiter newGuy = new Waiter();
int waiterId = -1;
this.Given(_=>GiveWaiterInformation(newGuy))
.when(_=>WhenIAddTheWaiter(newGuy, out waitId))
.then(_=>ThenTheWaiterExists(waiterId))
.And(_=>TheWaiterDetailsMatch(waiterId, newGuy))
.BDDfy
开发者ID:Bbyrne6,项目名称:In-Class,代码行数:9,代码来源:ManageWaitersStory.cs
示例12: AssertIsNotInList
private unsafe void AssertIsNotInList(Waiter waiter)
{
Contract.Assert(waiter.next == null && waiter.prev == null);
Contract.Assert((_waitersHead == null) == (_waitersTail == null));
for (Waiter current = _waitersHead; current != null; current = current.next)
if (current == waiter)
Contract.Assert(false, "Waiter is in the waiter list, but should not be");
}
开发者ID:huamichaelchen,项目名称:corert,代码行数:9,代码来源:Condition.cs
示例13: MakeFries
public void MakeFries(Waiter waiter)
{
if (fries > 0) {
Console.WriteLine("Cook making Fries");
waiter.ServeFood("Fries");
fries--;
}
else
Console.WriteLine("Sorry -- No more Fries");
}
开发者ID:JnS-Software-LLC,项目名称:CSC153,代码行数:10,代码来源:QuickFood.cs
示例14: MakeBurger
public void MakeBurger(Waiter waiter)
{
if (burgers > 0) {
Console.WriteLine("Cook making Burger");
waiter.ServeFood("Burger");
burgers--;
}
else
Console.WriteLine("Sorry -- No more Burgers");
}
开发者ID:JnS-Software-LLC,项目名称:CSC153,代码行数:10,代码来源:QuickFood.cs
示例15: AssertIsInList
private unsafe void AssertIsInList(Waiter waiter)
{
Contract.Assert(_waitersHead != null && _waitersTail != null);
Contract.Assert((_waitersHead == waiter) == (waiter.prev == null));
Contract.Assert((_waitersTail == waiter) == (waiter.next == null));
for (Waiter current = _waitersHead; current != null; current = current.next)
if (current == waiter)
return;
Contract.Assert(false, "Waiter is not in the waiter list");
}
开发者ID:huamichaelchen,项目名称:corert,代码行数:11,代码来源:Condition.cs
示例16: CheckOrderTest
public void CheckOrderTest()
{
IMessageSource<TestMessage> source = MessageGenerator.CreateSource(TestRouterHelper.SourceName, TestRouterHelper.MessagesCountToGenerate);
var waiter = new Waiter(waitablesCount:1);
var factory = new TestRouterFactory(waiter, messages => messages.CheckOrder(TestRouterHelper.Sequence(0, TestRouterHelper.MessagesCountToGenerate)));
using(IMessageConsumer<TestMessage> consumer = factory.CreateConsumer(source))
{
consumer.Consume(TestRouterHelper.HandleMessage);
waiter.Wait(true);
}
}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:11,代码来源:MessageConsumerTest.cs
示例17: Event
internal static async Task<AutomationEventArgs> Event(
AutomationEvent eventId,
AutomationElement element = null,
TreeScope scope = TreeScope.Descendants)
{
using (var waitr = new Waiter(eventId, element, scope))
{
await waitr.Completion.Task;
return waitr.EvtArgs;
}
}
开发者ID:peterson1,项目名称:ErrH,代码行数:11,代码来源:WaitFor.cs
示例18: Test
public void Test()
{
var waiter = new Waiter();
waiter.Start();
Console.WriteLine("Waiter started");
Thread.Sleep(5000);
waiter.Stop();
Console.WriteLine("Waiter stopped");
}
开发者ID:AndreyAndreev,项目名称:Experimentarium,代码行数:12,代码来源:Volatililty.cs
示例19: SwallowExceptionTest
public void SwallowExceptionTest()
{
const int errorMessageIndex = 5;
var waiter = new Waiter(waitablesCount:1);
IMessageSource<TestMessage> source = MessageGenerator.CreateSource(TestRouterHelper.SourceName, TestRouterHelper.MessagesCountToGenerate, errorMessageIndex, swallowException:true);
var factory = new TestRouterFactory(waiter, messages => messages.CheckOrder(TestRouterHelper.SequenceExcluding(0, TestRouterHelper.MessagesCountToGenerate, errorMessageIndex)));
using (IMessageConsumer<TestMessage> consumer = factory.CreateConsumer(source))
{
consumer.Consume(TestRouterHelper.HandleMessage);
waiter.Wait(true);
}
}
开发者ID:TargetProcess,项目名称:Target-Process-Plugins,代码行数:12,代码来源:MessageConsumerTest.cs
示例20: Main
static void Main(string[] args)
{
Barbecuer boy = new Barbecuer();
Command bakeMutton1 = new BakeMuttonCommand(boy);
Command bakeMutton2 = new BakeMuttonCommand(boy);
Command bakeChickenWing = new BakeChickenWingCommand(boy);
Waiter girl = new Waiter();
girl.SetOrder(bakeMutton1);
girl.SetOrder(bakeMutton2);
girl.SetOrder(bakeChickenWing);
girl.Notify();
}
开发者ID:Jeffiy,项目名称:DesignPatterns,代码行数:13,代码来源:Program.cs
注:本文中的Waiter类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论