Пример #1
0
 public App()
 {
     _gasContext = new GasContext();
     _gasContext.SetupServer();
     _gasContextController = new GasContextController(_gasContext);
     MainPage = new AppShell(_gasContextController);
     InitializeComponent();
 }
Пример #2
0
 public AppShell(GasContextController gasContextController)
 {
     InitializeComponent();
     RegisterRoutes();
     _gasContextController = gasContextController;
     _viewModel            = new MainPageViewModel(_gasContextController);
     BindingContext        = _viewModel;
 }
 public async Task SendMessage(Message message)
 {
     using (GasContext context = new GasContext())
     {
         context.SetupServer();
         GasContextController    contextController    = new GasContextController(context);
         GasGroupChatsController groupChatsController = contextController.GasGroupChatsController;
         await groupChatsController.CreateGasMessage(message);
     }
 }
 public async Task <IList <Message> > GetMessages(int groupChatId)
 {
     using (GasContext context = new GasContext())
     {
         context.SetupServer();
         GasContextController    contextController    = new GasContextController(context);
         GasGroupChatsController groupChatsController = contextController.GasGroupChatsController;
         return(await Task.Run(() => groupChatsController.FindGroupChatMessages(groupChatId)));
     }
 }
 public async Task <GroupChat> GetGroupChat(int workoutGroupId)
 {
     using (GasContext context = new GasContext())
     {
         context.SetupServer();
         GasContextController    contextController    = new GasContextController(context);
         GasGroupChatsController groupChatsController = contextController.GasGroupChatsController;
         //return groupChatsController.FindWorkoutGroupGroupChat(workoutGroupId);
         return(await Task.Run(() => groupChatsController.FindWorkoutGroupGroupChat(workoutGroupId)));
     }
 }
 public AddFriendPopupViewModel(ListView searchResultsLV, FriendsListPageViewModel parent, MainPageViewModel root)
 {
     _parent          = parent;
     _root            = root;
     _searchResultsLV = searchResultsLV;
     using (GasContext context = new GasContext())
     {
         context.SetupServer();
         GasContextController contextController  = new GasContextController(context);
         GasUsersController   gasUsersController = contextController.GasUsersController;
         _gasUsers = gasUsersController.GetGasUsers.ToList();
     }
     AddFriendCommand = new Command(AddFriend);
 }
Пример #7
0
 public MainPageViewModel(GasContextController gasContextController)
 {
     // Init commands here...
     //NavigateToLoginPage = new Command(
     //    async () => await NavigateToLoginPage()
     //);
     _gasContextController              = gasContextController;
     NavigateToLoginPageCommand         = new Command(NavigateToLoginPage);
     NavigateToLogoutPageCommand        = new Command(NavigateToLogoutPage);
     NavigateToAddWorkoutPageCommand    = new Command(NavigateToAddWorkoutPage);
     NavigateToWorkoutsPageCommand      = new Command(NavigateToWorkoutsPage);
     NavigateToWorkoutGroupsPageCommand = new Command(NavigateToWorkoutGroupsPage);
     NavigateToNotificationsPageCommand = new Command(NavigateToNotificationsPage);
     NavigateToFriendsPageCommand       = new Command(NavigateToFriendsPage);
 }
 public CompetitorWorkoutDetailsPageViewModel(Workout workout)
 {
     _workout     = workout;
     _date        = _workout.GetDate;
     _description = _workout.Description;
     using (GasContext context = new GasContext())
     {
         context.SetupServer();
         GasContextController contextController = new GasContextController(context);
         GasUsersController   usersController   = contextController.GasUsersController;
         _user = usersController.FindGasUser(_workout.GasUserId);
         _competitorUsername = _user.Username;
         GasWorkoutsController workoutsController = contextController.GasWorkoutsController;
         _workout.Workouts = workoutsController.GetWorkoutsWorkoutTypes(_workout.WorkoutId).ToList();
     }
 }
Пример #9
0
 private ObservableCollection<Workout> GetFriendsWorkouts()
 {
     using (GasContext context = new GasContext())
     {
         context.SetupServer();
         GasContextController contextController = new GasContextController(context);
         GasWorkoutsController workoutsController = contextController.GasWorkoutsController;
         IList<Workout> friendsWorkouts = workoutsController.GetUsersWorkouts(_friend.UserId).ToList();
         friendsWorkouts = friendsWorkouts.OrderBy(w => w.Date).ToList();
         IList<Workout> sortedWorkouts = friendsWorkouts.Reverse().ToList();
         if (sortedWorkouts.Count == 0)
         {
             NoWorkoutsLabelVisibility = true;
         }
         else
         {
             NoWorkoutsLabelVisibility = false;
         }
         return new ObservableCollection<Workout>(sortedWorkouts);
     }
 }