public async Task LoadAsync()
        {
            try
            {
                //LOAD EQUIPMENTS
                var lookup = await _equipmentLookupDataService.GetEquipmentLookupAsync();

                Equipments.Clear();
                foreach (var item in lookup)
                {
                    Equipments.Add(item);
                }
                //LOAD COMPONENTS
                var components = await _componentDataService.GetComponentLookupAsync();

                Components.Clear();
                foreach (var item in components)
                {
                    Components.Add(item);
                }
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "An error occurred", MessageBoxButton.OK, MessageBoxImage.Warning);
                //create new error object from the exception and add to DB
                Error error = new Error
                {
                    ErrorMessage    = e.Message,
                    ErrorTimeStamp  = DateTime.Now,
                    ErrorStackTrace = e.StackTrace
                };
                await _errorDataService.AddError(error);
            }
        }
Beispiel #2
0
        //LOAD EQUIPMENT LIST
        public async Task LoadEquipmentAsync()
        {
            try
            {
                var lookup = await _equipmentLookupDataService.GetEquipmentLookupAsync();

                Equipments.Clear();
                foreach (var item in lookup)
                {
                    Equipments.Add(item);
                }
                EquipmentView        = CollectionViewSource.GetDefaultView(Equipments);
                EquipmentView.Filter = new Predicate <object>(Filter);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message, "An error occurred", MessageBoxButton.OK, MessageBoxImage.Warning);
                //create new error object from the exception and add to DB
                Error error = new Error
                {
                    ErrorMessage    = e.Message,
                    ErrorTimeStamp  = DateTime.Now,
                    ErrorStackTrace = e.StackTrace,
                    LoginId         = CurrentUser.LoginId
                };
                await _errorDataService.AddError(error);
            }
        }
        public void Unload()
        {
            Log.Info(Log.LogSource.PoxDB, "Database.Unload() called");
            if (!ready)
            {
                return;
            }
            // todo: what if it is loading?

            Champions.Clear();
            Abilities.Clear();
            Abilities_similar.Clear();
            Spells.Clear();
            Relics.Clear();
            Equipments.Clear();

            Factions.Clear();
            Races.Clear();
            Classes.Clear();
            Rarities.Clear();
            Expansions.Clear();
            AbilityNames.Clear();

            ready = false;
        }
        private void OnSearchTextChanged()
        {
            Equipments.Clear();

            if (string.IsNullOrWhiteSpace(searchText))
            {
                foreach (EquipmentViewModel x in rootViewModel.AllEquipments)
                {
                    Equipments.Add(x);
                }
            }
            else
            {
                var searchStatement = SearchStatement.Create(searchText);

                foreach (EquipmentViewModel x in rootViewModel.AllEquipments)
                {
                    bool isVisible = searchStatement.IsMatching(Localization.Get(x.Name)) ||
                                     x.Abilities.Any(a => IsMatching(a, searchStatement));

                    if (isVisible)
                    {
                        Equipments.Add(x);
                    }
                }
            }
        }
 protected virtual void ClearNavigationProperties()
 {
     PrimaryPrefCustomers.Clear();
     SecondaryPrefCustomers.Clear();
     Equipments.Clear();
     Trips.Clear();
 }
        public async Task LoadEquipment()
        {
            var lookup = await _equipmentLookupDataService.GetEquipmentLookupAsync();

            Equipments.Clear();
            foreach (var item in lookup)
            {
                Equipments.Add(item);
            }
        }
Beispiel #7
0
        private void LoadEquipmentForCustomer(int customerId)
        {
            CustomerDto customer = Customers.Where(c => c.CustomerID == customerId).SingleOrDefault();

            Equipments.Clear();
            foreach (var item in customer.EquipmentCollection)
            {
                Equipments.Add(item);
            }
        }
        private async Task LoadEquipmentsLookupAsync()
        {
            Equipments.Clear();
            //Equipments.Add(new NullLookupItem { DisplayMember = " - " });
            var lookup = await _equipmentLookupDataService.GetEquipmentLookupAsync();

            foreach (var lookupItem in lookup)
            {
                Equipments.Add(lookupItem);
            }
        }
Beispiel #9
0
        private async void searchEquipment(object obj)
        {
            var searchText = obj as string;

            var equipments = (string.IsNullOrWhiteSpace(searchText) ? await _restServices.GetEquipments() :
                              await _restServices.SearchEquipment(searchText));

            Equipments.Clear();
            foreach (var equipment in equipments)
            {
                Equipments.Add(equipment);
            }
            IsBusy  = false;
            HasItem = (Equipments.Count > 0) ? true : false;
        }
        public ViewerMainViewModel(IRegionManager regionManager) : base(regionManager)
        {
            Message      = "Viewer Module.";
            GoSqlCommand = new DelegateCommand(DoSqlTest);

            Equipments.Clear();

            List <string> equipments = new List <string>();

            for (int i = 0; i < 200; i++)
            {
                equipments.Add("Inlet");
                equipments.Add("Outlet");
                equipments.Add("Valve");
                equipments.Add("Pipe");
            }

            Equipments.AddRange(equipments);

            List <ShapeViewModelBase> shapes = new List <ShapeViewModelBase>();

            for (int i = 0; i < 30; i++)
            {
                shapes.Add(new InletViewModel()
                {
                    X      = (i % 8) * 40 + 5,
                    Y      = (int)(i / 8) * 40 + 5,
                    Width  = 64,
                    Height = 64,
                    Angle  = 0
                });
            }
            for (int i = 0; i < 5; i++)
            {
                shapes.Add(new PipeViewModel()
                {
                    X      = (i % 8) * 40 + 5,
                    Y      = (int)(i / 8) * 40 + 5 + 300,
                    Width  = 64,
                    Height = 64,
                    Angle  = 0
                });
            }

            Shapes.AddRange(shapes);
        }
        public async override Task LoadAsync(int id)
        {
            Id = id;
            foreach (var wrapper in Equipments)
            {
                wrapper.PropertyChanged -= Wrapper_PropertyChanged;
            }

            Equipments.Clear();
            var equipments = await _equipmentRepository.GetAllAsync();

            foreach (var model in equipments)
            {
                var wrapper = new EquipmentWrapper(model);
                wrapper.PropertyChanged += Wrapper_PropertyChanged;
                Equipments.Add(wrapper);
            }
        }
        private async Task ExecuteLoadItemsCommand()
        {
            IsBusy = true;

            try
            {
                Equipments.Clear();
                var items = await DataStore.GetItemsAsync(true);

                foreach (var item in items)
                {
                    Equipments.Add(item);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex);
            }
            finally
            {
                IsBusy = false;
            }
        }