Exemple #1
0
        public DlgChooseOat(MountVM mountViewModel, Action <string, Action <CommandResponse> > sendCommand)
        {
            AvailableDevices    = new ObservableCollection <DeviceDriver>();
            stateTimer          = new DispatcherTimer();
            stateTimer.Tick    += new EventHandler(ProcessStateMachine);
            stateTimer.Interval = TimeSpan.FromMilliseconds(100);

            _sendCommand        = sendCommand;
            _mountViewModel     = mountViewModel;
            _rollOffsetHistory  = new List <double>(5);
            _pitchOffsetHistory = new List <double>(5);
            _latitude           = AppSettings.Instance.SiteLatitude;
            _longitude          = AppSettings.Instance.SiteLongitude;
            _altitude           = AppSettings.Instance.SiteAltitude;
            _runRAAutoHoming    = AppSettings.Instance.RunAutoHomeRAOnConnect;
            _runDECOffsetHoming = AppSettings.Instance.RunDECOffsetHomingOnConnect;

            CurrentStep            = Steps.Idle;
            _rescanCommand         = new DelegateCommand(async() => { await OnDiscoverDevices(); }, () => (_currentStep == Steps.Idle) || (_currentStep == Steps.WaitForBaudrate));
            _connectAndNextCommand = new DelegateCommand((o) => AdvanceStateMachine(), () => IsNextEnabled);

            this.DataContext = this;
            InitializeComponent();

            this.Result = false;

            Task.Run(async() => { await OnDiscoverDevices(); });

            stateTimer.Start();
        }
        public DlgChooseOat(MountVM mountViewModel, Action <string, Action <CommandResponse> > sendCommand)
        {
            stateTimer          = new DispatcherTimer();
            stateTimer.Tick    += new EventHandler(ProcessStateMachine);
            stateTimer.Interval = TimeSpan.FromMilliseconds(100);

            _sendCommand        = sendCommand;
            _mountViewModel     = mountViewModel;
            _rollOffsetHistory  = new List <double>(5);
            _pitchOffsetHistory = new List <double>(5);
            _latitude           = Settings.Default.SiteLatitude;
            _longitude          = Settings.Default.SiteLongitude;
            _altitude           = Settings.Default.SiteAltitude;

            CurrentStep            = Steps.Idle;
            _rescanCommand         = new DelegateCommand(() => { CommunicationHandlerFactory.DiscoverDevices(); }, () => (_currentStep == Steps.Idle) || (_currentStep == Steps.WaitForBaudrate));
            _connectAndNextCommand = new DelegateCommand((o) => AdvanceStateMachine(), () => IsNextEnabled);

            this.DataContext = this;
            InitializeComponent();

            this.Result = false;

            stateTimer.Start();
        }
Exemple #3
0
 public DlgWaitForGXState(string status, MountVM mountViewModel, Action <string, Action <CommandResponse> > sendCommand, Func <string[], bool> currentStatusFunc)
 {
     _mountVM           = mountViewModel;
     _sendCommand       = sendCommand;
     _currentStatusFunc = currentStatusFunc;
     InitializeComponent();
     this.DataContext = this;
     this.Status      = status;
     _timerStatus     = new DispatcherTimer(TimeSpan.FromMilliseconds(750), DispatcherPriority.Normal, (s, e) => OnTimer(s, e), Application.Current.Dispatcher);
     _timerStatus.Start();
     _cancelCommand = new DelegateCommand(s => OnCancel());
 }
Exemple #4
0
        public SettingsDialog(MountVM mount)
        {
            dispatchTimer    = new DispatcherTimer(TimeSpan.FromMilliseconds(333), DispatcherPriority.Normal, OnTimer, Dispatcher.CurrentDispatcher);
            _mount           = mount;
            this.DataContext = _mount;
            if ((_mount.RAStepsPerDegree < 10) || (_mount.DECStepsPerDegree < 10))
            {
                MessageBox.Show(
                    "It seems that the steps for RA and DEC have been incorrectly configured. It is strongly suggested to do a Factory Reset on the next screen.",
                    "Invalid EEPROM Data",
                    MessageBoxButton.OK,
                    MessageBoxImage.Exclamation
                    );
            }

            _mount.RAStepsPerDegreeEdit  = _mount.RAStepsPerDegree;
            _mount.DECStepsPerDegreeEdit = _mount.DECStepsPerDegree;
            InitializeComponent();
        }
 public MiniController(MountVM mount)
 {
     _mount           = mount;
     this.DataContext = mount;
     InitializeComponent();
 }
 public MainWindow()
 {
     mountVm = new MountVM();
     InitializeComponent();
     this.DataContext = mountVm;
 }
Exemple #7
0
 public TargetChooser(MountVM mount)
 {
     this.DataContext = mount;
     InitializeComponent();
 }