Exemplo n.º 1
0
        public MainViewModel()
        {
            logger.Info("Audio View started at {0}", DateTime.Now);

            SettingsViewModel = SettingsViewModel.Instance;
            HistoryViewModel = new HistoryViewModel();
            MeasurementsViewModel = new MeasurementsViewModel(this);

            // Debug for me
            MeasurementsViewModel.NewViewModel = new NewMeasurementViewModel(MeasurementsViewModel);

            // Load offline files
            DataStorageMeterListener.UploadLocalFiles();
        }
        public NewMeasurementViewModel(MeasurementsViewModel mainViewModel)
        {
            MainViewModel = mainViewModel;
            ProjectName = "Untitled - " + DateTime.Now.ToString("yyyy-MM-dd hh-mm-ss");
            UseLocal = true;
            IsRemoteTested = false;
            LocalDevices = new ObservableCollection<string>();
            LocalDeviceTimeOut = 800;

            MajorIntervalSeconds = 0.ToString();
            MinorIntervalSeconds = 0.ToString();
            MajorIntervalMinutes = 15.ToString();
            MinorIntervalMinutes = 1.ToString();
            MajorIntervalHours = 0.ToString();
            MinorIntervalHours = 0.ToString();

            GraphBoundUpper = 120.ToString();
            GraphBoundLower = 60.ToString();

            MinorDBLimit = 98.ToString();
            MajorDBLimit = 95.ToString();
            ClockItems = UserControls.CountDown.ClockItems.Get;

            MinorClockMainItem = ClockItems.FirstOrDefault(x => x.Id == 3);
            MinorClockSecondaryItem = ClockItems.FirstOrDefault(x => x.Id == -1);
            MajorClockMainItem = ClockItems.FirstOrDefault(x => x.Id == 3);
            MajorClockSecondaryItem = ClockItems.FirstOrDefault(x => x.Id == -1);

            RemoteIpAddress = "localhost";
            RemotePort = DefaultPort.ToString();

            //// Find an avalible port
            while (mainViewModel.Measurements.Any(x => x.Settings.Port == DefaultPort))
            {
                logger.Trace("Port {0} is in use, trying next.", DefaultPort);
                DefaultPort++;
            }
            ListenPort = DefaultPort.ToString();
        }