Beispiel #1
0
        public ChangeYearViewModel(SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this.SaveCommand      = new RelayCommand(() => this.Save());
            this.ExitPopupCommand = new RelayCommand(() => this.Exit());

            this._messageViewer = messageViewer;
        }
Beispiel #2
0
        public EditMovesetsViewModel(SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this._messageViewer = messageViewer;
            this.AllChargeMoves = this.Session.ChargeMoveList;
            this.AllFastMoves   = this.Session.FastMoveList;
            this.Movesets       = new ObservableCollection <MovesetDetailsWrapper>();
            this.FastMoves      = new ObservableCollection <PokedexFastMoveWrapper>();
            this.ChargeMoves    = new ObservableCollection <PokedexChargeMoveWrapper>();

            this.FastMoves.CollectionChanged   += FastMoves_CollectionChanged;
            this.ChargeMoves.CollectionChanged += ChargeMoves_CollectionChanged;

            this.AddFastMoveCommand   = new RelayCommand(() => this.FastMoves.Add(new PokedexFastMoveWrapper(this.AllFastMoves[0])));
            this.AddChargeMoveCommand = new RelayCommand(() => this.ChargeMoves.Add(new PokedexChargeMoveWrapper(this.AllChargeMoves[0])));

            this.RemoveFastMoveCommand   = new RelayCommand(() => RemoveFastMove());
            this.RemoveChargeMoveCommand = new RelayCommand(() => RemoveChargeMove());

            this.ExitPopupCommand = new RelayCommand(() => Exit());
            this.SaveCommand      = new RelayCommand(() => Save());

            this.ShowEditMovesetsCommand   = new RelayCommand(() => { this.EditMovesetsVisible = true; this.OffenseDetailsVisible = false; this.DefenseDetailsVisible = false; });
            this.ShowOffenseDetailsCommand = new RelayCommand(() => ShowOffenseDetails());
            this.ShowDefenseDetailsCommand = new RelayCommand(() => ShowDefenseDetails());
        }
        public SettingsViewModel(SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this.SaveCommand            = new RelayCommand(() => this.Save());
            this.ExitPopupCommand       = new RelayCommand(() => this.Exit());
            this.SelectDirectoryCommand = new RelayCommand(() => this.SelectDirectory());

            this._messageViewer = messageViewer;
        }
 public IVCalculatorViewModel(SessionService session, MessageViewerBase messageViewer) : base(session)
 {
     this._messageViewer      = messageViewer;
     this.ExitPopupCommand    = new RelayCommand(() => Exit());
     this.SaveCommand         = new RelayCommand(() => Save());
     this.CalculateIVsCommand = new RelayCommand(() => {
         this.Calculator.CalculateValues();
         if (this.Calculator.IVSets.Count > 0)
         {
             this.SimulatedLevel = this.Calculator.IVSets.Min(x => x.Level);
             this.MinLevel       = this.Calculator.IVSets.Min(x => x.Level);
         }
     });
 }
Beispiel #5
0
        public SessionService(IErrorHandler errorhandler, MessageViewerBase messageViewer)
        {
            //Sets event handlers to make sure all data is updated
            this.Categories.CollectionChanged += CategoryCollectionChanged;   //Used to add/remove rows
            this.Groups.CollectionChanged     += GroupsCollectionChanged;     //Used to add/remove rows
            this.Groups.MemberChanged         += GroupChanged;                //Used to update grouping
            this.BudgetValues.MemberChanged   += UpdateBudgetTotals;          //Update respective totals
            this.Transactions.MemberChanged   += UpdateSpendingValues;        //Update spending if transaction has been modified
            //TODO this.Transactions.MemberChanged += OnTransactionModified;   //Trigger event for view to handle
            this.Transactions.CollectionChanged += AddOrRemoveSpendingValues; //Update spending if transaction has been added or removed
            //TODO this.Transactions.CollectionChanged += OnTransactionsChanged;   //Trigger event for view to handle
            //this.SpendingTotals.MemberChanged += ((o, a) => { Debug.WriteLine("Spending totals auto update"); UpdateComparisonValues(); });    //Update comparison values if a spending values was changed. Totals used to allow bulk modification.
            //this.BudgetTotals.MemberChanged += ((o, a) => { Debug.WriteLine("Budget totals auto update"); UpdateComparisonValues(); });  //Update comparison values if a budget value was changed. Totals used to allow bulk modification.

            this._errorhandler  = errorhandler;
            this._messageViewer = messageViewer;
        }
Beispiel #6
0
        public PokemonViewModel(NavigationService navigationService, SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this.navigationService = navigationService;
            this._messageViewer    = messageViewer;

            this.CheckIVCommand       = new RelayCommand(async() => await CheckIVAsync());
            this.AddPokemonCommand    = new RelayCommand(async() => await AddPokemonAsync());
            this.DeletePokemonCommand = new RelayCommand(async() => await DeletePokemonAsync());
            this.CopyPokemonCommand   = new RelayCommand(async() => await CopyPokemonAsync());
            this.ShowMovesetsCommand  = new RelayCommand(async() => await ShowMovesetsAsync());
            this.GoToSpeciesCommand   = new RelayCommand(() => GoToSpecies());
            this.AddFilterCommand     = new RelayCommand(() => this.AddFilter());
            this.RemoveFilterCommand  = new RelayCommand <PokemonFilterElement>((filter) => this.RemoveFilter(filter));

            this.AllSpecies = this.Session.Pokedex;
            this.MyPokemon  = new ListCollectionView(this.Session.MyPokemon);
            this.Filters    = new MyObservableCollection <PokemonFilterElement>();
            this.Filters.CollectionChanged += (o, a) => this.UpdateFilter();
            this.Filters.MemberChanged     += (o, a) => this.UpdateFilter();
        }
        public MainWindowViewModel(NavigationService navigationService, SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this.NavigationService       = navigationService;
            this.MessageViewer           = messageViewer;
            this.NavigateToScreenCommand = new RelayCommand <Type>((viewModel) => this.NavigateToScreen(viewModel));
            this.SaveUserDataCommand     = new RelayCommand(() => this.SaveUserData());
            this.SaveUserDataAsCommand   = new RelayCommand(() => this.SaveUserDataAs());
            this.LoadUserDataCommand     = new RelayCommand(() => this.LoadUserData());
            this.NewFileCommand          = new RelayCommand(() => this.NewUserData());
            this.OpenSettingsCommand     = new RelayCommand(() => this.OpenSettings());
            this.OpenRecentFileCommand   = new RelayCommand <string>((s) => this.OpenRecentFile(s));
            this.ImportExcelDataCommand  = new RelayCommand(() => this.ImportExcelData());
            this.SaveBaseDataCommand     = new RelayCommand(() => this.SaveBaseData());
            this.LoadBaseDataCommand     = new RelayCommand(() => this.LoadBaseData());

            //Load list of recent files
            this.LastFiles = new ObservableCollection <string>();
            if (Properties.Settings.Default.LastFiles == null)
            {
                Properties.Settings.Default.LastFiles = new StringCollection();
            }
            foreach (string file in Properties.Settings.Default.LastFiles)
            {
                this.LastFiles.Add(file);
            }
            this.LastFiles.CollectionChanged += ((o, e) => SaveLastFiles());
            // Set the starting page
            this.NavigationService.NavigateTo <PokemonViewModel>();
            //Try to load base data
            try
            {
                Stream fileStream = this.GetType().Assembly.GetManifestResourceStream("Pokemon_Go_Database.Resources.BaseData.xml");
                this.Session.LoadBaseDataFromFile(fileStream);
            }
            catch (Exception ex)
            {
                this.MessageViewer.DisplayMessage("Unable to load base data; please load from file using the Settings menu.");
                Debug.WriteLine(ex.Message);
            }
        }
        public BattleSimulationViewModel(NavigationService navigationService, SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this.navigationService = navigationService;
            this._messageViewer    = messageViewer;
            this.Attackers         = new ObservableCollection <AttackerSimulationWrapper>();
            this.Defender          = new Pokemon();
            this.BattleLog         = new MyObservableCollection <BattleLogEntry>();
            this.AllPokemonResults = new MyObservableCollection <BattleResult>();

            this.SimulateBattleCommand         = new RelayCommand(() => this.SimulateSingleBattle());
            this.SimulateAllPokemonCommand     = new RelayCommand(() => this.SimulateAllPokemon());
            this.SimulateAllPokemonAt40Command = new RelayCommand(() => this.SimulateAllPokemonAt40());
            this.IncrementPartySizeCommand     = new RelayCommand(() => this.IncrementPartySize());
            this.DecrementPartySizeCommand     = new RelayCommand(() => this.DecrementPartySize());
            this.AssignAttackerPokemonCommand  = new RelayCommand <int>((position) => this.AssignSelectedPokemonToParty(position));

            this._partySize = 1;
            Pokemon newPokemon = new Pokemon();

            newPokemon.IVSets.Add(new IVSet());
            this.Attackers.Add(new AttackerSimulationWrapper(newPokemon, new BattleResult()));
            this.UpdatePartyVisibility();
        }
Beispiel #9
0
        public PaymentMethodsViewModel(NavigationService navigation, SessionService session, MessageViewerBase messageViewer) : base(session)
        {
            this.navigationService          = navigation;
            this.PaymentMethods             = session.PaymentMethods;
            this.AddPaymentMethodCommand    = new RelayCommand(() => { this.ShowPopup = true; });
            this.RemovePaymentMethodCommand = new RelayCommand(() => RemovePaymentMethod());
            this.SaveCommand   = new RelayCommand(() => Save());
            this.CancelCommand = new RelayCommand(() => { this.ShowPopup = false; });

            this._messageViewer = messageViewer;
        }
Beispiel #10
0
        public MainWindowViewModel(NavigationService navigationService, SessionService session, IErrorHandler errorHandler, MessageViewerBase messageViewer) : base(session)
        {
            this.NavigationService              = navigationService;
            this._errorHandler                  = errorHandler;
            this.MessageViewer                  = messageViewer;
            this.NavigateToScreenCommand        = new RelayCommand <Type>((viewModel) => this.NavigateToScreen(viewModel));
            this.OpenGroupsAndCategoriesCommand = new RelayCommand(() => this.OpenGroupsAndCategories());
            this.OpenPaymentMethodsCommand      = new RelayCommand(() => this.OpenPaymentMethods());
            this.ToggleEventLogVisibiliyCommand = new RelayCommand(this.ShowDebugWindow);
            this.SaveDataCommand                = new RelayCommand(() => this.SaveData());
            this.SaveDataAsCommand              = new RelayCommand(() => this.SaveAs());
            this.LoadDataCommand                = new RelayCommand(() => this.LoadData());
            this.NewFileCommand                 = new RelayCommand(() => this.NewData());
            this.OpenSettingsCommand            = new RelayCommand(() => this.OpenSettings());
            this.ChangeYearCommand              = new RelayCommand(() => this.ChangeYear());
            this.OpenRecentFileCommand          = new RelayCommand <string>((s) => this.OpenRecentFile(s));
            this.OpenHelpCommand                = new RelayCommand(() => this.ShowHelp());

            //Load list of recent files
            this.LastFiles = new ObservableCollection <string>();
            if (Properties.Settings.Default.LastFiles == null)
            {
                Properties.Settings.Default.LastFiles = new StringCollection();
            }
            foreach (string file in Properties.Settings.Default.LastFiles)
            {
                this.LastFiles.Add(file);
            }
            this.LastFiles.CollectionChanged += ((o, e) => SaveLastFiles());
            // Set the starting page
            this.NavigationService.NavigateTo <BudgetViewModel>();
        }