/// <summary> /// Obtiene datos cliente. /// </summary> public void GetClienteData() { // Cliente Cliente c; // Obtengo datos servidor RestManager.Connection().GetData((int)URIS.GetCliente, new string[] { Cliente.ID_Cliente.ToString() }, null, (arg) => { // Depuracion Console.WriteLine(arg ?? "null"); // Compruebo datos if (!string.IsNullOrWhiteSpace(arg)) { // Deserializo JSON NSDictionary data = (NSDictionary)NSJsonSerialization.Deserialize(arg, 0, out NSError e); // Cargo datos c = new Cliente(data); Cliente = c; } // Continuo lock (l) { Monitor.Pulse(l); } }); // Espero a obtener datos lock (l) { Monitor.Wait(l); } }
private async Task FilterPlayers() { AndHUD.Shared.Show(this, "Търсене…"); HttpResponseMessage getPlayersHttpResponse = await RestManager.GetAvailablePlayers(_searchPlayersCritera); string getPlayersResponse = await getPlayersHttpResponse.Content.ReadAsStringAsync(); if (getPlayersHttpResponse.IsSuccessStatusCode && !string.IsNullOrWhiteSpace(getPlayersResponse) && getPlayersResponse != "null") { _memberDetails = JsonConvert.DeserializeObject <IEnumerable <MemberDetails> >(getPlayersResponse); _adapter = new PlayerAdapter(this, _memberDetails.ToArray(), _clubDetails, _account); _recyclerView.SetAdapter(_adapter); AndHUD.Shared.Dismiss(this); if (_memberDetails.Any()) { _noPlayersFound.Visibility = ViewStates.Gone; } else { _noPlayersFound.Visibility = ViewStates.Visible; } } }
// Use this for initialization void Start() { infoManager = GameObject.Find("InformationManager").GetComponent <InformationManager>(); restCaller = GetComponent <RestManager>(); x3dObject = new X3DObj(restCaller, infoManager.FullBackendAddress + baseUrl, "Skull", shader); x3dObject.LoadGameObjects(OnFinished); // this automatically creates them }
private void KickPlayer_Click(object sender, System.EventArgs e, MemberDetails member, int position) { AlertDialog.Builder alert = new AlertDialog.Builder(_activity); alert.SetTitle("Премахване на играч"); alert.SetMessage("Сигурни ли сте, че искате да премахнете играча от отбора?"); alert.SetPositiveButton("Да", async(senderAlert, args) => { var response = await RestManager.KickPlayer(new KickPlayerRequest { ClubId = member.ClubId.Value, PlayerId = member.Id }); if (response.IsSuccessStatusCode) { _players = RemoveItem(position); NotifyItemRemoved(position); if (ItemCount > 0) { NotifyItemRangeChanged(position, ItemCount); } Toast.MakeText(_activity, "Успешно премахнат играч", ToastLength.Long).Show(); } }); alert.SetNegativeButton("Не", (senderAlert, args) => { return; }); Dialog dialog = alert.Create(); dialog.Show(); }
private async void TimeSpans_ItemSelected(object sender, AdapterView.ItemSelectedEventArgs e) { var timeSpan = (EventTimeSpan)e.Position; _clubEventFilterRequest.EventTimeSpan = timeSpan; AndHUD.Shared.Show(Context, "Търсене…"); HttpResponseMessage httpResponse = await RestManager.GetClubEvents(_clubEventFilterRequest); string response = await httpResponse.Content.ReadAsStringAsync(); _clubEvents = JsonConvert.DeserializeObject <IEnumerable <ClubEventFilterResult> >(response); AndHUD.Shared.Dismiss(Context); _adapter = new ClubEventAdapter(Activity, _clubEvents.ToArray(), _clubDetails, _account); _recyclerView.SetAdapter(_adapter); if (!_clubEvents.Any()) { _noClubEvents = View.FindViewById <TextView>(Resource.Id.tv_clubEvent_noClubEvents); _noClubEvents.Visibility = ViewStates.Visible; } else { _noClubEvents.Visibility = ViewStates.Gone; } }
public override void ViewDidLoad() { base.ViewDidLoad(); // Inicializo conexion servidor RestManager.Init(); }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.EditClub); _club = JsonConvert.DeserializeObject <ClubDetails>(Intent.GetStringExtra("club")); _toolbar = FindViewById <Toolbar>(Resource.Id.tbr_editClub_toolbar); SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); _pickImage = FindViewById <Button>(Resource.Id.btn_editClub_pickPhoto); _pickImage.Click += PickImage_Click; _clubImage = FindViewById <ImageView>(Resource.Id.iv_editClub_clubPhoto); _imagePath = await RestManager.GetClubPhoto(_club.Id); var bitmap = BitmapFactory.DecodeFile(_imagePath); _clubImage.SetImageBitmap(bitmap); _clubName = FindViewById <EditText>(Resource.Id.et_editClub_clubName); _clubName.Text = _club.Name; Button editClub = FindViewById <Button>(Resource.Id.btn_editClub_editClub); editClub.Click += EditClub_Click; }
private async void EditClub_Click(object sender, EventArgs e) { bool hasError = false; if (string.IsNullOrWhiteSpace(_clubName.Text)) { _clubName.Error = "Въведете име"; hasError = true; } if (!hasError) { HttpResponseMessage response = await RestManager.EditClub(new EditClub { ClubId = _club.Id, Email = Intent.GetStringExtra("email"), Name = _clubName.Text, ClubPhoto = _imageStream }); if (response.IsSuccessStatusCode) { Intent intent = new Intent(this, typeof(UserProfileActivity)); StartActivity(intent); } else { string message = await response.Content.ReadAsStringAsync(); Toast.MakeText(this, message, ToastLength.Long).Show(); } } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); // Create your application here SetContentView(Resource.Layout.UserProfile); _account = AccountStore .Create(this) .FindAccountsForService(GetString(Resource.String.app_name)) .FirstOrDefault(); if (_account == null) { Intent intent = new Intent(this, typeof(LoginActivity)); StartActivity(intent); } else { RestManager.SetAccessToken(_account.Properties["token"]); HttpResponseMessage httpResponse = await RestManager.GetMemberDetails(_account.Username); string response = await httpResponse.Content.ReadAsStringAsync(); if (!string.IsNullOrWhiteSpace(response) && response != "null") { _memberDetails = JsonConvert.DeserializeObject <MemberDetails>(response); } _viewPager = FindViewById <ViewPager>(Resource.Id.viewpager); SetupViewPager(_viewPager); _tabLayout = FindViewById <TabLayout>(Resource.Id.sliding_tabs); _tabLayout.SetupWithViewPager(_viewPager); } }
public App() { InitializeComponent(); RestAPIManager = new RestManager(new RestService()); MainPage = new REST(); }
/// <summary> /// Touch boton login. /// </summary> /// <param name="sender"></param> partial void Touch_BtnLogin(ButtonLoad sender) { // Desactivo boton btnLogin.Enabled = false; // Muestro carga sender.ShowLoading(); // Conexion con el servidor RestManager.Connection().GetData((int)URIS.Login, new string[] { txtUser.Text.Trim(), txtPass.Text.Trim() }, null, (arg) => { // Compruebo datos if (!string.IsNullOrWhiteSpace(arg)) // Login correcto { // Compruebo id if (!arg.Equals("-1")) { LoginOk(arg); } else { LoginError(); } } else // Login incorrecto { LoginError(); } }); }
private void RemoveClubEvent_Click(object sender, System.EventArgs e, int eventId, int position) { AlertDialog.Builder alert = new AlertDialog.Builder(_activity); alert.SetTitle("Премахване на събитие"); alert.SetMessage("Сигурни ли сте, че искате да премахнете това събитие?"); alert.SetPositiveButton("Да", async(senderAlert, args) => { HttpResponseMessage respondInvitationHttpResponse = await RestManager.RemoveEvent(eventId); if (respondInvitationHttpResponse.IsSuccessStatusCode) { _clubEvents = RemoveItem(position); NotifyItemRemoved(position); if (ItemCount > 0) { NotifyItemRangeChanged(position, ItemCount); } Toast.MakeText(_activity, "Успешно премахване на събитие!", ToastLength.Long).Show(); } }); alert.SetNegativeButton("Не", (senderAlert, args) => { return; }); Dialog dialog = alert.Create(); dialog.Show(); }
public override async void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); _account = AccountStore .Create(Context) .FindAccountsForService(GetString(Resource.String.app_name)) .FirstOrDefault(); RestManager.SetAccessToken(_account.Properties["token"]); HttpResponseMessage httpResponse = await RestManager.GetMemberDetails(_account.Username); string response = await httpResponse.Content.ReadAsStringAsync(); if (!string.IsNullOrWhiteSpace(response) && response != "null") { _memberDetails = JsonConvert.DeserializeObject <MemberDetails>(response); } var imagePath = await RestManager.GetMemberPhoto(_account.Username); TextView firstName = View.FindViewById <TextView>(Resource.Id.tv_memberDetails_firstName); TextView lastName = View.FindViewById <TextView>(Resource.Id.tv_memberDetails_lastName); TextView height = View.FindViewById <TextView>(Resource.Id.tv_memberDetails_height); TextView weight = View.FindViewById <TextView>(Resource.Id.tv_memberDetails_weight); TextView dateOfBirth = View.FindViewById <TextView>(Resource.Id.tv_memberDetails_dateOfBirth); TextView preferedPosition = View.FindViewById <TextView>(Resource.Id.tv_memberDetails_preferedPosition); LinearLayout playerSection = View.FindViewById <LinearLayout>(Resource.Id.ll_memberDetails_playerSection); _mainPhoto = View.FindViewById <ImageView>(Resource.Id.iv_memberDetails_mainPhoto); var bitmap = BitmapFactory.DecodeFile(imagePath); _mainPhoto.SetImageBitmap(bitmap); firstName.Text = _memberDetails.FirstName; lastName.Text = _memberDetails.LastName; if (string.Compare(_account.Properties["roles"], Role.Player.ToString(), true) == 0) { height.Text = _memberDetails.Height.HasValue ? string.Format(Literals.HeightCmFormat, string.Empty, _memberDetails.Height.Value.ToString()) : "0"; weight.Text = _memberDetails.Weight.HasValue ? string.Format(Literals.WeightKgFormat, string.Empty, _memberDetails.Weight.Value.ToString()) : "0"; dateOfBirth.Text = _memberDetails.DateOfBirth.HasValue ? _memberDetails.DateOfBirth.Value.ToShortDateString() : string.Empty; preferedPosition.Text = Literals.ResourceManager.GetString(_memberDetails.PreferedPosition.Value.ToString()); playerSection.Visibility = ViewStates.Visible; } Button logout = View.FindViewById <Button>(Resource.Id.btn_memberDetails_logout); logout.Click += Logout_Click; logout.Visibility = ViewStates.Visible; Button editMemberDetails = View.FindViewById <Button>(Resource.Id.btn_memberDetails_edit); editMemberDetails.Click += EditMemberDetails_Click; }
public override async void OnActivityCreated(Bundle savedInstanceState) { base.OnActivityCreated(savedInstanceState); _account = AccountStore .Create(Context) .FindAccountsForService(GetString(Resource.String.app_name)) .FirstOrDefault(); _noClubEvents = View.FindViewById <TextView>(Resource.Id.tv_clubEvent_noClubEvents); if (_account.Properties["roles"].Contains(Role.Coach.ToString())) { FloatingActionButton goToCreateClubEventButton = View.FindViewById <FloatingActionButton>(Resource.Id.btn_clubEvent_goToCreateClubEvent); goToCreateClubEventButton.BringToFront(); goToCreateClubEventButton.Click += GoToCreateClubEventButton_Click; goToCreateClubEventButton.Visibility = ViewStates.Visible; } HttpResponseMessage clubHttpResponse = await RestManager.GetMemberClub(_account.Username); string clubResponse = await clubHttpResponse.Content.ReadAsStringAsync(); if (clubResponse != "null") { _clubDetails = JsonConvert.DeserializeObject <ClubDetails>(clubResponse); _clubEventFilterRequest = new ClubEventFilterRequest { MemberId = int.Parse(_account.Properties["memberId"]), ClubId = _clubDetails.Id }; HttpResponseMessage httpResponse = await RestManager.GetClubEvents(_clubEventFilterRequest); string response = await httpResponse.Content.ReadAsStringAsync(); _clubEvents = JsonConvert.DeserializeObject <IEnumerable <ClubEventFilterResult> >(response); if (_clubEvents.Any()) { _timeSpans = View.FindViewById <Spinner>(Resource.Id.spn_clubEvent_timeSpan); var timeSpans = Enum.GetNames(typeof(EventTimeSpan)) .Select(r => Literals.ResourceManager.GetString(r)).ToArray(); _timeSpans.Adapter = new ArrayAdapter <string>(Context, Android.Resource.Layout.SimpleSpinnerDropDownItem, timeSpans); _timeSpans.ItemSelected += TimeSpans_ItemSelected; _eventsFilter = View.FindViewById <LinearLayout>(Resource.Id.ll_clubEvent_clubEventsFilter); _eventsFilter.Visibility = ViewStates.Visible; _adapter = new ClubEventAdapter(Activity, _clubEvents.ToArray(), _clubDetails, _account); _recyclerView = View.FindViewById <RecyclerView>(Resource.Id.rv_clubEvent_clubEvents); _recyclerView.SetAdapter(_adapter); _layoutManager = new LinearLayoutManager(Activity, LinearLayoutManager.Vertical, false); _recyclerView.SetLayoutManager(_layoutManager); } else { _noClubEvents.Visibility = ViewStates.Visible; } } }
protected override async void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.EditMemberDetails); _account = JsonConvert.DeserializeObject <Account>(Intent.GetStringExtra("account")); _memberDetails = JsonConvert.DeserializeObject <MemberDetails>(Intent.GetStringExtra("member")); _firstName = FindViewById <EditText>(Resource.Id.et_editMemberDetails_firstName); _lastName = FindViewById <EditText>(Resource.Id.et_editMemberDetails_lastName); _height = FindViewById <EditText>(Resource.Id.et_editMemberDetails_height); _weight = FindViewById <EditText>(Resource.Id.et_editMemberDetails_weight); _toolbar = FindViewById <Toolbar>(Resource.Id.tbr_editMemberDetails_toolbar); _dateOfBirth = FindViewById <DatePicker>(Resource.Id.dp_editMemberDetails_dateOfBirth); if (_memberDetails.DateOfBirth.HasValue) { int year = _memberDetails.DateOfBirth.Value.Year; int month = _memberDetails.DateOfBirth.Value.Month - 1; int day = _memberDetails.DateOfBirth.Value.Day; _dateOfBirth.UpdateDate(year, month, day); } _userImage = FindViewById <ImageView>(Resource.Id.iv_editMemberDetails_userImage); var imagePath = await RestManager.GetMemberPhoto(_account.Username); var bitmap = BitmapFactory.DecodeFile(imagePath); _userImage.SetImageBitmap(bitmap); _pickImage = FindViewById <Button>(Resource.Id.btn_editMemberDetails_pickImage); _playerSection = FindViewById <LinearLayout>(Resource.Id.ll_editMemberDetails_playerSection); _positionsSpinner = FindViewById <Spinner>(Resource.Id.spn_editMemberDetails_preferedPosition); _firstName.Text = _memberDetails.FirstName; _lastName.Text = _memberDetails.LastName; if (string.Compare(_account.Properties["roles"], Role.Player.ToString(), true) == 0) { _height.Text = _memberDetails.Height.HasValue ? _memberDetails.Height.Value.ToString() : string.Empty; _weight.Text = _memberDetails.Weight.HasValue ? _memberDetails.Weight.Value.ToString() : string.Empty; string[] positions = Enum .GetNames(typeof(Position)) .Select(r => Literals.ResourceManager.GetString(r)).ToArray(); _positionsSpinner.Adapter = new ArrayAdapter <string>(this, Android.Resource.Layout.SimpleSpinnerDropDownItem, positions); _positionsSpinner.SetSelection((int)_memberDetails.PreferedPosition.Value - 1); _playerSection.Visibility = ViewStates.Visible; } SetSupportActionBar(_toolbar); SupportActionBar.SetDisplayHomeAsUpEnabled(true); SupportActionBar.SetHomeButtonEnabled(true); Button editDetails = FindViewById <Button>(Resource.Id.btn_editMemberDetails_editDetails); editDetails.Click += EditDetails_Click; _pickImage.Click += PickImage_Click; }
public App() { InitializeComponent(); RestManager = new RestManager(new RestService()); MainPage = new NavigationPage(new SplashPage()); }
/// <summary> /// Obtiene datos del pais. /// </summary> public void GetDataPais() { // Pais Pais p; // Obtengo pais p = SQLiteManager.Connection().GetProvincia(ID_Pais); // Compruebo datos if (p == null) { // Obtengo pais del servidor RestManager.Connection().GetData((int)URIS.GetPais, new string[] { ID_Pais.ToString() }, null, (arg) => { // Compruebo datos if (!string.IsNullOrWhiteSpace(arg)) { // Deserializo JSON NSDictionary data = (NSDictionary)NSJsonSerialization.Deserialize(arg, 0, out NSError e); // Leo datos foreach (NSString key in data.Keys) { switch (key.ToString().ToLower()) { case "id_pais": ID_Pais = (int)(NSNumber)data.ValueForKey(key); break; case "nombre": Nombre_Pais = data.ValueForKey(key).ToString(); break; } } // Guardo en SQLite SQLiteManager.Connection().SetPais(this); } // Continuo lock (l) { Monitor.Pulse(l); } }); // Espero lock (l) { Monitor.Wait(l); } } else { // Cargo nombre Nombre_Pais = p.Nombre_Pais; } }
/// <summary> /// Constructor to initialize the X3D object's parameters /// </summary> /// <param name="restManager">The RestManager-component for downloading data</param> /// <param name="baseUrl">The base url where the models can be found</param> /// <param name="name">The name of the X3D object</param> /// <param name="shader">The shader which will be applied to the instantiated gameobject</param> public X3DObj(RestManager restManager, string baseUrl, string name, Shader shader) { pieces = new List <X3DPiece>(); this.restManager = restManager; this.baseUrl = baseUrl; this.shader = shader; this.name = name; url = baseUrl + name + "/"; }
/// <summary> /// Carga una solución /// </summary> public void Load(string path) { // Guarda el directorio Path = path; // Carga el archivo Solution = new RestManager().Load(GetSolutionFileName()); // Actualiza el árbol TreeRestApiViewModel.Load(); }
public void GivenISetTheFollowingBoundingBoxParameters(double lonleft, double latbottom, double lonright, double lattop, double zoom) { //Arrange string value = $"{lonleft},{latbottom},{lonright},{lattop},{zoom}"; RestManager.AddQueryStrings("bbox", value); Console.WriteLine("TEST"); }
private async void EditButton_Click(object sender, EventArgs e) { bool isValid = true; if (string.IsNullOrWhiteSpace(_title.Text)) { _title.Error = Literals.PleaseEnterTitle; isValid = false; } if (string.IsNullOrWhiteSpace(_description.Text)) { _description.Error = Literals.PleaseEnterDescription; isValid = false; } if (_markerPosition == null) { Toast.MakeText(this, Literals.PleaseEnterLocation, ToastLength.Long).Show(); isValid = false; } if (!isValid) { return; } var startTime = new DateTime( _startTimeDay.Year, _startTimeDay.Month + 1, // January-0 December-11 _startTimeDay.DayOfMonth, _startTimeHour.Hour, _startTimeHour.Minute, 0); ClubEventCreateRequest clubEventCreateRequest = new ClubEventCreateRequest { EventId = _clubEvent.Id, Title = _title.Text, Description = _description.Text, StartTime = startTime, EventType = (EventType)_eventTypesSpinner.SelectedItemPosition, Coordinates = _markerPosition }; AndHUD.Shared.Show(this, "Промяна на събитие…"); var response = await RestManager.EditClubEvent(clubEventCreateRequest); AndHUD.Shared.Dismiss(this); if (response.IsSuccessStatusCode) { Toast.MakeText(this, "Успешна промяна на събитие!", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Неуспешна промяна на събитие!", ToastLength.Short).Show(); } }
private void Start() { restManager = restManagerGameObject.GetComponent <RestManager>(); namePanel = nameField.GetComponent <NamePanel>(); Debug.Log("Querying"); restManager.Get("http://172.20.47.233:8080/api/session", ProcessReceivedSession); Debug.Log("Queried"); }
// Use this for initialization void Start() { restManager = RestManagerGameObject.GetComponent <RestManager>(); namePanel = NameField.GetComponent <NamePanel>(); sm = SM.GetComponent <SeatManager> (); Debug.Log("Querying"); restManager.Post("http://172.20.47.233:8080/api/session", ProcessCurrentSession(), null); Debug.Log("Queried"); }
/// <summary> /// Default Init function, also initialises all components within the application. /// </summary> public App() { InitializeComponent(); RestManager = new RestManager(new RestService()); EventManager = new EventManager(); //JW: Provides feedback when token is updated. CrossFirebasePushNotification.Current.OnTokenRefresh += (s, p) => { System.Diagnostics.Debug.WriteLine($"TOKEN : {p.Token}"); System.Console.WriteLine($"TOKEN : {p.Token}"); }; //JW: Provides feedback when notification is received. CrossFirebasePushNotification.Current.OnNotificationReceived += (s, p) => { System.Diagnostics.Debug.WriteLine("Received"); }; //JW: Provides feedback when notification is opened. CrossFirebasePushNotification.Current.OnNotificationOpened += (s, p) => { System.Diagnostics.Debug.WriteLine("Opened"); foreach (var data in p.Data) { System.Diagnostics.Debug.WriteLine($"{data.Key} : {data.Value}"); } if (!string.IsNullOrEmpty(p.Identifier)) { System.Diagnostics.Debug.WriteLine($"ActionId: {p.Identifier}"); } }; //JW: Provides feedback when notification is deleted (android only). CrossFirebasePushNotification.Current.OnNotificationDeleted += (s, p) => { System.Diagnostics.Debug.WriteLine("Deleted"); }; //JW: Check to see if there is a session if (Preferences.Get("UserID", "no session") != "no session") { // JA: Navigate to the main page of the application MainPage = new MainPage(); } else { // JA: Navigate to the login page MainPage = new NavigationPage(new LoginPage()); } }
void Awake() { //Creamos un singleton (solo puede existir un RestManager) if (RestManager.instance == null) { instance = this; } else { Destroy(this); } }
public void GetWeatherDataByCityIDTest(string endPoint, string key, string value) { //Arrange - Given RestManager.AddParameter(key, value); //Act - When RestManager.ExecuteRequest(endPoint, Method.GET); //Assert - Then Assert.AreEqual(HttpStatusCode.OK, RestManager.Status); var responseObjects = ToWeatherData(RestManager.ResponseContent); Assert.AreEqual(Convert.ToInt32(value), responseObjects.Id); }
private void RespondInvitation_Click( object sender, EventArgs eventArgs, int invitationId, string email, InvitationStatus invitationStatus, int position) { AlertDialog.Builder alert = new AlertDialog.Builder(_activity); alert.SetTitle("Отговор на покана"); alert.SetMessage("Сигурни ли сте, че искате да извършите това действие?"); alert.SetPositiveButton("Да", async(senderAlert, args) => { HttpResponseMessage respondInvitationHttpResponse = await RestManager.RespondInvitation(email, invitationId, invitationStatus); if (respondInvitationHttpResponse.IsSuccessStatusCode) { if (invitationStatus == InvitationStatus.Accepted) { Intent intent = new Intent(_activity, typeof(UserProfileActivity)); _activity.StartActivity(intent); } else { _invitationResponses = RemoveItem(position); NotifyItemRemoved(position); if (ItemCount > 0) { NotifyItemRangeChanged(position, ItemCount); } Toast.MakeText(_activity, "Успешен отговор на поканата!", ToastLength.Short).Show(); } } }); alert.SetNegativeButton("Не", (senderAlert, args) => { return; }); Dialog dialog = alert.Create(); dialog.Show(); }
/// <summary> /// Obtengo direccion cliente. /// </summary> public void GetDireccionData() { // Obtengo direccion de SQLite Direccion d = null; // Compruebo datos if (d == null) { // Obtengo direccion del servidor RestManager.Connection().GetData((int)URIS.GetDireccionCliente, new string[] { ID_Cliente.ToString() }, null, (arg) => { // Compruebo datos if (!string.IsNullOrWhiteSpace(arg)) { // Deserializo JSON NSDictionary data = (NSDictionary)NSJsonSerialization.Deserialize(arg, 0, out NSError e); // Cargo datos d = Direccion = new Direccion(data); // Guardo en SQLite SQLiteManager.Connection().SetDireccion(d); } // Continuo lock (l) { Monitor.Pulse(l); } }); // Espero a obtener datos lock (l) { Monitor.Wait(l); } } // Obtengo datos ciudad d.GetDataCiudad(); // Cargo direccion Direccion = d; }
public void GetWeatherDataByGeoCoordinatesTest(string endPoint, int longitude, int latitude) { //Arrange - Given var queryStrings = new List <KeyValuePair <string, object> >(); queryStrings.Add(new KeyValuePair <string, object>("lon", longitude)); queryStrings.Add(new KeyValuePair <string, object>("lat", latitude)); RestManager.AddQueryStrings(queryStrings); //Act - When RestManager.ExecuteRequest(endPoint, Method.GET); //Assert - Then Assert.AreEqual(HttpStatusCode.OK, RestManager.Status); var responseObjects = ToWeatherData(RestManager.ResponseContent); Assert.AreEqual(longitude, responseObjects.Coord.Lon); Assert.AreEqual(latitude, responseObjects.Coord.Lat); }
public HomeController() { var selectListItem = new List <SelectListItem>(); selectListItem.Add(new SelectListItem { Text = "Экскурсия", Value = "NameTour" }); selectListItem.Add(new SelectListItem { Text = "Номер школы", Value = "NumberSchool" }); selectListItem.Add(new SelectListItem { Text = "Дата", Value = "Date" }); selectListItem.Add(new SelectListItem { Text = "ФИО учителя", Value = "NameTeacher" }); selectListItem.Add(new SelectListItem { Text = "Email", Value = "Email" }); selectListItem.Add(new SelectListItem { Text = "Количество детей", Value = "CountOfChildren" }); selectListItem.Add(new SelectListItem { Text = "Номер тел. учителя", Value = "PhoneNumber" }); selectListItem.Add(new SelectListItem { Text = "Пожелания", Value = "NextTour" }); selectListItem.Add(new SelectListItem { Text = "ГАИ", Value = "GAI" }); selectListItem.Add(new SelectListItem { Text = "Стоимость", Value = "Money" }); selectListItem.Add(new SelectListItem { Text = "Комментарий", Value = "Comment" }); ViewBag.selectListItem = selectListItem; db = new RestManager(); }
void OnInitialize(EventArgs e) { #region Config string path = Path.Combine(TShock.SavePath, "CTRSystem", "CTRS-Config.json"); Config = Configuration.ConfigFile.Read(path); Formatter = new TextFormatter(this, Config); #endregion #region Commands Commands = new CommandManager(this); Action<Command> Add = c => { TShockAPI.Commands.ChatCommands.RemoveAll(c2 => c2.Names.Exists(s => c.Names.Contains(s))); TShockAPI.Commands.ChatCommands.Add(c); }; Add(new Command(Permissions.Admin, Commands.CAdmin, "cadmin") { HelpText = "Perform administrative actions across the Contributions Track & Reward System." }); Add(new Command(Permissions.Commands, Commands.Contributions, new List<string>(Config.AdditionalCommandAliases) { "ctrs" }.ToArray()) { HelpText = "Manages contributor settings. You must have contributed at least once before using this command." }); Add(new Command(Permissions.Auth, Commands.Authenticate, "auth", "authenticate") { DoLog = false, HelpText = "Connects your Xenforo account to your TShock account. Enter your forum credentials OR generate an auth code first by visiting your user control panel." }); #endregion _tierUpdateTimer = new Timer(Config.TierRefreshMinutes * 60 * 1000); _tierUpdateTimer.Elapsed += UpdateTiers; _tierUpdateTimer.Start(); Contributors = new ContributorManager(this); CredentialHelper = new LoginManager(this); Rests = new RestManager(this); Tiers = new TierManager(this); XenforoUsers = new XenforoManager(this); }