Exemplo n.º 1
0
        public ProfileViewModel()
        {
            navManager = PageNavigationManager.Instance;

            ProfileMockService _service = new ProfileMockService();

            EditClickedCommand = new Command(EditClicked);

            LogoutClickedCommand = new Command(Logout);

            Task.Run(async() => {
                try
                {
                    ProfileModel GetDetails = await _service.GetLoggedInProfileAsync("abs");
                    Username  = GetDetails.Username;
                    Email     = GetDetails.Email;
                    Location  = GetDetails.Location;
                    Rating    = GetDetails.Rating;
                    AvatarUri = GetDetails.AvatarUri;
                }
                catch (System.OperationCanceledException ex)
                {
                    Console.WriteLine($"Text load cancelled: {ex.Message}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            });
        }
Exemplo n.º 2
0
 public void StartGame(List <string> wordList)
 {
     PageNavigationManager.GetInstance().ChangePage("game");
     wordChecker.SetWordList(wordList);
     tileManager.AutoAdjustCharacterWeight(wordList);
     tileManager.GenerateTiles();
 }
        public SearchItemViewModel(SearchItemModel searchItem)
        {
            navManager = PageNavigationManager.Instance;
            SearchItem = searchItem;

            Position itemPosition = new Position(SearchItem.ItemLocation.Latitude, SearchItem.ItemLocation.Longitude);
            MapSpan  mapSpan      = MapSpan.FromCenterAndRadius(itemPosition, Distance.FromKilometers(5));

            Map = new Map(mapSpan);
            Map.HeightRequest = 150;
            Map.WidthRequest  = 150;
            Map.IsShowingUser = false;

            Pin pin = new Pin
            {
                Type     = PinType.Place,
                Position = itemPosition,
                Label    = SearchItem.Description,
                Address  = SearchItem.Location
            };

            Map.Pins.Add(pin);

            MessageCommand = new Command(MessageUserAsync);
        }
Exemplo n.º 4
0
        private async void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            btnLogin.IsEnabled = false;
            try
            {
                var result = await UsersAPI.Login(txtLogin.Text, txtPass.Password);

                if(result.error)
                {
                    lblStatus.Content = result.message;
                }
                else
                {
                    AppPersistent.UserToken = result.data.token;
                    AppPersistent.LocalUserId = result.data.id;
                    PageNavigationManager.SwitchToPage(new ApplicationPage());
                }

            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message, "An exception happened");
            }

        }
Exemplo n.º 5
0
        public async void OnLoginClicked(object sender, EventArgs e)
        {
            //Set the current user to the user that matches the name entered
            currentUser = await App.Manager.ReturnUserAsync(NameEntry.Text);

            navManager = PageNavigationManager.Instance;

            //If the user is not found in the database, display a message to the user
            if (currentUser == null)
            {
                SuccessLabel.Text = "Username does not exist";
            }
            else
            {
                //Check the username and password in the databse
                if (currentUser.UserName == NameEntry.Text && currentUser.UserPassword == PasswordEntry.Text)
                {
                    App.Manager.currentUser = currentUser;

                    navManager.ShowMainPage();
                }
                else
                {
                    SuccessLabel.Text = "Invalid Username or Password!";
                }
            }
        }
Exemplo n.º 6
0
        public TesterPageViewModel()
        {
            navManager = PageNavigationManager.Instance;
            Characters = Statics.JsonStuff.DeserializeCharacters();
            Character  = Statics.CharacterCreating.CreatingCharacter;

            AutoFill();
        }
 public AbilityScoreViewModel()
 {
     navManager  = PageNavigationManager.Instance;
     D6          = new Dice(6);
     Scores      = Statics.CharacterCreating.CreatingCharacter.Scores;
     Numbers     = Statics.CharacterCreating.ScoreRolls;
     NumbersUsed = Statics.CharacterCreating.ScoreRollsUsed;
 }
Exemplo n.º 8
0
 public FeatsViewModel()
 {
     navManager    = PageNavigationManager.Instance;
     Feats         = new List <Feat>();
     PossibleFeats = getFeats();
     SelectedFeats = new List <CustomCell>();
     FeatsAmount   = GetAmountofFeats();
     FeatsLeft     = FeatsAmount;
 }
Exemplo n.º 9
0
        public MainWindow()
        {
            InitializeComponent();

            PageNavigationManager.PageContentControl = contentArea;
            DialogManager.WindowRef = this;

            PageNavigationManager.SwitchToPage(new LoginPage());
        }
Exemplo n.º 10
0
 public RaceViewModel()
 {
     navManager  = PageNavigationManager.Instance;
     CustomCells = getRaces();
     //foreach(CustomCell cell in CustomCells) {
     //    if (cell.Title == Statics.CharacterCreating.CreatingCharacter.Race) {
     //        SelectedRace = cell;
     //    }
     //}
 }
Exemplo n.º 11
0
        public InboxViewModel()
        {
            navManager = PageNavigationManager.Instance;

            _service = new MessagingService(new RequestService());

            ItemSelectedCommand = new Command <ConversationModel>(ConversationSelected);
            RefreshCommand      = new Command(GetInbox);

            GetInbox();
        }
Exemplo n.º 12
0
        public LoginViewModel()
        {
            navManager = PageNavigationManager.Instance;

            Button_Clicked = new Command(() =>
            {
                navManager.showMainPageAfterLoginPage();
            });

            Button_SignUp = new Command(() =>
            {
                //Application.Current.MainPage = new MainPage();
                navManager.showSignUpPage();
            });

            Button_LogIn = new Command(() =>
            {
                // await Navigation.PushAsync(new Profile());
                if (email == null || password == null || email.Equals("") || password.Equals(""))
                {
                    UserDialogs.Instance.Alert("Email and password field can not be blank");
                }
                else
                {
                    Customer cust = App.Database.getPassword(email);
                    if (cust == null)
                    {
                        UserDialogs.Instance.Alert("Wrong email");
                    }
                    else
                    {
                        if (cust.password == password)
                        {
                            loggedIn = true;
                            customer = cust;
                            if (App.LoginStatus == 0 || App.LoginStatus == 1)
                            {
                                navManager.showMainPageAfterLoginPage();
                            }
                            if (App.LoginStatus == 2)
                            {
                                //invokes a known bug on the mainPage, since the LoginTab is still there instead of the ProfileTab
                                navManager.popPageAsync();
                            }
                            //MainPage.replaceLoginTabWithProfileTab();
                        }
                        else
                        {
                            UserDialogs.Instance.Alert("Wrong password");
                        }
                    }
                }
            });
        }
Exemplo n.º 13
0
        public CharacterSheetViewModel(int i)
        {
            navManager = PageNavigationManager.Instance;

            Characters = Statics.JsonStuff.DeserializeCharacters();
            position   = i;
            character  = Characters[i];

            LanguageCells = CreateLanguageCells(character.Languages);
            Statuses      = GetStatusCells(character.Statuses);
        }
        //public List<String> CustomCells = new List<String>();

        public LanguageViewModel()
        {
            navManager        = PageNavigationManager.Instance;
            Languages         = new List <string>();
            StartingLanguages = getStartingLanguages();
            PossibleLanguages = getLanguages();
            SelectedLanguages = new List <CustomCell>();
            SelectedLanguages = GetStartingAndSelected();
            LanguagesAmount   = GetAmountOfLanguages();
            LanguagesLeft     = LanguagesAmount;
        }
Exemplo n.º 15
0
        public ConversationViewModel(ConversationModel conversation)
        {
            navManager = PageNavigationManager.Instance;

            ConversationId = conversation.ConversationId;

            ReplyConversationCommand = new Command <ConversationModel>(ReplyConversationAsync);

            _service = new MessagingService(new RequestService());

            GetConversationAsync();
        }
Exemplo n.º 16
0
        public PantryViewModel()
        {
            navManager = PageNavigationManager.Instance;
            AddItemButton_ClickedCommand = new Command(() =>
            {
                navManager.showItemPage(this.pantryList);
            });

            //_service = new PantryMockService();
            _service = new PantryService(new RequestService());
            Task.Run(async() => {
                try
                {
                    PantryModel GetDetails = await _service.GetPantryAsync("abs", 1);
                    PantryList             = new ObservableCollection <PantryItemModel>(GetDetails.Items);
                }
                catch (System.OperationCanceledException ex)
                {
                    Console.WriteLine($"Text load cancelled: {ex.Message}");
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            });

            ItemSelectedCommand       = new Command <PantryItemModel>(pantryItemSelected);
            EditItemSelectedCommand   = new Command <PantryItemModel>(pantryEditItemSelected);
            DeleteItemSelectedCommand = new Command <PantryItemModel>(pantryDeleteItemSelected);

            MessagingCenter.Subscribe <ItemViewModel, PantryItemModel>(this, "New Item", (sender, receivedPantryItem) =>
            {
                this.pantryList.Add(receivedPantryItem);
                _service.SetPantryAsync("abs", receivedPantryItem);
            });

            MessagingCenter.Subscribe <EditItemViewModel, PantryItemModel>(this, "Edit Item", (sender, pantryItem) =>
            {
                int index = 0;
                bool done = true;
                while (done)
                {
                    if (this.pantryList[index].Id == pantryItem.Id)
                    {
                        this.pantryList[index] = pantryItem;
                        done = false;
                    }
                    index++;
                }
            });
        }
        public SearchListViewModel()
        {
            IsFilter = false;

            navManager = PageNavigationManager.Instance;

            _service = new SearchService(new RequestService());

            ItemSelectedCommand = new Command <SearchItemModel>(SearchItemSelected);
            FilterStartCommand  = new Command(FilterShow);
            FilterApplyCommand  = new Command(FilterApply);
            FilterClearCommand  = new Command(FilterClose);

            GetItems(new SearchRequestModel());
        }
        public SkillsViewModel()
        {
            navManager = PageNavigationManager.Instance;
            if (Statics.CharacterCreating.CreatingCharacter.CharClass.Skills != null)
            {
                skills = Statics.CharacterCreating.CreatingCharacter.CharClass.Skills;
            }
            else
            {
                skills = new List <Skill>();
            }

            remainingPoints = (Statics.CharacterCreating.CreatingCharacter.CharClass.SkillPoints *
                               Statics.CharacterCreating.CreatingCharacter.Level) +
                              Statics.GlobalFunctions.ReturnModifier(Statics.CharacterCreating.CreatingCharacter.Scores.Intelligence.Value);
        }
        public ProfileViewModel()
        {
            navManager    = PageNavigationManager.Instance;
            userManager   = UserManager.DefaultManager;
            recipeManager = RecipeManager.DefaultManager;

            //User = Classes.GlobalVariables.currentUser;

            //UserName = User.FirstName + User.LastName;

            //recipes = recipeManager.GetUserRecipesAsync(User.Email).Result;

            RecipeClicked = new Command(() =>
            {
                navManager.showRecipePage();
            });
        }
Exemplo n.º 20
0
        private void GetModers_Click(object sender, RoutedEventArgs e)
        {
            var roomWidget = (RoomSelectorWidget)lstRooms.SelectedItem;

            if (roomWidget != null)
            {
                if (roomWidget.RoomType != ERoomType.Dialog)
                {
                    PageNavigationManager.SwitchToPage(new ModeratorsPage()
                    {
                        RoomID = roomWidget.RoomID, RoomType = roomWidget.RoomType
                    });
                }
                else
                {
                    MessageBox.Show("Not allowed");
                }
            }
        }
Exemplo n.º 21
0
        public ProfileViewModel()
        {
            navManager = PageNavigationManager.Instance;

            Button_Details = new Command(() =>
            {
                navManager.showProfileDetails();
            });

            Button_Preferences = new Command(() =>
            {
                navManager.showProfilePreferences();
            });

            Button_Ratings = new Command(() =>
            {
                navManager.showProfileRatings();
            });
        }
Exemplo n.º 22
0
 public void StartNextLevel()
 {
     curLevelIndex++;
     if (LevelProgress.GetProgress() < curLevelIndex)
     {
         LevelProgress.SetProgress(curLevelIndex);
     }
     if (curLevelIndex >= curLevelSeries.Length)
     {
         //curLevelIndex = -1;
         tileManager.InitTiles();
         PageNavigationManager.GetInstance().ChangePage("level");
     }
     else
     {
         Debug.Log("Level: " + curLevelIndex + "/" + curLevelSeries.Length);
         StartGame(curLevelSeries[curLevelIndex]);
     }
 }
Exemplo n.º 23
0
        private async void btnLogin_Click(object sender, RoutedEventArgs e)
        {
            AuthData data = new AuthData()
            {
                user     = txtLogin.Text,
                password = txtPass.Password
            };
            var response = await ApiHelper.RequestInternalJson <AuthResponse>("api/v1/login", data, null);

            if (response.status == "success")
            {
                AppPersistent.Token = new AuthTokens()
                {
                    UserId = response.data.userId,
                    Token  = response.data.authToken
                };
                PageNavigationManager.SwitchToPage(new RoomsPage());
            }
        }
Exemplo n.º 24
0
        public App()
        {
            //Register Syncfusion license
            Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("MzY0NzZAMzEzNjJlMzMyZTMwSDhWM1pMTUJNOFM1SnRYSmYwbjlmUzA5MmlLdDF6SERtSjVLL0s3alIwZz0=");

            InitializeComponent();

            Manager = new ItemManager(new RestService());

            UserItemManager = new LocalItemManager(new DBService(dbPath));

            navigationManager = PageNavigationManager.Instance;

            //Make the app a navigation based app
            mainPage = new LoginPage();
            MainPage = new NavigationPage(mainPage);


            //Assign a navigation object to the pageNavigationManager
            PageNavigationManager.Instance.Navigation = MainPage.Navigation;
        }
Exemplo n.º 25
0
        public ItemViewModel(ObservableCollection <PantryItemModel> pantryList)
        {
            navManager           = PageNavigationManager.Instance;
            submitButton_Clicked = new Command(() =>
            {
                PantryItemModel pantryItem = new PantryItemModel
                {
                    Id          = (pantryList.Count + 1),
                    Description = this.description,
                    Location    = this.location,
                    //pantryItem.ImageUri = itemImageInput.Text;
                    ImageUri = "https://images.heb.com/is/image/HEBGrocery/001511184",
                    active   = true
                };
                //pantryList.Add(pantryItem);

                MessagingCenter.Send <ItemViewModel, PantryItemModel>(this, "New Item", pantryItem);

                navManager.removeTopPage();
            });
        }
Exemplo n.º 26
0
        public SignupViewModel()
        {
            navManager = PageNavigationManager.Instance;
            ISignupService _service = new SignupService(new RequestService());

            //ISignupService _service = new SignupMockService();


            SignupClickedCommand = new Command(async() =>
            {
                IsBusy  = true;
                Message = null;

                SignupModel success = await _service.RegisterUserAsync(new SignupModel {
                    Email                = email,
                    Name                 = name,
                    Password             = password,
                    PasswordConfirmation = confirmpassword
                });

                if (success.errors == null)
                {
                    Application.Current.MainPage = new LoginPage();
                    MessagingCenter.Send <string, string>("OurPantry", "SignupMsg", success.message);
                }
                else
                {
                    Message = success.message;
                }

                IsBusy = false;
            });

            CancelClickedCommand = new Command(() =>
            {
                Application.Current.MainPage = new LoginPage();
            });
        }
Exemplo n.º 27
0
        public MoneyViewModel()
        {
            navManager = PageNavigationManager.Instance;
            D6         = new Dice(6);

            if (Statics.CharacterCreating.CreatingCharacter.Coin == null)
            {
                Coin = new Money();
            }
            else
            {
                Coin = Statics.CharacterCreating.CreatingCharacter.Coin;
            }

            if (Statics.CharacterCreating.CreatingCharacter.Coin == null)
            {
                Class = "Wizard";
            }
            else
            {
                Class = Statics.CharacterCreating.CreatingCharacter.CharClass.Name;
            }
        }
Exemplo n.º 28
0
 public ItemInfoViewModel(PantryItemModel pantryItem)
 {
     navManager = PageNavigationManager.Instance;
     PantryItem = pantryItem;
 }
        public DetailsViewModel()
        {
            navManager = PageNavigationManager.Instance;

            details = new Objects.CharacterDetails();
        }
Exemplo n.º 30
0
 public ClassViewModel()
 {
     navManager  = PageNavigationManager.Instance;
     CustomCells = getClasses();
 }