Exemplo n.º 1
0
        private void UpdateRoutine(MoveDirection direction)
        {
            // Save the data to the database
            SaveCustomerRecord();

            // Move to the next customer
            if (direction == MoveDirection.Forward)
            {
                _currentCustomerIndex++;
            }
            else if (direction == MoveDirection.Backward)
            {
                _currentCustomerIndex--;
            }

            // Show the label at the top
            DisplayCustomer();

            // Recall their data (if they have any)
            CollectedItems.Clear();
            CollectedItems = CollectionRecord.GetItemByCustomer(_currentCustomerId);

            // Get the bag count
            if (CollectedItems.Count > 0)
            {
                _currentBagCount = CollectedItems.Where(x => x.ItemID == "1").Select(x => x.Quantity).FirstOrDefault();
            }

            // Display it
            AddToList();

            // See if this allows us to select the same extra item a second time
            CurrentItemList.SelectedItem = null;
        }
Exemplo n.º 2
0
        private async void ButtonUploadData(object sender, EventArgs e)
        {
            // Show a message to the user stating what is going on
            bool answer = await DisplayAlert("Confirm", "Are you sure you would like to upload this route to the FTP site?  A message will appear once the upload has been completed.", "Yes", "No");

            if (answer == false)
            {
                return;
            }

            int dayToExport   = App.GetLastDay() + 1;
            int routeToExport = App.GetLastRoute() + 1;

            // Create a filtered list
            List <CollectionRecord> filteredList = CollectionRecord.GetItemsByDayAndRoute(dayToExport, routeToExport);

            // Create the base file name string
            string baseFileName = string.Format("CollectionData_Day{0}_Route{1}_{2:ddMMMyyyy}.fcf", dayToExport, routeToExport, DateTime.Today);

            // Export the data (if we have any records)
            if (filteredList.Count > 0)
            {
                DependencyService.Get <ISQLite>().ExportRouteData(filteredList, baseFileName);
            }

            // Tell the user
            await DisplayAlert("FTP Transfer", "The route has been uploaded.", "OK");
        }
Exemplo n.º 3
0
        //--------------------------------------------------------------------------------------------------------
        public MainViewModel()
        {
            RecordCollection = new CollectionRecord();

            this.visualizations = new SpectrumAnalyzerVisualization();
            this.AudioPlayBack  = new AudioPlayBack();

            AudioPlayBack.MaximumCalculated += audioGraph_MaximumCalculated;
            AudioPlayBack.FftCalculated     += audioGraph_FftCalculated;

            var enumerator = new MMDeviceEnumerator();

            CaptureDevices = enumerator.EnumerateAudioEndPoints(DataFlow.Capture, DeviceState.Active).ToArray();
            var defaultDevice = enumerator.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Console);

            SelectedDevice         = CaptureDevices.FirstOrDefault(c => c.ID == defaultDevice.ID);
            synchronizationContext = SynchronizationContext.Current;

            this.OpenFileCommand = new RelayCommand(this.OpenFolderAndLoadSound);

            this.PlayCommand = new RelayCommand(this.Play);
            this.StopCommand = new RelayCommand(this.Stop);

            this.NextSound     = new RelayCommand(this.NextTrack);
            this.PreviousSound = new RelayCommand(this.PreviosTrack);

            this.StartRecordCommand = new RelayCommand(this.Record);
            this.StopRecordCommand  = new RelayCommand(this.StopRecord);

            this.CloseWindowCommand = new RelayCommand(this.CloseWindow);
            //---------------------------------------------------------------
            timer.Interval = TimeSpan.FromMilliseconds(900); //Интервал вызова - Обновлять позицию каждые 900 миллисекунд
            timer.Tick    += TimerOnTick;                    //Привязка метода к таймеру
        }
Exemplo n.º 4
0
 private void SaveCustomerRecord()
 {
     CollectionRecord.DeleteItemByCustomer(_currentCustomerId);
     foreach (CollectionRecord colRec in CollectedItems)
     {
         CollectionRecord.SaveRecord(colRec);
     }
 }
Exemplo n.º 5
0
        public void RemoveFromList()
        {
            CollectionRecord itemSel = (CollectionRecord)CollectedItemList.SelectedItem;

            if (itemSel != null)
            {
                CollectedItems.Remove(itemSel);
                AddToList();
            }
        }
Exemplo n.º 6
0
        public DisposalEntry(RouteStatus rs, int curDay, int curRoute)
        {
            InitializeComponent();

            // Disable the navigation bar
            NavigationPage.SetHasBackButton(this, false);

            // Create a message to listen for Jump Requests
            MessagingCenter.Subscribe <JumpToCustomer, int>(this, "JumpTo", (sender, arg) =>
            {
                _currentCustomerIndex = arg;
                UpdateRoutine(MoveDirection.Jump);
            });

            // Get the customer list for the day and route
            _currentDay         = curDay + 1;
            _currentRoute       = curRoute + 1;
            _routeDesc          = string.Format("Truck - {0}", _currentRoute);
            CurrentCustomerList = CCustomerList.GetCustomerListing(_currentDay, _currentRoute);

            // If the list comes back blank ... tell the user and go back
            if (CurrentCustomerList == null)
            {
                DisplayAlert("Customer List", "The customer list cannot be loaded.  The most likely cause is due to a missing file.  Please press the Update Customer List button and then try again.", "OK");
                Navigation.PopAsync();
            }

            // If this is a new route, clear every thing out
            if (rs == RouteStatus.StartNew)
            {
                CollectionRecord.DeleteDayAndRoute(_currentDay, _currentRoute);
            }

            // Fill in the other items that are collected
            ReadItemsToCollect();

            // Go to the first record
            UpdateRoutine(MoveDirection.Forward);

            // Set an event when those items are selected
            CurrentItemList.ItemSelected += (sender, e) =>
            {
                ItemsCollected colItem = (ItemsCollected)e.SelectedItem;
                if (colItem != null)
                {
                    CollectedItems.Add(new CollectionRecord(_currentCustomerId, _currentDay, _currentRoute, colItem.ID.ToString(), 1, colItem.ItemDescription, DateTime.Now, _routeDesc, colItem.MinimumPrice));
                }
                AddToList();
            };
        }
Exemplo n.º 7
0
 private void ClearRoute(object sender, EventArgs e)
 {
     CollectionRecord.DeleteAll();
 }
Exemplo n.º 8
0
 /// <summary>
 /// Invoked when the Page is loaded and becomes the current source of a parent Frame.
 /// </summary>
 /// <param name="e">
 /// Event data that can be examined by overriding code. The event data
 /// is representative of the pending navigation that will load the current Page.
 /// Usually the most relevant property to examine is Parameter.
 /// </param>
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     base.OnNavigatedTo(e);
     _collection = (CollectionRecord)e.Parameter;
 }