/// <summary> /// Called when an item is tapped /// </summary> /// <param name="sender">cityListView(Xamarin.Forms.ListView) object</param> /// <param name="e">ItemTappedEventArgs</param> private void CityListView_ItemTapped(object sender, ItemTappedEventArgs e) { CityRecord cityRecord = e.Item as CityRecord; TimezoneUtility.SetCurrentTimezone(TimezoneUtility.GetTimezoneByOffset(cityRecord.Offset)); Worldclock.WorldclockPage.GetInstance().OnMapViewUpdateRequest(); }
/// <summary> /// Constructor /// </summary> /// <param name="_page">WorldclockPage</param> public WorldclockInfo(WorldclockPage _page) { CityRecordList = new ObservableCollection <CityRecord>(); userLocations = new LocationObservableCollection(); page = _page; LoadItemsList(); TimezoneUtility.UpdateLocalTime(); }
/// <summary> /// Called after a city is selected /// The information about the city is added to ListView. /// </summary> /// <param name="l">Location</param> public void OnItemAdded(Location l) { // check if the city is already added to listView or not if (Exist(l)) { Toast.DisplayText(l.Name + " already exists."); return; } // Add location information to userLocations userLocations.Add(l); Timezone tz = TimezoneUtility.GetTimezoneByOffset(l.GmtOffset); TimezoneUtility.SetCurrentTimezone(tz); page.OnMapViewUpdateRequest(); AppendItemToCustomList(l); }
public void Dispose() { SaveItemsList(); DependencyService.Get <IPreference>().SetInt("DOTNET_WORLDCLOCK_MAP_CURRENT_TIMEZONE", TimezoneUtility.GetCurrentTimezoneNo()); }
/// <summary> /// Updates map view and timezone details based on current timezone information /// </summary> public void OnMapViewUpdateRequest() { UpdateMapAndTimezoneDetails(TimezoneUtility.GetCurrentTimezone()); }
/// <summary> /// Called when left arrow button has been clicked /// It updates Map view including time zone details according to GMT variation(current - 1) /// </summary> /// <param name="sender">arrowLeftImage Button object</param> /// <seealso cref="System.object"> /// <param name="e">Event argument for event of Button</param> /// <seealso cref="System.EventArgs"> private void ArrowLeftImage_Clicked(object sender, EventArgs e) { TimezoneUtility.MoveCurrentTimezone(Direction.LEFT); UpdateMapAndTimezoneDetails(TimezoneUtility.GetCurrentTimezone()); }