Beispiel #1
0
        public App()
        {
            InitializeComponent();
            MainEvents = new EventEntriesMain();
            MyEvents   = new MyEventEntries();



            InteractivePage            = new InteractiveSchedulePage(MainEvents, MyEvents, MyPage);
            MyPage                     = new MySchedulePage(MyEvents, InteractivePage);
            InteractivePage.mySchudule = MyPage;

            Task.Factory.StartNew(() => {
                return(MainEvents.refreshData(saveLoad.loadDatabaseFromFile()));
            })
            .ContinueWith(task =>
            {
                InteractivePage.refresh();
                refreshInteractivePage(task.Result);
            }, TaskScheduler.FromCurrentSynchronizationContext());

            Task.Factory.StartNew(() => { updateMyEvents(); }).ContinueWith(task =>
            {
                MyPage.refresh();
            }, TaskScheduler.FromCurrentSynchronizationContext());


            MyPage.Title          = "Personal";
            InteractivePage.Title = "Main";
            var nav = new NavigationPage();

            var tab = new TabbedPage
            {
                Padding  = 0,
                Children =
                {
                    InteractivePage,
                    MyPage,
                    new MapPage(),
                    new InfoPage()
                }
            };

            var passwordPage = new Password(tab);

            passwordPage.Start(tab);
            NavigationPage.SetHasNavigationBar(tab, false);
            NavigationPage.SetHasBackButton(tab, false);

            //Preload about image
            ImageService.Instance.LoadUrl(AppResources.aboutPicture).Preload();
            //Preload the default image
            ImageService.Instance.LoadUrl(AppResources.defaultPicture).Preload();
        }
Beispiel #2
0
        async void PopUpWithData(object sender, SelectedItemChangedEventArgs e)
        {
            if (e.SelectedItem == null)
            {
                return;
            }
            EventEntry ee   = e.SelectedItem as EventEntry;
            bool       inMy = false;

            foreach (EventEntry _event in MyEvents.Events)
            {
                if (_event.EventID == ee.EventID)
                {
                    inMy = true;
                }
            }
            string addOrRemove = String.Empty;

            if (!inMy)
            {
                addOrRemove = "Add to My Schedule";
            }
            else
            {
                addOrRemove = "Remove from My Schedule";
            }
            string body = string.Empty;

            if (ee.StartTime.ToString() != string.Empty)
            {
                body += "Time: " + ee.StartTime.ToString() + "\n\n";
            }
            if (ee.category.Trim() != string.Empty)
            {
                body += "Category: " + ee.category + "\n\n";
            }
            if (ee.speaker1.Trim() != string.Empty && ee.speaker2.Trim() != string.Empty)
            {
                body += "Speakers: " + ee.speaker1 + ", " + ee.speaker2 + "\n\n";
            }
            else if (ee.speaker1.Trim() != string.Empty)
            {
                body += "Speaker: " + ee.speaker1 + "\n\n";
            }
            if (ee.contactInfo.Trim() != string.Empty)
            {
                body += "Contact: " + ee.contactInfo + "\n\n";
            }
            if (ee.Location.Trim() != string.Empty)
            {
                body += "Location: " + ee.Location + "\n\n";
            }
            if (ee.Description.Trim() != string.Empty)
            {
                body += "Description: " + ee.Description;
            }



            var userResult = await DisplayAlert(ee.Title, body, addOrRemove, "Back");

            if (userResult)
            {
                if (inMy)
                {
                    MyEvents.removeEvent(ee.EventID);
                    if (mySchudule != null)
                    {
                        mySchudule.refresh();
                        MainEvents.syncWithMySched(mySchudule.MyEvents.Events);
                    }
                    this.refresh();
                    await DisplayAlert(ee.Title, "Event has been removed from your schedule.", "Ok");

                    ee.inMySched = false;
                }
                else
                {
                    MyEvents.addEvent(ee);
                    if (mySchudule != null)
                    {
                        mySchudule.refresh();
                        MainEvents.syncWithMySched(mySchudule.MyEvents.Events);
                    }
                    this.refresh();
                    await DisplayAlert(ee.Title, "Event has been added to your schedule.\nIt starts at " + ee.StartTime.ToString(), "Ok");

                    ee.inMySched = true;
                }
            }
            ((ListView)sender).SelectedItem = null;
        }