Exemple #1
0
    public Form1(int id)
    {
        if (id == 0)
        {
            //KITCHEN
            Text = "Kitchen";
            InitializeComponent();
            listServer = (IManagement)RemoteNew.New(typeof(IManagement));

            items             = listServer.GetItems();
            tables            = listServer.GetTables();
            ordersPending     = listServer.GetOrdersPending(id);
            ordersPreparation = listServer.GetOrdersInPreparation(id);

            evRepeater             = new AlterEventRepeater();
            evRepeater.alterEvent += new AlterDelegate(DoAlterations);
            listServer.alterEvent += new AlterDelegate(evRepeater.Repeater);
        }
        else if (id == 1)
        {
            //BAR
            Text = "Bar";
            InitializeComponent();
            listServer = (IManagement)RemoteNew.New(typeof(IManagement));

            items             = listServer.GetItems();
            tables            = listServer.GetTables();
            ordersPending     = listServer.GetOrdersPending(id);
            ordersPreparation = listServer.GetOrdersInPreparation(id);

            evRepeater             = new AlterEventRepeater();
            evRepeater.alterEvent += new AlterDelegate(DoAlterations);
            listServer.alterEvent += new AlterDelegate(evRepeater.Repeater);
        }
    }
    void setup()
    {
        om = (IOrderManager)RemoteNew.New(typeof(IOrderManager));

        //Listen to any order that has changed
        orderRepeater = new Repeater();
        orderRepeater.orderChanged += new orderChangedDelegate(orderChangedHandler);
        om.orderChangedEvent       += new orderChangedDelegate(orderRepeater.orderChangedRepeater);

        //Listen to new kitchen orders
        orderRepeater.newOrderKitchen += new newOrderKitchenDelegate(newOrderHandler);
        om.newOrderKitchenEvent       += new newOrderKitchenDelegate(orderRepeater.newOrderKitchenRepeater);

        //Listen to new bar orders
        orderRepeater.newOrderBar += new newOrderBarDelegate(newOrderHandler);
        om.newOrderBarEvent       += new newOrderBarDelegate(orderRepeater.newOrderKitchenRepeater);

        //Listen to removed orders
        orderRepeater.tableRemoved += new tableRemovedDelegate(removedTableHandler);
        om.tableRemovedEvent       += new tableRemovedDelegate(orderRepeater.tableRemovedRepeater);

        setupTables(om.getAllOrders());
        if (Program.debug)
        {
            Console.WriteLine("Setup was made");
        }
    }
Exemple #3
0
 protected AbstractController(string remotingConfiguration)
 {
     RemotingConfiguration.Configure(remotingConfiguration, false);
     RestaurantServer = (IRestaurantSingleton)RemoteNew.New(typeof(IRestaurantSingleton));
     Orders           = RestaurantServer.GetListOfOrders();
     Products         = RestaurantServer.GetListOfProducts();
     Tables           = RestaurantServer.GetListOfTables();
 }
 public PaymentTerminalForm()
 {
     RemotingConfiguration.Configure("PaymentTerminal.exe.config", false);
     InitializeComponent();
     listServer = (IListSingleton)RemoteNew.New(typeof(IListSingleton));
     updateTablesListView();
     evRepeater             = new AlterEventRepeater();
     evRepeater.alterEvent += new AlterDelegate(DoAlterations);
     listServer.alterEvent += new AlterDelegate(evRepeater.Repeater);
 }
Exemple #5
0
 public ChatManagerServer()
 {
     try
     {
         cm = (IChatManager)RemoteNew.New(typeof(IChatManager));
     }
     catch (Exception)
     {
         cm = null;
     }
 }
Exemple #6
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            RemotingConfiguration.Configure("PaymentTerminal.exe.config", false);
            ICentralNode       iCentralNode    = (ICentralNode)RemoteNew.New(typeof(ICentralNode));
            PaymentTerminalGUI gui             = new PaymentTerminalGUI();
            PaymentTerminal    paymentTerminal = new PaymentTerminal(iCentralNode);

            gui.SetPaymentTerminal(paymentTerminal);
            Application.Run(gui);
        }
        public static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            RemotingConfiguration.Configure("Bar.exe.config", false);
            ICentralNode  iCentralNode = (ICentralNode)RemoteNew.New(typeof(ICentralNode));
            ListOrdersGUI gui          = new ListOrdersGUI();

            OrderProcessor.OrderProcessor orderProcessor = new OrderProcessor.OrderProcessor(iCentralNode, gui);
            gui.SetOrderProcessor(orderProcessor);
            iCentralNode.NewBarClientOrder += orderProcessor.handleNewOrder;
            Application.Run(gui);
        }
Exemple #8
0
    public void setup()
    {
        // creates the remote object
        om            = (IOrderManager)RemoteNew.New(typeof(IOrderManager));
        orderRepeater = new Repeater();
        switch (cType)
        {
        case CookType.Kitchen:
            orderRepeater.newOrderKitchen += new newOrderKitchenDelegate(newOrderHandler);
            om.newOrderKitchenEvent       += new newOrderKitchenDelegate(orderRepeater.newOrderKitchenRepeater);
            break;

        case CookType.Bar:
            orderRepeater.newOrderBar += new newOrderBarDelegate(newOrderHandler);
            om.newOrderBarEvent       += new newOrderBarDelegate(orderRepeater.newOrderBarRepeater);
            break;

        default:
            if (Program.debug)
            {
                Console.WriteLine("OOPS");
            }
            break;
        }

        orderRepeater.orderChanged += new orderChangedDelegate(orderChangedHandler);
        om.orderChangedEvent       += new orderChangedDelegate(orderRepeater.orderChangedRepeater);

        mf.addInitialOrders(om.getAllDestination(cType));
        if (Program.debug)
        {
            Console.WriteLine("Setup was made");
        }


        switch (cType)
        {
        case CookType.Bar:
            mf.Text = "CookClient - Bar";
            break;

        case CookType.Kitchen:
            mf.Text = "CookClient - Kitchen";
            break;

        default:
            mf.Text = "CookClient";
            break;
        }
        mf.Show();
    }
Exemple #9
0
    public Form1()
    {
        RemotingConfiguration.Configure("DinningRoom.exe.config", false);
        InitializeComponent();
        listServer = (IManagement)RemoteNew.New(typeof(IManagement));


        items  = listServer.GetItems();
        tables = listServer.GetTables();


        evRepeater             = new AlterEventRepeater();
        evRepeater.alterEvent += new AlterDelegate(DoAlterations);
        listServer.alterEvent += new AlterDelegate(evRepeater.Repeater);
    }
Exemple #10
0
        public AuthServer()
        {
            TcpChannel       chan = (TcpChannel)ChannelServices.GetChannel("tcp");
            ChannelDataStore data = (ChannelDataStore)chan.ChannelData;

            Port    = new Uri(data.ChannelUris[0]).Port;
            Address = GetLocalIPAddress();

            try
            {
                Auth = (IAuthentication)RemoteNew.New(typeof(IAuthentication));
                UsersOnlineRepeater = new OnlineHandlerRepeater();
            } catch (Exception)
            {
                Auth = null;
            }
        }
Exemple #11
0
    static void Main()
    {
        RemotingConfiguration.Configure("Client.exe.config", false);
        IServer server = (IServer)RemoteNew.New(typeof(IServer));

        inter = new Intermediate(server);
        inter.newClientEvent += OnNewClient;
        inter.chatReqEvent   += OnNewChatRequest;
        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);
        Application.Run(new Login(server));


        //    while (self == null)
        //    {
        //        Console.WriteLine("[Client] Enter username:"******"[Client] Enter password:"******"[Client]Port: " + port);

        //        /*
        //         * Pede ao servidor que lhe crie uma instancia
        //         */
        //        self = server.AddNewClient(name, password, port);
        //        if (self != null)
        //        {
        //            Console.WriteLine("[Client]: Joined! (Id=" + self.Id.ToString() + ", Name=" + self.Name + ")");

        //            Console.WriteLine("Want to make a connection? (y/n)");
        //            string res = Console.ReadLine();
        //            if (res == "y")
        //            {
        //                string destination = Console.ReadLine();
        //                server.CreateNewChatRequest(self, destination);

        //                inter.ConnectChat((Chat)RemotingServices.Connect(typeof(Chat),
        //                    "tcp://localhost:" + Client.port + "/Client/Chat"
        //                    ));
        //                inter.newMessage += handleNewChatMessage;
        //                while (true)
        //                {
        //                    Console.WriteLine("Write new message");
        //                    string message = Console.ReadLine();
        //                    string source = name;
        //                    inter.chat.addMessage(self, message);
        //                }
        //                inter.newMessage -= handleNewChatMessage;
        //            }
        //            else
        //            {
        //                while (true)
        //                {
        //                    Console.ReadKey();
        //                }
        //            }

        //        }
        //        else
        //        {
        //            Console.WriteLine("There is already a username with a different password");
        //        }
        //    }


        inter.newClientEvent  -= OnNewClient;
        server.newClientEvent -= inter.FireNewClient;
        inter.chatReqEvent    -= OnNewChatRequest;
        server.chatReqEvent   -= inter.FireChatRequest;
    }
 static ConnectionObject()
 {
     Console.Write("CONNECTION OBJECT CALLED");
     RemotingConfiguration.Configure("BarTerminal.exe.config", false);
     centralServer = (IOrder_Info)RemoteNew.New(typeof(IOrder_Info));
 }
Exemple #13
0
        static void Main(string[] args)
        {
            RemotingConfiguration.Configure("Test.exe.config", false);
            IRegistry r     = (IRegistry)RemoteNew.New(typeof(IRegistry));
            User      user1 = new User("sara", "123", "Sara Santos");
            User      user2 = new User("joao", "123", "João Chaves");

            /* r.AddUser(user1);
             * r.AddUser(user2);*/

            User check1 = r.CheckLogin("sara", "123");
            User check2 = r.CheckLogin("joao", "123");

            if (check1 != null)
            {
                Console.WriteLine("Login 1 sucessfull");
            }
            if (check2 != null)
            {
                Console.WriteLine("Login 2 sucessfull");
            }

            r.SetQuote(2);
            Console.WriteLine("Quote changed...");

            /*Console.WriteLine("Creating Diginotes...");
             * r.CreateDiginote("AS123567", user1);
             * r.CreateDiginote("AS123568", user1);
             * r.CreateDiginote("AS123569", user1);
             *
             * Console.WriteLine("User1 Diginotes:");
             * List<Diginote> diginotes = r.GetUserDiginotes(user1);
             * foreach(Diginote d in diginotes)
             * {
             *  Console.WriteLine("Diginote " + d.SerialNumber);
             * }*/

            Order order1 = new Order(OrderType.PURCHASE, user1, 20);
            // Order order2 = new Order(OrderType.PURCHASE, user1, 10);
            // Order order3 = new Order(OrderType.PURCHASE, user1, 10);
            //Order order4 = new Order(OrderType.PURCHASE, user1, 10);
            // Order order5 = new Order(OrderType.SELL, user2, 10);
            Order order6 = new Order(OrderType.SELL, user2, 60);

            r.AddOrder(order1);

            /* r.AddOrder(order2);
             * r.AddOrder(order3);
             * r.AddOrder(order4);*/
            //r.AddOrder(order2);

            /* Console.WriteLine("Orders:");
             * foreach (Order o in r.GetOrders())
             * {
             *   Console.WriteLine("User " + o.Owner.Name + ", quantity=" + o.Quantity);
             * }*/

            //Console.ReadLine();
            System.Threading.Thread.Sleep(5000);
            r.AddOrder(order6);

            /*
             * foreach (Order o in r.GetOrders())
             * {
             *  Console.WriteLine("User " + o.Owner.Name + ", quantity=" + o.Quantity);
             * }
             */
            Console.ReadLine();
        }