public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow) { _deckWindow = deckWindow; NumMod = ""; Game = game; InitializeComponent(); filtersList.ItemsSource = Enumerable.Repeat <object>("First", 1).Union( Enumerable.Repeat <object>(new SetPropertyDef(Game.Sets().Where(x => x.Hidden == false)), 1).Union( game.AllProperties().Where(p => !p.Hidden))); GenerateColumns(game); //resultsGrid.ItemsSource = game.SelectCards(null).DefaultView; UpdateDataGrid(game.AllCards(true).ToDataTable(Game).DefaultView); FileName = ""; UpdateCount(); }//Why are we populating the list on load? I'd rather wait until the search is run with no parameters (V)_V
public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow) { _deckWindow = deckWindow; NumMod = ""; Game = game; InitializeComponent(); filtersList.ItemsSource = Enumerable.Repeat<object>("First", 1).Union( Enumerable.Repeat<object>(new SetPropertyDef(Game.Sets()), 1).Union( game.AllProperties().Where(p => !p.Hidden))); GenerateColumns(game); //resultsGrid.ItemsSource = game.SelectCards(null).DefaultView; UpdateDataGrid(game.AllCards().ToDataTable(Game).DefaultView); FileName = ""; UpdateCount(); }
private void EditDeckClick(object sender, RoutedEventArgs e) { var deck = (sender as Button).DataContext as MetaDeck; if (deck == null) { return; } if (deck.IsCorrupt) { return; } var de = new DeckBuilderWindow(deck); de.ShowDialog(); }
public void Launch() { if (DeckPath == null) return; try { Deck = new MetaDeck(DeckPath); var win = new DeckBuilderWindow(Deck,true); Application.Current.MainWindow = win; win.Show(); } catch (UserMessageException e) { TopMostMessageBox.Show(e.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Asterisk); this.Shutdown = true; } }
public SearchControl(DataNew.Entities.Game game, DeckBuilderWindow deckWindow) { _deckWindow = deckWindow; NumMod = ""; Game = game; InitializeComponent(); var source = Enumerable.Repeat <object>("First", 1) .Union(Enumerable.Repeat <object>(new NamePropertyDef(), 1)) .Union(Enumerable.Repeat <object>(new SetPropertyDef(Game.Sets().Where(x => x.Hidden == false)), 1)) .Union(game.CardProperties.Values.Where(p => !p.Hidden)); filtersList.ItemsSource = source; GenerateColumns(game); //resultsGrid.ItemsSource = game.SelectCards(null).DefaultView; UpdateDataGrid(game.AllCards(true).ToDataTable(Game).DefaultView); FileName = ""; UpdateCount(); }
internal static void Start() { Application.Current.MainWindow = new Window(); KillOtherOctgn(); bool isUpdate = RunUpdateChecker(); if (isUpdate) { KillOtherOctgn(true); UpdateManager.Instance.UpdateAndRestart(); return; } Log.Info("Ping back"); System.Threading.Tasks.Task.Factory.StartNew(pingOB); bool tableOnlyFailed = false; int? hostport = null; Guid? gameid = null; var os = new Mono.Options.OptionSet() { { "t|table", x => TableOnly = true }, { "g|game=",x=> gameid=Guid.Parse(x)}, { "d|deck",x=>DeckEditorOnly = true} }; try { os.Parse(Environment.GetCommandLineArgs()); } catch (Exception e) { Log.Warn("Parse args exception: " +String.Join(",",Environment.GetCommandLineArgs()),e); } if (TableOnly) { try { new GameTableLauncher().Launch(hostport,gameid); } catch (Exception e) { Log.Warn("Couldn't host/join table mode",e); tableOnlyFailed = true; Program.Exit(); } } if (DeckEditorOnly) { var win = new DeckBuilderWindow(); Application.Current.MainWindow = win; win.Show(); } if ((!TableOnly || tableOnlyFailed) && !DeckEditorOnly) { Log.Info("Creating main window..."); WindowManager.Main = new Main(); Log.Info("Main window Created, Launching it."); Application.Current.MainWindow = WindowManager.Main; Log.Info("Main window set."); Log.Info("Launching Main Window"); WindowManager.Main.Show(); Log.Info("Main Window Launched"); } }
private void EditDeckClick(object sender, RoutedEventArgs e) { var deck = (sender as Button).DataContext as MetaDeck; if (deck == null) return; if (deck.IsCorrupt) return; var de = new DeckBuilderWindow(deck); de.ShowDialog(); }
public SearchControl(DataNew.Entities.Game loadedGame, SearchSave save, DeckBuilderWindow deckWindow) { _deckWindow = deckWindow; NumMod = ""; var game = GameManager.Get().GetById(save.GameId); if (game == null) { TopMostMessageBox.Show("You don't have the game for this search installed", "Oh No", MessageBoxButton.OK, MessageBoxImage.Error); save = null; } else if (loadedGame.Id != save.GameId) { TopMostMessageBox.Show( "This search is for the game " + game.Name + ". You currently have the game " + loadedGame.Name + " loaded so you can not load this search.", "Oh No", MessageBoxButton.OK, MessageBoxImage.Error); save = null; } Game = loadedGame; InitializeComponent(); filtersList.ItemsSource = Enumerable.Repeat <object>("First", 1) .Union(Enumerable.Repeat <object>(new NamePropertyDef(), 1)) .Union(Enumerable.Repeat <object>(new SetPropertyDef(Game.Sets()), 1)) .Union(game.CardProperties.Values.Where(p => !p.Hidden)); this.GenerateColumns(game); FileName = ""; if (save != null) { this.SearchName = save.Name; this.FileName = save.FileName; // Load filters foreach (var filter in save.Filters) { DataNew.Entities.PropertyDef prop; if (filter.IsSetProperty) { prop = filtersList.Items.OfType <SetPropertyDef>().First(); } else { prop = filtersList.Items.OfType <PropertyDef>().FirstOrDefault( x => x.Name.Equals(filter.PropertyName, StringComparison.InvariantCultureIgnoreCase)); } if (prop == null) { continue; } filterList.Items.Add(prop); } RoutedEventHandler loadedEvent = null; loadedEvent = (sender, args) => { this.Loaded -= loadedEvent; var generator = filterList.ItemContainerGenerator; for (int i = 0; i < filterList.Items.Count; i++) { DependencyObject container = generator.ContainerFromIndex(i); var filterCtrl = (FilterControl)VisualTreeHelper.GetChild(container, 0); var filter = save.Filters[i]; filterCtrl.SetFromSave(Game, filter); } this.RefreshSearch(SearchButton, null); }; this.Loaded += loadedEvent; } this.UpdateDataGrid(game.AllCards(true).ToDataTable(Game).DefaultView); UpdateCount(); }