public MainMenuViewModel() { SaveCommand = ReactiveCommand.Create(); SaveCommand.Subscribe(_ => { ShellViewModel.Instance.Save(); }); SaveAllCommand = ReactiveCommand.Create(); SaveAllCommand.Subscribe(_ => { ShellViewModel.Instance.SaveAll(); }); CleanProjectCommand = ReactiveCommand.Create(); CleanProjectCommand.Subscribe(_ => { ShellViewModel.Instance.Clean(); }); BuildProjectCommand = ReactiveCommand.Create(); BuildProjectCommand.Subscribe(_ => { ShellViewModel.Instance.Build(); }); PackagesCommand = ReactiveCommand.Create(); PackagesCommand.Subscribe(o => { ShellViewModel.Instance.ShowPackagesDialog(); }); ProjectPropertiesCommand = ReactiveCommand.Create(); ProjectPropertiesCommand.Subscribe(o => { ShellViewModel.Instance.ShowProjectPropertiesDialog(); }); NewProjectCommand = ReactiveCommand.Create(); NewProjectCommand.Subscribe(o => { // ShellViewModel.Instance.ShowNewProjectDialog(); }); ExitCommand = ReactiveCommand.Create(); ExitCommand.Subscribe(o => { ShellViewModel.Instance.ExitApplication(); }); }
/// <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> /// 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 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> /// 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 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 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> /// 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 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 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))); }
public LwsViewModel() { model = new LwsModel(); Output = model.Output.ToReadOnlyReactiveCollection(); EnchantGroupList.AddRange(Const.EnchantmentList.Select(item => item.Name)); ExecuteCommand.Subscribe(_ => Execute()); ExitCommand.Subscribe(_ => Exit()); SelectedGroupIndex.Subscribe(_ => { EnchantNameList.Clear(); EnchantNameList.AddRange(GetEnchantNameList().Select(i => i.Name)); SelectedNameIndex.Value = 0; }); Disposable.Add(Output); Disposable.Add(ExecuteCommand); Disposable.Add(ExitCommand); }
/// <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 RoomView() { InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif AccessCodeTextBlock = this.FindControl <TextBlock>("AccessCodeTextBlock"); StatusTextBlock = this.FindControl <TextBlock>("StatusTextBlock"); CopyButton = this.FindControl <Button>("CopyButton"); StartButton = this.FindControl <Button>("StartButton"); ExitButton = this.FindControl <Button>("ExitButton"); CopyImage = this.FindControl <Image>("CopyImage"); TimerPanel = this.FindControl <ContentControl>("TimerPanel"); ScrambleContenteControl = this.FindControl <ContentControl>("ScrambleContenteControl"); Opened += (_, _) => OnOpen(); this.WhenActivated(async disposableRegistration => { this.Bind( ViewModel, viewModel => viewModel.AccessCode, view => view.AccessCodeTextBlock.Text) .DisposeWith(disposableRegistration); this.Bind( ViewModel, viewModel => viewModel.Status, view => view.StatusTextBlock.Text) .DisposeWith(disposableRegistration); this.Bind( ViewModel, viewModel => viewModel.CopyImage, view => view.CopyImage.Source) .DisposeWith(disposableRegistration); this.BindCommand( ViewModel, viewModel => viewModel.CopyToClipboardCommand, view => view.CopyButton) .DisposeWith(disposableRegistration); this.BindCommand( ViewModel, viewModel => viewModel.StartCommand, view => view.StartButton) .DisposeWith(disposableRegistration); this.BindCommand( ViewModel, viewModel => viewModel.ExitCommand, view => view.ExitButton) .DisposeWith(disposableRegistration); ViewModel !.ExitCommand.Subscribe(_ => Close()).DisposeWith(disposableRegistration); await ViewModel.ConstructAsync().ConfigureAwait(false); }); }