Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?xml version="1.0" encoding="utf-8" ?>
- <configuration>
- <startup>
- <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5.2" />
- </startup>
- </configuration>
- //////////////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace sLanCS
- {
- interface sLanCS
- {
- void Show();
- }
- class Client : sLanCS
- {
- public void Show()
- {
- Form3 f3 = new Form3();
- f3.Show();
- }
- }
- class Server : sLanCS
- {
- public void Show()
- {
- Form2 f2 = new Form2();
- f2.Show();
- }
- }
- abstract class Factory
- {
- public abstract sLanCS FactoryMethod(string type);
- }
- class sLanCSFactory : Factory
- {
- public override sLanCS FactoryMethod(string type)
- {
- switch (type)
- {
- case "Client":
- return new Client();
- case "Server":
- return new Server();
- default:
- return null;
- }
- }
- }
- }
- //////////////////////////////
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- namespace sLanCS
- {
- class Program
- {
- static void Main(string[] args)
- {
- Application.EnableVisualStyles();
- Application.SetCompatibleTextRenderingDefault(false);
- Form1 f1 = new Form1();
- Application.Run(f1);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement