public override void ViewDidLoad() { System.Diagnostics.Debug.WriteLine("ModeSmsStatusViewController ViewDidLoad"); Vm = (ModeSmsViewModel)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("ModeSmsViewController ViewDidLoad"); Vm = (ModeSmsViewModel)NavigationParameter; Vm.PropertyChanged += (s, e) => { }; SwapStartStopButton.TouchUpInside += (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; }; IntervalValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (decimal)IntervalValuePickerTableViewCell.Model.SelectedTime.TotalSeconds; if (Vm.IntervalTime != t) Vm.IntervalTime = t; }; DurationValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (decimal)DurationValuePickerTableViewCell.Model.SelectedTime.TotalSeconds; if (Vm.DurationTime != t) Vm.DurationTime = t; }; ShotsValuePickerTableViewCell.Model.ValueChanged += (sender, e) => { var t = (ushort)ShotsValuePickerTableViewCell.Model.SelectedNumber; if (Vm.MaxShots != t) Vm.MaxShots = t; }; SwapStartStopButton.SetCommand( "TouchUpInside", Vm.SwapStartStopCommand); StartButton.Clicked += (sender, e) => { _navigatedToStatusView = true; Vm.StartProgramCommand.Execute(null); ServiceLocator.Current.GetInstance<INavigationService>().NavigateTo(AppDelegate.ModeSmsStatusViewKey, Vm); }; SetupBindings(); base.ViewDidLoad(); }