/// <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(); }
/// <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()); }
/// <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(); }
/// <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> /// 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))); }
/// <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 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(); }
/// <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(); }
/// <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(); }
/// <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()); }
/// <summary> /// Load the home view. /// </summary> public ShellViewModel(IEventAggregator events) { Debug.Print("Shell Open"); // To set the Window title // http://stackoverflow.com/questions/4615467/problem-with-binding-title-of-wpf-window-on-property-in-shell-view-model-class base.DisplayName = "Pulse"; // Initialize the values _events = events; events.Subscribe(this); // Setup ErrorLog SetupErrorLog(); // Set a size of 10 views _backStack = new Stack <ViewNavEvent>(20); _prevViewNavEvent = null; // Set the Navigation bar viewmodel NavBarVM = IoC.Get <NavBarViewModel>(); IsNavBarEnabled = false; // Set the Playback viewmodel PlaybackVM = IoC.Get <PlaybackViewModel>(); IsPlaybackEnabled = false; // Command to view the Home view HomeViewCommand = ReactiveCommand.Create(); HomeViewCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Command to view the Terimal view TerminalViewCommand = ReactiveCommand.Create(); TerminalViewCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.TerminalView))); // Command to view the Settings view SettingsViewCommand = ReactiveCommand.Create(); SettingsViewCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SettingsView))); // Command to view the Settings view AboutViewCommand = ReactiveCommand.Create(); AboutViewCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AboutView))); // Command to view the Settings view ValidationTestViewCommand = ReactiveCommand.Create(); ValidationTestViewCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ValidationTestView))); // Command to go back a view BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Display the HomeViewModel Handle(new ViewNavEvent(ViewNavEvent.ViewId.HomeView)); // Check for updates to the applications CheckForUpdates(); Debug.Print("Shell Complete"); }
private void InitialiseCommands() { BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(BackCommandHandler); NavigateToScorer = ReactiveCommand.Create(); NavigateToScorer.Subscribe(NavigateToScorerCommandHandler); NavigateToPlayers = ReactiveCommand.Create(); NavigateToPlayers.Subscribe(NavigateToPlayerCommandHandler); }
/// <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(); }
/// <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))); }
/// <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))); }
/// <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))); }
/// <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(); }
/// <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()); }
/// <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(); }
/// <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))); }
/// <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()); }
public BackPreviousVm() { BackCommand = ReactiveCommand.Create(Observable.Return(true)); BackCommand.Subscribe(_ => ShellContainerVm.ChangeCurrentView(StatusScreen.ShMenu, true)); }
/// <summary> /// Initalize values. /// </summary> public NavBarViewModel() : base("Nav") { _pm = IoC.Get <PulseManager>(); _events = IoC.Get <IEventAggregator>(); _adcpConn = IoC.Get <AdcpConnection>(); _IsRecording = false; this.NotifyOfPropertyChange(() => this.IsRecording); // Set the record image SetRecorderImage(); // Warning timer _recorderTimer = new System.Timers.Timer(); _recorderTimer.Interval = 2000; // 2 seconds. _recorderTimer.Elapsed += _recorderTimer_Elapsed; _recorderTimer.AutoReset = true; _recorderTimer.Start(); // Command to go back a view BackCommand = ReactiveCommand.Create(); BackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.Back))); // Command to go to Home View HomeCommand = ReactiveCommand.Create(); HomeCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Command to go to SmartPage View ConfigureCommand = ReactiveCommand.Create(); ConfigureCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SmartPageView))); // Command to go to ViewData View ViewDataCommand = ReactiveCommand.Create(); ViewDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ViewDataView))); //// Command to go to Playback data //PlaybackCommand = ReactiveCommand.Create(); //PlaybackCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.SelectPlaybackView))); // Select a file to playback PlaybackCommand = ReactiveCommand.Create(); PlaybackCommand.Subscribe(_ => PlaybackFile()); // Command to go to ScreenData View ScreenDataCommand = ReactiveCommand.Create(); ScreenDataCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ScreenDataView))); // Command to go to Project View ProjectCommand = ReactiveCommand.Create(); ProjectCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.ProjectView))); // Command to go to VesselMount Options View VmOptionsCommand = ReactiveCommand.Create(); VmOptionsCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.VesselMountOptionsView))); // Command to go to Data Format View DataFormatCommand = ReactiveCommand.Create(); DataFormatCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.DataFormatView))); // Command to go to VesselMount Options View AveragingCommand = ReactiveCommand.Create(); AveragingCommand.Subscribe(_ => _events.PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.AveragingView))); // Set the Clock time to Local System time on the ADCP StartTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => !x.Value), _ => Task.Run(() => On_StartTesting())); // Create a command to stop testing StopTestingCommand = ReactiveCommand.CreateAsyncTask(this.WhenAny(x => x.IsTesting, x => x.Value), _ => Task.Run(() => On_StopTesting())); }