コード例 #1
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);


            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.EventDeletion_Admin);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.EventDeletion_Admin);
                        break;
                    }
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.EventDeletion_Moderator);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.EventDeletion_Moderator);
                        break;
                    }
            }

            eventDeleter = new EventDeleter();
            deletionListView = FindViewById<ListView>(Resource.Id.listDeletion);
            DeleteEventsBtn = FindViewById<Button>(Resource.Id.DeleteEventsBtn);

            await RefreshView();
            FindViewById(Resource.Id.loadingPanel).Visibility = ViewStates.Gone;

            _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.event_deletion, this);

            if (IoC.UserInfo.Employee.PrivledgeLevel == "Admin")
            {
                myEventList = eventItemAdapter.getAllEventsNotDeleted(); 
            }
            else
            {
                myEventList = eventItemAdapter.getEventsByEmployeeID();
            }

            sortByDate(myEventList);
            //Plug in my adapter
            myCheckBoxAdapter = new CheckBoxAdapter(this,myEventList);
            deletionListView.Adapter = myCheckBoxAdapter;
            RegisterForContextMenu(deletionListView);

            DeleteEventsBtn.Click += delegate
            {
                checkedEvents = ((CheckBoxAdapter)deletionListView.Adapter).getCheckedList();
                deleteEvents(deletionListView.Adapter.Count);
            };

        }
コード例 #2
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.Calendar_Admin);
                        eventItemAdapter = new EventItemAdapter();
                        recipientListItemAdapter = new RecipientListItemAdapter();
                        break;
                    }
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.Calendar_Moderator);
                        eventItemAdapter = new EventItemAdapter();
                        recipientListItemAdapter = new RecipientListItemAdapter();
                        break;
                    }
                default:
                    {
                        SetContentView(Resource.Layout.Calendar_User);
                        eventItemAdapter = new EventItemAdapter();
                        recipientListItemAdapter = new RecipientListItemAdapter();
                        break;
                    }
            }

            _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.calendar_view, this);

            var nextYear = DateTime.Now.AddYears(1);
            var lastYear = DateTime.Now.AddYears(-1);
            calendar = FindViewById<CalendarPickerView>(Resource.Id.calendar_view);
            calendar.Init(lastYear, nextYear)
                .WithSelectedDate(DateTime.Now)
                .InMode(CalendarPickerView.SelectionMode.Single);

            await RefreshView();
            myEventList = recipientListItemAdapter.getEventsByEmployeeID(IoC.UserInfo.EmployeeID, eventItemAdapter);
            myEventList = filterEvents();

            setHighlightDates(calendar);

            calendar.DateSelected += delegate
            {
                IoC.selectedDate = calendar.SelectedDate;
                Intent intent = new Intent(this, typeof(CalendarListActivity));
                StartActivity(intent);
            };
        }
コード例 #3
0
 public async Task RefreshItemsFromTableAsync(EventItemAdapter adapter)
 {
     try
     {
         var eventList = await IoC.Dbconnect.getEventSyncTable().ToListAsync();
         adapter.Clear();
         foreach (EventItem currentEvent in eventList)
             adapter.Add(currentEvent);
     }
     catch (Exception e)
     {
         System.Diagnostics.Debug.WriteLine(e.Message);
     }
 }
コード例 #4
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.CalendarList_Admin);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.CalendarList_Admin);
                        break;
                    }
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.CalendarList_Moderator);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.CalendarList_Moderator);
                        break;
                    }
                default:
                    {
                        SetContentView(Resource.Layout.CalendarList_User);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.CalendarList_User);
                        break;
                    }
            }

            await RefreshView();
            FindViewById(Resource.Id.loadingPanel).Visibility = ViewStates.Gone;

            _supporttoolbar = FindViewById<Android.Support.V7.Widget.Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.event_list, this);


            myEventList = eventItemAdapter.getEventsByEmployeeID();
            DateTime date = IoC.selectedDate;
            myEventList = filterByDate(date);
            calendarListView = FindViewById<ListView>(Resource.Id.listCalendar);           
            myCalendarAdapter = new CalendarAdapter(this, myEventList);
            calendarListView.Adapter = myCalendarAdapter;
            RegisterForContextMenu(calendarListView);


        }
コード例 #5
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            await IoC.UserInfo.setEmployee();
            // Set our view from the "main" layout resource
            await IoC.UserInfo.setEmployee();
            switch (IoC.UserInfo.Employee.PrivledgeLevel)
            {
                case "Admin":
                    {
                        SetContentView(Resource.Layout.RecentEvents_Admin);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_Admin);
                        recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_Admin);
                        break;
                    }                    
                case "Moderator":
                    {
                        SetContentView(Resource.Layout.RecentEvents_Moderator);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_Moderator);
                        recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_Moderator);
                        break;
                    }                    
                default:
                    {
                        SetContentView(Resource.Layout.RecentEvents_User);
                        eventItemAdapter = new EventItemAdapter(this, Resource.Layout.RecentEvents_User);
                        recipientListItemAdapter = new RecipientListItemAdapter(this, Resource.Layout.RecentEvents_User);
                        break;
                    }
            }

                


            mRecyclerView = FindViewById<RecyclerView>(Resource.Id.recyclerView);


            _supporttoolbar = FindViewById<Toolbar>(Resource.Id.ToolBar);
            _drawer = FindViewById<DrawerLayout>(Resource.Id.DrawerLayout);
            _navigationview = FindViewById<NavigationView>(Resource.Id.nav_view);
            ToolbarCreator toolbarCreator = new ToolbarCreator();
            toolbarCreator.setupToolbar(_supporttoolbar, _drawer, _navigationview, Resource.String.recent_events, this);

            error = new ErrorHandler(this);

            if (IsPlayServicesAvailable())
            {
                var intentRegistration = new Intent(this, typeof(RegistrationIntentService));
                StartService(intentRegistration);
            }

            await RefreshView();
            FindViewById(Resource.Id.loadingPanel).Visibility = ViewStates.Gone;


            myEventList = recipientListItemAdapter.getEventsByEmployeeID(IoC.UserInfo.EmployeeID, eventItemAdapter);
            myEventList = filterEvents();

            sortByDate(myEventList);
            //Plug in the linear layout manager
            mLayoutManager = new LinearLayoutManager(this);
            mRecyclerView.SetLayoutManager(mLayoutManager);

            //Plug in my adapter
            myEventListAdapter = new EventListAdapter(myEventList);
            myEventListAdapter.ItemClick += OnItemClick;
            mRecyclerView.SetAdapter(myEventListAdapter);

        }