public ItemsViewModel(INavigation navigation, ItemsPage page) { // save Navigation this._Nav = navigation; // save Page this._Page = page; this._Realm = Realm.GetInstance(); // clear items this._Realm.Write(() => this._Realm.RemoveAll <Models.OrderItem>()); // must be set global to capture change events this._Realm.All <Models.OrderItem>().SubscribeForNotifications(RealmObjectChanged); }
public void AddNewItem() { //Arrange const string itemName = "Item Name"; const string itemDescription = "Item Description"; //Act ItemsPage.TapAddToolbarButton(); NewItemPage.EnterItemName(itemName); NewItemPage.EnterItemDescription(itemDescription); NewItemPage.TapSaveToolbarButton(); //Assert Assert.IsTrue(ItemsPage.IsPageVisible); Assert.IsTrue(app.Query(itemName).Length > 0); }
public HttpResponseMessage Finished() { ItemsPage <SynchronizationReport> page = null; Storage.Batch(accessor => { int totalCount = 0; var configs = accessor.GetConfigsStartWithPrefix(RavenFileNameHelper.SyncResultNamePrefix, Paging.Start, Paging.PageSize, out totalCount); var reports = configs.Select(config => config.JsonDeserialization <SynchronizationReport>()).ToList(); page = new ItemsPage <SynchronizationReport>(reports, totalCount); }); return(GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache()); }
public HttpResponseMessage Conflicts() { ItemsPage <ConflictItem> page = null; Storage.Batch(accessor => { int totalCount; var values = accessor.GetConfigsStartWithPrefix(RavenFileNameHelper.ConflictConfigNamePrefix, Paging.Start, Paging.PageSize, out totalCount); var conflicts = values.Select(x => JsonExtensions.JsonDeserialization <ConflictItem>(x)); page = new ItemsPage <ConflictItem>(conflicts, totalCount); }); return(GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache()); }
public ItemsViewModel(ItemsPage mainpage) : base(mainpage) { Title = "Browse"; Items = new ObservableCollection <Item>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); MessagingCenter.Subscribe <NewItemPage, Item>(this, "AddItem", async(obj, item) => { var newItem = item as Item; Items.Add(newItem); await DataStore.AddItemAsync(newItem); }); OnRemoteNotifcation = async(body) => { await m_page.Navigation.PopToRootAsync(); }; }
public HttpResponseMessage Conflicts() { ItemsPage <ConflictItem> page = null; Storage.Batch(accessor => { var conflicts = accessor.GetConfigurationValuesStartWithPrefix <ConflictItem>( RavenFileNameHelper.ConflictConfigNamePrefix, Paging.PageSize * Paging.Start, Paging.PageSize).ToList(); page = new ItemsPage <ConflictItem>(conflicts, conflicts.Count); }); return(this.GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache()); }
private void InitializePages() { _startController = new StartPageController(); _startPage = _startController.Initialize() as StartPage; _itemsController = new ItemsController(); _itemsPage = _itemsController.Initialize() as ItemsPage; _bestRatedController = new BestRatedController(); _bestRatedPage = _bestRatedController.Initialize() as BestRatedPage; _mostRatedController = new MostRatedController(); _mostRatedPage = _mostRatedController.Initialize() as MostRatedPage; _userManagementController = new UserManagementController(); _userManagement = _userManagementController.Initialize() as UserManagement; _categoriesController = new CategoriesController(); _categoriesPage = _categoriesController.Initialize() as CategoriesPage; }
public ItemsViewModel(ItemsPage itemsPage, int parentItemId = -1) { Title = getTitle(); Items = new ObservableCollection <ItemDetailViewModel>(); AllItems = new ObservableCollection <ItemDetailViewModel>(); LoadItemsCommand = new Command(async() => await ExecuteLoadItemsCommand()); FilterItemsCommand = new Command((filterString) => Filter(filterString)); ItemsPage = itemsPage; AppStorage = CdbMobileAppStorage.Instance; this.parentItemId = parentItemId; //MessagingCenter.Subscribe<NewItemPage, Domain>(this, "AddItem", (obj, item) => //{ // var newItem = item as Item; // Items.Add(newItem); // //await DataStore.AddItemAsync(newItem); //}); }
public MainPage() { Page itemsPage, aboutPage = null; switch (Device.RuntimePlatform) { case Device.iOS: itemsPage = new NavigationPage(new ItemsPage()) { Title = "Browse" }; aboutPage = new NavigationPage(new AboutPage()) { Title = "About" }; itemsPage.Icon = "tab_feed.png"; aboutPage.Icon = "tab_about.png"; break; default: itemsPage = new ItemsPage() { Title = "Browse" }; aboutPage = new AboutPage() { Title = "About" }; break; } Children.Add(itemsPage); Children.Add(aboutPage); Title = Children[0].Title; }
public void AddAndDeleteLoactionTest() { var cityName = "New York"; var itemsPage = new ItemsPage(DriverInstance); Assert.IsTrue(itemsPage.IsOppened()); var selectedItemName = itemsPage.ClickAddLocationButton() .SetValueToSearch(cityName).ClickSearchButton() .SelectFirstLocationNameItem(); Assert.IsTrue(itemsPage.IsOppened()); var resultList = itemsPage.WaitForValueAddedInList(selectedItemName, 5).GetLocationsList(); Assert.IsTrue(resultList.Contains(selectedItemName)); itemsPage.SelectLocationInList(selectedItemName).ClickDeleteLocationButton(); resultList = itemsPage.GetLocationsList(); Assert.IsFalse(resultList.Contains(selectedItemName)); }
public static IEnumerable <DynamoItem> GetAll(this ItemsPage <DynamoItemListResponse> page) { IEnumerable <DynamoItem> GetEnumerable(ItemsPage <DynamoItemListResponse> pg) { while (true) { if (pg.Response?.Data == null || !pg.Response.Data.Data.Any()) { yield break; } pg.Response.ThrowIfErrorResponse(); foreach (var item in pg.Response.Data.Data) { yield return(item); } if (!pg.HasNext) { yield break; } pg = pg.GetNext(); } } if (page == null) { throw new ArgumentNullException(nameof(page)); } var enumerable = GetEnumerable(page); return(page?.Response?.Data?.Total == null ? enumerable : new PagedEnumerable <DynamoItem>(enumerable, page.Response.Data.Total.Value)); }
void EnterWorld() { if (!properties.enabled) { return; } int itemsPerPage = levelPage.GetComponent <ItemsPage>().maximum; int numberOfPages = Mathf.CeilToInt((float)properties.levels.Length / (float)itemsPerPage); for (int i = 0; i < numberOfPages; i++) { manager.levelsScroll.CreateItem(levelPage); ItemsPage page = manager.levelsScroll.GetItem(manager.levelsScroll.Count - 1).gameObject.GetComponent <ItemsPage>(); for (int j = 0; j < page.levels.Length; j++) { if ((i * itemsPerPage + j) > properties.levels.Length - 1) { //Debug.Log("o item " + (i*itemsPerPage+j) + " foi desativado"); page.levels[j].gameObject.SetActive(false); } else { page.levels[j].properties = properties.levels[i * itemsPerPage + j]; page.levels[j].manager = manager; } } } /*foreach(LevelProperties p in properties.levels) * { * manager.levelsScroll.CreateItem(levelPrefab); * Level newLevel = manager.levelsScroll.GetItem(manager.levelsScroll.Count-1).gameObject.GetComponent<Level>(); * newLevel.properties = p; * newLevel.manager = manager; * }*/ manager.BringLevelPanel(); }
public HttpResponseMessage Conflicts() { ItemsPage<ConflictItem> page = null; Storage.Batch(accessor => { var conflicts = accessor.GetConfigurationValuesStartWithPrefix<ConflictItem>( RavenFileNameHelper.ConflictConfigNamePrefix, Paging.PageSize * Paging.Start, Paging.PageSize).ToList(); page = new ItemsPage<ConflictItem>(conflicts, conflicts.Count); }); return GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache(); }
public HttpResponseMessage Incoming() { var activeIncoming = SynchronizationTask.IncomingQueue; var result = new ItemsPage<SynchronizationDetails>(activeIncoming.Skip(Paging.Start) .Take(Paging.PageSize), activeIncoming.Count()); return GetMessageWithObject(result, HttpStatusCode.OK) .WithNoCache(); }
public HttpResponseMessage Pending() { var result = new ItemsPage<SynchronizationDetails>(SynchronizationTask.Queue.Pending .Skip(Paging.Start) .Take(Paging.PageSize), SynchronizationTask.Queue.GetTotalPendingTasks()); return GetMessageWithObject(result, HttpStatusCode.OK) .WithNoCache(); }
public HttpResponseMessage Finished() { ItemsPage<SynchronizationReport> page = null; Storage.Batch(accessor => { var configs = accessor.GetConfigsStartWithPrefix(RavenFileNameHelper.SyncResultNamePrefix, Paging.Start, Paging.PageSize); int totalCount = 0; accessor.GetConfigNamesStartingWithPrefix(RavenFileNameHelper.SyncResultNamePrefix, Paging.Start, Paging.PageSize, out totalCount); var reports = configs.Select(config => config.JsonDeserialization<SynchronizationReport>()).ToList(); page = new ItemsPage<SynchronizationReport>(reports, totalCount); }); return GetMessageWithObject(page, HttpStatusCode.OK) .WithNoCache(); }
private void PageChanged(int pageIndex) { this.pageIndex = pageIndex; switch (pageIndex) { case 0: newClientPage = new NewClientPage(CloseFrame); MainFrame.Content = newClientPage; break; case 1: newOrderPage = new NewOrderPage(CloseFrame); MainFrame.Content = newOrderPage; break; case 2: newProjectPage = new NewProjectPage(CloseFrame); MainFrame.Content = newProjectPage; break; case 3: newEmployeePage = new NewEmployeePage(CloseFrame); MainFrame.Content = newEmployeePage; break; case 4: clientsPage = new ClientsPage(CloseFrame); MainFrame.Content = clientsPage; break; case 5: ordersPage = new OrdersPage(CloseFrame); MainFrame.Content = ordersPage; break; case 6: employeesPage = new EmployeesPage(CloseFrame); MainFrame.Content = employeesPage; break; case 7: allprojectsPage = new AllProjectsPage(CloseFrame); MainFrame.Content = allprojectsPage; break; case 8: lifeprojectsPage = new ProjectLifePage(CloseFrame); MainFrame.Content = lifeprojectsPage; break; case 9: notopened = new NotOpenedProjectsPage(CloseFrame); MainFrame.Content = notopened; break; case 10: alltasksPage = new TasksPage(CloseFrame); MainFrame.Content = alltasksPage; break; case 11: newTaskPage = new NewTaskPage(CloseFrame); MainFrame.Content = newTaskPage; break; case 12: newItemPage = new NewItemPage(CloseFrame); MainFrame.Content = newItemPage; break; case 13: itemsPage = new ItemsPage(CloseFrame); MainFrame.Content = itemsPage; break; } }
public async Task <IActionResult> GetAsync( int?fromAirportId, int?toAirportId, int?fromCityId, int?toCityId, DateTime?departureTime, DateTime?arrivalTime, int?ticketCount, bool searchBack, int?currentPage, int?pageLimit, DateTime?departureBackDate, DateTime?arrivalBackDate ) { currentPage ??= _paginationSettings.DefaultPage; pageLimit ??= _paginationSettings.DefaultPageSize; if (pageLimit > _paginationSettings.MaxPageLimit) { return(BadRequest()); } BlItemsPage flightsBl; if (fromAirportId != null || toAirportId != null || fromCityId != null || toCityId != null || departureTime != null || arrivalTime != null || ticketCount != null ) { FlightFilter filter = new FlightFilter( fromAirportId, toAirportId, fromCityId, toCityId, departureTime, arrivalTime, ticketCount, searchBack, departureBackDate, arrivalBackDate, currentPage.Value, pageLimit.Value ); BlFlightFilter filterBl = _mapper.Map <BlFlightFilter>(filter); flightsBl = await _flightService.SearchFlightsAsync(filterBl); } else { flightsBl = await _flightService.GetAllAsync(currentPage.Value, pageLimit.Value); } ItemsPage <Flight> flights = _mapper.Map <ItemsPage <Flight> >(flightsBl); return(Ok(flights)); }
public void LoadNextItem(Item item) { ItemsPage itemsPage = new ItemsPage(); itemsPage.NextItem(item); }
public CatalogItemsViewModel(ItemsPage itemsPage, int parentItemId = -1) : base(itemsPage, parentItemId) { }
public InventoryItemsViewModel(ItemsPage itemsPage, int parentItemId = -1) : base(itemsPage, parentItemId) { }
public override void BeforeEachTest() { base.BeforeEachTest(); ItemsPage.WaitForPageToLoad(); }
public async Task Foo() { IFilesStore store = null; #region get_destinations_2 SynchronizationDestination[] destinations = await store.AsyncFilesCommands.Synchronization .GetDestinationsAsync(); #endregion #region set_destinations_2 await store.AsyncFilesCommands.Synchronization.SetDestinationsAsync(new SynchronizationDestination { ServerUrl = "http://localhost:8080/", FileSystem = "BackupFS" }); #endregion #region get_sync_status_2 SynchronizationReport report = await store.AsyncFilesCommands.Synchronization .GetSynchronizationStatusForAsync("/documentation/readme.txt"); if (report.Exception == null) { Console.WriteLine("The file {0} has been synchronized successfully. The synchronization type: {1}", report.FileName, report.Type); } else { Console.WriteLine("The synchronization of the file {0} failed. The exception message: {1}", report.FileName, report.Exception.Message); } #endregion { #region get_finished_2 ItemsPage <SynchronizationReport> page; IList <SynchronizationReport> reports = new List <SynchronizationReport>(); var start = 0; const int pageSize = 10; do { page = await store.AsyncFilesCommands.Synchronization.GetFinishedAsync(start, pageSize); reports.AddRange(page.Items); Console.WriteLine("Retrieved {0} of {1} reports", reports.Count, page.TotalCount); } while (page.Items.Count == pageSize); #endregion } { #region get_active_2 ItemsPage <SynchronizationDetails> page = await store.AsyncFilesCommands.Synchronization .GetActiveAsync(0, 128); page.Items.ForEach(x => Console.WriteLine("Synchronization of {0} to {1} (type: {2}) is in progress", x.FileName, x.DestinationUrl, x.Type)); #endregion } { #region get_pending_2 ItemsPage <SynchronizationDetails> page = await store.AsyncFilesCommands.Synchronization .GetPendingAsync(0, 128); page.Items.ForEach(x => Console.WriteLine("File {0} waits to be synchronized to {1} (modification type: {2})", x.FileName, x.DestinationUrl, x.Type)); #endregion } { #region get_conflicts_2 ItemsPage <ConflictItem> page = await store.AsyncFilesCommands.Synchronization .GetConflictsAsync(0, 128); page.Items.ForEach(x => Console.WriteLine("Synchronization of file {0} from {1} file system resulted in conflict", x.FileName, x.RemoteServerUrl)); #endregion } #region resolve_conflict_2 await store.AsyncFilesCommands.Synchronization .ResolveConflictAsync("/documents/file.bin", ConflictResolutionStrategy.CurrentVersion); #endregion #region resolve_conflict_3 await store.AsyncFilesCommands.Synchronization .ResolveConflictAsync("/documents/file.bin", ConflictResolutionStrategy.RemoteVersion); #endregion #region start_4 DestinationSyncResult[] results = await store.AsyncFilesCommands.Synchronization .StartAsync(); foreach (var destinationSyncResult in results) { Console.WriteLine("Reports of synchronization to server {0}, fs {1}", destinationSyncResult.DestinationServer, destinationSyncResult.DestinationFileSystem); if (destinationSyncResult.Exception != null) { continue; } foreach (var fileReport in destinationSyncResult.Reports) { Console.WriteLine("\tFile {0} synchronization type: {1}", fileReport.FileName, fileReport.Type); } } #endregion { #region start_5 SynchronizationReport syncReport = await store.AsyncFilesCommands.Synchronization .StartAsync("/products/pictures/canon_1.jpg", new SynchronizationDestination { FileSystem = "NorthwindFS", ServerUrl = "http://localhost:8081/" }); #endregion } }
public App() { InitializeComponent(); MainPage = new ItemsPage(); }
//NOTE: User can delete item by clicking the button in the row /// <summary> /// Taking user to the items page /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void lookupBtn_Click(object sender, RoutedEventArgs e) { var ui = new ItemsPage(); LoginService.Instance.currentUIWindow.pageHolder.Content = ui; }
public bool LoadData(string path, TabControl tabControl) { tabControl.TabPages.Clear(); Animals.Clear(); //try { SaveDocument = XDocument.Load(path); GameData = new GameData(SaveDocument.Root.XPathSelectElement("game/tickManager")); uniqueIdsManager = new UniqueIDsManager(SaveDocument.Root.XPathSelectElement("game/uniqueIDsManager")); var playerFactionDef = EvaluateSingle <XElement>("scenario/playerFaction/factionDef").Value; foreach (var element in SaveDocument.Root.XPathSelectElements("game/world/factionManager/allFactions/li")) { Faction faction = new Faction(element); if (faction.Def.Equals(playerFactionDef)) { PlayerFaction = faction; } Factions[faction.FactionIDString] = faction; PawnsByFactions[faction] = new List <Pawn>(); } //Console.WriteLine($"playerFaction:{playerFaction}, colonyFaction:{colonyFaction}"); Dictionary <String, List <PawnData> > pawnDataDir = new Dictionary <string, List <PawnData> >(); foreach (var pawnData in SaveDocument.Descendants("pawn")) { String key = pawnData.GetValue(); List <PawnData> pawnDataList; if (!pawnDataDir.TryGetValue(key, out pawnDataList)) { pawnDataList = new List <PawnData>(); pawnDataDir[key] = pawnDataList; } pawnDataList.Add(new PawnData(pawnData.Parent)); } foreach (var pawn in SaveDocument.Root.XPathSelectElements("game/world/worldPawns/pawnsAlive/li")) { Pawn p = new Pawn(pawn); if (p.Faction != null) { List <PawnData> pawnDataList; if (!pawnDataDir.TryGetValue(p.PawnId, out pawnDataList)) { pawnDataList = new List <PawnData>(); } p.addPawnData(pawnDataList); PawnsById[p.PawnId] = p; Faction faction = Factions[p.Faction]; PawnsByFactions[faction].Add(p); } } SaveThingsByClass = new Dictionary <string, List <SaveThing> >(); foreach (var thing in SaveDocument.Descendants("thing")) { if ((string)thing.Attribute("Class") == "Pawn") { Pawn p = new Pawn(thing); if (p.Faction != null) { List <PawnData> pawnDataList; if (!pawnDataDir.TryGetValue(p.PawnId, out pawnDataList)) { pawnDataList = new List <PawnData>(); } p.addPawnData(pawnDataList); PawnsById[p.PawnId] = p; Faction faction = Factions[p.Faction]; PawnsByFactions[faction].Add(p); } } else { SaveThing SaveThing = new SaveThing(thing); String key = SaveThing.Class; if (SaveThing.BaseThing != null && SaveThing.BaseThing.BaseName == "BuildingBase") { key = SaveThing.BaseThing.BaseName; } if (SaveThingsByClass.TryGetValue(key, out List <SaveThing> list)) { list.Add(SaveThing); } else { List <SaveThing> newList = new List <SaveThing>(); newList.Add(SaveThing); SaveThingsByClass.Add(key, newList); } } } if (PawnsByFactions[PlayerFaction].Count == 0) { throw new Exception("No characters found!\nTry playing the game a little more."); } colonistPage = new ColonistPage(); colonistPage.Dock = DockStyle.Fill; animalPage = new AnimalPage(); animalPage.Dock = DockStyle.Fill; itemsPage = new ItemsPage(); itemsPage.Dock = DockStyle.Fill; buidingsPage = new BuildingsPage(); buidingsPage.Dock = DockStyle.Fill; relationsPage = new RelationPage(); generalPage = new GeneralPage(); TabPage colonisTabPage = new TabPage("Colonists"); TabPage animalsTabPage = new TabPage("Animals"); TabPage relationsTabPage = new TabPage("Relations"); TabPage gameDataTabPage = new TabPage("General"); TabPage itemsTabPage = new TabPage("Items"); TabPage buildingsTabPage = new TabPage("Buildings"); colonisTabPage.Controls.Add(colonistPage); animalsTabPage.Controls.Add(animalPage); itemsTabPage.Controls.Add(itemsPage); relationsTabPage.Controls.Add(relationsPage); gameDataTabPage.Controls.Add(generalPage); buildingsTabPage.Controls.Add(buidingsPage); tabControl.TabPages.Add(gameDataTabPage); tabControl.TabPages.Add(colonisTabPage); tabControl.TabPages.Add(animalsTabPage); tabControl.TabPages.Add(relationsTabPage); tabControl.TabPages.Add(itemsTabPage); tabControl.TabPages.Add(buildingsTabPage); return(true); }