private void OpenPage(PageType type) { if (pn_main.Controls.Count < 1) { return; } switch (type) { case PageType.SSH: foreach (var item in this.pn_main.Controls) { if (item is MultiPagePanel ctrl) { if (ctrl.Name == "pn_ssh") { ctrl.BringToFront(); ChangeMenuBtn(this.btn_ssh); break; } } } break; //case PageType.SFTP: // foreach (var item in this.pn_main.Controls) // { // if(item is MultiPagePanel ctrl) // { // if (ctrl.Name == "pn_sftp") // { // ctrl.BringToFront(); // ChangeMenuBtn(this.btn_sftp); // break; // } // } // } // break; case PageType.Batch: if (this.pn_batch == null) { this.pn_batch = new BatchPage(clients) { Name = "pn_batch", }; this.pn_main.AddPage(this.pn_batch); ChangeMenuBtn(this.btn_batch); } else { this.pn_batch.BringToFront(); ChangeMenuBtn(this.btn_batch); } break; default: break; } }
public MainWindow() { SevenZip.SevenZipBase.SetLibraryPath(Path.Combine(ApplicationInfo.AppPath, $"{(System.Environment.Is64BitOperatingSystem ? "x64" : "x86")}/7z.dll")); InitializeComponent(); _settings = new SettingsPage(this); _isFirstRun = _settings.IsFirstRun; _singlePage = new SinglePage(this, _settings.Model, _gameDb); _batchPage = new BatchPage(this, _settings.Model, _gameDb); _singlePage.Model.PropertyChanged += ModelOnPropertyChanged; _model = new MainModel(); DataContext = _model; _model.Mode = AppMode.Single; CurrentPage.Content = _singlePage; }