public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RootView     = inflater.Inflate(Resource.Layout.generic_list, container, false);
            RecyclerView = RootView.FindViewById <RecyclerView>(Resource.Id.gridView_items);
            RecyclerView.SetLayoutManager(new LinearLayoutManager(Context));
            SwipeRefreshLayout = RootView.FindViewById <SwipeRefreshLayout>(Resource.Id.swipe_refresh_layout);
            LoadingProgressBar = RootView.FindViewById <ContentLoadingProgressBar>(Resource.Id.load_progress_bar);
            var BtnFloatingAction = RootView.FindViewById <ImageButton>(Resource.Id.btn_floating_action);

            SwipeRefreshLayout.SetColorSchemeResources(Android.Resource.Color.HoloBlueBright, Android.Resource.Color.HoloBlueLight, Android.Resource.Color.HoloOrangeLight, Android.Resource.Color.HoloRedLight);
            SwipeRefreshLayout.Enabled   = AllowRefresh;
            BtnFloatingAction.Visibility = ShowFloatingActionButton ? ViewStates.Visible : ViewStates.Gone;
            BtnFloatingAction.Click     += (o, e) => FloatingActionButtonClick?.Invoke(o, e);
            if (FloatingActionButtonResID > 0)
            {
                BtnFloatingAction.SetImageResource(FloatingActionButtonResID.Value);
            }
            SwipeRefreshLayout.Refresh += (o, e) => OnRefreshed(e);
            ViewCreated?.Invoke(this, new EventArgs());
            if (HeaderLayoutResID.HasValue)
            {
                var headerView = inflater.Inflate(HeaderLayoutResID.Value, RootView.FindViewById <ViewGroup>(Resource.Id.view_list_header));
            }
            return(RootView);
        }
Esempio n. 2
0
        private Task <TModel> CreateModelAndView <TView, TModel, TOrders, TInfo>(GameObject prefab, Func <TView, TModel> createModel, Vector2 position)
            where TView : ModelSelectableView <TOrders, TInfo>
            where TOrders : IGameObjectOrders
            where TInfo : IGameObjectInfo
            where TModel : RtsGameObject, TOrders, TInfo
        {
            return(mSyncContext.Execute(() =>
            {
                var instance = Instantiate(prefab);
                var view = instance.GetComponent <TView>();
                if (view == null)
                {
                    throw new Exception("Prefab not contains View script.");
                }

                var result = createModel(view);
                result.RemovedFromGame += o =>
                {
                    Destroy(instance);
                    instance.transform.parent = null;
                };
                view.Map = mMap;
                view.SyncContext = mSyncContext;
                view.LoadModel(result, result);

                instance.transform.parent = mMap.ChildContainer.transform;
                instance.transform.localPosition = mMap.GetWorldPosition(position);

                ViewCreated?.Invoke(view);

                return result;
            }));
        }
Esempio n. 3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var timeStart = DateTime.UtcNow;
            var view      = inflater.Inflate(_resource, container, false);

            ElapsedMemory = GC.GetTotalMemory(true) / (1024 * 1024);
            ElapsedTime   = (DateTime.UtcNow - timeStart).Milliseconds;
            ViewCreated?.Invoke(this);
            return(view);
        }
Esempio n. 4
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            RootView = inflater.Inflate(Resource.Layout.searchable_list, container, false);
            RootView.SetBackgroundResource(Resource.Color.colorWindowBackground);
            RecyclerView = RootView.FindViewById <RecyclerView>(Resource.Id.gridView_items);
            var toolbar = RootView.FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar_top);

            toolbar.InflateMenu(Resource.Menu.appcompat_search);
            var searchView = (Android.Support.V7.Widget.SearchView)toolbar.Menu.FindItem(Resource.Id.action_search).ActionView;

            searchView.Iconified        = false;
            searchView.QueryTextChange += (o, e) => QueryTextChanged?.Invoke(o, e);
            RecyclerView.SetLayoutManager(new LinearLayoutManager(Context));
            ViewCreated?.Invoke(this, null);
            return(RootView);
        }
Esempio n. 5
0
        public Task <object> GetViewAsync(IViewMappingItem viewMapping, IDataContext context = null)
        {
            Should.NotBeNull(viewMapping, nameof(viewMapping));
            var tcs = new TaskCompletionSource <object>();

            ThreadManager.InvokeOnUiThreadAsync(() =>
            {
                if (context == null)
                {
                    context = DataContext.Empty;
                }
                object view = GetView(viewMapping, context);
                ViewCreated?.Invoke(this, new ViewCreatedEventArgs(view, null, viewMapping, context));
                tcs.SetResult(view);
            });
            return(tcs.Task);
        }
Esempio n. 6
0
 private void OnViewCreated(EnvironmentView view)
 {
     ViewCreated?.Invoke(this, new EnvironmentViewEventArgs(view));
 }
Esempio n. 7
0
 /// <summary>
 /// Called when a view object is created
 /// </summary>
 protected virtual void OnViewCreated(object view)
 {
     _logger?.Log(_eventsSource, $"View created {view.GetType().Name} for {__Name}", LogRecordTypes.Debug);
     ViewCreated?.Invoke(this, view);
 }
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            ViewCreated?.Invoke();

            base.OnViewCreated(view, savedInstanceState);
        }