public SettingsPage()
 {
     var fetcher = new Fetcher();
     fetcher.RaiseErrorMessage += (sender, e) =>
     {
         Alert(e.MessageHead, e.MessageBody);
     };
     fetcher.RaiseRetreivedGroupItems += (sender, e) =>
     {
         Refresh(e.Groups);
     };
     InitializeComponent();
     DataContext = _groups;
     #if LEHRER
     if (_settings.Read("lehrer") == null)
     {
         ShowPopup(false);
     }
     else
     {
         fetcher.GetClasses();
     }
     #endif
     _pi = new ProgressIndicator {IsVisible = true, IsIndeterminate = true, Text = "Vertretungen werden geladen"};
     #if !LEHRER
     fetcher.GetClasses();
     if (_settings.Read("group") == null)
     {
         _settings.Write("group", 0);
     }
     // Datenkontext des Listenfeldsteuerelements auf die Beispieldaten festlegen
     #endif
 }
Beispiel #2
0
        public MapControl()
        {
            _canvas = new Canvas
            {
                VerticalAlignment = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Background = new SolidColorBrush(Colors.Transparent),
            };

            Children.Add(_canvas);
            _renderer = new Renderer(_canvas);

            _tileSource = TileSource.Create(KnownTileServers.Mapnik); 
            CompositionTarget.Rendering += CompositionTargetRendering;
            SizeChanged += MapControlSizeChanged;
            MouseWheel += MapControlMouseWheel;
            MouseMove += MapControlMouseMove;
            MouseUp += OnMouseUp;
            MouseLeave += OnMouseLeave;

            ClipToBounds = true;
            _fetcher = new Fetcher<Image>(_tileSource, _tileCache);
            _fetcher.DataChanged += FetcherOnDataChanged;
            _invalid = true;
        }
        public override void OnCreate()
        {
            base.OnCreate ();
            _settings = new Settings (this);
            _fetcher = new Fetcher (2);
            _fetcher.RaiseErrorMessage += (sender, args) =>
            {
                StopSelf();
            };

            _fetcher.RaiseRetreivedScheduleItems += (sender, args) =>
            {
                OnReceive(args.Schedule);
            };

            try
            {
                _group = (int)_settings.Read ("group");
            } catch {
                StopSelf ();
                return;
            }
            try {
                _firstStart = (int)_settings.Read("firstStart");
                _lastState = (int)_settings.Read("lastState");
            }
            catch
            {
                // ignored
            }
        }
 public VplanViewController(IntPtr handle)
     : base(handle)
 {
     this.Title = "Vertretungen";
     this.TabBarItem.Image = UIImage.FromBundle ("first");
     fetcher = new Fetcher (clear, Alert, refresh, add);
     ti = new List<Data> ();
     ili = new List<Igno> ();
 }
 public GroupController(IntPtr handle)
     : base(handle)
 {
     fetcher = new Fetcher (Alert, refresh);
     this.Title = "Klasse";
     this.TabBarItem.Image = UIImage.FromBundle ("second");
     EdgesForExtendedLayout = UIRectEdge.None;
     ExtendedLayoutIncludesOpaqueBars = false;
     AutomaticallyAdjustsScrollViewInsets = false;
 }
Beispiel #6
0
 public void SetTileSource(ITileSource source)
 {
     _tileSource = source;
     _tileCache.Clear();
     _fetcher.DataChanged -= FetcherOnDataChanged;
     _fetcher.AbortFetch();
     _fetcher = new Fetcher<Image>(_tileSource, _tileCache);
     _fetcher.DataChanged += FetcherOnDataChanged;
     _fetcher.ViewChanged(_viewport.Extent, _viewport.Resolution);
     _invalid = true;
 }
Beispiel #7
0
        // Konstruktor
        public MainPage()
        {
            InitializeComponent();
            String title ="CWS Informant";
            #if LEHRER
            title += " für Lehrer";
            #endif
            #if DEBUG
            title += " BETA";
            #endif
            Pano.Title = title;
            _pi = new ProgressIndicator
            {
                IsVisible = true,
                IsIndeterminate = true,
                Text = "Vertretungen werden aktualisiert"
            };
            SystemTray.SetProgressIndicator(this, _pi);
            SystemTray.SetBackgroundColor(this, Color.FromArgb(225, 0, 31, 63));
            SystemTray.SetForegroundColor(this, Color.FromArgb(225, 221, 221, 221));
            _fetcher = new Fetcher();
            _fetcher.RaiseErrorMessage += (sender, e) =>
            {
                Alert(e.MessageHead, e.MessageBody);
            };
            _fetcher.RaiseRetreivedScheduleItems += (sender, e) =>
            {
                Refresh(e.Schedule);
            };

            if (_settings.Read("oldDb1") != null)
            {
                _vertr1 = (ObservableCollection<Data>)_settings.Read("oldDb1");
            }
            else
            {
                _vertr1.Add(new Data());
            }
            if (_settings.Read("oldDb2") != null)
            {
                _vertr2 = (ObservableCollection<Data>)_settings.Read("oldDb2");
            }
            if (_settings.Read("oldDb1Tit") != null)
            {
                Agenda1.Header = (String)_settings.Read("oldDb1Tit");
            }
            if (_settings.Read("oldDb2Tit") != null)
            {
                Agenda2.Header = (String)_settings.Read("oldDb2Tit");
            }
            SetPanoItems();
        }
        public void TestMethod3()
        {
            Fetcher f = new Fetcher();
            var result = f.Execute<dynamic>("http://jsonplaceholder.typicode.com/posts", new RestRequest());

            //var resultset = result.Data as IEnumerable<dynamic>;
            var ruleSet = new ParserRules();
            ruleSet.Fields.Add(new Field { Selector = "id" });
            Parser p = new Parser();
            var parseResult = p.Parse(result, ruleSet);

            var serialized = SimpleJson.SerializeObject(parseResult);
        }
Beispiel #9
0
        public MapControl()
        {
            _fetcher = new Fetcher<Image>(_osmTileSource, _tileCache);
            _fetcher.DataChanged += FetcherDataChanged;

            CompositionTarget.Rendering += CompositionTargetRendering;
            SizeChanged += MapControlSizeChanged;

            ManipulationMode = ManipulationModes.Scale | ManipulationModes.TranslateX | ManipulationModes.TranslateY;
            ManipulationDelta += OnManipulationDelta;
            ManipulationCompleted += OnManipulationCompleted;
            ManipulationInertiaStarting += OnManipulationInertiaStarting;
        }
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate (bundle);

            SetContentView (Resource.Layout.Settings);
            _setti = new Settings (this);
            var toolbar = FindViewById<Toolbar> (Resource.Id.toolbar);
            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar (toolbar);
            #if LEHRER
            SupportActionBar.Title = "Kürzel";
            #else
            SupportActionBar.Title = "Klasse / Kurs";
            #endif
            if (_setti.Read ("group") != null) {
                SupportActionBar.SetHomeButtonEnabled (true);
                SupportActionBar.SetDefaultDisplayHomeAsUpEnabled (true);
            }
            _lv = FindViewById<ListView>(Resource.Id.lv);

            _fetcher = new Fetcher ();
            _fetcher.RaiseErrorMessage += (sender, args) =>
            {
                Toast(args.MessageBody);
            };
            _fetcher.RaiseRetreivedGroupItems += (sender, args) =>
            {
                Refresh(args.Groups);
            };
            #if LEHRER
            try {
                if ((bool)_setti.Read("Teacher") == false)
                    throw new NullReferenceException();
                _pd = new ProgressDialog (this);
                _pd.SetMessage("Kürzel werden geladen");
                _pd.Show ();

                _fetcher.GetClasses();
            } catch (NullReferenceException) {
                ShowAuthDialogue();
            }
            #endif
            #if !LEHRER
            _pd = new ProgressDialog (this);
            _pd.SetMessage("Klassen werden geladen");
            _pd.Show ();

            _fetcher.GetClasses();
            #endif
        }
Beispiel #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate (savedInstanceState);
            //Typeface.Default = Typeface.CreateFromAsset (Assets, "SourceSansPro-Regular.ttf");
            //Typeface.DefaultBold = Typeface.CreateFromAsset (Assets, "SourceSansPro-Bold.ttf");
            // Set our view from the "main" layout resource
            SetContentView (Resource.Layout.Main);
            _fetcher = new Fetcher();
            _fetcher.RaiseErrorMessage += (sender, args) =>
            {
                Toast(args.MessageBody);
            };
            _fetcher.RaiseReadyToClearView += (sender, args) =>
            {
                Clear();
            };
            _fetcher.RaiseRetreivedScheduleItems += (sender, args) =>
            {
                Refresh(args.Schedule);
            };
            var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
            //Toolbar will now take on default actionbar characteristics
            SetSupportActionBar (toolbar);
            SupportActionBar.Title = "CWS Informant";
            _pd = ProgressDialog.Show (this, "", "Vertretungen werden geladen" );
            _lv = FindViewById<ListView>(Resource.Id.lv);
            var fab = FindViewById<FloatingActionButton>(Resource.Id.fab);
            fab.Click += (sender, e) => {
                var set1 = new Intent(this, typeof(NewsActivity));
                StartActivity(set1);
            };

            fab.AttachToListView (_lv);

            _settings = new Settings (this);
            if (_settings.Read("notifies") == null) {
                StartService (new Intent ("setup", Android.Net.Uri.Parse (VConfig.Url), this, typeof(NotifyService)));
                _settings.Write ("notifies", 1);
            }
            try {
                int group = (int)_settings.Read ("group");
                _fetcher.GetTimes (group);
                _fetching = true;
                _list.Clear();
            } catch (NullReferenceException) {
                var set = new Intent(this, typeof(SettingsActivity));
                StartActivityForResult(set, 0);
            }
        }
Beispiel #12
0
        public void SetTileSource(ITileSource source)
        {
            _fetcher.DataChanged -= FetcherOnDataChanged;
            _fetcher.AbortFetch();

            _tileSource = source;
            _viewport.CenterX = source.Schema.Extent.CenterX;
            _viewport.CenterY = source.Schema.Extent.CenterY;
            _viewport.UnitsPerPixel = Math.Max(source.Schema.Extent.Width / ActualWidth, source.Schema.Extent.Height / ActualHeight);
            _tileCache.Clear();
            _fetcher = new Fetcher<Image>(_tileSource, _tileCache);
            _fetcher.DataChanged += FetcherOnDataChanged;
            _fetcher.ViewChanged(_viewport.Extent, _viewport.UnitsPerPixel);
            _invalid = true;
        }
Beispiel #13
0
        public void SetUp()
        {
            const byte expectedCode = 0xEA; // Nop opcode

              var model = new ProgrammingModel();
              model.GetRegister(RegisterName.PC).SetValue(InstructionAddress);

              memory = new Memory();
              memory.SetValue(InstructionAddress, expectedCode);

              instruction = new InstructionTestDouble();
              var registry = new Registry {
            { expectedCode, Opcode.Nop, instruction, AddressingMode.Absolute } };

              var fetcher = new Fetcher(model, memory);
              var decoder = new Decoder(registry);
              var executor = new Executor(registry, model, memory);

              loop = new CoreLoop(fetcher, decoder, executor);
        }
Beispiel #14
0
 public override void PerformFetch(UIApplication application, Action<UIBackgroundFetchResult> _completionHandler)
 {
     int mode;
     try {
         nu.Synchronize();
         if (nu.BoolForKey ("backgrounding") == false) {
             _completionHandler (UIBackgroundFetchResult.NoData);
             return;
         }
     } catch {
     }
     try {
         mode = (int)nu.IntForKey("bgMode");
     } catch {
         mode = 0;
     }
     completionHandler = _completionHandler;
     Fetcher fetcher = new Fetcher (Alert, Refresh, mode);
     int group;
     try {
         group = pm.getInt ("group");
         if (group == 0) {
             throw new Exception();
         } else {
             fetcher.getTimes(group);
         }
     } catch {
         _completionHandler (UIBackgroundFetchResult.Failed);
     }
 }
Beispiel #15
0
        protected Crawler(IDocumentFactory documentFactory, IKeyValueStore <string, Result> store, IKeyValueStore <string, FetchTarget> frontier)
        {
            _store    = store;
            _frontier = frontier;

            var fetcherOptions = new FetcherOptions
            {
                UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36",
            };

            var parserOptions = new ParserOptions
            {
            };

            var scraperOptions = new ScraperOptions
            {
            };

            var extractorOptions = new ExtractorOptions
            {
            };

            //var storerOptions = new StorerOptions
            //{
            //};

            var builderOptions = new BuilderOptions
            {
            };

            var providerOptions = new ProviderOptions
            {
            };

            //var dispatcherOptions = new DispatcherOptions
            //{
            //};


            Fetcher    = new Fetcher(fetcherOptions);
            Parser     = new Parser(parserOptions, documentFactory);
            Scraper    = new Scraper(scraperOptions);
            Extractor  = new Extractor(extractorOptions);
            Storer     = new Storer(store);
            Builder    = new Builder(builderOptions);
            Provider   = new Provider(providerOptions, store, frontier);
            Dispatcher = new Dispatcher();

            Fetcher.SendTo(Parser, x => x.StatusCode == System.Net.HttpStatusCode.OK);

            Parser.SendTo(Scraper);
            Parser.SendTo(Extractor);

            Fetcher.SendTo(Builder, x => x.StatusCode == System.Net.HttpStatusCode.OK);
            Scraper.SendTo(Builder);
            Extractor.SendTo(Builder);

            Builder.SendTo(Storer);

            //Storer.LinkTo(new ActionBlock<Result>(x =>
            //{
            //}));

            Builder.SendTo(Provider);
            Provider.SendTo(Dispatcher, x => x != null);
            Dispatcher.SendTo(Fetcher);
        }
 private static int[] Zip(int data1, int data2, bool reverse) => Fetcher.Zip(data1, data2, reverse, new int[8]);
 private async void JoinEm(object sender, RoutedEventArgs e)
 {
     Fetcher fetcher = new Fetcher();
     Progress progress = new Progress();
     var thumbnail = new Thumbnail();
     progress.Show();
     thumbnail.Show();
     await fetcher.GetDayScheduleAsync(viewModel.Date, progress, thumbnail);
     MessageBox.Show("Updated schedules for " + viewModel.Date.ToString());
 }
		protected async void InitNews() 
		{
			var news = await press.getNews ();
			globNews = news;
			int group;
			try {
				group = pm.getInt ("group");
				if (group == 0) {
					throw new Exception();
				} else {
					fetcher = new Fetcher(addToNewsTable, group);
				}
			}
			catch {
				fetcher = new Fetcher(addToNewsTable, 5);
			}
			try {
				if (table == null) {
					table = new UITableView (View.Bounds);
					table.AutoresizingMask = UIViewAutoresizing.All;
					table.Source = new NewsTableSource (globNews, this);
					Add (table);
				} else {
					table.Source = new NewsTableSource (globNews, this);
					table.ReloadData();
				}
				spinner.StopAnimating();
			} catch {
			}
		}
        private void ShowPopup(bool wrongPw)
        {
            ContentPanel.Visibility = Visibility.Collapsed;
                PasswordBox pwBox = new PasswordBox();

                TiltEffect.SetIsTiltEnabled(pwBox, true);
                CustomMessageBox messageBox = new CustomMessageBox
                {
                    Caption = "Bitte Passwort eingeben",
                    Content = pwBox,
                    LeftButtonContent = "ok",
                    IsRightButtonEnabled = false,
                    IsFullScreen = false,
                    Message = wrongPw ? "Falsches Passwort!!" : VConfig.EnterPw
                };

                //Create a new custom message box

                //Define the dismissed event handler
                messageBox.Dismissed += (s1, e1) =>
                {
                    switch (e1.Result)
                    {
                        case CustomMessageBoxResult.LeftButton:
                            if (pwBox.Password == VConfig.Password)
                            {
                                _settings.Write("lehrer", 1);
                                if (_settings.Read("group") == null)
                                {
                                    _settings.Write("group", 0);
                                }
                                var fetcher = new Fetcher();
                                fetcher.RaiseErrorMessage += (sender, e) =>
                                {
                                    Alert(e.MessageHead, e.MessageBody);
                                };
                               fetcher.RaiseRetreivedGroupItems += (sender, e) =>
                                {
                                    Refresh(e.Groups);
                                };
                                fetcher.GetClasses();
                                try
                                {
                                    ContentPanel.Visibility = Visibility.Visible;
                                }
                                catch (NullReferenceException) { }

                            }
                            else
                            {
                                ShowPopup(true);
                            }
                            break;
                        case CustomMessageBoxResult.None:
                            Application.Current.Terminate();
                            break;
                    }
                };

                //launch the task
                messageBox.Show();
        }
Beispiel #20
0
 public void TestMethod2()
 {
     Fetcher f = new Fetcher();
     var result = f.Execute(new RestRequest());
 }
Beispiel #21
0
 public void TestMethod1()
 {
     Fetcher f = new Fetcher();
     var result = f.Execute<List<Post>>("http://jsonplaceholder.typicode.com/posts", new RestRequest());
 }
Beispiel #22
0
	    private async void GetFreshNews()
		{
			var pd = ProgressDialog.Show(this, "", "Nachrichten werden geladen");
			var newNews = await _p.GetNews ();
			pd.Dismiss ();
			_globNews.AddRange (newNews);
			RunOnUiThread (() =>
			{
			    _lv.Adapter = new NewsAdapter(this, _globNews, Assets);
				_fetcher = new Fetcher ();
			    _fetcher.RaiseRetreivedNewsItem += (sender, args) =>
			    {
			        RefreshList(args.News);
			    };
			    _fetcher.GetTimes(_groupn, Activity.GetNews);
			});
		}
Beispiel #23
0
        protected Crawler(IDocumentFactory documentFactory, IKeyValueStore<string, Result> store, IKeyValueStore<string, FetchTarget> frontier)
        {
            _store = store;
            _frontier = frontier;

            var fetcherOptions = new FetcherOptions
            {
                UserAgent = "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/29.0.1547.62 Safari/537.36",
            };

            var parserOptions = new ParserOptions
            {
            };

            var scraperOptions = new ScraperOptions
            {
            };

            var extractorOptions = new ExtractorOptions
            {
            };

            //var storerOptions = new StorerOptions
            //{
            //};

            var builderOptions = new BuilderOptions
            {
            };

            var providerOptions = new ProviderOptions
            {
            };

            //var dispatcherOptions = new DispatcherOptions
            //{
            //};

            Fetcher = new Fetcher(fetcherOptions);
            Parser = new Parser(parserOptions, documentFactory);
            Scraper = new Scraper(scraperOptions);
            Extractor = new Extractor(extractorOptions);
            Storer = new Storer(store);
            Builder = new Builder(builderOptions);
            Provider = new Provider(providerOptions, store, frontier);
            Dispatcher = new Dispatcher();

            Fetcher.SendTo(Parser, x => x.StatusCode == System.Net.HttpStatusCode.OK);

            Parser.SendTo(Scraper);
            Parser.SendTo(Extractor);

            Fetcher.SendTo(Builder, x => x.StatusCode == System.Net.HttpStatusCode.OK);
            Scraper.SendTo(Builder);
            Extractor.SendTo(Builder);

            Builder.SendTo(Storer);

            //Storer.LinkTo(new ActionBlock<Result>(x =>
            //{
            //}));

            Builder.SendTo(Provider);
            Provider.SendTo(Dispatcher, x => x != null);
            Dispatcher.SendTo(Fetcher);
        }
Beispiel #24
0
 public void SetUp()
 {
     model = new ProgrammingModel();
       memory = new Memory();
       fetcher = new Fetcher(model, memory);
 }
Beispiel #25
0
 public Options(Writer Writer = default, FlagSet Flagset = default, Fetcher Fetch = default, Symbolizer Sym = default, ObjTool Obj = default, UI UI = default, Func <ptr <HTTPServerArgs>, error> HTTPServer = default, http.RoundTripper HTTPTransport = default)
 {
     this.Writer        = Writer;
     this.Flagset       = Flagset;
     this.Fetch         = Fetch;
     this.Sym           = Sym;
     this.Obj           = Obj;
     this.UI            = UI;
     this.HTTPServer    = HTTPServer;
     this.HTTPTransport = HTTPTransport;
 }