Exemple #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();
        }
Exemple #2
0
        public InteractiveSchedulePage(EventEntriesMain _MainEvents, MyEventEntries _MyEvents, MySchedulePage _mySchedule = null)
        {
            InitializeComponent();
            mySchudule   = _mySchedule;
            this.Padding = GetPagePadding();
            MyEvents     = _MyEvents;
            MainEvents   = _MainEvents;


            LoadingText                         = new Label();
            LoadingText.FontSize                = 20;
            LoadingText.HorizontalOptions       = LayoutOptions.Center;
            LoadingText.VerticalOptions         = LayoutOptions.Center;
            LoadingText.HorizontalTextAlignment = TextAlignment.Center;
            LoadingText.FontAttributes          = FontAttributes.Italic;
            LoadingText.Text                    = "Loading Database...";
            this.Content                        = LoadingText;

            lvForEvents = new SchedListView(MainEvents.Events);
            lvForEvents.ItemSelected += PopUpWithData;
        }
        //Constructor that sets up the item template for the EventEntry list
        public SchedListView(List <EventEntry> _events, MyEventEntries myEvents = null, EventEntriesMain _mainEvents = null) : base(ListViewCachingStrategy.RecycleElement)
        {
            this.IsPullToRefreshEnabled = false;
            mainEvents = _mainEvents;
            events     = _events;

            Task.Factory.StartNew(() => {
                refresh();
                ItemTemplate = new DataTemplate(() =>
                {
                    RowHeight            = 95;
                    Label Title          = new Label();
                    Title.FontAttributes = FontAttributes.Bold;
                    Title.SetBinding(Label.TextProperty, "Title");
                    Title.MinimumHeightRequest = 50;
                    Title.FontSize             = Xamarin.Forms.AbsoluteLayout.AutoSize;

                    Label date          = new Label();
                    date.FontAttributes = FontAttributes.Italic;
                    date.SetBinding(Label.TextProperty, "StartTime", BindingMode.Default, null, ("{0:MMMM dd}"));
                    date.MinimumHeightRequest = 50;
                    date.FontSize             = Xamarin.Forms.AbsoluteLayout.AutoSize;

                    Label speaker          = new Label();
                    speaker.FontAttributes = FontAttributes.Italic;
                    speaker.SetBinding(Label.TextProperty, "speaker1");
                    speaker.MinimumHeightRequest = 50;
                    speaker.FontSize             = Xamarin.Forms.AbsoluteLayout.AutoSize;

                    Label startEndTime          = new Label();
                    startEndTime.FontAttributes = FontAttributes.Italic;
                    startEndTime.SetBinding(Label.TextProperty, "StartEndTime");
                    startEndTime.MinimumHeightRequest = 50;
                    startEndTime.FontSize             = Xamarin.Forms.AbsoluteLayout.AutoSize;

                    Label location = new Label();
                    location.SetBinding(Label.TextProperty, "Location");
                    location.MinimumHeightRequest = 50;
                    location.FontSize             = Xamarin.Forms.AbsoluteLayout.AutoSize;

                    FFImageLoading.Forms.CachedImage im = new FFImageLoading.Forms.CachedImage()
                    {
                        RetryCount    = 3,   //Number of trys until it gives up
                        RetryDelay    = 200, //Delay between tries (in ms)
                        HeightRequest = 50,
                        WidthRequest  = 50,
                        // DownsampleWidth = 100, //Down sample to predetermined width (maintains aspect ratio)
                        Aspect = Xamarin.Forms.Aspect.AspectFit, //Sets aspect ratio
                        DownsampleToViewSize = true,
                        CacheType            = FFImageLoading.Cache.CacheType.All,
                        IsOpaque             = true,
                        LoadingPriority      = FFImageLoading.Work.LoadingPriority.High,
                        LoadingPlaceholder   = AppResources.defaultPicture
                    };

                    var transform = new FFImageLoading.Transformations.CircleTransformation(10, "#000000");
                    im.Transformations.Add(transform);
                    im.SetBinding(CachedImage.SourceProperty, "ThumbnailStr");
                    im.SetBinding(CachedImage.BackgroundColorProperty, "Color");

                    FFImageLoading.Forms.CachedImage calenderImage = new FFImageLoading.Forms.CachedImage()
                    {
                        IsVisible     = false,
                        HeightRequest = 50,
                        WidthRequest  = 50,
                        // DownsampleWidth = 100, //Down sample to predetermined width (maintains aspect ratio)
                        Aspect = Xamarin.Forms.Aspect.AspectFit, //Sets aspect ratio
                        DownsampleToViewSize = true,
                        CacheType            = FFImageLoading.Cache.CacheType.Memory,
                        IsOpaque             = true,
                        LoadingPriority      = FFImageLoading.Work.LoadingPriority.High,
                        Source = "checklist.png"
                    };
                    calenderImage.SetBinding(CachedImage.IsVisibleProperty, "inMySched");



                    Button addRemove;
                    addRemove = new Button
                    {
                        Text = "Add/Remove",
                    };

                    BoxView boxView = new BoxView
                    {
                        Color             = Color.Gray,
                        HeightRequest     = 1,
                        HorizontalOptions = LayoutOptions.Fill
                    };


                    var tempGrid           = new Grid();
                    tempGrid.RowSpacing    = 2;
                    tempGrid.ColumnSpacing = 5;

                    tempGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(1, GridUnitType.Star)
                    });
                    tempGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(50, GridUnitType.Star)
                    });
                    tempGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(50, GridUnitType.Auto)
                    });
                    tempGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(25, GridUnitType.Star)
                    });
                    tempGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(25, GridUnitType.Star)
                    });
                    tempGrid.RowDefinitions.Add(new RowDefinition {
                        Height = new GridLength(5, GridUnitType.Star)
                    });

                    tempGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(30, GridUnitType.Star)
                    });
                    tempGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(50, GridUnitType.Star)
                    });
                    tempGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(10, GridUnitType.Star)
                    });
                    tempGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(50, GridUnitType.Star)
                    });
                    tempGrid.ColumnDefinitions.Add(new ColumnDefinition {
                        Width = new GridLength(10, GridUnitType.Star)
                    });
                    //  tempGrid.ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(50, GridUnitType.Star) });
                    tempGrid.Children.Add(Title, 1, 4, 1, 3);
                    tempGrid.Children.Add(date, 1, 3);
                    tempGrid.Children.Add(startEndTime, 3, 3);
                    tempGrid.Children.Add(location, 1, 3, 4, 5);
                    tempGrid.Children.Add(speaker, 3, 4);
                    tempGrid.Children.Add(im, 0, 1, 1, 5);
                    tempGrid.Children.Add(calenderImage, 4, 5, 1, 5);
                    //tempGrid.Children.Add(addRemove, 2, 3, 1, 4);
                    tempGrid.Children.Add(boxView, 0, 5, 5, 6);
                    tempGrid.SetBinding(Grid.BackgroundColorProperty, "Color");

                    return(new ViewCell
                    {
                        View = tempGrid
                    });
                });
            }).ContinueWith(task =>
            {
                // scrollToCurrent();
            }, TaskScheduler.FromCurrentSynchronizationContext());
        }