public virtual IView Create(ViewTypes type) { IView view = null; switch (type) { case ViewTypes.GAME: view = new GameView(services.Updateables, services.GameService); break; case ViewTypes.INIT: view = new InitView(); break; case ViewTypes.LOAD: view = new LoadView(); break; case ViewTypes.MAIN: view = new MainView(services); break; case ViewTypes.RESULTS: view = new ResultsView(services); break; case ViewTypes.LEVEL_UP: view = new LevelUpView(services); break; } initView(view); return view; }
public MainForm() { InitializeComponent(); InitView init = new InitView(); init.onDispose += (counts) => { if (counts == null) { Program = new MyProgram(); } else { Program = new MyProgram(true, counts[0], counts[1], counts[2], counts[3]); } comboPType.SelectedIndex = 0; comboCAType.SelectedIndex = 0; comboTypes.SelectedIndex = 0; this.dataGridPerson.DataSource = BindSourcePersons; this.dataGridCA.DataSource = BindSourceCadastralAreas; this.InitPersons(); this.InitCadastralAreas(); }; init.ShowDialog(); }
public App() { InitializeComponent(); //Crear o cargar las tablas de base de datos a partir de los modelos connection = new SQLiteAsyncConnection(Cfg.Database); connection.CreateTableAsync <Profile>().Wait(); connection.CreateTableAsync <Chat>().Wait(); connection.CreateTableAsync <Contact>().Wait(); connection.CreateTableAsync <Message>().Wait(); connection.CreateTableAsync <Configuration>().Wait(); if (configurationDAO.isEmpty()) { MainPage = new InitView(); configurationDAO.Insert(new Configuration(1)); } else { if (profileDAO.isEmpty()) { MainPage = new LoginView { BindingContext = new LoginViewModel { LoginSendDTO = new LoginSendDTO() } }; } else { MainPage = new NavigationPage(new MainView()); } } }
private void Application_Startup(object sender, StartupEventArgs e) { Init(); // Create the startup window InitView wnd = new InitView(_dataManager, _createFactory); // Do stuff here, e.g. to the window // Show the window wnd.Show(); }
static async Task Main(string[] args) { if (args.Length > 0) { Settings = Settings.CreateOverride(args); } if (Settings.MigrateOldLibrarianData.Length > 0) { Migrate(); return; } if (Settings.Log) { Logger.SetLogger(new Logger("log.txt")); } AppDomain.CurrentDomain.UnhandledException += (sender, eventArgs) => Logger.Instance.Log(eventArgs.ExceptionObject.ToString() ?? "Unknown Exception", Logger.Level.Error); State = new State(Settings); using UiHub uiHub = UiHub.Register(80, 20, true); uiHub.Title = $"Librarian v{Version}"; uiHub.MainLoopInterval = Settings.UiInputInterval; uiHub.ViewUpdateReduction = Settings.UiRenderReduction; InitView initView = new InitView(uiHub.AddView("Init")); MainView mainView = new MainView(uiHub.AddView("Main")); DownloadView downloadView = new DownloadView(uiHub.AddView("Download")); ScanView scanView = new ScanView(uiHub.AddView("Scan")); State.PropertyChanged += (s, e) => { switch (e.PropertyName) { case nameof(State.Current): switch (State.Current) { case State.View.Init: uiHub.SwitchView(initView.Name); break; case State.View.Main: uiHub.SwitchView(mainView.Name); break; case State.View.Download: uiHub.SwitchView(downloadView.Name); break; case State.View.Scan: uiHub.SwitchView(scanView.Name); break; } break; case nameof(State.InitCurrentPath): initView.UpdateView(State.InitCurrentPath); break; default: mainView.UpdateView(State); break; } }; State.DownloadState.PropertyChanged += (s, e) => downloadView.UpdateView(State.DownloadState); State.ScanState.PropertyChanged += (s, e) => scanView.UpdateView(State.ScanState); downloadView.UpdateView(State.DownloadState); scanView.UpdateView(State.ScanState); CancellationTokenSource tokenSource = new CancellationTokenSource(); Logger.Instance.Log($"Starting Librarian v{Version}"); Task run = Task.Run(() => Run(tokenSource.Token), tokenSource.Token); uiHub.Run(); tokenSource.Cancel(); await run; Logger.Instance.Log("Stopping"); }