Example #1
0
        public void ScrollToBottom()
        {
            var historyItems = HistoryListView.Items;

            if (historyItems.Count > 0)
            {
                HistoryListView.ScrollIntoView(historyItems[historyItems.Count - 1]);
            }
        }
Example #2
0
        public HistoryView()
        {
            InitializeComponent();

            ((INotifyCollectionChanged)HistoryListView.Items).CollectionChanged += (sender, args) =>
            {
                if (HistoryListView.SelectedIndex != HistoryListView.Items.Count - 2)
                {
                    return;
                }

                var item = HistoryListView.Items[HistoryListView.Items.Count - 1];
                HistoryListView.ScrollIntoView(item);
                HistoryListView.SelectedItem = item;
            };
        }
Example #3
0
        private async void UpdateActivities()
        {
            List <ListViewItem> lvlist = new List <ListViewItem>();

            foreach (ParkingYard.Activities Activity in await ufunctions.GetActivities(23))
            {
                if (HistoryListView.InvokeRequired)
                {
                    HistoryListView.Invoke(new MethodInvoker(delegate
                    {
                        string[] str = { "Hello", "world" };

                        HistoryListView.Items.Add(Activity.License).SubItems.Add(Activity.IN.ToString());
                    }));
                }
                //  HistoryListView.Items.AddRange(new ListViewItem[] { lvi, lvi, lvi3 });
            }
        }
        public NonBillableTab()
        {
            imei = DeviceHelper.GetMyIMEI();

            #region titles
            this.Padding = 10;
            this.Title = "ETC TimeTrack Non-Billable";
            var hLabel = new Label {
                Text = "Your Non Billable History",
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                TextColor = Color.Black,
                FontSize = 14,
                FontFamily = "Helvetica"
            };
            #endregion
            #region selections
            this.selectedCodeId = -1;
            generalEntry = new Entry {
                Placeholder = "Enter description..."
            };
            //job & code area
            nonBillableCodes = ProjectCodeManager.GetNonBillableCodes ();
            JobCode = new JobCodeLayout (nonBillableCodes);
            JobCode.jobEntry.IsVisible = false;
            JobCode.codePicker.HorizontalOptions = LayoutOptions.FillAndExpand;
            JobCode.codePicker.SelectedIndexChanged += codePickerChanged;
            #endregion

            #region buttons
            //start & stop area
            buttons = new StartStopLayout ();
            buttons.btnStart.Clicked += onStartClicked;
            buttons.btnStop.Clicked += onStopClicked;
            #endregion

            #region active job
            var activeEntry = TimeManager.GetActiveTimeEntry ();
            currentJobLabel = new Label ();
            currentJobLabel.HorizontalOptions = LayoutOptions.CenterAndExpand;
            if (activeEntry != null) {
                currentJobLabel.Text = "Active on:" + activeEntry.Description + " " + activeEntry.Code;
                currentJobLabel.TextColor = Color.Green;
            } else {
                currentJobLabel.Text = "Inactive";
                currentJobLabel.TextColor = Color.Red;
            }
            #endregion

            #region history listview
            var localEntries = TimeManager.GetCompletedNonBillableEntries ()
                .Where (x => x.Stop > DateTime.Now.AddHours (-24)).ToList();
            h = new ObservableCollection<WorkHistory>();
            history = new HistoryListView();
            foreach(var e in localEntries)
                h.Add(history.TimeEntryToWorkHistory(e));

            history.ItemsSource = h;

            history.ItemSelected += (sender, e) => {
                if (e.SelectedItem == null)
                    return; // don't do anything if we just de-selected the row
                // do something with e.SelectedItem
                var t = e.SelectedItem as WorkHistory;
                generalEntry.Text = t.Header;
                JobCode.codePicker.SelectedIndex =
                    nonBillableCodes.IndexOf (nonBillableCodes.First (b => b.code_ID == t.Code));
                ((ListView)sender).SelectedItem = null; // de-select the row
            };
            #endregion

            this.Content = new StackLayout {
                Children = {
                    generalEntry,
                    JobCode,
                    buttons,
                    currentJobLabel,
                    hLabel,
                    history
                }
            };
        }
Example #5
0
 private void FilterHistoryTextBox_TextChanged(object sender, TextChangedEventArgs e)
 {
     HistoryListView.FilterList(FilterHistoryTextBox.Text);
 }
 private void MoveToLastButton_OnClicked(object sender, EventArgs e)
 {
     HistoryListView.ScrollTo(ViewModel.CalculatorItems[ViewModel.CalculatorItems.Count - 1],
                              ScrollToPosition.MakeVisible, true);
 }