Beispiel #1
0
        private void ConnectWeighingMachineService()
        {
            grdContainer.BlockUI();
            mBolWeighingMachineLoaded = false;

            try
            {
                mObjWeighingMachineServer = (WeighingMachineServerObject)Activator.GetObject(typeof(WeighingMachineServerObject), "http://localhost:8810/WeighingMachine");
                mObjWrapperObject         = new WrapperObject();

                mObjWeighingMachineServer.DataReceived += new WeighingMachineEventHandler(mObjWrapperObject.WrapperOnDataReceived);
                mObjWrapperObject.WrapperDataReceived  += new WeighingMachineEventHandler(OnDataReceived);

                mObjWeighingMachineConnection = mObjWeighingMachineServer.Connect();
                mBolWeighingMachineLoaded     = true;
            }
            catch (Exception lObjException)
            {
                grdContainer.UnblockUI();
                ShowMessage("Error", lObjException.Message);
                mBolWeighingMachineLoaded = false;
            }
            finally
            {
                grdContainer.UnblockUI();
            }
        }
Beispiel #2
0
        private void GetRemoteObject()
        {
            try
            {
                //Objects
                mObjWeighingMachine = (WeighingMachineServerObject)Activator.GetObject(typeof(WeighingMachineServerObject), "http://localhost:8810/WeighingMachine");

                mObjConnection = mObjWeighingMachine.Connect();
            }
            catch (Exception lObjException)
            {
                MessageBox.Show(lObjException.Message);
                //UIApplication.ShowError(string.Format("Obtener bascula: {0}", lObjException.Message));
                // return false;
            }
        }
Beispiel #3
0
        public bool GetRemoteObject()
        {
            try
            {
                //Objects
                mObjWeighingMachine = (WeighingMachineServerObject)Activator.GetObject(typeof(WeighingMachineServerObject), "http://localhost:8810/WeighingMachine");
                mObjWrapperObject   = new WrapperObject();

                //Events
                mObjWeighingMachine.DataReceived      += new WeighingMachineEventHandler(mObjWrapperObject.WrapperOnDataReceived);
                mObjWrapperObject.WrapperDataReceived += new WeighingMachineEventHandler(OnDataReceived);

                //Connection
                mObjConnection = mObjWeighingMachine.Connect();
                return(true);
            }
            catch (Exception lObjException)
            {
                CustomMessageBox.Show("Error", lObjException.Message);
                return(false);
            }
        }