/// <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"); }
/// <summary> /// Initialize values. /// </summary> public ViewDataBaseViewModel() { // Project Manager _pm = IoC.Get <PulseManager>(); _events = IoC.Get <IEventAggregator>(); _events.Subscribe(this); _adcpConn = IoC.Get <AdcpConnection>(); // Initialize for warning when not recording live data IsDisplayRecordingWarning = false; // Warning timer _warningRecordTimer = new System.Timers.Timer(); _warningRecordTimer.Interval = 5000; // 5 seconds. _warningRecordTimer.Elapsed += _warningRecordTimer_Elapsed; _warningRecordTimer.AutoReset = true; // Command to view the ViewData page HomeViewCommand = ReactiveCommand.Create(); HomeViewCommand.Subscribe(_ => IoC.Get <IEventAggregator>().PublishOnUIThread(new ViewNavEvent(ViewNavEvent.ViewId.HomeView))); // Command to view Graphical data GraphicalViewCommand = ReactiveCommand.Create(); GraphicalViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseGraphicalViewModel>())); // Command to view Graphical data TextViewCommand = ReactiveCommand.Create(); TextViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseTextViewModel>())); // Command to view DVL data DvlViewCommand = ReactiveCommand.Create(); DvlViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseDvlViewModel>())); // Command to view Backscatter data BackscatterViewCommand = ReactiveCommand.Create(); BackscatterViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseBackscatterViewModel>())); // Command to view 3D Profile data Profile3DViewCommand = ReactiveCommand.Create(); Profile3DViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ViewDataBaseProfile3DViewModel>())); // Command to view Diagnotics data DiagnosticViewCommand = ReactiveCommand.Create(); DiagnosticViewCommand.Subscribe(_ => ActivateItem(IoC.Get <DiagnosticsBaseViewModel>())); // Command to view Diagnotics data ShipTrackViewCommand = ReactiveCommand.Create(); ShipTrackViewCommand.Subscribe(_ => ActivateItem(IoC.Get <ValidationTestBaseViewModel>())); // Display Graphical view by default ActivateItem(IoC.Get <ViewDataBaseGraphicalViewModel>()); }