/// <summary> /// This happens when the menu item is clicked. /// </summary> /// <param name="pluginController"></param> public void OnClick(IDeckBuilderPluginController pluginController) { // WHI: e1e11562-efce-4379-9701-534f9717391f // Find the first game with cards in it. // var game = pluginController.Games.Games.FirstOrDefault(x => x.SelectCards(null).Rows.Count > 0); var game = pluginController.Games.Games.FirstOrDefault(); if (game == null) { MessageBox.Show("No Games Installed?!?!?"); return; } // Before we make a deck, we need to make sure we load the correct game for the deck. pluginController.SetLoadedGame(game); var window = new MainWindow(new MainViewModel(pluginController)); // Trigger the version check here var dispatcher = Dispatcher.CurrentDispatcher; var task = new Task(() => { var versionDetails = GetLatestVersion.LatestVersionDetails(); if (!VersionCheckDone && versionDetails.Any()) { var current = Assembly.GetExecutingAssembly().GetName().Version; var latest = new Version(versionDetails.First().Version); if (latest > current) { dispatcher.Invoke(() => { // TODO: Owner sichern + exception fangen (owner zu schnell zu) var dialog = new NewVersionAvailableDialog() { Owner = window, VersionDetails = versionDetails, }; dialog.ShowDialog(); }); } VersionCheckDone = true; } }); task.Start(); window.ShowDialog(); }
/// <summary> /// This happens when the menu item is clicked. /// </summary> /// <param name="pluginController"></param> public void OnClick(IDeckBuilderPluginController pluginController) { // WHI: e1e11562-efce-4379-9701-534f9717391f // Find the first game with cards in it. var game = pluginController.Games.Games.FirstOrDefault(x => x.SelectCards(null).Rows.Count > 0); if (game == null) { MessageBox.Show("No Games Installed?!?!?"); return; } // Before we make a deck, we need to make sure we load the correct game for the deck. pluginController.SetLoadedGame(game); var window = new MainWindow(new MainViewModel(pluginController)); window.ShowDialog(); }