Exemple #1
0
 private static void Main(string[] args)
 {
     IGraphicInterface adapter = new TextAdapterObject();
     adapter.Draw();
     IGraphicInterface classAdapter = new TextAdapterClass();
     classAdapter.SetPosition(0, 1);
     StructuralPatterns.Adapter.PluggableAdapter.AbstractMethods.TreeDisplay tree = new DirectoryTreeDisplay();
     tree.Display();
     StructuralPatterns.Adapter.PluggableAdapter.DelegateObject.TreeDisplay treeDelegate = new StructuralPatterns.Adapter.PluggableAdapter.DelegateObject.TreeDisplay();
     treeDelegate.SetDelegate(new DirectoryBrowser());
     treeDelegate.Display();
     tree.Display();
     IComponent element = new ConcreteDecorator(new ConcreteComponent());
     element.Display();
     View view = View.LargeIcon;
     new ApplicationWindow(view).DrawContents();
     new IconWindow(view).SetOrigin(new Point(10, 20));
     Console.WriteLine(Environment.NewLine + "Flyweight");
     GlyphContext gc = new GlyphContext();
     Font times12 = new Font("Times New Roman", 12f);
     Font timesItalic12 = new Font(times12, FontStyle.Italic);
     gc.SetFont(times12, 6);
     gc.Insert(6);
     gc.SetFont(timesItalic12, 6);
     GlyphFactory factory = new GlyphFactory();
     Row row = factory.CreateRow();
     Charachter n = factory.CreateCharacter('n');
     row.Insert(n, gc);
     row.Insert(n, gc);
     row.Draw(View.LargeIcon, gc);
     Console.WriteLine("End Flyweight" + Environment.NewLine);
     new Compiler().Compile(new FileStream("facade.txt", FileMode.OpenOrCreate), new BytecodeStream());
 }
Exemple #2
0
 public override void Draw(View view, GlyphContext context)
 {
     Console.WriteLine(string.Format("Draw {0} symbol with font {1}", this.charCode, context.GetFont()));
 }
Exemple #3
0
 public void Remove(GlyphContext context)
 {
 }
Exemple #4
0
 public virtual void SetFont(Font font, GlyphContext context)
 {
     context.SetFont(font, 1);
 }
Exemple #5
0
 public virtual bool IsDone(GlyphContext context)
 {
     return true;
 }
Exemple #6
0
 public virtual void Next(GlyphContext context)
 {
     context.Next(1);
 }
Exemple #7
0
 public void Insert(Glyph glyph, GlyphContext context)
 {
     context.Insert(1);
 }
Exemple #8
0
 public virtual Font GetFont(GlyphContext context)
 {
     return context.GetFont();
 }
Exemple #9
0
 public virtual void First(GlyphContext context)
 {
 }
Exemple #10
0
 public virtual void Draw(View view, GlyphContext context)
 {
     Console.WriteLine(string.Format("Draw glyph with font {0}", context.GetFont()));
 }
Exemple #11
0
 public virtual Glyph Current(GlyphContext context)
 {
     return this;
 }