示例#1
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public ScanAdcpViewModel()
            : base("Scan ADCP")
        {
            // Initialize values
            _events         = IoC.Get <IEventAggregator>();
            _pm             = IoC.Get <PulseManager>();
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Serial Number Generator view model
            SerialNumberGeneratorVM              = IoC.Get <SerialNumberGeneratorViewModel>();
            SerialNumberGeneratorVM.UpdateEvent += SerialNumberGeneratorVM_UpdateEvent;

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsScanning, x => !x.Value));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ModeView)));

            // 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)));

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

            InitializeValue();
        }
示例#2
0
        /// <summary>
        /// Create a base view for all the Averaging Views.
        /// </summary>
        public AveragingBaseViewModel()
            : base("AvergingBaseViewModel")
        {
            // Project Manager
            _pm = IoC.Get <PulseManager>();
            _pm.RegisterDisplayVM(this);
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);

            // Initialize the dict
            _averagingVMDict = new ConcurrentDictionary <SubsystemDataConfig, AveragingViewModel>();

            // Create the ViewModels based off the AdcpConfiguration
            AddConfigurations();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SimpleCompassCalWizardView)));

            // 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)));
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public ZeroPressureSensorViewModel()
            : base("Zero Pressure Sensor")
        {
            // Initialize values
            _events         = IoC.Get <IEventAggregator>();
            _pm             = IoC.Get <PulseManager>();
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DeployAdcpView)));

            // 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)));

            // Zero Pressure sensor command
            ZeroPressureSensorCommand = ReactiveCommand.Create();
            ZeroPressureSensorCommand.Subscribe(_ => ZeroPressureSensor());

            InitializeValue();
        }
示例#4
0
        /// <summary>
        /// Select whether to playback a file or a project.
        /// </summary>
        public SelectPlaybackViewModel()
            : base("Select Playback")
        {
            // Initialize values
            _pm     = IoC.Get <PulseManager>();
            _events = IoC.Get <IEventAggregator>();

            // Initialize values
            IsLoading = false;

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView)));

            // 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)));

            // Select a file to playback
            FilePlaybackCommand = ReactiveCommand.Create();
            FilePlaybackCommand.Subscribe(_ => PlaybackFile());

            // Project coommand
            ProjectPlaybackCommand = ReactiveCommand.Create();
            ProjectPlaybackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.LoadProjectsView)));
        }
示例#5
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public BottomTrackOnViewModel()
            : base("Bottom Track On")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            ConfigKey = "";

            // Create the list
            CreateList();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.BinsView, ConfigKey)));

            // 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)));

            MovingCommand = ReactiveCommand.Create();
            MovingCommand.Subscribe(_ => MovingBoat());

            MovingCommand = ReactiveCommand.Create();
            MovingCommand.Subscribe(_ => MonitoringAdcp());
        }
        // コンストラクタ

        public ConfigurePincodeViewModel(DialogService dialogService, AddAccountService addAccountModel)
        {
            // DI
            _dialogService     = dialogService;
            _addAccountService = addAccountModel;

            // バリデーションを有効化する
            Pincode.SetValidateAttribute(() => Pincode);

            // Pincodeが入力されているときのみ「次へ」を押せるようにする
            NextCommand = Pincode
                          .ObserveHasErrors
                          .Select(x => !x)
                          .ToReactiveCommand()
                          .AddTo(Disposables);

            // 「次へ」が押されたらPinコードの認証を開始する
            NextCommand.Subscribe(() =>
            {
                _addAccountService.ConfigureAccessTokens(Pincode.Value);
                _dialogService.CloseConfigurePincodeView();
                _dialogService.CloseConfigureApiKeyView();
            })
            .AddTo(Disposables);
        }
示例#7
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public TemperatureViewModel()
            : base("Salinity")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();


            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.TimeView)));

            // 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)));

            // Salinity coommand
            SalinityCommand = ReactiveCommand.Create();
            SalinityCommand.Subscribe(param => OnSalinityCommand(param));

            InitializeValue();
        }
示例#8
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public TimeViewModel()
            : base("ADCP Time")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Initialize the list
            TimeZoneList = new ReactiveList <AdcpTimeZoneOptions>();
            TimeZoneList.Add(new AdcpTimeZoneOptions(RTI.Commands.AdcpTimeZone.LOCAL, "Local", true));
            TimeZoneList.Add(new AdcpTimeZoneOptions(RTI.Commands.AdcpTimeZone.GMT, "GMT", false));

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.EnsembleIntervalView)));

            // 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)));

            // Local Date Time Command
            SetLocalDateTimeCommand = ReactiveCommand.Create();
            SetLocalDateTimeCommand.Subscribe(_ => SetLocalDateTime());

            // GMT Date Time Command
            SetGmtDateTimeCommand = ReactiveCommand.Create();
            SetGmtDateTimeCommand.Subscribe(_ => SetGmtDateTime());

            InitializeValue();
        }
示例#9
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public FrequencyViewModel()
            : base("Frequency ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();


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

            // 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)));

            FreqCommand = ReactiveCommand.Create();
            FreqCommand.Subscribe(param => AddConfig(param));

            // Set the possible subsystems
            SetSubsystems();
        }
示例#10
0
        /// <summary>
        /// Intialize the view model.
        /// </summary>
        public CommunicationViewModel()
            : base("Communications")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Initialize the values
            InitValues();

            // Set the list
            CommPortList = SerialOptions.PortOptions;
            BaudRateList = SerialOptions.BaudRateOptions;

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScanAdcpView)));

            // 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)));

            // Scan for ADCP command
            ScanAdcpCommand = ReactiveCommand.Create();
            ScanAdcpCommand.Subscribe(_ => ScanForAdcp());
        }
示例#11
0
        // コンストラクタ

        public ConfigureApiKeyViewModel(DialogService dialogService, AddAccountService addAccountModel)
        {
            // DI
            _dialogService     = dialogService;
            _addAccountService = addAccountModel;

            // バリデーションを有効化する
            ConsumerKey.SetValidateAttribute(() => ConsumerKey);
            ConsumerSecret.SetValidateAttribute(() => ConsumerSecret);

            // ConsumerKeyとConsumerKeyが正しく入力されているときのみ「次へ」を押せるようにする
            NextCommand = new[]
            {
                ConsumerKey.ObserveHasErrors,
                ConsumerSecret.ObserveHasErrors
            }
            .CombineLatestValuesAreAllFalse()
            .ToReactiveCommand()
            .AddTo(Disposables);

            // 「次へ」が押されたらPinコード設定画面を開く
            NextCommand
            .Subscribe(() =>
            {
                _addAccountService.OpenAuthorizeUrl(ConsumerKey.Value, ConsumerSecret.Value);
                _dialogService.OpenConfigurePincodeView();
            })
            .AddTo(Disposables);
        }
示例#12
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public VesselMountViewModel()
            : base("Vessel Mount ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _events.Subscribe(this);
            _pm = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Get Options
            GetOptions();

            // Set the list
            CommPortList = SerialOptions.PortOptions;
            BaudRateList = SerialOptions.BaudRateOptions;

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AveragingView)));

            // 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)));

            // Set the lists
            InitLists();
            InitValues();
        }
        /// <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();
        }
示例#14
0
        /// <summary>
        /// Initialize the values.
        /// </summary>
        public ModeViewModel()
            : base("Mode")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            ModeOptionsList = new List <ModeOption>();
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.DirectReading)
            {
                TitleLine1 = "Direct", TitleLine2 = "Reading\n  Mode", Image = "../Images/SeaProfiler.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.SelfContained)
            {
                TitleLine1 = "Self", TitleLine2 = "Contained\n    Mode", Image = "../Images/SeaWatch.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.Waves)
            {
                TitleLine1 = "Waves", TitleLine2 = "Mode", Image = "../Images/SeaWave.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.River)
            {
                TitleLine1 = "River", TitleLine2 = "Mode", Image = "../Images/RiverProfiler.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.Dvl)
            {
                TitleLine1 = "DVL", TitleLine2 = "Mode", Image = "../Images/SeaPilot.png"
            });
            ModeOptionsList.Add(new ModeOption(RTI.DeploymentOptions.AdcpDeploymentMode.VM)
            {
                TitleLine1 = "Vessel Mount", TitleLine2 = "Mode", Image = "../Images/SeaTrak.png"
            });

            // Get the Mode option
            GetSelectedModeOption();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.StorageView)));

            // 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)));
        }
示例#15
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public BinsViewModel()
            : base("Bins ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.PingTimingView, ConfigKey)));

            // 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)));
        }
示例#16
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public SaveAdcpConfigurationViewModel()
            : base("Save ADCP Configuration ViewModel")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();


            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView)));

            // 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)));
        }
示例#17
0
        public FloatingPageViewModel()
        {
            _visibles.Add(Visible);
            _visibles.Add(Visible1);
            _visibles.Add(Visible2);
            _visibles.Add(Visible3);
            _visibles.Add(Visible4);

            NextCommand.Subscribe(_ =>
            {
                var index = _visibles.FindIndex(x => x.Value == false);
                _visibles[index++].Value = true;

                if (index == _visibles.Count)
                {
                    index = 0;
                }

                _visibles[index].Value = false;
            });
        }
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public SimpleCompassCalWizardViewModel()
            : base("Simple Compass Cal Wizard")
        {
            // Initialize values
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Next command
            NextCommand = ReactiveCommand.Create();
            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)));

            InitializeValue();
        }
        public CollectionViewTestViewModel(IPageDialogService pageDialog)
        {
            _pageDlg = pageDialog;
            InitializeProperties();

            Action currentAction = null;

            NextCommand.Subscribe(async _ =>
            {
                if (!_testEnumerator.MoveNext())
                {
                    await pageDialog.DisplayAlertAsync("", "Finished", "OK");
                    return;
                }
                currentAction = _testEnumerator.Current.Run;
                currentAction?.Invoke();
            });
            RepeatCommand.Subscribe(_ =>
            {
                currentAction?.Invoke();
            });
        }
        public WorkerViewModel()
        {
            _workOrderRepository      = new WorkOrderSQLServer();
            Worker1StartButton        = new DelegateCommand(Worker1StartButtonExecute);
            Worker2StartButton        = new DelegateCommand(Worker2StartButtonExecute);
            Worker3StartButton        = new DelegateCommand(Worker3StartButtonExecute);
            _timeManagementRepository = new TimeManagementSQLServer();

            observableTimer = Observable.Timer(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(2))
                              .Subscribe(_ =>
            {
                LabelContent.Value  += 1;
                WorkerWorkings.Value = new ObservableCollection <WorkingEntity>(WorkingData.GetWorkings(WorkId.Value, WorkerId.Value));
            });

            NextCommand = CanNext.Select(x => x == false).ToReactiveCommand();
            NextCommand.Subscribe(_ => { _workOrderRepository.ToNext(WorkId.Value, WorkerId.Value); });

            WorkerId.Subscribe(x =>
            {
            });
        }
示例#21
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public LoadProjectsViewModel()
            : base("Load Projects")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Wait for decoding to be complete
            _eventWaitImport = new EventWaitHandle(false, EventResetMode.AutoReset);

            // Intialize values
            InitValues();

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.SelectedProjectVM, x => x.Value != null));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AdcpConfigurationView)));

            // 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)));

            // Dialog to import data
            ImportDataCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsProjectLoading, x => !x.Value));
            ImportDataCommand.Subscribe(_ => ImportData());

            // Dialog to import RTB data
            ImportRtbDataCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsProjectLoading, x => !x.Value));
            ImportRtbDataCommand.Subscribe(_ => ImportRTB());

            // Scan for the projects
            Task.Run(() => ScanProjectAsync());
        }
示例#22
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public StorageViewModel()
            : base("Storage")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Get the singleton ADCP connection
            _adcpConnection = IoC.Get <AdcpConnection>();

            // Initialize values
            IsLoading = false;

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsNextAvail, x => x.Value));                           // Check if available
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SalinityView)));

            // 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)));

            // Browse Project Folder command
            BrowseProjectFolderCommand = ReactiveCommand.Create();
            BrowseProjectFolderCommand.Subscribe(param => BrowseProjectFolder(param));

            // Refresh Internal ADCP storage coommand
            RefreshAdcpInternalStorageCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => CheckMemoryCard()));

            // Format SD Card
            FormatInternalStorageCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => FormatInternalStorage()));

            // Initialize values
            InitializeValues();
        }
示例#23
0
        /// <summary>
        /// Initialize the view model.
        /// </summary>
        public NewProjectViewModel()
            : base("New Project")
        {
            // Set Event Aggregator
            _events = IoC.Get <IEventAggregator>();
            _pm     = IoC.Get <PulseManager>();

            // Serial Number Generator view model
            SerialNumberGeneratorVM = IoC.Get <SerialNumberGeneratorViewModel>();

            // Initialize the values
            _projectNameIndex  = 1;
            AdditionalCommands = "";

            // Get a default project name
            ProjectDir  = Pulse.Commons.GetProjectDefaultFolderPath();
            ProjectName = GetNewDefaultProjectName();

            // Load Project command
            LoadCommandsCommand = ReactiveCommand.Create();
            LoadCommandsCommand.Subscribe(_ => LoadCommands());

            // Browse Project Folder command
            BrowseProjectFolderCommand = ReactiveCommand.Create();
            BrowseProjectFolderCommand.Subscribe(_ => BrowseProjectFolder());

            // Next command
            NextCommand = ReactiveCommand.Create();
            NextCommand.Subscribe(_ => CreateProject());

            // 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)));
        }
示例#24
0
        /// <summary>
        /// Initialize the view.
        /// </summary>
        public DeployAdcpViewModel()
            : base("Deploy ADCP")
        {
            // Initialize values
            _events            = IoC.Get <IEventAggregator>();
            _pm                = IoC.Get <PulseManager>();
            _adcpConnection    = IoC.Get <AdcpConnection>();
            AdditionalCommands = "";
            IsLoading          = false;

            // Next command
            NextCommand = ReactiveCommand.Create(this.WhenAny(x => x.IsLoading, x => !x.Value));
            NextCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView)));

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

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

            // Command to send commands to ADCP
            SendCommandsCommand = ReactiveCommand.CreateAsyncTask(_ => Task.Run(() => ConfigureAdcp()));

            // Command to view all the commands
            ViewCommandsCommand = ReactiveCommand.Create();
            ViewCommandsCommand.Subscribe(_ => ShowCommands());

            // Command to zero pressure sensor
            ZeroPressureCommand = ReactiveCommand.Create();
            ZeroPressureCommand.Subscribe(_ => ZeroPressureSensor());

            // Save the commands to a text file
            SaveCmdsCommand = ReactiveCommand.Create();
            SaveCmdsCommand.Subscribe(_ => SaveCommandsToFile());
        }
示例#25
0
        public DemoPageViewModel(IPageDialogService pageDialog, IToast toast)
        {
            _toast   = toast;
            _pageDlg = pageDialog;

            var list1 = new List <PhotoItem>();

            for (var i = 0; i < 20; i++)
            {
                list1.Add(new PhotoItem
                {
                    PhotoUrl = $"https://kamusoft.jp/openimage/nativecell/{i + 1}.jpg",
                    Title    = $"Title {i + 1}",
                    Category = "AAA",
                });
            }
            var list2 = new List <PhotoItem>();

            for (var i = 10; i < 15; i++)
            {
                list2.Add(new PhotoItem
                {
                    PhotoUrl = $"https://kamusoft.jp/openimage/nativecell/{i + 1}.jpg",
                    Title    = $"Title {i + 1}",
                    Category = "BBB",
                });
            }
            var list3 = new List <PhotoItem>();

            for (var i = 5; i < 20; i++)
            {
                list3.Add(new PhotoItem
                {
                    PhotoUrl = $"https://kamusoft.jp/openimage/nativecell/{i + 1}.jpg",
                    Title    = $"Title {i + 1}",
                    Category = "CCC",
                });
            }

            var group1 = new PhotoGroup(list1)
            {
                Head = "SectionA"
            };
            var group2 = new PhotoGroup(list2)
            {
                Head = "SectionB"
            };
            var group3 = new PhotoGroup(list3)
            {
                Head = "SectionC"
            };

            ItemsSource.Add(group1);
            ItemsSource.Add(group2);
            ItemsSource.Add(group3);
            ItemsSourceH.Add(group1);
            ItemsSourceH.Add(group2);

            TapCommand.Subscribe(async item => {
                var photo = item as PhotoItem;
                await _pageDlg.DisplayAlertAsync("", $"Tap {photo.Title}", "OK");
            });

            LongTapCommand.Subscribe(async item => {
                var photo = item as PhotoItem;
                await _pageDlg.DisplayAlertAsync("", $"LongTap {photo.Title}", "OK");
            });

            RefreshCommand.Subscribe(async _ => {
                await Task.Delay(3000);
                IsRefreshing.Value = false;
            });

            NextCommand.Subscribe(NextAction);

            var loadCount = 1;

            LoadMoreCommand.Subscribe(_ =>
            {
                if (loadCount == 10)
                {
                    SetEndLoadMore(true);
                    return;
                }
                var list = new List <PhotoItem>();
                for (var i = 5; i < 20; i++)
                {
                    list.Add(new PhotoItem
                    {
                        PhotoUrl = $"https://kamusoft.jp/openimage/nativecell/{i + 1}.jpg",
                        Title    = $"Title {i + 1}",
                        Category = "XXX",
                    });
                }

                var group = new PhotoGroup(list)
                {
                    Head = $"SectionX{loadCount}"
                };
                ItemsSource.Add(group);
                SetEndLoadMore(false);
                loadCount++;
            });

            var loadHCount = 1;

            LoadMoreHCommand.Subscribe(_ =>
            {
                if (loadHCount == 10)
                {
                    SetEndLoadMoreH(true);
                    return;
                }
                var list = new List <PhotoItem>();
                for (var i = 5; i < 20; i++)
                {
                    list.Add(new PhotoItem
                    {
                        PhotoUrl = $"https://kamusoft.jp/openimage/nativecell/{i + 1}.jpg",
                        Title    = $"Title {i + 1}",
                        Category = "XXX",
                    });
                }

                var group = new PhotoGroup(list)
                {
                    Head = $"SectionX{loadHCount}"
                };
                ItemsSourceH.Add(group);
                SetEndLoadMoreH(false);
                loadHCount++;
            });

            SetDemoItems();
        }