Exemple #1
0
        public AccountsBannerViewModel(int id, bool editMode)
        {
            Config  config  = Config.getInstance();
            Account account = config.accounts.ElementAt(id);

            Id            = id + 1;
            SteamPicture  = account.steamPicture;
            SteamNickName = account.nickname;
            VacCount      = account.vacCount;
            //d2Rank = account.d2Rank.getRank();
            cSRank               = account.cSRank.getRank();
            d2Rank               = account.d2Rank.getRank();
            EditMode             = editMode;
            Selected             = false;
            DeleteAccoundCommand = new RelayCommand(o =>
            {
                //MessageBox.Show("123");
                config.accounts.RemoveAt(id);
                config.saveChanges();
                AccountsViewModel.fillAccountBannerViews();
            });
            EditAccountCommand = new RelayCommand(o =>
            {
                MainViewModel.EditAccountViewCommand.Execute(id);
            });
        }
Exemple #2
0
        public MainViewModel()
        {
            AccountsVM   = new AccountsViewModel();
            SettingsVM   = new SettingsViewModel();
            AddAccountVM = new AddAccountViewModel();

            CurrentView = AccountsVM;

            AccountsViewCommand = new RelayCommand(o =>
            {
                CurrentView = AccountsVM;
            });

            SettingsViewCommand = new RelayCommand(o =>
            {
                CurrentView = SettingsVM;
            });

            AddAccountViewCommand = new RelayCommand(o =>
            {
                CurrentView = AddAccountVM;
            });

            EditAccountViewCommand = new RelayCommand(o =>
            {
                EditAccountV = new EditAccountView((int)o);
                CurrentView  = EditAccountV;
            });

            ExitCommand = new RelayCommand(o =>
            {
                try
                {
                    Application.Current.Shutdown();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });

            MinimizeCommand = new RelayCommand(o =>
            {
                try
                {
                    CurWindowState = WindowState.Minimized;
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            });
        }