public AirplanesRadar(IServiceAPI serviceAPI, bool isCacheEnabled = false)
        {
            source = serviceAPI;
            this.IsCacheEnabled = isCacheEnabled;

            LoggingHelper.LogBehavior("> INIT basic data...");
            var fooAirplane = new Airplane("0", "0", AltitudeMetric.FromMeter(0), 0, 0, SpeedMetric.FromKnot(0), 0, 0, "", "", "A319", "0", false);

            LoggingHelper.LogBehavior("> DONE basic data.");
        }
        public void CreateTest()
        {
            CHessianProxyFactory target = new CHessianProxyFactory();
            Type        type            = typeof(IServiceAPI);
            String      url             = ApiUrl;
            object      actual          = null;
            IServiceAPI test            = (IServiceAPI)target.Create(type, url);

            actual = test.registerAccount("Tim" + DateTime.Now.ToString());

            Assert.IsInstanceOfType(actual, typeof(Response));
        }
Beispiel #3
0
        public void SetupAsyncActions(INavigator nav, IServiceAPI serviceAPI)
        {
            DeviceListRefreshAction = async(dispatch, getState) => {
                dispatch(new DeviceListRefreshStarted());
                List <DeviceInfo> devices;
                devices = await serviceAPI.GetDevices();

                dispatch(new DeviceListRefreshFinished {
                    Devices = devices
                });
            };

            LoginAction = Store.asyncActionVoid <LoginInfo>(async(dispatch, getState, userinfo) => {
                dispatch(new LoginStarted {
                    Username = userinfo.Username
                });                                                          // starting the login process
                UserInfo loggedIn;
                try {
                    loggedIn = await serviceAPI.AuthUser(userinfo.Username, userinfo.Password);
                } catch (Exception) {
                    dispatch(new LoginServiceUnavailable()); // error communicating with the service
                    return;
                }
                if (loggedIn == UserInfo.NotFound)
                {
                    dispatch(new LoginFailed()); // user/pass did not match
                }
                else
                {
                    dispatch(new LoggedIn {
                        Username = userinfo.Username,
                        City     = loggedIn.HomeCity
                    }); // success
                    nav.PushAsync(() => new DeviceListPageViewModel(this));
                    await DeviceListRefreshAction(dispatch, getState);
                }
            });
        }
Beispiel #4
0
 public ApiController(IServiceAPI serviceAPI)
 {
     ServiceAPI = serviceAPI;
 }
Beispiel #5
0
 public Service(IServiceAPI _service)
 {
     this._service = _service;
 }
Beispiel #6
0
 public ContatosController(IServiceAPI serviceAPI)
 {
     _service = serviceAPI;
 }
Beispiel #7
0
        public void SetupAsyncActions(INavigator nav, IServiceAPI serviceAPI)
        {
            DeviceListRefreshAction = async (dispatch, getState) => {
                dispatch(new DeviceListRefreshStarted());
                List<DeviceInfo> devices;
                devices = await serviceAPI.GetDevices();
                dispatch(new DeviceListRefreshFinished { Devices = devices });
            };

            LoginAction = Store.asyncActionVoid<LoginInfo>(async (dispatch, getState, userinfo) => {
                dispatch(new LoginStarted { Username = userinfo.Username }); // starting the login process
                UserInfo loggedIn;
                try {
                    loggedIn = await serviceAPI.AuthUser(userinfo.Username, userinfo.Password);
                } catch(Exception){
                    dispatch(new LoginServiceUnavailable()); // error communicating with the service
                    return;
                }
                if (loggedIn == UserInfo.NotFound) {
                    dispatch(new LoginFailed()); // user/pass did not match
                } else {
                    dispatch(new LoggedIn { 
                        Username = userinfo.Username, 
                        City = loggedIn.HomeCity 
                    }); // success
                    nav.PushAsync(() => new DeviceListPageViewModel(this));
                    await DeviceListRefreshAction(dispatch, getState);
                }
            });
        }