/// <summary>
        /// Initialize the view model.
        /// </summary>
        public AdcpConfigurationViewModel()
            : base("Adcp Configuration")
        {
            // Initialize values
            _events         = IoC.Get <IEventAggregator>();
            _pm             = IoC.Get <PulseManager>();
            _adcpConnection = IoC.Get <AdcpConnection>();

            SubsystemConfigList = new ReactiveList <AdcpSubsystemConfigurationViewModel>();
            BatteryTypeList     = DeploymentOptions.GetBatteryList();

            // Initialize the values
            InitializeValues();

            // Scan ADCP command
            ScanAdcpCommand = ReactiveCommand.CreateAsyncTask(_ => ScanConfiguration());

            // Add Subsystem Configuration
            AddSubsystemCommand = ReactiveCommand.Create();
            AddSubsystemCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.FrequencyView)));

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsScanning, x => !x.Value));
            NextCommand.Subscribe(_ => NextPage());

            // Back coommand
            BackCommand = ReactiveCommand.Create();
            BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back)));

            // Exit coommand
            ExitCommand = ReactiveCommand.Create();
            ExitCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)));

            // Compass Cal coommand
            CompassCalCommand = ReactiveCommand.Create();
            CompassCalCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.CompassCalView)));

            // Edit the configuration command
            EditCommand = ReactiveCommand.Create();
            EditCommand.Subscribe(param => OnEditCommand(param));

            // Save the commands to a text file
            SaveCmdsCommand = ReactiveCommand.CreateAsyncTask(_ => SaveCommandsToFile());

            // Get the configuration from the project
            GetConfiguation();

            // Update the deployment duration to include all the new configurations
            // The duration needs to be divided amoung all the configuration
            UpdateDeploymentDuration();

            // Update the properites
            UpdateProperties();
        }
Пример #2
0
        /// <summary>
        /// Initialize values.
        /// </summary>
        public SerialNumberGeneratorViewModel()
            : base("Serial Number Generator")
        {
            // Initialize the value
            _SerialNumber = new SerialNumber("01000000000000000000000000000001");

            // Populate the subsystem list
            PopulateSubsystemList();

            // Populate Base Electronic Type List
            PopulateBaseElectronicTypeList();

            _isSerialNumValueVis     = false;
            _isSpareValueVis         = false;
            _isSubsystemValueVis     = true;
            _isBaseElectTypeValueVis = false;

            UpdateProperties();

            // Commands
            SerialNumValueViewCommand = ReactiveCommand.Create();
            SerialNumValueViewCommand.Subscribe(_ => On_SerialNumValueViewCommand());

            SpareValueViewCommand = ReactiveCommand.Create();
            SpareValueViewCommand.Subscribe(_ => On_SpareValueViewCommand());

            SubsystemValueViewCommand = ReactiveCommand.Create();
            SubsystemValueViewCommand.Subscribe(_ => On_SubsystemValueViewCommand());

            AddSubsystemCommand = ReactiveCommand.Create();
            AddSubsystemCommand.Subscribe(_ => On_AddSubsystemCommand());

            RemoveSubsystemCommand = ReactiveCommand.Create();
            RemoveSubsystemCommand.Subscribe(_ => On_RemoveSubsystemCommand());

            BaseElecTypeValueViewCommand = ReactiveCommand.Create();
            BaseElecTypeValueViewCommand.Subscribe(_ => On_BaseElecTypeValueViewCommand());
        }