public MainWindowVM(StatusBlinker statusBlinker, InMatchTrackerStateVM inMatchState, IOptionsMonitor <ConfigModelApp> config) { this.statusBlinker = statusBlinker; statusBlinker.EmitStatus += StatusBlinkerEmitStatus; this.InMatchState = inMatchState; this.OrderLibraryCardsBy = config.CurrentValue.OrderLibraryCardsBy == "Converted Mana Cost" ? CardsListOrder.Cmc : CardsListOrder.DrawChance; }
/// <summary> /// Default constructor /// </summary> /// <param name="statusBlinker"></param> /// <param name="inMatchState"></param> /// <param name="config"></param> public MainWindowVM(StatusBlinker statusBlinker, InMatchTrackerStateVM inMatchState, ConfigModel config) { // Set the status blinker reference StatusBlinker = statusBlinker; // Subscribe to the blinker event statusBlinker.EmitStatus += StatusBlinkerEmitStatus; // Set the match state reference InMatchState = inMatchState; // Set the library order from the config OrderLibraryCardsBy = config.OrderLibraryCardsBy == "Converted Mana Cost" ? CardsListOrder.ManaCost : CardsListOrder.DrawChance; // Set the reference the config ConfigModel = config; // Create the opponent window view model OpponentWindowViewModel = new OpponentWindowViewModel("Opponent Cards", this); // Subscribe to property changes PropertyChanged += OnPropertyChanged; // Set the animated icon state AnimatedIcon = ConfigModel?.AnimatedIcon ?? false; // Set the initial window settings PositionTop = WindowSettings?.Position.Y ?? 0; PositionLeft = WindowSettings?.Position.X ?? 0; WindowOpacity = WindowSettings?.Opacity ?? 0.9; WindowTopmost = WindowSettings?.Topmost ?? true; // Set the initial window size WindowWidth = WindowSettings != null && WindowSettings.Size.X > double.Epsilon ? WindowSettings.Size.X : 340; WindowHeight = WindowSettings != null && WindowSettings.Size.Y > double.Epsilon ? WindowSettings.Size.Y : 500; }
public MainWindowVM(StatusBlinker statusBlinker, InMatchTrackerStateVM inMatchState, ConfigModel config, DraftingVM draftingVM, IMapper mapper, ICacheLoader <Dictionary <int, Set> > cacheSets, ProcessMonitor processMonitor, ServerApiCaller api, StartupShortcutManager startupManager, MtgaResourcesLocator resourcesLocator, FileMonitor fileMonitor, DraftCardsPicker draftHelper, ReaderMtgaOutputLog readerMtgaOutputLog, InGameTracker2 inMatchTracker, ExternalProviderTokenManager tokenManager, PasswordHasher passwordHasher, CacheSingleton <Dictionary <string, DraftRatings> > draftRatings, DraftHelperRunner draftHelperRunner, //IEmailProvider emailProvider, ICollection <Card> allCards, CardThumbnailDownloader cardThumbnailDownloader, ServerApiCaller serverApiCaller ) { // Set the status blinker reference StatusBlinker = statusBlinker; // Set the network status emission handler StatusBlinker.EmitStatus += status => { NetworkStatus = status; }; Sets = cacheSets.LoadData().Values.ToArray(); InMatchState = inMatchState; Config = config; DraftingVM = draftingVM; Mapper = mapper; ProcessMonitor = processMonitor; Api = api; StartupManager = startupManager; ResourcesLocator = resourcesLocator; FileMonitor = fileMonitor; DraftHelper = draftHelper; ReaderMtgaOutputLog = readerMtgaOutputLog; InMatchTracker = inMatchTracker; InMatchState.GameEnded += OnGameEnded; InMatchState.OpponentCardsUpdated += OnOpponentCardsUpdated; TokenManager = tokenManager; PasswordHasher = passwordHasher; DraftRatings = draftRatings; DraftHelperRunner = draftHelperRunner; //this.emailProvider = emailProvider; AllCards = allCards; CardThumbnailDownloader = cardThumbnailDownloader; this.serverApiCaller = serverApiCaller; // Set the library order from the config OrderLibraryCardsBy = config.OrderLibraryCardsBy == "Converted Mana Cost" ? CardsListOrder.ManaCost : CardsListOrder.DrawChance; // Create the opponent window view model OpponentWindowVM = new OpponentWindowVM("Opponent Cards", this, serverApiCaller); // Subscribe to property changes PropertyChanged += OnPropertyChanged; // Set the animated icon state AnimatedIcon = Config?.AnimatedIcon ?? false; // Set the initial window settings PositionTop = WindowSettings?.Position.Y ?? 0; PositionLeft = WindowSettings?.Position.X ?? 0; WindowOpacity = WindowSettings?.Opacity ?? 0.9; WindowTopmost = WindowSettings?.Topmost ?? true; // Set the initial window size WindowWidth = WindowSettings != null && WindowSettings.Size.X > double.Epsilon ? WindowSettings.Size.X : 340; WindowHeight = WindowSettings != null && WindowSettings.Size.Y > double.Epsilon ? WindowSettings.Size.Y : 500; }