public NewsPage()
        {
            InitializeComponent();

            Debug.WriteLine("Starting viewModel");
            RSSFeedViewModelObject = new RSSFeedViewModel(Navigation);
            BindingContext         = RSSFeedViewModelObject;



            // start the first refresh of the listview
            FeedListView.IsRefreshing = true;
            FeedListView.BeginRefresh();

            // add select item event
            FeedListView.ItemSelected += (sender, e) => {
                var item = ((ListView)sender).SelectedItem;
                var feed = (FeedItem)item;


                webview.Source = feed.guid;


                web.IsVisible = true;
            };
        }
Esempio n. 2
0
        public FeedPage()
        {
            BackgroundColor = ColorConstants.FeedBackground;

            listContent = new ObservableCollection <FeedListItem>();
            listView    = new FeedListView(ListViewCachingStrategy.RecycleElement)
            {
                ItemsSource = listContent
            };

            listView.ItemTapped += (sender, e) => {
                ((ListView)sender).SelectedItem = null;
                var trip   = FeedController.GetTrip(((FeedListItem)e.Item).Trip.Id);
                var result = trip.Result;
                Navigation.PushModalAsync(new TripPage(result));
            };

            var newBtn = new ToolbarItem {
                Icon = ImgConstants.NewTrip
            };

            newBtn.Clicked += (sender, e) => Navigation.PushAsync(new NewTripPage());
            ToolbarItems.Add(newBtn);
            Content = listView;

            UpdateTripList();
        }
        public ScreenSaverForm(bool debugmode)
        {
            InitializeComponent();

            isFeedViewShown  = debugmode;
            isItemsViewShown = debugmode;

            // In debug mode, allow minimize after breakpoint
            if (debugmode)
            {
                this.FormBorderStyle = FormBorderStyle.Sizable;
            }

            LoadFeedList();     // may throw ApplicationException

            SetupScreenSaver();

            // Initialize the ItemListView to display the list of items in the
            // current feed. It is placed on the left side of the screen.
            rssItemsView = new ItemListView <RssItem>(feedlist);
            InitializeRssItemsView();

            // Initialize the ItemDescriptionView to display the description of the
            // RssItem.  It is placed on the bottom of the screen.
            rssDescriptionView = new ItemDescriptionView <RssItem>(feedlist);
            InitializeRssDescriptionView();

            // Initialize the FeedListView to display the list of feeds. It is placed
            // at the top of the screen.
            rssFeedsView = new FeedListView <RssFeed>("Picture Feeds", feedlist);
            InitializeRssFeedView();

            InitializeListRefresh();
        }
        public ScreenSaverForm(bool debugmode)
        {
            InitializeComponent();

            isFeedViewShown = debugmode;
            isItemsViewShown = debugmode;

            // In debug mode, allow minimize after breakpoint
            if (debugmode) this.FormBorderStyle = FormBorderStyle.Sizable;

            LoadFeedList();     // may throw ApplicationException

            SetupScreenSaver();

            // Initialize the ItemListView to display the list of items in the
            // current feed. It is placed on the left side of the screen.
            rssItemsView = new ItemListView<RssItem>(feedlist);
            InitializeRssItemsView();

            // Initialize the ItemDescriptionView to display the description of the
            // RssItem.  It is placed on the bottom of the screen.
            rssDescriptionView = new ItemDescriptionView<RssItem>(feedlist);
            InitializeRssDescriptionView();

            // Initialize the FeedListView to display the list of feeds. It is placed
            // at the top of the screen.
            rssFeedsView = new FeedListView<RssFeed>("Picture Feeds", feedlist);
            InitializeRssFeedView();

            InitializeListRefresh();
        }
Esempio n. 5
0
        private void FeedListView_Loaded(object sender, RoutedEventArgs e)
        {
            if (FeedScrollViewer != null)
            {
                FeedScrollViewer.ViewChanged -= OnScrollViewerViewChanged;
            }

            FeedScrollViewer              = FeedListView.FindChild <ScrollViewer>();
            FeedScrollViewer.ViewChanged += OnScrollViewerViewChanged;
        }
        public RSSReaderPage()
        {
            InitializeComponent();

            Debug.WriteLine("Starting viewModel");
            RSSFeedViewModelObject = new RSSFeedViewModel(Navigation);
            Title          = "ORMAA RSS Feeds";
            BindingContext = RSSFeedViewModelObject;


            // subscribe to event fired when download of RSS Feed is completed.

            //MessagingCenter.Subscribe<Application>(this, "stopActivity", (sender) => {

            //    Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            //    {
            //         hideWaitAnimation();
            //    });
            //});

            //// subscribe to event fired when download of RSS Feed is started.

            //MessagingCenter.Subscribe<Application>(this, "startActivity", (sender) => {

            //    Xamarin.Forms.Device.BeginInvokeOnMainThread(() =>
            //    {
            //        showWaitAnimation();
            //    });
            //});

            // start the first refresh of the listview
            FeedListView.IsRefreshing = true;
            FeedListView.BeginRefresh();

            // add select item event
            FeedListView.ItemSelected += (sender, e) => {
                //((ListView)sender).SelectedItem = null;

                var item = ((ListView)sender).SelectedItem;
                var feed = (FeedItem)item;

                // Create a webview
                //var browser = new WebView
                //{
                //    Source = feed.guid
                //};
                //webview.Children.Add(browser);
                webview.Source = feed.guid;
                //webview.Scale = 0.9;

                web.IsVisible = true;
            };
        }
Esempio n. 7
0
        public void ShowTest()
        {
            using (ShimsContext.Create())
            {
                ShimLog.AllInstances.ConfiguredLogLevelGet = (a) => { return(LogLevel.FromString("Debug")); };


                ShimFeedListView.AllInstances.GetFeedListIListOfRssFeed = (a, b) =>
                {
                    var f = new List <RssFeed>();
                    return(Result.Ok <IList <RssFeed> >(f));
                };

                ShimBaseView.AllInstances.ShowHeaderString = (a, b) => { };
                ShimBaseView.AllInstances.ShowFooterString = (a, b) => { };

                ShimFeedListView.AllInstances.GetPicklist = (a) =>
                {
                    var r = new Picklist <RssFeed>();
                    return(Result.Ok(r));
                };

                ConfigObject layout   = new ConfigObject();
                var          controls = new List <GuiElement>();
                layout.Add(new KeyValuePair <string, object>("Width", 100));
                layout.Add(new KeyValuePair <string, object>("Height", 101));
                layout.Add(new KeyValuePair <string, object>("Controls", controls));

                var view  = new FeedListView(layout);
                var feeds = new List <RssFeed>();

                view.Show(false, feeds);

                Assert.AreEqual(view._mainView.Width, 100);
                Assert.AreEqual(view._mainView.Height, 101);
            }
        }
Esempio n. 8
0
        /// <summary>
        /// The Main
        /// </summary>
        /// <param name="args">The <see cref="string"/></param>
        internal static void Main(string[] args)
        {
            NLog.Logger logger = Log.Instance.Logger;
            logger.Trace("App started.");

            var arguments = new ArgumentParser(args);

            var handle = NativeMethods.GetStdHandle(STD_OUTPUT_HANDLE);

            if (NativeMethods.GetConsoleMode(handle, out uint mode))
            {
                mode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
                mode |= DISABLE_NEWLINE_AUTO_RETURN;
                //mode |= ENABLE_EXTENDED_FLAGS;
                NativeMethods.SetConsoleMode(handle, mode);
            }
            Console.OutputEncoding = Encoding.UTF8;
            //SetConsoleCtrlHandler(new HandlerRoutine(ConsoleCtrlCheck), true);

            //arguments
            Configuration.Database = arguments.GetArgValue <string>("d", Config.Global.Database);
            var refresh = arguments.GetArgValue <bool>("r", Config.Global.Refresh);
            var opml    = arguments.GetArgValue <string>("o", Config.Global.Opml);

            //show help?
            if (arguments.GetArgValue <bool>("h"))
            {
                ShowHelp();
            }

            FileInfo conf = new FileInfo("settings.conf");

            Config.WatchUserConfig(conf);
            Config.OnUserConfigFileChanged += Config_OnUserConfigFileChanged;

            SetAllowUnsafeHeaderParsing20();

            //using (var db = new LiteDatabase(database))
            //{
            List <RssFeed> feeds = new List <RssFeed>();

            var configFeeds = Enumerable.ToList(Config.Global.Feeds);
            int i           = 0;

            foreach (var feed in configFeeds)
            {
                feeds.Add(new RssFeed(feed.FeedUrl, feed.FeedQuery, i, feed.Title, feed.AutoReload, feed.ReloadInterval, feed.UserName, feed.Password)
                {
                    Select  = feed.Select,
                    Filters = feed.Filters,
                    Hidden  = feed.Hidden,
                    Tags    = feed.Tags,
                });
                i++;
            }

            if (!string.IsNullOrEmpty(opml))
            {
                var importedFeeds = OpmlImport.Import(opml);
                foreach (var feed in importedFeeds)
                {
                    feeds.Add(new RssFeed(feed.FeedUrl, null, i, feed.Title)
                    {
                        Tags = feed.Tags
                    });
                    i++;
                }
            }

            feedList = new FeedListView(Config.Global.UI.Layout.FeedList);
            feedList.Show(refresh, feeds);
            Console.Clear();
        }