Advertisement
Guest User

Untitled

a guest
Nov 24th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.70 KB | None | 0 0
  1. <?xml version="1.0" encoding="utf-8" ?>
  2. <configuration>
  3.     <startup>
  4.         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
  5.     </startup>
  6. </configuration>
  7.  
  8. //////////////////////////////////////
  9.  
  10. using System;
  11. using System.Collections.Generic;
  12. using System.Linq;
  13. using System.Text;
  14. using System.Threading.Tasks;
  15.  
  16. namespace sLanCS
  17. {
  18.     interface sLanCS
  19.     {
  20.         void Show();
  21.     }
  22.  
  23.     class Client : sLanCS
  24.     {
  25.         public void Show()
  26.         {
  27.             Form3 f3 = new Form3();
  28.             f3.Show();
  29.         }
  30.     }
  31.  
  32.     class Server : sLanCS
  33.     {
  34.         public void Show()
  35.         {
  36.             Form2 f2 = new Form2();
  37.             f2.Show();
  38.         }
  39.     }
  40.    
  41.     abstract class Factory
  42.     {
  43.         public abstract sLanCS FactoryMethod(string type);
  44.     }
  45.  
  46.     class sLanCSFactory : Factory
  47.     {
  48.         public override sLanCS FactoryMethod(string type)
  49.         {
  50.             switch (type)
  51.             {
  52.                 case "Client":
  53.                     return new Client();
  54.                 case "Server":
  55.                     return new Server();
  56.                 default:
  57.                     return null;
  58.             }
  59.         }
  60.     }
  61. }
  62.  
  63.  
  64. //////////////////////////////
  65.  
  66. using System;
  67. using System.Collections.Generic;
  68. using System.Linq;
  69. using System.Text;
  70. using System.Threading.Tasks;
  71. using System.Windows.Forms;
  72.  
  73. namespace sLanCS
  74. {
  75.     class Program
  76.     {
  77.         static void Main(string[] args)
  78.         {
  79.             Application.EnableVisualStyles();
  80.             Application.SetCompatibleTextRenderingDefault(false);
  81.  
  82.             Form1 f1 = new Form1();
  83.             Application.Run(f1);
  84.         }
  85.     }
  86. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement