public BanGear() { InitializeComponent(); this.BindingContext = viewModels = new GearViewModel(); viewModels.CPU = new CPU(); Init(); }
public BanHeadPhone() { InitializeComponent(); this.BindingContext = viewModels = new GearViewModel(); viewModels.headPhone = new HeadPhone(); Init(); }
public BanKeyBoard() { InitializeComponent(); this.BindingContext = viewModels = new GearViewModel(); viewModels.keyBoard = new KeyBoard(); Init(); }
public GioHang(ObservableCollection <CPU> cpus) { InitializeComponent(); this.BindingContext = viewModel = new GearViewModel(); Init(cpus); Listcpu.ItemsSource = viewModel.CPUs; for (int i = 0; i < viewModel.CPUs.Count; i++) { Tong = Tong + viewModel.CPUs[i].Price; } All.Text = String.Format("{0:0,0 đ}", (decimal)Tong); }
public async Task <ActionResult> Create(int tripId) { var user = await GetCurrentUserAsync(); var trip = await _context.Trips.FirstOrDefaultAsync(t => t.Id == tripId); var usersGear = await _context.Gears.Where(g => g.ApplicationuserId == user.Id) .Include(g => g.GearType) .ToListAsync(); var addedGears = new List <GearViewModel>(); foreach (var gear in usersGear) { var newGear = new GearViewModel() { Gear = gear }; addedGears.Add(newGear); } var sharedGear = await _context.SharedGears .Include(s => s.Gear) .Include(s => s.Gear.GearType) .Where(s => s.AcceptedRequest == true) .Where(s => s.ApplicationuserId == user.Id) .ToListAsync(); foreach (var gear in sharedGear) { var gearModel = new GearViewModel() { Gear = gear.Gear }; addedGears.Add(gearModel); } var viewModel = new AddGearTripViewModel() { Trip = trip, Gears = usersGear, ApplicationUser = user, AddedGears = addedGears }; return(View(viewModel)); }
// Initializing the simulator models and all of the view models. private void Application_Startup(object sender, StartupEventArgs e) { // Connection part MyTelnetClient TCinstance = MyTelnetClient.Instance; connectVM = new ConnectionViewModel(TCinstance); // Map part IMapModel mapModel = new MyMapModel(TCinstance); mapVM = new MapViewModel(mapModel); // Gear part IGearModel gearModel = new MyGearModel(TCinstance); gearVM = new GearViewModel(gearModel); // Dashboard part IDashboardModel dashboardModel = new MyDashboardModel(TCinstance); dashboardVM = new DashboardViewModel(dashboardModel); }
// Setting the gear control view model public void SetVM(GearViewModel gearVM) { this.vmGear = gearVM; }
// GET: GearTrips/Edit/5 public async Task <ActionResult> Edit(int tripId) { var user = await GetCurrentUserAsync(); var trip = await _context.Trips.FirstOrDefaultAsync(t => t.Id == tripId); var usersGear = await _context.Gears.Where(g => g.ApplicationuserId == user.Id) .Include(g => g.GearType) .Include(g => g.GearTrips) .ThenInclude(g => g.Trip) .ToListAsync(); var SelectedGear = new List <Gear>(); foreach (var item in usersGear) { foreach (var gt in item.GearTrips) { if (gt.TripId == tripId) { SelectedGear.Add(item); } } } var addedGears = new List <GearViewModel>(); foreach (var gear in usersGear) { var newGear = new GearViewModel() { Gear = gear, TripId = tripId }; addedGears.Add(newGear); } var sharedGear = await _context.SharedGears .Include(s => s.Gear) .Include(s => s.Gear.GearType) .Include(s => s.Gear.GearTrips) .ThenInclude(s => s.Trip) .Where(s => s.AcceptedRequest == true) .Where(s => s.ApplicationuserId == user.Id) .ToListAsync(); foreach (var gear in sharedGear) { var gearModel = new GearViewModel() { Gear = gear.Gear, TripId = tripId }; addedGears.Add(gearModel); foreach (var item in gear.Gear.GearTrips) { if (item.TripId == tripId) { SelectedGear.Add(gear.Gear); } } } foreach (var singleGear in addedGears.ToList()) { foreach (var selectedGearItem in SelectedGear) { if (singleGear.Gear.Id == selectedGearItem.Id) { addedGears.Remove(singleGear); } } } var viewModel = new EditGearTripViewModel() { Trip = trip, AddedGears = addedGears, AlreadySelected = SelectedGear, ApplicationUser = user }; return(View(viewModel)); }
public KeyBoardInfo(KeyBoard keyBoard) { InitializeComponent(); this.BindingContext = viewModel = new GearViewModel(); Init(keyBoard); }
public CPUInfo(CPU cpu) { InitializeComponent(); this.BindingContext = viewModel = new GearViewModel(); Init(cpu); }
public HeadPhoneInfo(HeadPhone headPhone) { InitializeComponent(); this.BindingContext = viewModel = new GearViewModel(); Init(headPhone); }