Exemplo n.º 1
0
        public PivotPage()
        {
            this.InitializeComponent();

            this.NavigationCacheMode = NavigationCacheMode.Required;

            this.navigationHelper            = new NavigationHelper(this);
            this.navigationHelper.LoadState += this.NavigationHelper_LoadState;
            this.navigationHelper.SaveState += this.NavigationHelper_SaveState;

            _syncContext = SynchronizationContext.Current;

            var httpFilter = new Windows.Web.Http.Filters.HttpBaseProtocolFilter();

            httpFilter.CacheControl.ReadBehavior =
                Windows.Web.Http.Filters.HttpCacheReadBehavior.MostRecent;

            client = new HttpClient(httpFilter);

            fireflies = new FireflyCollection();
            //addSampleFireflies();
            lstFireflies.ItemsSource = fireflies;

            nodes = new NodeCollection();
            lstNodes.ItemsSource = nodes;

            getMonitorIPAddress();

            monitorUri = "http://" + monitorIPAddress + ":" + monitorPort + "/";

            //getFirefliesFromMonitor();
            //getNodesFromMonitor();
        }
Exemplo n.º 2
0
        private void NavigationHelper_LoadState(object sender, LoadStateEventArgs e)
        {
            // Parse Navigation Args
            List <object> itemPageNavList = (List <object>)e.NavigationParameter;

            pivotPageRef = (PivotPage)itemPageNavList.ElementAt <object>(0);
            nodeClicked  = (Node)itemPageNavList.ElementAt <object>(1);

            // Load details
            tblId.Text = nodeClicked.Id;

            if (nodeClicked.Location != "")
            {
                txtLocation.Text      = nodeClicked.Location;
                txtLocation.FontStyle = Windows.UI.Text.FontStyle.Normal;
            }
            else
            {
                txtLocation.Text      = "Not set!";
                txtLocation.FontStyle = Windows.UI.Text.FontStyle.Italic;
            }

            if (nodeClicked.LastUpdateTime != new DateTime(0))
            {
                tblLastUpdate.Text      = nodeClicked.LastUpdateTime.ToString();
                tblLastUpdate.FontStyle = Windows.UI.Text.FontStyle.Normal;
            }
            else
            {
                tblLastUpdate.Text      = "Unknown";
                tblLastUpdate.FontStyle = Windows.UI.Text.FontStyle.Italic;
            }

            if (nodeClicked.FirefliesList.Count != 0)
            {
                nodeFireflies = new FireflyCollection();

                foreach (JsonValue firefly in nodeClicked.FirefliesList)
                {
                    nodeFireflies.Add(pivotPageRef.fireflies.GetById(firefly.GetString()));
                }

                lstFireflies.ItemsSource = nodeFireflies;
            }
            else
            {
                lstFireflies.Visibility = Visibility.Collapsed;
            }
        }