コード例 #1
0
        public void UpdateTabViewModel(string name)
        {
            switch (name)
            {
            case "Focuser":
                if (Settings.Settings.Focuser)
                {
                    if (!PageViewModels.Contains(_focuserVM))
                    {
                        _focuserVM = new FocuserVM();
                        PageViewModels.Add(_focuserVM);
                    }
                    FocuserRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_focuserVM))
                    {
                        PageViewModels.Remove(_focuserVM);
                    }
                    FocuserRadioVisible = false;
                }
                break;

            case "Notes":
                if (Settings.Settings.Notes)
                {
                    if (!PageViewModels.Contains(_notesVM))
                    {
                        _notesVM = new NotesVM();
                        PageViewModels.Add(_notesVM);
                    }
                    NotesRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_notesVM))
                    {
                        PageViewModels.Remove(_notesVM);
                    }
                    NotesRadioVisible = false;
                }
                break;

            case "SkyWatcher":
                if (Settings.Settings.SkyWatcher)
                {
                    if (!PageViewModels.Contains(_skyTelescopeVM))
                    {
                        _skyTelescopeVM = new SkyTelescopeVM();
                        PageViewModels.Add(_skyTelescopeVM);
                    }
                    SkyWatcherRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_skyTelescopeVM))
                    {
                        PageViewModels.Remove(_skyTelescopeVM);
                    }
                    SkyWatcherRadioVisible = false;
                }
                break;

            case "GamePad":
                if (Settings.Settings.GamePad)
                {
                    if (!PageViewModels.Contains(_gamePadVM))
                    {
                        _gamePadVM = new GamePadVM();
                        PageViewModels.Add(_gamePadVM);
                    }
                    GamePadRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_gamePadVM))
                    {
                        PageViewModels.Remove(_gamePadVM);
                    }
                    GamePadRadioVisible = false;
                }
                break;

            case "Settings":
                _settingsVM = new SettingsVM();
                PageViewModels.Add(_settingsVM);
                SettingsRadioVisible = true;
                break;

            case "Model3D":
                if (Settings.Settings.Model3D)
                {
                    if (!PageViewModels.Contains(_model3dVM))
                    {
                        _model3dVM = new Model3DVM();
                        PageViewModels.Add(_model3dVM);
                    }
                    Model3DRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_model3dVM))
                    {
                        PageViewModels.Remove(_model3dVM);
                    }
                    Model3DRadioVisible = false;
                }
                break;

            case "Plot":
                if (Settings.Settings.Plot)
                {
                    if (!PageViewModels.Contains(_plotVM))
                    {
                        _plotVM = new PlotVM();
                        PageViewModels.Add(_plotVM);
                    }
                    PlotRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_plotVM))
                    {
                        PageViewModels.Remove(_plotVM);
                    }
                    PlotRadioVisible = false;
                }
                break;

            case "PoleLocator":
                if (Settings.Settings.PoleLocator)
                {
                    if (!PageViewModels.Contains(_poleLocatorVM))
                    {
                        _poleLocatorVM = new PoleLocatorVM();
                        PageViewModels.Add(_poleLocatorVM);
                    }
                    PoleLocatorRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_poleLocatorVM))
                    {
                        PageViewModels.Remove(_poleLocatorVM);
                    }
                    PoleLocatorRadioVisible = false;
                }
                break;

            case "Pulses":
                if (Settings.Settings.Pulses)
                {
                    if (!PageViewModels.Contains(_pulsesVM))
                    {
                        _pulsesVM = new PulsesVM();
                        PageViewModels.Add(_pulsesVM);
                    }
                    PulsesRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_pulsesVM))
                    {
                        PageViewModels.Remove(_pulsesVM);
                    }
                    PulsesRadioVisible = false;
                }
                break;

            case "Test":
                if (SkyServer.TestTab)
                {
                    if (!PageViewModels.Contains(_testVM))
                    {
                        _testVM = new TestVM();
                        PageViewModels.Add(_testVM);
                    }
                    TestRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_testVM))
                    {
                        PageViewModels.Remove(_testVM);
                    }
                    TestRadioVisible = false;
                }
                break;
            }
        }
コード例 #2
0
ファイル: MainWindowVM.cs プロジェクト: AndreBremer/GSServer
        public void UpdateTabViewModel(string name)
        {
            switch (name)
            {
            case "Focuser":
                if (Settings.Settings.Focuser)
                {
                    if (!PageViewModels.Contains(_focuserVM))
                    {
                        _focuserVM = new FocuserVM();
                        PageViewModels.Add(_focuserVM);
                    }
                    FocuserRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_focuserVM))
                    {
                        PageViewModels.Remove(_focuserVM);
                    }
                    FocuserRadioVisible = false;
                }
                break;

            case "Notes":
                if (Settings.Settings.Notes)
                {
                    if (!PageViewModels.Contains(_notesVM))
                    {
                        _notesVM = new NotesVM();
                        PageViewModels.Add(_notesVM);
                    }
                    NotesRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_notesVM))
                    {
                        PageViewModels.Remove(_notesVM);
                    }
                    NotesRadioVisible = false;
                }
                break;

            case "SkyWatcher":
                if (Settings.Settings.SkyWatcher)
                {
                    if (!PageViewModels.Contains(_skyTelescopeVM))
                    {
                        _skyTelescopeVM = new SkyTelescopeVM();
                        PageViewModels.Add(_skyTelescopeVM);
                    }
                    SkyWatcherRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_skyTelescopeVM))
                    {
                        PageViewModels.Remove(_skyTelescopeVM);
                    }
                    SkyWatcherRadioVisible = false;
                }
                break;

            case "GamePad":
                if (Settings.Settings.GamePad)
                {
                    if (!PageViewModels.Contains(_gamePadVM))
                    {
                        _gamePadVM = new GamePadVM();
                        PageViewModels.Add(_gamePadVM);
                    }
                    GamePadRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_gamePadVM))
                    {
                        PageViewModels.Remove(_gamePadVM);
                    }
                    GamePadRadioVisible = false;
                }
                break;

            case "Settings":
                _settingsVM = new SettingsVM();
                PageViewModels.Add(_settingsVM);
                SettingsRadioVisible = true;
                break;

            case "Model3D":
                if (Settings.Settings.Model3D)
                {
                    if (!PageViewModels.Contains(_model3dVM))
                    {
                        _model3dVM = new Model3DVM();
                        PageViewModels.Add(_model3dVM);
                    }
                    Model3DRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_model3dVM))
                    {
                        PageViewModels.Remove(_model3dVM);
                    }
                    Model3DRadioVisible = false;
                }
                break;

            case "Plot":
                if (Settings.Settings.Plot)
                {
                    if (!PageViewModels.Contains(_plotVM))
                    {
                        _plotVM = new PlotVM();
                        PageViewModels.Add(_plotVM);
                    }
                    PlotRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_plotVM))
                    {
                        PageViewModels.Remove(_plotVM);
                    }
                    PlotRadioVisible = false;
                }
                break;

            case "PoleLocator":
                if (Settings.Settings.PoleLocator)
                {
                    if (!PageViewModels.Contains(_poleLocatorVM))
                    {
                        _poleLocatorVM = new PoleLocatorVM();
                        PageViewModels.Add(_poleLocatorVM);
                    }
                    PoleLocatorRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_poleLocatorVM))
                    {
                        PageViewModels.Remove(_poleLocatorVM);
                    }
                    PoleLocatorRadioVisible = false;
                }
                break;

            case "Pulses":
                if (Settings.Settings.Pulses)
                {
                    if (!PageViewModels.Contains(_pulsesVM))
                    {
                        _pulsesVM = new PulsesVM();
                        PageViewModels.Add(_pulsesVM);
                    }
                    PulsesRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_pulsesVM))
                    {
                        PageViewModels.Remove(_pulsesVM);
                    }
                    PulsesRadioVisible = false;
                }
                break;

            case "Pec":
                //if (Settings.Settings.Pec)
                if (SkyServer.PecShow)
                {
                    if (!PageViewModels.Contains(_pecVM))
                    {
                        _pecVM = new PecVM();
                        PageViewModels.Add(_pecVM);
                    }
                    PecRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_pecVM))
                    {
                        PageViewModels.Remove(_pecVM);
                    }
                    PecRadioVisible = false;
                }
                break;

            case "Snap":
                if (Settings.Settings.Snap)
                {
                    if (!PageViewModels.Contains(_snapVM))
                    {
                        _snapVM = new SnapVM();
                        PageViewModels.Add(_snapVM);
                    }
                    SnapRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_snapVM))
                    {
                        PageViewModels.Remove(_snapVM);
                    }
                    SnapRadioVisible = false;
                }
                break;

            case "Alignment":
                if (SkyServer.AlignmentShow && Settings.Settings.AlignmentTabVisible)
                {
                    if (!PageViewModels.Contains(_alignmentVM))
                    {
                        _alignmentVM = new AlignmentVM();
                        PageViewModels.Add(_alignmentVM);
                    }
                    AlignmentRadioVisible = true;
                }
                else
                {
                    if (PageViewModels.Contains(_alignmentVM))
                    {
                        PageViewModels.Remove(_alignmentVM);
                    }

                    AlignmentRadioVisible = false;
                }
                break;
            }
        }