static void BirthdayParty() { //Birthday birthday = new Birthday(); //birthday.Venue = "Disneyland"; //string venue = birthday.Venue; Console.WriteLine(venue); TwentyOnePlus top = new TwentyOnePlus(); //Party party = new Party(); Party party = new TwentyOnePlus(); Quack quack = new Quack(); top.Goober(quack); // an array of parties // top is a 21+ Birthdya party // quack is a football party Party[] parties = { top, quack }; for (int i = 0; i < parties.Length; i++) { if (parties[i] is Football) { // Do something } else if (parties[i] is Birthday) { } } }
public void SaveQuack(Quack quack) { quack.CreatedDate = DateTime.Now; quack.LastModifiedDate = DateTime.Now; quack.Active = true; var quackType = _quackTypeRepository.GetQuackByQuackType(quack.QuackTypeID); quack.QuackType = quackType; var user = _userRepository.GetUserById(quack.UserID); quack.User = user; if (!String.IsNullOrEmpty(quack.QuackContent.ImageUrl)) { var img = quack.QuackContent.ImageUrl; quack.QuackContent.ImageUrl = "Y"; var currentImage = img.Substring(img.IndexOf(',') + 1); var data = Convert.FromBase64String(currentImage); quack.QuackContent.Image = data; } quack.QuackContent.CreatedDate = DateTime.Now; _quackRepository.SaveQuack(quack); if (quack.ConversationID != 0) { _quackRepository.UpdateQuack(quack.ConversationID); } }
public static void Main(string[] args) { //A DEPENDENCY INJECTOR OR FACTORY SHOULD REPLACE ALL THIS DECLARATIONS IFlyBehavior canFly = new FlyWithWings(); IFlyBehavior cantFly = new FlyNoWay(); IQuackBehavior quack = new Quack(); IQuackBehavior squeack = new Squeack(); IQuackBehavior mute = new MuteQuack(); List <Duck> ducks = new List <Duck>(); Duck mallardDuck = new MallardDuck(canFly, quack); Duck redHeadDuck = new RedHeadDuck(canFly, quack); Duck decoyDuck = new DecoyDuck(cantFly, mute); Duck rubberDuck = new RubberDuck(cantFly, squeack); ducks.Add(mallardDuck); ducks.Add(redHeadDuck); ducks.Add(decoyDuck); ducks.Add(rubberDuck); //NOW WE WILL MAKE OUR DUCKS DISPLAY FLY AND QUACK foreach (Duck duck in ducks) { duck.Display(); duck.PerformFly(); duck.PerformQuack(); Console.WriteLine("---------------"); } Console.ReadLine(); }
public void PushWork(WorkItem workItem) { if (_firstWorkItem == null) { _firstWorkItem = workItem; } else { if (_workItemQueue == null) { _workItemQueue = new Quack <WorkItem>(); } _workItemQueue.PushFront(_firstWorkItem); _firstWorkItem = workItem; } // To avoid the virt call on EVERY work item we check // the Verbose flag. All of our Schedule traces are // verbose. if (Microsoft.CoreWf.Internals.FxTrace.ShouldTraceVerboseToTraceSource) { workItem.TraceScheduled(); } }
public void PushWork(WorkItem workItem) { if (this.firstWorkItem == null) { this.firstWorkItem = workItem; } else { if (this.workItemQueue == null) { this.workItemQueue = new Quack <WorkItem>(); } this.workItemQueue.PushFront(this.firstWorkItem); this.firstWorkItem = workItem; } // To avoid the virt call on EVERY work item we check // the Verbose flag. All of our Schedule traces are // verbose. if (FxTrace.ShouldTraceVerboseToTraceSource) { workItem.TraceScheduled(); } }
public MallardDuck() { // 呱呱叫 QuackBehavior = new Quack(); // 有翅膀飞行 FlyBehavior = new FlyWithWings(); }
public ActionResult DeleteConfirmed(int id) { Quack quack = db.Quacks.Find(id); db.Quacks.Remove(quack); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Quack_Id,Quack_Title,Date_Created,Quack_Text")] Quack quack) { if (ModelState.IsValid) { db.Entry(quack).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(quack)); }
public static ulong[] Quack2MachineCode(Quack <AIMouvementCommand> quack) { ulong[] res = new ulong[quack.Count]; for (uint i = 0u; i < quack.Count; i++) { res [i] = quack [i].ToCode(); } return(res); }
// GET: Quacks/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Quack quack = db.Quacks.Find(id); if (quack == null) { return(HttpNotFound()); } return(View(quack)); }
public void TypeDuck(Label a, Label b, Label c, PictureBox pic) { IQuack quack; Ivolar ivolar; quack = new Quack(); ivolar = new Flyaway(); Swim s = new Swim(); a.Text = quack.TypeQuack(); b.Text = ivolar.Comportamiento(); c.Text = s.S(); quack.Typesound(); pic.Image = Properties.Resources.redhead; }
public ActionResult Create([Bind(Include = "Quack_Id,Quack_Title,Date_Created,Quack_Text")] Quack quack) { var userId = User.Identity.GetUserId(); quack.UserId = userId; if (ModelState.IsValid) { db.Quacks.Add(quack); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(quack)); }
public void TypeDuck(Label a, Label b, Label c, PictureBox pic) { Ivolar ivolar; IQuack quack; Swim s = new Swim(); ivolar = new Flyaway(); quack = new Quack(); a.Text = ivolar.Comportamiento(); b.Text = quack.TypeQuack(); c.Text = s.S(); quack.Typesound(); PMallard d = new PMallard(); d.p(pic); }
public void ClearAllWorkItems(ActivityExecutor executor) { if (this.firstWorkItem != null) { this.firstWorkItem.Release(executor); this.firstWorkItem = null; if (this.workItemQueue != null) { while (this.workItemQueue.Count > 0) { this.workItemQueue.Dequeue().Release(executor); } } } this.workItemQueue = null; }
public void ClearAllWorkItems(ActivityExecutor executor) { if (this.firstWorkItem != null) { this.firstWorkItem.Release(executor); this.firstWorkItem = null; if (this.workItemQueue != null) { while (this.workItemQueue.Count > 0) { this.workItemQueue.Dequeue().Release(executor); } } } this.workItemQueue = null; }
public void EnqueueWork(System.Activities.Runtime.WorkItem workItem) { if (this.firstWorkItem == null) { this.firstWorkItem = workItem; } else { if (this.workItemQueue == null) { this.workItemQueue = new Quack <System.Activities.Runtime.WorkItem>(); } this.workItemQueue.Enqueue(workItem); } if (FxTrace.ShouldTraceVerboseToTraceSource) { workItem.TraceScheduled(); } }
public void EnqueueWork(System.Activities.Runtime.WorkItem workItem) { if (this.firstWorkItem == null) { this.firstWorkItem = workItem; } else { if (this.workItemQueue == null) { this.workItemQueue = new Quack<System.Activities.Runtime.WorkItem>(); } this.workItemQueue.Enqueue(workItem); } if (FxTrace.ShouldTraceVerboseToTraceSource) { workItem.TraceScheduled(); } }
private QuackDto QuackMapper(Quack quack, int userId = 0) { return(new QuackDto { Id = quack.ID, Likes = quack.QuackLikes.Count(q => q.Active), Message = quack.QuackContent.MessageText, TimeSpan = GetTimeSpanInformation(quack.LastModifiedDate), UserName = quack.User.UserName, UserImage = quack.User.ProfileImage, UserId = quack.User.ID, LikeOrUnlike = VerifyLikeOrUnLike(quack, userId), IsNew = quack.QuackTypeID == 1 ? true : false, UserNickName = quack.User.UserName.Replace("DS\\", ""), ConversationId = quack.ConversationID, UserDisplayName = quack.User.FirstName + " " + quack.User.LastName, LatestReply = GetRepliesInformation(quack.ID), QuackImage = quack.QuackContent.Image }); }
public void EnqueueWork(WorkItem workItem) { if (_firstWorkItem == null) { _firstWorkItem = workItem; } else { if (_workItemQueue == null) { _workItemQueue = new Quack <WorkItem>(); } _workItemQueue.Enqueue(workItem); } if (Microsoft.CoreWf.Internals.FxTrace.ShouldTraceVerboseToTraceSource) { workItem.TraceScheduled(); } }
public void ClearAllWorkItems(ActivityExecutor executor) { if (this.firstWorkItem != null) { this.firstWorkItem.Release(executor); this.firstWorkItem = null; if (this.workItemQueue != null) { while (this.workItemQueue.Count > 0) { WorkItem item = this.workItemQueue.Dequeue(); item.Release(executor); } } } Fx.Assert(this.workItemQueue == null || this.workItemQueue.Count == 0, "We either didn't have a first work item and therefore don't have anything in the queue, or we drained the queue."); // For consistency we set this to null even if it is empty this.workItemQueue = null; }
protected void valueRemember(string what) { RegistryKey rk = Application.UserAppDataRegistry.CreateSubKey(myID()); #if USER_READABLE ///send the recent list back for (i = maxRecent - 1; i > 1; i--) { found = rk.GetValue(recentPrefix + i); if (found != null) { rk.SetValue(recentPrefix + (i + 1), found); } } rk.SetValue(recentPrefix + 0, what); #else object s = ApplicationHelper.getSetting(@"recent", myID()); if (!(s is Quack)) { s = new Quack(); } if (((Quack)s).Contains(what)) { ((Quack)s).Remove(what); } while (((Quack)s).Count >= maxRecent) { ((Quack)s).Dequeue(); } ((Quack)s).Enqueue(what); ApplicationHelper.storeSetting(@"recent", myID(), s); //rk.SetValue(recentPrefix + "list", s); #endif }
public RubberDuck() { flyBehaviour = new CantFly(); quackBehaviour = new Quack(); }
public HttpResponseMessage Post(Quack quack) { _quackFacade.SaveQuack(quack); return(Request.CreateResponse(HttpStatusCode.Created, "true")); }
public RedheadDuck() { QuackBehavior = new Quack(); FlyBehavior = new FlyWithWings(); }
public void ClearAllWorkItems(ActivityExecutor executor) { if (this.firstWorkItem != null) { this.firstWorkItem.Release(executor); this.firstWorkItem = null; if (this.workItemQueue != null) { while (this.workItemQueue.Count > 0) { WorkItem item = this.workItemQueue.Dequeue(); item.Release(executor); } } } Fx.Assert(this.workItemQueue == null || this.workItemQueue.Count == 0, "We either didn't have a first work item and therefore don't have anything in the queue, or we drained the queue."); // For consistency we set this to null even if it is empty this.workItemQueue = null; }
public ModelDuck() { _iFlyBehavior = new FlyNoWay(); _iQuackBehavior = new Quack(); }
public ReadheadDuck() { quackBehavior = new Quack(); flyBehavior = new FlyWithWings(); swimBehavior = new SwimWithPaws(); }
public ModelDuck() { quackBehavior = new Quack(); flyBehavior = new FlyNoWay(); }
public MallardDuck() { flyBehavior = new FlyWithWings(); quackBehavior = new Quack(); }
public ModelDuck() { flyBehavior = new FlyNoWay(); quackBehavior = new Quack(); }
public MallarDuck() { QuackBehavior = new Quack(); FlyBehavior = new FlyWithWings(); }
public ModelDuck() { FlyBehaviour = new FlyNoWay(); QuackBehaviour = new Quack(); }
//Mallard Duck is a real duck. Therefore it quacks and flies(For short durations) public MallardDuck() { quackBehaviour = new Quack(); flyBehaviour = new FlyWithWings(); }
public RedheadDuck() { flyBehavior = new FlyNoWay(); quackBehavior = new Quack(); }
public MallardDuck() { FlyBehavior = new FlyWithWings(); QuackBehavior = new Quack(); }
public void PushWork(WorkItem workItem) { if (this.firstWorkItem == null) { this.firstWorkItem = workItem; } else { if (this.workItemQueue == null) { this.workItemQueue = new Quack<WorkItem>(); } this.workItemQueue.PushFront(this.firstWorkItem); this.firstWorkItem = workItem; } // To avoid the virt call on EVERY work item we check // the Verbose flag. All of our Schedule traces are // verbose. if (FxTrace.ShouldTraceVerboseToTraceSource) { workItem.TraceScheduled(); } }