public override void BuildButtons() { _pcTemplate = new PlayingCardTemplate(); _tcTemplate = new TextCardTemplate(); var positions = new List <Tuple <int, int> >(); for (int x = 0; x < _cardCount; x++) { for (int y = 0; y < _cardCount; y++) { positions.Add(new Tuple <int, int>(x, y)); } } lock (_syncLock) { positions = positions.OrderBy(p => _rnd.Next()).ToList(); } for (int i = 0; i < positions.Count; i += 2) { Card card = CreateRandomCard(positions[i]); Card cardClone = card.CreateComparable(); cardClone.X = positions[i + 1].Item1; cardClone.Y = positions[i + 1].Item2; controls.Add(new CardButton(card)); controls.Add(new CardButton(cardClone)); } }
static void Main(string[] args) { Console.WriteLine("Start"); // Creational Patterns FactoryMethod.Run(); AbstractFactory.Run(); Prototype.Run(); Builder.Run(); Singleton.Run(); // Behavioral Patterns Strategy.Run(); Observer.Run(); Command.Run(); TemplateMethod.Run(); Iterator.Run(); State.Run(); //ChainOfResponsibility.Run(); //Interpreter.Run(); MediatorExample.Run(); Memento.Run(); Visitor.Run(); // Structural Decorator.Run(); Adapter.Run(); Facade.Run(); Composite.Run(); Bridge.Run(); Flyweight.Run(); Console.WriteLine("\r\nFinish"); }
public List <dtoSelectRatingSet> RatingSetGetAvailable(long idMethod, Int32 idLanguage, Int32 idDefaultLanguage) { List <dtoSelectRatingSet> items = null; try { TemplateMethod method = Manager.Get <TemplateMethod>(idMethod); if (method != null) { List <dtoSelectRatingSet> sets = (from s in Manager.GetIQ <TemplateRatingSet>() where s.Deleted == BaseStatusDeleted.None select s).ToList().Select(s => dtoSelectRatingSet.Create(s, idLanguage, idDefaultLanguage)).ToList(); if (sets != null && sets.Any()) { if (sets.Any(s => s.OnlyForAlgorithm == method.Type && s.IsFuzzy == method.IsFuzzy)) { items = sets.Where(s => s.OnlyForAlgorithm == method.Type && s.IsFuzzy == method.IsFuzzy).Select(s => s.Copy(method.Id)).ToList(); } else { items = sets.Where(s => (s.OnlyForAlgorithm == AlgorithmType.none && s.IsFuzzy == method.IsFuzzy)).Select(s => s.Copy(method.Id)).ToList(); } } } } catch (Exception ex) { items = null; } return(items); }
static void Main(string[] args) { //GenerativePatterns FactoryMethod.Run(); AbstractFactory.Run(); Singleton.Run(); LazySingleton.Run(); Prototype.Run(); Builder.Run(); //BehaviorPatterns Strategy.Run(); Observer.Run(); Command.Run(); TemplateMethod.Run(); Iterator.Run(); State.Run(); ChainOfResponsibility.Run(); Interpreter.Run(); Mediator.Run(); Memento.Run(); Visitor.Run(); //StructuralPatterns Decorator.Run(); Adapter.Run(); Facade.Run(); Composite.Run(); Proxy.Run(); Bridge.Run(); Flyweight.Run(); Console.ReadKey(); }
internal AnimatedEvent( Engine engine, UInt64 idRundownEvent, UInt64 idEventBinding, VideoLayer videoLayer, TStartType startType, TPlayState playState, DateTime scheduledTime, TimeSpan duration, TimeSpan scheduledDelay, Guid mediaGuid, string eventName, DateTime startTime, bool isEnabled, IDictionary <string, string> fields, TemplateMethod method, int templateLayer ) : base( engine, idRundownEvent, idEventBinding, videoLayer, TEventType.Animation, startType, playState, scheduledTime, duration, scheduledDelay, TimeSpan.Zero, mediaGuid, eventName, startTime, TimeSpan.Zero, null, TimeSpan.Zero, TimeSpan.Zero, TTransitionType.Cut, TEasing.None, 0, 0, string.Empty, isEnabled, false, false, AutoStartFlags.None, false, 0, 0, 0 ) { _fields = new SimpleDictionary <string, string>(fields); _fields.DictionaryOperation += _fields_DictionaryOperation; _method = method; _templateLayer = templateLayer; }
static void Main(string[] args) { Console.WriteLine("--------------------------AbstractFactory----------------------------"); AbstractFactory.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------Singleton----------------------------"); Singleton.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------Builder----------------------------"); BuilderExampleTest.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------Adapter----------------------------"); Adapter.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------Decorator----------------------------"); Decorator.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------Strategy----------------------------"); Strategy.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------TemplateMethod----------------------------"); TemplateMethod.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.WriteLine("--------------------------Visitor----------------------------"); Visitor.Run(); Console.WriteLine("--------------------------END----------------------------"); Console.WriteLine(); Console.ReadLine(); }
public dtoSelectMethod MethodGetAvailable(long idMethod, Int32 idLanguage, Int32 idDefaultLanguage) { dtoSelectMethod method = null; try { TemplateMethod tMethod = (from m in Manager.GetIQ <TemplateMethod>() where m.Id == idMethod select m).Skip(0).Take(1).ToList().FirstOrDefault(); if (tMethod != null) { List <dtoSelectRatingSet> sets = (from s in Manager.GetIQ <TemplateRatingSet>() where s.Deleted == BaseStatusDeleted.None select s).ToList().Select(s => dtoSelectRatingSet.Create(s, idLanguage, idDefaultLanguage)).ToList(); method = dtoSelectMethod.Create(tMethod, sets, idLanguage, idDefaultLanguage); } } catch (Exception ex) { method = null; } return(method); }
public IEvent CreateNewEvent( ulong idRundownEvent = 0, ulong idEventBinding = 0, VideoLayer videoLayer = VideoLayer.None, TEventType eventType = TEventType.Rundown, TStartType startType = TStartType.None, TPlayState playState = TPlayState.Scheduled, DateTime scheduledTime = default(DateTime), TimeSpan duration = default(TimeSpan), TimeSpan scheduledDelay = default(TimeSpan), TimeSpan scheduledTC = default(TimeSpan), Guid mediaGuid = default(Guid), string eventName = "", DateTime startTime = default(DateTime), TimeSpan startTC = default(TimeSpan), TimeSpan?requestedStartTime = null, TimeSpan transitionTime = default(TimeSpan), TimeSpan transitionPauseTime = default(TimeSpan), TTransitionType transitionType = TTransitionType.Cut, TEasing transitionEasing = TEasing.Linear, double?audioVolume = null, ulong idProgramme = 0, string idAux = "", bool isEnabled = true, bool isHold = false, bool isLoop = false, bool isCGEnabled = false, byte crawl = 0, byte logo = 0, byte parental = 0, AutoStartFlags autoStartFlags = AutoStartFlags.None, string command = null, IDictionary <string, string> fields = null, TemplateMethod method = TemplateMethod.Add, int templateLayer = -1 ) { return(Query <Event>(parameters: new object[] { idRundownEvent, idEventBinding, videoLayer, eventType, startType, playState, scheduledTime, duration, scheduledDelay, scheduledTC, mediaGuid, eventName, startTime, startTC, requestedStartTime, transitionTime, transitionPauseTime, transitionType, transitionEasing, audioVolume, idProgramme, idAux, isEnabled, isHold, isLoop, isCGEnabled, crawl, logo, parental, autoStartFlags, command, fields, method, templateLayer })); }
static void Main(string[] args) { // Strategy パターン //Strategy.StrategyPattern(args); // Observer パターン //Observer.ObserverPattern(args); // Flyweight パターン //Flyweight.FlyweightPattern(args); // Proxy パターン Proxy.ProxyMain(); Adapter.AdapterMain(); TemplateMethod.TemplateMethodMain(); FactoryMethod.FactoryMethodMain(); Prototype.PrototypeMain(); }
public void TestExample() { var t = new TemplateMethod(); t.TemplateMethod(() => Console.WriteLine("hello"), () => Console.WriteLine("world")); }
static void Main(string[] args) { //SingletonPattern.Test(); //FactoryMethod.Test(); TemplateMethod.Test(); }
public virtual Object GetList() { this._templateMethod = new GetListMethod <T>(this._dbDao); return(this._templateMethod.Run(this)); }
public virtual Object Delete() { this._templateMethod = new DeleteMethod(this._dbDao); return(this._templateMethod.Run(this)); }
public virtual Object Insert() { this._templateMethod = new InsertMethod(this._dbDao); return(this._templateMethod.Run(this)); }
public Boolean MethodIsFuzzy(long idMethod) { TemplateMethod m = MethodGet(idMethod); return(m != null && m.IsFuzzy); }