Exemplo n.º 1
0
        private static IDocumentBrowser CreateEnhancedDocumentBrowser(ServiceProvider serviceProvider)
        {
            var navigator = new CachingNavigator(
                new Navigator(),
                new DocumentCache());

            var browser = new DocumentBrowser(navigator);

            return(browser);
        }
        private void Reset()
        {
            city             = new City();
            this.DataContext = city;

            theChart.SetValue(Grid.ColumnSpanProperty, 2);
            theChart2.Visibility = Visibility.Collapsed;
            DocumentBrowser      = new DocumentBrowser(this.documentTextBox);

            this.theChart.DataContext  = city.ConfirmedCasesCurve;
            this.theChart2.DataContext = city.Model;

            this.documentsListBox.SetBinding(ListBox.ItemsSourceProperty, new Binding {
                Source = city.allDocuments
            });
            this.documentsListBox.SetBinding(ListBox.SelectedValueProperty, new Binding {
                Path = new PropertyPath("CurrentDocument"), Source = DocumentBrowser, Mode = BindingMode.OneWay
            });
            this.BackButton.SetBinding(Button.IsEnabledProperty, new Binding {
                Path = new PropertyPath("CanGoBack"), Source = DocumentBrowser
            });
            this.ForwardButton.SetBinding(Button.IsEnabledProperty, new Binding {
                Path = new PropertyPath("CanGoForward"), Source = DocumentBrowser
            });

            var newGameDocument = new NewGameDocument(city.DailyUpdates.First());

            city.allDocuments.Add(newGameDocument);
            documentsListBox.SelectedItem = newGameDocument;

            city.allDocuments.Add(new InformationDocument("Tips",
                                                          @"Left-click a person to read what you know about that person. Right-click a person to order a test, order home quarantine or trace that person's contacts.

Tips:
- At the beginning, you know about some cases but more cases are hidden in the town.
- Every night, you get test results from last day's test.
- Some people who have symptoms manifest even if you don't order a test for them! This is ""sentinel testing"".
"));



            //for (int i = 0; i < 50; i++)
            //{
            //    EndDay_Click(null, new RoutedEventArgs());
            //}
        }