Ejemplo n.º 1
0
        private void GraphSort_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            int executeOnce = 0;

            try
            {
                ListPickerItem lpi = (sender as ListPicker).SelectedItem as ListPickerItem;
                GraphType     = lpi.Content.ToString();
                sortText.Text = GraphType;

                if (executeOnce == 0)
                {
                    graphModel.setType(GraphType);
                    executeOnce++;
                    Debug.WriteLine(GraphType.ToString());

                    if (GraphType == "last hour")
                    {
                        graphModel.GenerateLastHour();
                    }
                    else if (GraphType == "last 24 hours")
                    {
                        graphModel.GenerateDaily();
                    }
                    else if (GraphType == "last 7 days")
                    {
                        graphModel.GenerateWeekly();
                    }
                    else if (GraphType == "last charge")
                    {
                        graphModel.GenerateLastCharge();
                        sortText.Text += " (" + timeSinceLastChargeInput.Text + ")";
                    }
                    else if (GraphType == "last 100% charge")
                    {
                        graphModel.GenerateAllTime();
                        sortText.Text += " (" + SystemEndPoints.timeSinceLastHundred() + ")";
                    }
                    areachart.DataContext = graphModel;
                }
            }
            catch
            {
                //selection failed
            }



            //updateDetailedListUI();
        }