示例#1
0
        ExtractImportableVehicles(IEnumerable <PsaTrace> traces)
        {
            IList <string> vins = traces.GetVins();

            foreach (string vin in vins)
            {
                ImportableVehicleViewModel ivm =
                    new ImportableVehicleViewModel(traces.Where(
                                                       t => t.Vin == vin));
                yield return(ivm);
            }
        }
        private void OnGridSelectedItemChanged(object sender,
                                               RoutedPropertyChangedEventArgs <object> e)
        {
            object obj = e.NewValue;
            ImportableVehicleViewModel veh =
                obj as ImportableVehicleViewModel;

            if (veh != null)
            {
                if (obj != currentSelectedItem)
                {
                    DeselectCurrentlySelected();
                    veh.IsSelected      = true;
                    currentSelectedItem = veh;
                }
                VehicleItemDetailsControl vehDetails =
                    new VehicleItemDetailsControl();

                UpdateFakeGraphControl(veh);

                vehDetails.DataContext      = veh;
                ContentControlLower.Content = vehDetails;
                return;
            }
            ImportablePsaParameterDataViewModel parameterData =
                obj as ImportablePsaParameterDataViewModel;

            if (parameterData != null)
            {
                currentSelectedItem = parameterData;
                SingleParameterGraphControl graph =
                    new SingleParameterGraphControl();
                if (parameterData.HasTimestamps)
                {
                    graph.DisplayGraph(parameterData.Model.Timestamps,
                                       parameterData.Values, Colors.Blue);
                }
                else
                {
                    graph.DisplayGraph(parameterData.Values, Colors.Blue);
                }
                ContentControlLower.Content = graph;
                ContentControlUpper.Content = null;
                return;
                // set parameter description and some other info at top place
            }
            IPsaParametersSetViewModel set = obj as IPsaParametersSetViewModel;

            if (set != null)
            {
                currentSelectedItem = set;
                PsaParametersSetGraphSelectionControl selector =
                    new PsaParametersSetGraphSelectionControl();
                selector.DataContext        = set;
                ContentControlUpper.Content = selector;
                selector.InitializeCheckboxes();
                PsaParametersSetGraphControl multigraph =
                    new PsaParametersSetGraphControl();
                ContentControlLower.Content = multigraph;
                selector.CheckBoxChecked   -= OnSelectorCheckBoxChecked;
                selector.CheckBoxUnchecked -= OnSelectorCheckBoxUnChecked;
                selector.CheckBoxChecked   += OnSelectorCheckBoxChecked;
                selector.CheckBoxUnchecked += OnSelectorCheckBoxUnChecked;
                return;
            }

            ContentControlUpper.Content = null;
            ContentControlLower.Content = null;
        }
 private void UpdateFakeGraphControl(
     ImportableVehicleViewModel vehicleViewModel)
 {
 }