protected LogDetailsPageModel(BatNodeLog batLog) { EditLogCommand = new RelayCommand(() => _navigationService.EditLog(BatLog)); BatLog = batLog; _batCalls = new List<BatCall>(); FrequencyRange = new Range<uint>(0, 100); FrequencyRange.PropertyChanged += async (s, e) => await UpdateBins(); IntensityRange = new Range<uint>(0, 1024); IntensityRange.PropertyChanged += async (s, e) => await UpdateBins(); DurationRange = new Range<uint>(0, 100); DurationRange.PropertyChanged += async (s, e) => await UpdateBins(); TimeRange = new Range<uint>(0, 100); TimeRange.PropertyChanged += async (s, e) => await UpdateBins(); //BUG! Func<BatCall, bool> filter = c => IntensityRange.Contains(c.MaxPower) && FrequencyRange.Contains(c.MaxFrequency) && DurationRange.Contains(c.Duration / 1000) && TimeRange.Contains(c.StartTimeMs); FreqBins = new UintBinCollection(100, b => (uint)b.MaxFrequency, filter); IntensityBins = new UintBinCollection(200, b => (uint)b.MaxPower, filter); CallDurationBins = new UintBinCollection(100, b => b.Duration / 1000, filter); TimeBins = new TimeCallBinCollection(200, batLog.LogStart, filter); }
public EditLogViewModel(NavigationEventArgs navigation, BatContext db, NavigationHelper navigationHelper) { _db = db; _navigationHelper = navigationHelper; _batLog = (BatNodeLog)navigation.Parameter; SaveCommand = new RelayCommand(async () => await SaveAction()); CancelCommand = new RelayCommand(() => GoBack()); PivotItems = new ObservableCollection<PivotModelBase>(); PivotItems.Add(new EditCallsPivotModel(_batLog, this)); PivotItems.Add(new EditCallsPivotModel(_batLog, this)); }
public MainPageModel(NavigationEventArgs navigation, BatContext db, NavigationService navigationService, BatNodeLogReader logReader) { _db = db; _navigationService = navigationService; _logReader = logReader; ImportFileCommand = new RelayCommand(async () => await ImportLogFile()); EditCommand = new RelayCommand(() => { if (SelectedItem != null) { _navigationService.EditLog(SelectedItem); } }, () => SelectedItem != null); DetailsCommand = new RelayCommand(() => { if (SelectedItem != null) { _navigationService.NavigateToLogDetails(SelectedItem); } }, () => SelectedItem != null); }
//public EditLogPageModel() // : this(DesignData.CreateBatLog()) //{ // Calls = new ObservableCollection<BatCallViewModel>(BatLog.Calls.Select((c, i) => new BatCallViewModel(BatLog, c, i+1))); // if (Calls.Any()) // { // SelectedCall = Calls.First(); // } //} public EditCallsPivotModel(BatNodeLog batLog, EditLogViewModel parentViewModel) : base(parentViewModel) { BatLog = batLog; Name = batLog.Name; Description = batLog.Description; StartDate = new DateTimeOffset(BatLog.LogStart.Date); StartTime = batLog.LogStart.TimeOfDay; ToggleEnabledCommand = new RelayCommand(() => { if (SelectedCall != null) { SelectedCall.Enabled = !SelectedCall.Enabled; } }); }