예제 #1
0
        private void StopsAdapter_Click(GenericAdapter <Stop> adapter, View view, Stop item)
        {
            Intent intent = new Intent(view.Context, typeof(StopActivity));

            intent.PutExtra("Stop", item.Id);
            intent.PutExtra("Line", item.Line.Id);

            view.Context.StartActivity(intent);
        }
예제 #2
0
 public void RenderGridRows(ushort skip, bool UpdateUI)
 {
     if (skip > 0)
     {
         SortedRowsListActual = SortedRowsList.Skip(skip).Take(bvgGrid.DisplayedRowsCount).ToArray();
         GenericAdapter <TItem> .GetRows(SortedRowsListActual, bvgGrid, skip);
     }
     else
     {
         SortedRowsListActual = SortedRowsList.Take(bvgGrid.DisplayedRowsCount).ToArray();
         GenericAdapter <TItem> .GetRows(SortedRowsListActual, bvgGrid, 0);
     }
 }
예제 #3
0
        public void SortGrid(string s)
        {
            SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), s).ToArray();

            bvgGrid.CurrVerticalScrollPosition = 0;
            bvgGrid.VerticalScroll.compBlazorScrollbar.SetScrollPosition(0);


            bvgGrid.bvgAreaColumnsFrozen.InvokePropertyChanged();
            bvgGrid.bvgAreaColumnsNonFrozen.InvokePropertyChanged();

            RenderGridRows(0, true);
        }
예제 #4
0
        public void RenderGridRows(int skip, bool UpdateUI)
        {
            if (skip != LastVerticalSkip)
            {
                LastVerticalSkip = skip;


                if (skip > 0)
                {
                    SortedRowsListActual = SortedRowsList.Skip(skip).Take(bvgGrid.DisplayedRowsCount).ToArray();
                    GenericAdapter <TItem> .GetRows(SortedRowsListActual, bvgGrid);
                }
                else
                {
                    SortedRowsListActual = SortedRowsList.Take(bvgGrid.DisplayedRowsCount).ToArray();
                    GenericAdapter <TItem> .GetRows(SortedRowsListActual, bvgGrid);
                }
            }
        }
예제 #5
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);

            // Settings data
            if(!File.Exists (dbPath))
            {
                CreateDatabase();
                FillDataBase();
            }

            // Autocomplete component (I wanna test this feature too)
            AutoCompleteTextView input = FindViewById<AutoCompleteTextView>(Resource.Id.txtInput);
            ArrayAdapter autoCompleteData = new ArrayAdapter<string>(this,Resource.Layout.SimpleListItem, new string[]{"Harley","Honda","Yamaha","Suzuki","Kawazaki","Triumph","Voxan","Ducati","BMW","Moto Guzzy"});
            input.Adapter = autoCompleteData;

            // Setting the genericAdapter and the ListView
            ListView listOfMotorCycle = FindViewById<ListView>(Resource.Id.listMotorCycle);
            // the genericAdapter is instantiate with a method that retrieve datas from our database
            GenericAdapter<Item> myGenericAdapter = new GenericAdapter<Item>(this,Resource.Layout.IdAndNameListItem, GetData);

            listOfMotorCycle.Adapter = myGenericAdapter;
            listOfMotorCycle.ItemClick+= new EventHandler<ItemEventArgs>(showDetails);

            // finaly, attach an event to the button 'save'
            Button btnSave = FindViewById<Button> (Resource.Id.btnSave);
            btnSave.Click += delegate
                            {
                                InsertData(input.Text);
                                myGenericAdapter.Bind();
                                input.Text="";
                            };
        }
예제 #6
0
        public void RenderGridColumns(double Scrollposition, bool UpdateUI, bool RequestedFromResize = false)
        {
            LastHorizontalScrollPosition = Scrollposition;


            int skip = Scrollposition == 0 ? 0 : GetSkipedColumns(Scrollposition);


            if (skip != LastHorizontalSkip || RequestedFromResize)
            {
                //BlazorWindowHelper.BlazorTimeAnalyzer.Reset();
                //BlazorWindowHelper.BlazorTimeAnalyzer.Add("prepare cols", MethodBase.GetCurrentMethod());

                LastHorizontalSkip = skip;

                IEnumerable <ColProp> ActiveRegularProps;
                if (skip > 0)
                {
                    ActiveRegularProps = bvgGrid.ColumnsOrderedListNonFrozen.Skip(skip).Take(bvgGrid.DisplayedColumnsCount);
                }
                else
                {
                    ActiveRegularProps = bvgGrid.ColumnsOrderedListNonFrozen.Take(bvgGrid.DisplayedColumnsCount);
                }



                bvgGrid.ActiveProps = new PropertyInfo[bvgGrid.ColumnsOrderedListFrozen.Count() + ActiveRegularProps.Count()];

                ColProp[] ListProps = new ColProp[bvgGrid.ActiveProps.Count()];

                int j = 0;

                for (int i = 0; i < bvgGrid.ColumnsOrderedListFrozen.Count(); i++)
                {
                    bvgGrid.ActiveProps[j] = bvgGrid.ColumnsOrderedListFrozen[i].prop;
                    ListProps[j]           = bvgGrid.ColumnsOrderedListFrozen[i];
                    j++;
                }

                foreach (var item in ActiveRegularProps)
                {
                    bvgGrid.ActiveProps[j] = item.prop;
                    ListProps[j]           = item;
                    j++;
                }

                //BlazorWindowHelper.BlazorTimeAnalyzer.Add("get columns", MethodBase.GetCurrentMethod());



                GenericAdapter <TItem> .GetColumns(ListProps, bvgGrid, SortedRowsListActual, UpdateUI);

                //BlazorWindowHelper.BlazorTimeAnalyzer.Log();



                bvgGrid.cssHelper.UpdateStyle2(bvgGrid);

                //if (bvgGrid.SortState.Item1)
                //{
                //    if (bvgGrid.Columns.Any(x => x.prop.Name.Equals(bvgGrid.SortState.Item2, StringComparison.InvariantCultureIgnoreCase)))
                //    {
                //        if (bvgGrid.Columns.Single(x => x.prop.Name.Equals(bvgGrid.SortState.Item2, StringComparison.InvariantCultureIgnoreCase)).IsFrozen == false)
                //        {

                //            bvgGrid.bvgAreaColumnsNonFrozen.InvokePropertyChanged();
                //        }
                //    }
                //}


                bvgGrid.bvgAreaColumnsNonFrozen.InvokePropertyChanged();
            }
        }
예제 #7
0
        private void Reset(bool LoadColumnsFromSettings)
        {
            FirstLoad    = true;
            ActualRender = true;

            LastHorizontalSkip = -1;

            LastHorizontalScrollPosition = 0;


            if (bvgGrid != null)
            {
                bvgGridTransferableState = new BvgGridTransferableState <TItem>(bvgGrid);
            }
            else
            {
                bvgGridTransferableState = new BvgGridTransferableState <TItem>();
            }

            bvgGrid = new BvgGrid <TItem>
            {
                IsReady         = true,
                Name            = TableName,
                RowsTotalCount  = SourceList.Count(),
                bvgSettings     = bvgSettings,
                AllProps        = typeof(TItem).GetProperties(BindingFlags.Public | BindingFlags.Instance),
                HasMeasuredRect = bvgGridTransferableState.HasMeasuredRect,
                bvgSize         = bvgGridTransferableState.bvgSize,
            };

            bvgGrid.bvgModal.bvgGrid = bvgGrid;

            if (bvgGridTransferableState.ContaintState)
            {
                bvgGrid.cssHelper = bvgGridTransferableState.cssHelper;
            }

            if (bvgGridTransferableState.ContaintState && !LoadColumnsFromSettings)
            {
                bvgGrid.ColumnsOrderedList          = bvgGridTransferableState.ColumnsOrderedList;
                bvgGrid.ColumnsOrderedListFrozen    = bvgGridTransferableState.ColumnsOrderedListFrozen;
                bvgGrid.ColumnsOrderedListNonFrozen = bvgGridTransferableState.ColumnsOrderedListNonFrozen;
            }
            else
            {
                bvgGrid.ColumnsOrderedList = ColumnsHelper <TItem> .GetColumnsOrderedList(bvgGrid);

                bvgGrid.ColumnsOrderedListFrozen    = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen).ToArray();
                bvgGrid.ColumnsOrderedListNonFrozen = bvgGrid.ColumnsOrderedList.Where(x => x.IsFrozen == false).ToArray();
            }


            bvgGrid.UpdateNonFrozenColwidthSumsByElement();

            if (bvgSettings.SortedColumn.Item1)
            {
                bvgGrid.SortState = Tuple.Create(bvgSettings.SortedColumn.Item1, bvgSettings.SortedColumn.Item2, bvgSettings.SortedColumn.Item3);


                if (bvgSettings.SortedColumn.Item3)
                {
                    SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), bvgSettings.SortedColumn.Item2).ToArray();
                }
                else
                {
                    SortedRowsList = GenericAdapter <TItem> .GetSortedRowsList(SourceList.AsQueryable(), bvgSettings.SortedColumn.Item2 + " desc").ToArray();
                }
            }
            else
            {
                bvgGrid.SortState = Tuple.Create(false, string.Empty, false);

                SortedRowsList = SourceList.ToArray();
            }
        }