public override void ViewDidLoad() { System.Diagnostics.Debug.WriteLine("ModePanoStatusViewController ViewDidLoad"); Vm = (ModePanoViewModel)NavigationParameter; CancelButton.Clicked += (sender, e) => { PauseResumeButton.Enabled = false; CancelButton.Enabled = false; _canceled = true; Vm.StopProgramCommand.Execute(null); }; PauseResumeButton.Clicked += (sender, e) => { PauseResumeButton.Enabled = false; CancelButton.Enabled = false; switch (DeviceVm.RunStatus) { case MoCoBusRunStatus.Paused: Vm.StartProgramCommand.Execute(null); break; case MoCoBusRunStatus.Running: Vm.PauseProgramCommand.Execute(null); break; } }; SetupBindings(); base.ViewDidLoad(); }
public DeviceViewModel(IDispatcherHelper dispatcherHelper, INavigationService navigationService, IDevice device, Func<IDevice, IMoCoBusCommService> moCoBusCommServiceFactory, Func<IMoCoBusCommService, byte, IMoCoBusProtocolService> moCoBusProtocolServiceFactory) { _dispatcherHelper = dispatcherHelper; _navigationService = navigationService; _commService = moCoBusCommServiceFactory(device); _commService.ConnectionChanged += CommServiceOnConnectionChanged; _protocolService = moCoBusProtocolServiceFactory(_commService, 3); ModeAstroViewModel = new ModeAstroViewModel(_dispatcherHelper, this, _protocolService); ModePanoViewModel = new ModePanoViewModel(_dispatcherHelper, this, _protocolService); ModeSmsViewModel = new ModeSmsViewModel(_dispatcherHelper, this, _protocolService); JoystickViewModel = new JoystickViewModel(this, _protocolService); }
public override void ViewDidLoad() { System.Diagnostics.Debug.WriteLine("ModePanoViewController ViewDidLoad"); Vm = (ModePanoViewModel)NavigationParameter; Vm.PropertyChanged += (s, e) => { }; var tableView = (UITableView)View; tableView.BackgroundColor = UIColor.GroupTableViewBackgroundColor; tableView.BackgroundView = null; tableView.AllowsSelection = true; PreDelayValueLabel.Text = $"{0.1f:F1}s"; ExposureValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (decimal)ExposureValuePickerTableViewCell.Model.SelectedTime.TotalSeconds; if (Vm.ExposureTime != t) Vm.ExposureTime = t; }; PreDelayValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (decimal)PreDelayValuePickerTableViewCell.Model.SelectedTime.TotalSeconds; if (Vm.PreDelayTime != t) Vm.PreDelayTime = t; }; PostDelayValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (decimal)PostDelayValuePickerTableViewCell.Model.SelectedTime.TotalSeconds; if (Vm.DelayTime != t) Vm.DelayTime = t; }; PauseValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (decimal)PauseValuePickerTableViewCell.Model.SelectedTime.TotalSeconds; if (Vm.PauseTime != t) Vm.PauseTime = t; }; RepititionsValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (ushort)RepititionsValuePickerTableViewCell.Model.SelectedNumber; if (Vm.Repititions != t) Vm.Repititions = t; }; StartButton.Clicked += (sender, e) => { _navigatedToStatusView = true; Vm.StartProgramCommand.Execute(null); ServiceLocator.Current.GetInstance<INavigationService>().NavigateTo(AppDelegate.ModePanoStatusViewKey, Vm); }; SetupBindings(); base.ViewDidLoad(); }