示例#1
0
        void Greeting(object sender, EventArgs args)
        {
            try
            {
                if (factory == null)
                {
                    factory = new ChannelFactory <IContractXam>(binding, new EndpointAddress(address));
                    channel = factory.CreateChannel();
                }

                if (factory != null && channel != null)
                {
                    //Message.Text = channel.Greeting();
                }
            }
            catch (Exception)
            {
                //Message.Text = "Error";
            }
        }
示例#2
0
        public static Machine MoveMachineRight(this Machine machine, IContractXam channel)
        {
            Machine temp_machine = machine.ToClone();

            if (channel != null)
            {
                temp_machine.X++;

                if (MainPage.MinX <= temp_machine.X &&
                    temp_machine.X < MainPage.MaxX &&
                    temp_machine.Y % 2 != 0
                    )
                {
                    channel.ChangeMachinePosition(temp_machine);

                    return(temp_machine);
                }
            }

            return(machine);
        }
示例#3
0
        public static Machine MoveMachineUp(this Machine machine, IContractXam channel)
        {
            Machine temp_machine = machine.ToClone();

            if (channel != null)
            {
                temp_machine.Y--;

                if (MainPage.MinY <= temp_machine.Y &&
                    temp_machine.Y < MainPage.MaxY &&
                    temp_machine.X % 2 != 0
                    )
                {
                    channel.ChangeMachinePosition(temp_machine);

                    return(temp_machine);
                }
            }

            return(machine);
        }
示例#4
0
        void Connect()
        {
            try
            {
                if (factory == null)
                {
                    factory = new ChannelFactory <IContractXam>(binding, new EndpointAddress(address));
                    channel = factory.CreateChannel();
                }

                if (factory != null && channel != null)
                {
                    //TODO picker
                    MachineList = channel.GetAllMachines();
                    DisplayAlert("", $"Got machines list", "OK");

                    PositionsList = channel.GetAllPositions();
                    DisplayAlert("", $"Got positions list", "OK");
                }
            }
            catch (Exception) { }
        }
示例#5
0
        public static Machine MoveMachineLeft(this Machine machine, IContractXam channel)
        {
            Machine temp_machine = machine.ToClone();

            if (channel != null)
            {
                temp_machine.X--;

                if (MainPage.MinX <= temp_machine.X &&
                    temp_machine.X < MainPage.MaxX &&
                    temp_machine.Y % 2 != 0
                    )
                {
                    Console.WriteLine("Before sending " + machine.Str());
                    channel.ChangeMachinePosition(temp_machine);

                    return(temp_machine);
                }
            }

            return(machine);
        }