public MedicApp(int type, SmartPhone phone, int consumeRate, Entity owner = null, string Title = "Medic App v1.0") : base(type, phone, consumeRate, owner, Title) { UIGrid statusEffects = new UIGrid(Width: SmartPhone.SCREEN_RECT.Width, GridColumns: 1, CursorType: CursorType.Cursor, MarginBottom: 20); PageContent.AddElement(statusEffects); PageContent.AddElement(CreateSwitchAppButton("Main Menu", phone.GetMainMenu())); }
public MainMenuApp(int type, SmartPhone phone, int consumeRate, List<PhoneApp> InstalledApps, Entity owner, string Title = "Main Menu") : base(type, phone, consumeRate, owner, Title) { this.InstalledApps = InstalledApps; this.HeldApps = new List<int>(); Item[] Inventory = (Owner as IItemHolder).Inventory; for (int i = 0; i < Inventory.Length; i++) { if (Inventory[i] != null) if (Inventory[i].Type >= APP_TYPE_START && Inventory[i].Type <= APP_TYPE_END) { HeldApps.Add(Inventory[i].Type); } } UpdateUI(); }
public PhoneApp(int type, SmartPhone phone, int consumeRate, Entity owner = null, string Title = "") : base(type, -1, owner) { this.ConsumeRate = consumeRate; this.phone = phone; this.ActiveEffects = new ItemEffect[0]; this.PassiveEffects = new ItemEffect[0]; //This container allows the TextSprite to be centred UIContainer PageTitleContainer = new UIContainer(Color.White, Color.White, Width: SmartPhone.SCREEN_RECT.Width, CursorType: CursorType.Cursor, MarginTop: 10, MarginBottom: 10, CentreHorizontal: true); TextSprite PageTitle = new TextSprite(Title, 2, Color.White, SmartPhone.SCREEN_RECT.Width, CursorType: CursorType.Cursor); PageTitleContainer.AddElement(PageTitle); HUD = new UIGrid(Width: SmartPhone.SCREEN_RECT.Width, Height: SmartPhone.SCREEN_RECT.Height, CursorType: CursorType.Cursor, GridColumns: 1, ColWidth: SmartPhone.SCREEN_RECT.Width); HUD.AddElement(PageTitleContainer); PageContent = new UIGrid(Width: SmartPhone.SCREEN_RECT.Width, Height: SmartPhone.SCREEN_RECT.Height - PageTitleContainer.Height, CursorType: CursorType.Cursor, GridColumns: 1, ColWidth: SmartPhone.SCREEN_RECT.Width); HUD.AddElement(PageContent); }
public async Task UpdateSmartphone(int key, SmartPhone obj) { await _webApi.Update(key, obj); }
protected static bool ReplaceGlass(SmartPhone device) { device.IsDamagedGlass = false; return(true); // Skilled technicians only ;) }
public async Task DeleteSmartphone(SmartPhone s) { var httpclient = new HttpClient(); var reponse = await httpclient.DeleteAsync(Base_Url + s.Id); }
public Controller(SmartPhone mySmartPhone) { this.MySmartPhone = mySmartPhone; }
public Form2(SmartPhone Phone) { InitializeComponent(); //show giá điện thoại lên giao diện PriceLabel.Text = Phone.Gia + " VNĐ"; //show tên điện thoại lên giao diện phoneNameLB.Text = Phone.TenDienThoai; //Set lại ảnh đại diện cho điện thoại trên giao diện PhonePicturePath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\hinh\" + Phone.TenDienThoai + ".PNG"; pictureBox1.Image = Image.FromFile(PhonePicturePath); //Màn Hình { //công nghệ màn hình { Label CongNgheManHinh = new Label(); this.Controls.Add(CongNgheManHinh); CongNgheManHinh.Location = new Point(500, label5.Location.Y); CongNgheManHinh.AutoSize = true; CongNgheManHinh.Text = Phone.CongNgheManHinh; CongNgheManHinh.ForeColor = Color.FromArgb(0, 192, 192); CongNgheManHinh.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); CongNgheManHinh.Cursor = Cursors.Hand; CongNgheManHinh.Show(); CongNgheManHinh.MouseHover += new EventHandler(KeyHover); CongNgheManHinh.MouseLeave += new EventHandler(KeyLeave); } //độ phân giải { Label DoPG = new Label(); this.Controls.Add(DoPG); DoPG.Location = new Point(500, label6.Location.Y); DoPG.AutoSize = true; DoPG.Text = Phone.DoPhanGiai; DoPG.ForeColor = Color.FromArgb(0, 192, 192); DoPG.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); DoPG.Cursor = Cursors.Hand; DoPG.MouseHover += new EventHandler(KeyHover); DoPG.MouseLeave += new EventHandler(KeyLeave); DoPG.Show(); } //độ màn hình rộng { Label ManHR = new Label(); this.Controls.Add(ManHR); ManHR.Location = new Point(500, label8.Location.Y); ManHR.AutoSize = true; ManHR.Text = Phone.ManHinhRong + " ''"; ManHR.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ManHR.Cursor = Cursors.Hand; ManHR.Show(); } //mặt kính cảm ứng { Label MatKCU = new Label(); this.Controls.Add(MatKCU); MatKCU.Location = new Point(500, label7.Location.Y); MatKCU.AutoSize = true; MatKCU.Text = Phone.MatKinhCamUng; MatKCU.ForeColor = Color.FromArgb(0, 192, 192); MatKCU.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); MatKCU.Cursor = Cursors.Hand; MatKCU.MouseHover += new EventHandler(KeyHover); MatKCU.MouseLeave += new EventHandler(KeyLeave); MatKCU.Show(); } } //Camera Sau { //độ phân giải camera sau { Label[] DoPGCameraSau = new Label[Phone.DoPhanGiaiCameraSau.Length]; int i = 0; foreach (String doPG in Phone.DoPhanGiaiCameraSau) { DoPGCameraSau[i] = new Label(); this.Controls.Add(DoPGCameraSau[i]); if (i == 0) { DoPGCameraSau[i].Location = new Point(500, label13.Location.Y); } else { int X = DoPGCameraSau[i - 1].Location.X + DoPGCameraSau[i - 1].Width + 2; DoPGCameraSau[i].Location = new Point(X, label13.Location.Y); } DoPGCameraSau[i].AutoSize = true; if (i == 0 && Phone.DoPhanGiaiCameraSau.Length > 1) { DoPGCameraSau[i].Text = doPG + " MP,"; } else { DoPGCameraSau[i].Text = doPG + " MP"; } DoPGCameraSau[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); DoPGCameraSau[i].Cursor = Cursors.Hand; DoPGCameraSau[i].MouseHover += new EventHandler(KeyHover); DoPGCameraSau[i].MouseLeave += new EventHandler(KeyLeave); DoPGCameraSau[i].Show(); i++; } } //quay phim { Label[] QuayPhim = new Label[Phone.Quayphim.Length]; int i = 0; foreach (String QP in Phone.Quayphim.Split(',')) { QuayPhim[i] = new Label(); this.Controls.Add(QuayPhim[i]); if (i == 0) { QuayPhim[i].Location = new Point(500, label12.Location.Y); } else { int X = QuayPhim[i - 1].Location.X + QuayPhim[i - 1].Width + 2; QuayPhim[i].Location = new Point(X, label12.Location.Y); } QuayPhim[i].AutoSize = true; if (i != Phone.Quayphim.Split(',').Length - 1) { QuayPhim[i].Text = QP + ", "; } else { QuayPhim[i].Text = QP; } QuayPhim[i].ForeColor = Color.FromArgb(0, 192, 192); QuayPhim[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); QuayPhim[i].Cursor = Cursors.Hand; QuayPhim[i].MouseHover += new EventHandler(KeyHover); QuayPhim[i].MouseLeave += new EventHandler(KeyLeave); QuayPhim[i].Show(); i++; } } //mặt kính cảm ứng { Label Flash = new Label(); this.Controls.Add(Flash); Flash.Location = new Point(500, label10.Location.Y); Flash.AutoSize = true; Flash.Text = Phone.DenFlash; Flash.ForeColor = Color.FromArgb(0, 192, 192); Flash.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); Flash.Cursor = Cursors.Hand; Flash.MouseHover += new EventHandler(KeyHover); Flash.MouseLeave += new EventHandler(KeyLeave); Flash.Show(); } //chụp ảnh nâng cao { Label[] ChupAnhNC = new Label[Phone.ChupAnhNangCao.Length]; int i = 0; foreach (String str in Phone.ChupAnhNangCao) { ChupAnhNC[i] = new Label(); this.Controls.Add(ChupAnhNC[i]); if (i == 0) { ChupAnhNC[i].Location = new Point(500, label11.Location.Y); } else { int X = ChupAnhNC[i - 1].Location.X + ChupAnhNC[i - 1].Width + 2; ChupAnhNC[i].Location = new Point(X, label11.Location.Y); } ChupAnhNC[i].AutoSize = true; if (i != Phone.ChupAnhNangCao.Length - 1) { ChupAnhNC[i].Text = str + ","; } else { ChupAnhNC[i].Text = str; } ChupAnhNC[i].ForeColor = Color.FromArgb(0, 192, 192); ChupAnhNC[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ChupAnhNC[i].Cursor = Cursors.Hand; ChupAnhNC[i].MouseHover += new EventHandler(KeyHover); ChupAnhNC[i].MouseLeave += new EventHandler(KeyLeave); ChupAnhNC[i].Show(); i++; } } } //Camera truóc { //độ phân giải camera trước { Label DoPGCameraTruoc = new Label(); this.Controls.Add(DoPGCameraTruoc); DoPGCameraTruoc.Location = new Point(500, label16.Location.Y); DoPGCameraTruoc.AutoSize = true; DoPGCameraTruoc.Text = Phone.DoPhanGiaiCameraTruoc; DoPGCameraTruoc.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); DoPGCameraTruoc.Cursor = Cursors.Hand; DoPGCameraTruoc.Show(); } //video call { Label VideoCall = new Label(); this.Controls.Add(VideoCall); VideoCall.Location = new Point(500, label14.Location.Y); VideoCall.AutoSize = true; VideoCall.Text = Phone.Videocall; VideoCall.ForeColor = Color.FromArgb(0, 192, 192); VideoCall.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); VideoCall.Cursor = Cursors.Hand; VideoCall.MouseHover += new EventHandler(KeyHover); VideoCall.MouseLeave += new EventHandler(KeyLeave); VideoCall.Show(); } //Tính Năng Camera trước { Label[] TinhNangCameraTruoc = new Label[Phone.TinhNangCameraTruoc.Length]; int i = 0; foreach (String str in Phone.TinhNangCameraTruoc) { TinhNangCameraTruoc[i] = new Label(); this.Controls.Add(TinhNangCameraTruoc[i]); if (i == 0) { TinhNangCameraTruoc[i].Location = new Point(500, label15.Location.Y); } else { int X = TinhNangCameraTruoc[i - 1].Location.X + TinhNangCameraTruoc[i - 1].Width + 2; TinhNangCameraTruoc[i].Location = new Point(X, label15.Location.Y); } TinhNangCameraTruoc[i].AutoSize = true; if (i != Phone.TinhNangCameraTruoc.Length - 1) { TinhNangCameraTruoc[i].Text = str + ","; } else { TinhNangCameraTruoc[i].Text = str; } TinhNangCameraTruoc[i].ForeColor = Color.FromArgb(0, 192, 192); TinhNangCameraTruoc[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); TinhNangCameraTruoc[i].Cursor = Cursors.Hand; TinhNangCameraTruoc[i].Show(); TinhNangCameraTruoc[i].MouseHover += new EventHandler(KeyHover); TinhNangCameraTruoc[i].MouseLeave += new EventHandler(KeyLeave); i++; } } } //Hệ điều hành & CPU { //Hệ điều hành { Label HeDieuHanh = new Label(); this.Controls.Add(HeDieuHanh); HeDieuHanh.Location = new Point(500, label21.Location.Y); HeDieuHanh.AutoSize = true; HeDieuHanh.Text = Phone.HeDieuHanh; HeDieuHanh.ForeColor = Color.FromArgb(0, 192, 192); HeDieuHanh.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); HeDieuHanh.Cursor = Cursors.Hand; HeDieuHanh.MouseHover += new EventHandler(KeyHover); HeDieuHanh.MouseLeave += new EventHandler(KeyLeave); HeDieuHanh.Show(); } //chip set { Label ChipSet = new Label(); this.Controls.Add(ChipSet); ChipSet.Location = new Point(500, label20.Location.Y); ChipSet.AutoSize = true; ChipSet.Text = Phone.Chipset; ChipSet.ForeColor = Color.FromArgb(0, 192, 192); ChipSet.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ChipSet.Cursor = Cursors.Hand; ChipSet.MouseHover += new EventHandler(KeyHover); ChipSet.MouseLeave += new EventHandler(KeyLeave); ChipSet.Show(); } //tốc độ cpu { Label TocDoCPU = new Label(); this.Controls.Add(TocDoCPU); TocDoCPU.Location = new Point(500, label18.Location.Y); TocDoCPU.AutoSize = true; TocDoCPU.Text = Phone.TocDoCPU; TocDoCPU.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); TocDoCPU.Cursor = Cursors.Hand; TocDoCPU.Show(); } //chip đồ họa { Label ChipDoHoa = new Label(); this.Controls.Add(ChipDoHoa); ChipDoHoa.Location = new Point(500, label19.Location.Y); ChipDoHoa.AutoSize = true; ChipDoHoa.Text = Phone.ChipDoHoa; ChipDoHoa.ForeColor = Color.FromArgb(0, 192, 192); ChipDoHoa.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ChipDoHoa.Cursor = Cursors.Hand; ChipDoHoa.MouseHover += new EventHandler(KeyHover); ChipDoHoa.MouseLeave += new EventHandler(KeyLeave); ChipDoHoa.Show(); } } //Bộ nhớ && lưu trữ { //Ram { Label Ram = new Label(); this.Controls.Add(Ram); Ram.Location = new Point(500, label26.Location.Y); Ram.AutoSize = true; Ram.Text = Phone.Ram + " GB"; Ram.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); Ram.Cursor = Cursors.Hand; Ram.Show(); } //Bộ nhớ trong { Label BoNhoTrong = new Label(); this.Controls.Add(BoNhoTrong); BoNhoTrong.Location = new Point(500, label25.Location.Y); BoNhoTrong.AutoSize = true; BoNhoTrong.Text = Phone.BoNhoTrong + " GB"; BoNhoTrong.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); BoNhoTrong.Cursor = Cursors.Hand; BoNhoTrong.Show(); } //Bộ nhớ còn lại { Label BoNhoConLai = new Label(); this.Controls.Add(BoNhoConLai); BoNhoConLai.Location = new Point(500, label23.Location.Y); BoNhoConLai.AutoSize = true; BoNhoConLai.Text = Phone.BoNhoConLai + " GB"; BoNhoConLai.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); BoNhoConLai.Cursor = Cursors.Hand; BoNhoConLai.Show(); } //Thẻ nhớ ngoài { Label TheNhoNgoai = new Label(); this.Controls.Add(TheNhoNgoai); TheNhoNgoai.Location = new Point(500, label24.Location.Y); TheNhoNgoai.AutoSize = true; TheNhoNgoai.Text = Phone.TheNhoNgoai + " GB"; TheNhoNgoai.ForeColor = Color.FromArgb(0, 192, 192); TheNhoNgoai.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); TheNhoNgoai.Cursor = Cursors.Hand; TheNhoNgoai.MouseHover += new EventHandler(KeyHover); TheNhoNgoai.MouseLeave += new EventHandler(KeyLeave); TheNhoNgoai.Show(); } } //Kết nối { //Mạng di động { Label[] MangDiDong = new Label[Phone.MangDiDong.Length]; int i = 0; foreach (String str in Phone.MangDiDong) { MangDiDong[i] = new Label(); this.Controls.Add(MangDiDong[i]); if (i == 0) { MangDiDong[i].Location = new Point(500, label31.Location.Y); } else { int X = MangDiDong[i - 1].Location.X + MangDiDong[i - 1].Width + 2; MangDiDong[i].Location = new Point(X, label31.Location.Y); } MangDiDong[i].AutoSize = true; if (i != Phone.MangDiDong.Length - 1) { MangDiDong[i].Text = str + ","; } else { MangDiDong[i].Text = str; } MangDiDong[i].ForeColor = Color.FromArgb(0, 192, 192); MangDiDong[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); MangDiDong[i].Cursor = Cursors.Hand; MangDiDong[i].MouseHover += new EventHandler(KeyHover); MangDiDong[i].MouseLeave += new EventHandler(KeyLeave); MangDiDong[i].Show(); i++; } } //Sim { Label Sim = new Label(); this.Controls.Add(Sim); Sim.Location = new Point(500, label30.Location.Y); Sim.AutoSize = true; Sim.Text = Phone.Sim + " Nano Sim"; Sim.ForeColor = Color.FromArgb(0, 192, 192); Sim.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); Sim.Cursor = Cursors.Hand; Sim.MouseHover += new EventHandler(KeyHover); Sim.MouseLeave += new EventHandler(KeyLeave); Sim.Show(); } //Wifi { Label[] Wifi = new Label[Phone.Wifi.Length]; int i = 0; foreach (String str in Phone.Wifi) { Wifi[i] = new Label(); this.Controls.Add(Wifi[i]); if (i == 0) { Wifi[i].Location = new Point(500, label28.Location.Y); } else { int X = Wifi[i - 1].Location.X + Wifi[i - 1].Width + 2; Wifi[i].Location = new Point(X, label28.Location.Y); } Wifi[i].AutoSize = true; if (i != Phone.Wifi.Length - 1) { Wifi[i].Text = str + ","; } else { Wifi[i].Text = str; } Wifi[i].ForeColor = Color.FromArgb(0, 192, 192); Wifi[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); Wifi[i].Cursor = Cursors.Hand; Wifi[i].MouseHover += new EventHandler(KeyHover); Wifi[i].MouseLeave += new EventHandler(KeyLeave); Wifi[i].Show(); i++; } } //GPS { Label[] GPS = new Label[Phone.GPS.Length]; int i = 0; foreach (String str in Phone.GPS) { GPS[i] = new Label(); this.Controls.Add(GPS[i]); if (i == 0) { GPS[i].Location = new Point(500, label29.Location.Y); } else { int X = GPS[i - 1].Location.X + GPS[i - 1].Width + 2; GPS[i].Location = new Point(X, label29.Location.Y); } GPS[i].AutoSize = true; if (i != Phone.GPS.Length - 1) { GPS[i].Text = str + ","; } else { GPS[i].Text = str; } GPS[i].ForeColor = Color.FromArgb(0, 192, 192); GPS[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); GPS[i].Cursor = Cursors.Hand; GPS[i].MouseHover += new EventHandler(KeyHover); GPS[i].MouseLeave += new EventHandler(KeyLeave); GPS[i].Show(); i++; } } //Bluetooth { Label[] Bluetooth = new Label[Phone.Bluetooth.Length]; int i = 0; foreach (String str in Phone.Bluetooth) { Bluetooth[i] = new Label(); this.Controls.Add(Bluetooth[i]); if (i == 0) { Bluetooth[i].Location = new Point(500, label36.Location.Y); } else { int X = Bluetooth[i - 1].Location.X + Bluetooth[i - 1].Width + 2; Bluetooth[i].Location = new Point(X, label36.Location.Y); } Bluetooth[i].AutoSize = true; if (i != Phone.Bluetooth.Length - 1) { Bluetooth[i].Text = str + ","; } else { Bluetooth[i].Text = str; } Bluetooth[i].ForeColor = Color.FromArgb(0, 192, 192); Bluetooth[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); Bluetooth[i].Cursor = Cursors.Hand; Bluetooth[i].MouseHover += new EventHandler(KeyHover); Bluetooth[i].MouseLeave += new EventHandler(KeyLeave); Bluetooth[i].Show(); i++; } } //Cổng thiết kế/ sạc { Label CongKetNoi_Sac = new Label(); this.Controls.Add(CongKetNoi_Sac); CongKetNoi_Sac.Location = new Point(500, label35.Location.Y); CongKetNoi_Sac.AutoSize = true; CongKetNoi_Sac.Text = Phone.CongKetNoi_Sac; CongKetNoi_Sac.ForeColor = Color.FromArgb(0, 192, 192); CongKetNoi_Sac.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); CongKetNoi_Sac.Cursor = Cursors.Hand; CongKetNoi_Sac.MouseHover += new EventHandler(KeyHover); CongKetNoi_Sac.MouseLeave += new EventHandler(KeyLeave); CongKetNoi_Sac.Show(); } //Jack tai nghe { Label JackTaiNghe = new Label(); this.Controls.Add(JackTaiNghe); JackTaiNghe.Location = new Point(500, label33.Location.Y); JackTaiNghe.AutoSize = true; JackTaiNghe.Text = Phone.JackTaiNghe; JackTaiNghe.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); JackTaiNghe.Cursor = Cursors.Hand; JackTaiNghe.Show(); } //Kết nối khác { Label[] KetNoiKhac = new Label[Phone.KetNoiKhac.Length]; int i = 0; foreach (String str in Phone.KetNoiKhac) { KetNoiKhac[i] = new Label(); this.Controls.Add(KetNoiKhac[i]); if (i == 0) { KetNoiKhac[i].Location = new Point(500, label34.Location.Y); } else { int X = KetNoiKhac[i - 1].Location.X + KetNoiKhac[i - 1].Width + 2; KetNoiKhac[i].Location = new Point(X, label34.Location.Y); } KetNoiKhac[i].AutoSize = true; if (i != Phone.KetNoiKhac.Length - 1) { KetNoiKhac[i].Text = str + ","; } else { KetNoiKhac[i].Text = str; } KetNoiKhac[i].ForeColor = Color.FromArgb(0, 192, 192); KetNoiKhac[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); KetNoiKhac[i].Cursor = Cursors.Hand; KetNoiKhac[i].MouseHover += new EventHandler(KeyHover); KetNoiKhac[i].MouseLeave += new EventHandler(KeyLeave); KetNoiKhac[i].Show(); i++; } } } //Thiết kế & Trọng lượng { //Thiết kế { Label[] ThietKe = new Label[Phone.ThietKe.Length]; int i = 0; foreach (String str in Phone.ThietKe) { ThietKe[i] = new Label(); this.Controls.Add(ThietKe[i]); if (i == 0) { ThietKe[i].Location = new Point(500, label40.Location.Y); } else { int X = ThietKe[i - 1].Location.X + ThietKe[i - 1].Width + 2; ThietKe[i].Location = new Point(X, label40.Location.Y); } ThietKe[i].AutoSize = true; if (i != Phone.ThietKe.Length - 1) { ThietKe[i].Text = str + ","; } else { ThietKe[i].Text = str; } ThietKe[i].ForeColor = Color.FromArgb(0, 192, 192); ThietKe[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ThietKe[i].Cursor = Cursors.Hand; ThietKe[i].MouseHover += new EventHandler(KeyHover); ThietKe[i].MouseLeave += new EventHandler(KeyLeave); ThietKe[i].Show(); i++; } } //chất liệu { Label ChatLieu = new Label(); this.Controls.Add(ChatLieu); ChatLieu.Location = new Point(500, label39.Location.Y); ChatLieu.AutoSize = true; ChatLieu.Text = string.Join(",", Phone.ChatLieu); ChatLieu.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ChatLieu.Cursor = Cursors.Hand; ChatLieu.Show(); } //kích thước { Label KichThuoc = new Label(); this.Controls.Add(KichThuoc); KichThuoc.Location = new Point(500, label37.Location.Y); KichThuoc.AutoSize = true; KichThuoc.Text = Phone.KichThuoc; KichThuoc.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); KichThuoc.Cursor = Cursors.Hand; KichThuoc.Show(); } //Trọng lượng { Label TrongLuong = new Label(); this.Controls.Add(TrongLuong); TrongLuong.Location = new Point(500, label38.Location.Y); TrongLuong.AutoSize = true; TrongLuong.Text = Phone.TrongLuong; TrongLuong.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); TrongLuong.Cursor = Cursors.Hand; TrongLuong.Show(); } } //Thông tin pin & sạc { //Dung lượng pin { Label DungLuongPin = new Label(); this.Controls.Add(DungLuongPin); DungLuongPin.Location = new Point(500, label44.Location.Y); DungLuongPin.AutoSize = true; DungLuongPin.Text = Phone.DungLuongPin; DungLuongPin.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); DungLuongPin.Cursor = Cursors.Hand; DungLuongPin.Show(); } //Loại pin { Label LoaiPin = new Label(); this.Controls.Add(LoaiPin); LoaiPin.Location = new Point(500, label43.Location.Y); LoaiPin.AutoSize = true; LoaiPin.Text = Phone.LoaiPin; LoaiPin.ForeColor = Color.FromArgb(0, 192, 192); LoaiPin.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); LoaiPin.Cursor = Cursors.Hand; LoaiPin.MouseHover += new EventHandler(KeyHover); LoaiPin.MouseLeave += new EventHandler(KeyLeave); LoaiPin.Show(); } //Công nghệ pin { Label[] CongNghePin = new Label[Phone.CongNghePin.Length]; int i = 0; foreach (String str in Phone.CongNghePin) { CongNghePin[i] = new Label(); this.Controls.Add(CongNghePin[i]); if (i == 0) { CongNghePin[i].Location = new Point(500, label42.Location.Y); } else { int X = CongNghePin[i - 1].Location.X + CongNghePin[i - 1].Width + 2; CongNghePin[i].Location = new Point(X, label42.Location.Y); } CongNghePin[i].AutoSize = true; if (i != Phone.CongNghePin.Length - 1) { CongNghePin[i].Text = str + ","; } else { CongNghePin[i].Text = str; } CongNghePin[i].ForeColor = Color.FromArgb(0, 192, 192); CongNghePin[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); CongNghePin[i].Cursor = Cursors.Hand; CongNghePin[i].MouseHover += new EventHandler(KeyHover); CongNghePin[i].MouseLeave += new EventHandler(KeyLeave); CongNghePin[i].Show(); i++; } } } //Tiện ích { //bảo mật nâng cao { Label[] BaoMatNangCao = new Label[Phone.BaoMatNangCao.Length]; int i = 0; foreach (String str in Phone.BaoMatNangCao) { BaoMatNangCao[i] = new Label(); this.Controls.Add(BaoMatNangCao[i]); if (i == 0) { BaoMatNangCao[i].Location = new Point(500, label48.Location.Y); } else { int X = BaoMatNangCao[i - 1].Location.X + BaoMatNangCao[i - 1].Width + 2; BaoMatNangCao[i].Location = new Point(X, label48.Location.Y); } BaoMatNangCao[i].AutoSize = true; if (i != Phone.BaoMatNangCao.Length - 1) { BaoMatNangCao[i].Text = str + ","; } else { BaoMatNangCao[i].Text = str; } BaoMatNangCao[i].ForeColor = Color.FromArgb(0, 192, 192); BaoMatNangCao[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); BaoMatNangCao[i].Cursor = Cursors.Hand; BaoMatNangCao[i].MouseHover += new EventHandler(KeyHover); BaoMatNangCao[i].MouseLeave += new EventHandler(KeyLeave); BaoMatNangCao[i].Show(); i++; } } //Tính năng đặc biết { Label[] TinhNangDacBiet = new Label[Phone.TinhNangDacBiet.Length]; int i = 0; foreach (String str in Phone.TinhNangDacBiet) { TinhNangDacBiet[i] = new Label(); this.Controls.Add(TinhNangDacBiet[i]); if (i == 0) { TinhNangDacBiet[i].Location = new Point(500, label47.Location.Y); } else { int X = TinhNangDacBiet[i - 1].Location.X + TinhNangDacBiet[i - 1].Width + 2; TinhNangDacBiet[i].Location = new Point(X, label47.Location.Y); } TinhNangDacBiet[i].AutoSize = true; if (i != Phone.TinhNangDacBiet.Length - 1) { TinhNangDacBiet[i].Text = str + ","; } else { TinhNangDacBiet[i].Text = str; } TinhNangDacBiet[i].ForeColor = Color.FromArgb(0, 192, 192); TinhNangDacBiet[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); TinhNangDacBiet[i].Cursor = Cursors.Hand; TinhNangDacBiet[i].MouseHover += new EventHandler(KeyHover); TinhNangDacBiet[i].MouseLeave += new EventHandler(KeyLeave); TinhNangDacBiet[i].Show(); i++; } } //Ghi âm { Label[] GhiAm = new Label[Phone.GhiAm.Length]; int i = 0; foreach (String str in Phone.GhiAm) { GhiAm[i] = new Label(); this.Controls.Add(GhiAm[i]); if (i == 0) { GhiAm[i].Location = new Point(500, label46.Location.Y); } else { int X = GhiAm[i - 1].Location.X + GhiAm[i - 1].Width + 2; GhiAm[i].Location = new Point(X, label46.Location.Y); } GhiAm[i].AutoSize = true; if (i != Phone.GhiAm.Length - 1) { GhiAm[i].Text = str + ","; } else { GhiAm[i].Text = str; } GhiAm[i].ForeColor = Color.FromArgb(0, 192, 192); GhiAm[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); GhiAm[i].Cursor = Cursors.Hand; GhiAm[i].MouseHover += new EventHandler(KeyHover); GhiAm[i].MouseLeave += new EventHandler(KeyLeave); GhiAm[i].Show(); i++; } } //Radio { Label Radio = new Label(); this.Controls.Add(Radio); Radio.Location = new Point(500, label52.Location.Y); Radio.AutoSize = true; Radio.Text = Phone.Radio; Radio.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); Radio.Cursor = Cursors.Hand; Radio.Show(); } //Xem Phim { Label[] XemPhim = new Label[Phone.XemPhim.Length]; int i = 0; foreach (String str in Phone.XemPhim) { XemPhim[i] = new Label(); this.Controls.Add(XemPhim[i]); if (i == 0) { XemPhim[i].Location = new Point(500, label51.Location.Y); } else { int X = XemPhim[i - 1].Location.X + XemPhim[i - 1].Width + 2; XemPhim[i].Location = new Point(X, label51.Location.Y); } XemPhim[i].AutoSize = true; if (i != Phone.XemPhim.Length - 1) { XemPhim[i].Text = str + ","; } else { XemPhim[i].Text = str; } XemPhim[i].ForeColor = Color.FromArgb(0, 192, 192); XemPhim[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); XemPhim[i].Cursor = Cursors.Hand; XemPhim[i].MouseHover += new EventHandler(KeyHover); XemPhim[i].MouseLeave += new EventHandler(KeyLeave); XemPhim[i].Show(); i++; } } //Nghe nhạc { Label[] NgheNhac = new Label[Phone.NgheNhac.Length]; int i = 0; foreach (String str in Phone.NgheNhac) { NgheNhac[i] = new Label(); this.Controls.Add(NgheNhac[i]); if (i == 0) { NgheNhac[i].Location = new Point(500, label50.Location.Y); } else { int X = NgheNhac[i - 1].Location.X + NgheNhac[i - 1].Width + 2; NgheNhac[i].Location = new Point(X, label50.Location.Y); } NgheNhac[i].AutoSize = true; if (i != Phone.NgheNhac.Length - 1) { NgheNhac[i].Text = str + ","; } else { NgheNhac[i].Text = str; } NgheNhac[i].ForeColor = Color.FromArgb(0, 192, 192); NgheNhac[i].Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); NgheNhac[i].Cursor = Cursors.Hand; NgheNhac[i].MouseHover += new EventHandler(KeyHover); NgheNhac[i].MouseLeave += new EventHandler(KeyLeave); NgheNhac[i].Show(); i++; } } } //Thời điểm ra mắt { Label ThoiDiemRaMat = new Label(); this.Controls.Add(ThoiDiemRaMat); ThoiDiemRaMat.Location = new Point(500, label54.Location.Y); ThoiDiemRaMat.AutoSize = true; ThoiDiemRaMat.Text = Phone.ThoiDiemRaMat; ThoiDiemRaMat.Font = new Font("Microsoft Sans Serif", 11, FontStyle.Regular); ThoiDiemRaMat.Cursor = Cursors.Hand; ThoiDiemRaMat.Show(); } }
/// <summary> /// Tilføjer et udstyr /// </summary> public async void AddEquipment() { if (TypeOfEquipment == "Computer" || TypeOfEquipment == "Smartboard" || TypeOfEquipment == "Smartphone" || TypeOfEquipment == "Tablet") { Equipment e = new Equipment(TypeOfEquipment); await Singleton.Instance.EQP.CreateEquipment(e); AllEquipment = Singleton.Instance.EQP.GetEquipments().Result; Equipment NewlyCreatedEquip = AllEquipment.Last(); switch (TypeOfEquipment) { case "Computer": Computer pc = new Computer(NewlyCreatedEquip.Uid); await Singleton.Instance.COM.CreateComputer(pc); var messageDialogue1 = new MessageDialog($"En computer er tilføjet"); messageDialogue1.Commands.Add(new UICommand("Luk")); await messageDialogue1.ShowAsync(); break; case "Smartboard": SmartBoard sb = new SmartBoard(NewlyCreatedEquip.Uid); await Singleton.Instance.SB.CreateSmartboard(sb); var messageDialogue2 = new MessageDialog($"Et smartboard er tilføjet"); messageDialogue2.Commands.Add(new UICommand("Luk")); await messageDialogue2.ShowAsync(); break; case "Smartphone": SmartPhone sp = new SmartPhone(NewlyCreatedEquip.Uid); await Singleton.Instance.SP.CreateSmartphone(sp); var messageDialogue3 = new MessageDialog($"En smartphone er tilføjet"); messageDialogue3.Commands.Add(new UICommand("Luk")); await messageDialogue3.ShowAsync(); break; case "Tablet": Tablet tab = new Tablet(NewlyCreatedEquip.Uid); await Singleton.Instance.TAB.CreateTablet(tab); var messageDialogue4 = new MessageDialog($"En tablet er tilføjet"); messageDialogue4.Commands.Add(new UICommand("Luk")); await messageDialogue4.ShowAsync(); break; default: break; } } else { throw new ArgumentException("TypeOfEquipment is null"); } ObsEquipment.Clear(); ConvertToObs(); }
public void Initialize() { testComputer = new Computer(8, 3.2, 500); testLaptop = new Laptop(2.0, 16, 2.6, 256); testPhone = new SmartPhone(5.0, 12, 2.5, 128); }
public void CreateObjects() { c = new Computer(100, 4.0); l = new Laptop(15, 256, 1.8); sp = new SmartPhone("terrible", 64, 2.4); }
/// <summary> /// Запуска примера работы со словарем /// </summary> public static void RunDictionary() { var dictionary = new Dictionary <IPerson, IPhone> { { new Employee { Name = "Иван", SurName = "Иванов", Position = "Секретарь" }, new Phone { Model = "PXFGH1345", Name = "Philips" } }, { new Employee { Name = "Петр", SurName = "Петров", Position = "Директор" }, new Phone { Model = "PXFGH1345", Name = "Philips" } }, { new Student { Name = "Семен", SurName = "Овечкин", Course = 1, Group = "AМ1" }, new SmartPhone { Model = "P40 Pro", Name = "Huawei", Os = "Harmony" } }, { new Student { Name = "Ольга", SurName = "Корженова", Course = 1, Group = "AМ1" }, new SmartPhone { Model = "10 Max", Name = "IPhone", Os = "IOS" } }, { new Student { Name = "Екатерина", SurName = "Иванова", Course = 4, Group = "BМ1" }, new SmartPhone { Model = "S10", Name = "Samsung", Os = "Android" } } }; dictionary.Print("Вывод Dictionary"); var employee = new Employee { Name = "Имя1", SurName = "Фамилия1", Position = "Должность1" }; var smartPhone = new SmartPhone { Model = "S20", Name = "Samsung", Os = "Android" }; dictionary.Add(employee, smartPhone); dictionary.Print("Вывод Dictionary после добавления нового ключа"); // Попытка вставить дубликат ключа try { var smartPhone1 = new SmartPhone { Model = "7 Pro", Name = "OnePlus", Os = "Adroid" }; dictionary.Add(employee, smartPhone1); } catch (Exception ex) { Console.WriteLine($"Ошибка добавления ключа в словарь - {ex.Message}"); } dictionary.Remove(employee); dictionary.Print("Вывод Dictionary после удаления по ключу"); }
public void Try() { SmartPhone IPhone = SmartPhone.Factory.IPhoneX(64); SmartPhone Samsung = SmartPhone.Factory.SamsungGalaxy(128); }
protected static bool FactoryReset(SmartPhone device) { device.IsDamagedSoftware = false; return(true); }
public async Task CreateSmartphone(SmartPhone obj) { await _webApi.Create(obj); }
/// <summary> /// Invoked when this page is about to be displayed in a Frame. /// </summary> /// <param name="e">Event data that describes how this page was reached. /// This parameter is typically used to configure the page.</param> protected override void OnNavigatedTo(NavigationEventArgs e) { this.DataContext = App.Ds; Current_Item = App.Ds.GetItem(e.Parameter.ToString()); }
public IosBuilder() { _smartPhone = new SmartPhone("Iphone 6s"); }
public void CreateTestDevices() { testSmartPhone = new SmartPhone("iOS", "AT&T", .33, 2.98, 5.94, "Apple"); testLaptop = new Laptop(3, true, .63, 12.11, 8.81, "Huawei"); testComputer = new Computer(20.8, 8.58, 17.7, "Apple"); }
public void SmartPhoneTest() { var smartPhone = new SmartPhone(); Assert.NotNull(smartPhone); }
public Engine(SmartPhone smartphone) { this.smartphone = smartphone; }
protected void CreateInstallAppButton(string appname, int apptype, SmartPhone phone, Entity owner, List<PhoneApp> InstalledApps) { UIContainer btncontainer = new UIContainer(CursorType: CursorType.Cursor, Width: SmartPhone.SCREEN_RECT.Width, CentreHorizontal: true); Button button = new Button(Color.LightBlue, Color.LightBlue, Color.LightCyan, Color.Turquoise, Textures.SmartPhoneButton, CursorType: CursorType.Cursor, Text: "Install " + appname); button.OnPressed += (obj) => { int itemIndex = (owner as IItemHolder).GetItemIndex(apptype); if (itemIndex != -1) { int consumeRate = (owner as IItemHolder).GetItem(apptype).ConsumeRate; (owner as IItemHolder).TrashItem(itemIndex); //Remove the item from the HUD as well ((UI.Inventory_UI[itemIndex] as UIContainer)[0] as InventoryElement).Item = null; //Remove this button, since it's no longer needed (button.Parent as UIContainer).RemoveElement(button); //Also create the button for launching the new app PhoneApp newApp = phone.InstallApp(apptype, consumeRate); PageContent.AddElement(CreateSwitchAppButton(appname, newApp)); } }; btncontainer.AddElement(button); PageContent.AddElement(btncontainer); }
public void InitializeTests() { computer = new Computer("Intel", baseMemory, baseStorage); laptop = new Laptop("AMD", baseMemory, baseStorage, monitorSize); phone = new SmartPhone("Qualcomm", 512, 2, "Verizon"); }
public bool updateSmartPhone(SmartPhone smartPhone) { bool rs = new SmartPhoneDAO().updateSmartPhone(smartPhone); return(rs); }
public static Item Create(int type, int amount = -1, Entity owner = null) { Item newItem; if (GameData.GameItems[type] is Gun) newItem = new Gun(type, amount, owner); else if (GameData.GameItems[type] is Melee) newItem = new Melee(type, amount, owner); else if (GameData.GameItems[type] is Goggles) newItem = new Goggles(type, owner); else if (GameData.GameItems[type] is Torch) newItem = new Torch(type, owner); else if (GameData.GameItems[type] is SmartPhone) newItem = new SmartPhone(type, owner); else if (GameData.GameItems[type] is Togglable) newItem = new Togglable(type, owner); else newItem = new Item(type, amount, owner); return newItem; }
//load thong tin dien thoai tu file cau truc private void LoadSmartPhoneInfo() { String[] Str; String jsonString = "{"; CurrenFolderPath = System.IO.Path.GetDirectoryName(Application.ExecutablePath) + @"\Knowledge base\"; using (XmlReader reader = XmlReader.Create(CurrenFolderPath + "Cấu trúc hệ tư vấn mua điện thoại - Copy.owl")) while (reader.Read()) { if (reader.IsStartElement()) { switch (reader.Name.ToString()) { case "TenDienThoai": jsonString = "{"; String TenDienThoai = reader.ReadElementContentAsString(); jsonString += "TenDienThoai:" + "'" + TenDienThoai + "',"; break; case "HangSanXuat": String HangSanXuat = reader.ReadElementContentAsString(); jsonString += "HangSanXuat:" + "'" + HangSanXuat + "',"; break; case "LoaiDienThoai": String LoaiDienThoai = reader.ReadElementContentAsString(); jsonString += "LoaiDienThoai:" + "'" + LoaiDienThoai + "',"; break; case "CongNgheManHinh": String CongNgheManHinh = reader.ReadElementContentAsString(); jsonString += "CongNgheManHinh:" + "'" + CongNgheManHinh + "',"; break; case "DoPhanGiai": String DoPhanGiai = reader.ReadElementContentAsString(); jsonString += "DoPhanGiai:" + "'" + DoPhanGiai + "',"; break; case "ManHinhRong": String ManHinhRong = reader.ReadElementContentAsString(); jsonString += "ManHinhRong:" + "'" + ManHinhRong + "',"; break; case "MatKinhCamUng": String MatKinhCamUng = reader.ReadElementContentAsString(); jsonString += "MatKinhCamUng:" + "'" + MatKinhCamUng + "',"; break; case "DoPhanGiaiCameraSau": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String DoPhanGiaiCameraSau = String.Join(",", Str).Insert(0, "["); DoPhanGiaiCameraSau = DoPhanGiaiCameraSau.Insert(DoPhanGiaiCameraSau.Length, "]"); //Console.WriteLine(DoPhanGiaiCameraSau); jsonString += "DoPhanGiaiCameraSau:" + DoPhanGiaiCameraSau + ","; break; case "Quayphim": String Quayphim = reader.ReadElementContentAsString(); jsonString += "Quayphim:" + "'" + Quayphim + "',"; break; case "DenFlash": String DenFlash = reader.ReadElementContentAsString(); jsonString += "DenFlash:" + "'" + DenFlash + "',"; break; case "ChupAnhNangCao": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String ChupAnhNangCao = String.Join(",", Str).Insert(0, "["); ChupAnhNangCao = ChupAnhNangCao.Insert(ChupAnhNangCao.Length, "]"); //Console.WriteLine(ChupAnhNangCao); jsonString += "ChupAnhNangCao:" + ChupAnhNangCao + ","; break; case "DoPhanGiaiCameraTruoc": String DoPhanGiaiCameraTruoc = reader.ReadElementContentAsString(); jsonString += "DoPhanGiaiCameraTruoc:" + "'" + DoPhanGiaiCameraTruoc + "',"; break; case "Videocall": String Videocall = reader.ReadElementContentAsString(); jsonString += "Videocall:" + "'" + Videocall + "',"; break; case "TinhNangCameraTruoc": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String TinhNangCameraTruoc = String.Join(",", Str).Insert(0, "["); TinhNangCameraTruoc = TinhNangCameraTruoc.Insert(TinhNangCameraTruoc.Length, "]"); //Console.WriteLine(TinhNangCameraTruoc); jsonString += "TinhNangCameraTruoc:" + TinhNangCameraTruoc + ","; break; case "HeDieuHanh": String HeDieuHanh = reader.ReadElementContentAsString(); jsonString += "HeDieuHanh:" + "'" + HeDieuHanh + "',"; break; case "Chipset": String Chipset = reader.ReadElementContentAsString(); jsonString += "Chipset:" + "'" + Chipset + "',"; break; case "TocDoCPU": String TocDoCPU = reader.ReadElementContentAsString(); jsonString += "TocDoCPU:" + "'" + TocDoCPU + "',"; break; case "ChipDoHoa": String ChipDoHoa = reader.ReadElementContentAsString(); jsonString += "ChipDoHoa:" + "'" + ChipDoHoa + "',"; break; case "RAM": String RAM = reader.ReadElementContentAsString(); jsonString += "RAM:" + "'" + RAM + "',"; break; case "BoNhoTrong": String BoNhoTrong = reader.ReadElementContentAsString(); jsonString += "BoNhoTrong:" + "'" + BoNhoTrong + "',"; break; case "BoNhoConLai": String BoNhoConLai = reader.ReadElementContentAsString(); jsonString += "BoNhoConLai:" + "'" + BoNhoConLai + "',"; break; case "TheNhoNgoai": String TheNhoNgoai = reader.ReadElementContentAsString(); jsonString += "TheNhoNgoai:" + "'" + TheNhoNgoai + "',"; break; case "MangDiDong": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String MangDiDong = String.Join(",", Str).Insert(0, "["); MangDiDong = MangDiDong.Insert(MangDiDong.Length, "]"); //Console.WriteLine(MangDiDong); jsonString += "MangDiDong:" + MangDiDong + ","; break; case "SIM": String SIM = reader.ReadElementContentAsString(); jsonString += "SIM:" + "'" + SIM + "',"; break; case "Wifi": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String Wifi = String.Join(",", Str).Insert(0, "["); Wifi = Wifi.Insert(Wifi.Length, "]"); //Console.WriteLine(Wifi); jsonString += "Wifi:" + Wifi + ","; break; case "GPS": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String GPS = String.Join(",", Str).Insert(0, "["); GPS = GPS.Insert(GPS.Length, "]"); //Console.WriteLine(GPS); jsonString += "GPS:" + GPS + ","; break; case "Bluetooth": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String Bluetooth = String.Join(",", Str).Insert(0, "["); Bluetooth = Bluetooth.Insert(Bluetooth.Length, "]"); //Console.WriteLine(Bluetooth); jsonString += "Bluetooth:" + Bluetooth + ","; break; case "CongKetNoi_Sac": String CongKetNoi_Sac = reader.ReadElementContentAsString(); jsonString += "CongKetNoi_Sac:" + "'" + CongKetNoi_Sac + "',"; break; case "JackTaiNghe": String JackTaiNghe = reader.ReadElementContentAsString(); jsonString += "JackTaiNghe:" + "'" + JackTaiNghe + "',"; break; case "KetNoiKhac": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String KetNoiKhac = String.Join(",", Str).Insert(0, "["); KetNoiKhac = KetNoiKhac.Insert(KetNoiKhac.Length, "]"); //Console.WriteLine(KetNoiKhac); jsonString += "KetNoiKhac:" + KetNoiKhac + ","; break; case "ThietKe": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String ThietKe = String.Join(",", Str).Insert(0, "["); ThietKe = ThietKe.Insert(ThietKe.Length, "]"); //Console.WriteLine(ThietKe); jsonString += "ThietKe:" + ThietKe + ","; break; case "ChatLieu": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String ChatLieu = String.Join(",", Str).Insert(0, "["); ChatLieu = ChatLieu.Insert(ChatLieu.Length, "]"); //Console.WriteLine(ChatLieu); jsonString += "ChatLieu:" + ChatLieu + ","; break; case "KichThuoc": String KichThuoc = reader.ReadElementContentAsString(); jsonString += "KichThuoc:" + "'" + KichThuoc + "',"; break; case "TrongLuong": String TrongLuong = reader.ReadElementContentAsString(); jsonString += "TrongLuong:" + "'" + TrongLuong + "',"; break; case "DungLuongPin": String DungLuongPin = reader.ReadElementContentAsString(); jsonString += "DungLuongPin:" + "'" + DungLuongPin + "',"; break; case "LoaiPin": String LoaiPin = reader.ReadElementContentAsString(); jsonString += "LoaiPin:" + "'" + LoaiPin + "',"; break; case "CongNghePin": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String CongNghePin = String.Join(",", Str).Insert(0, "["); CongNghePin = CongNghePin.Insert(CongNghePin.Length, "]"); //Console.WriteLine(CongNghePin); jsonString += "CongNghePin:" + CongNghePin + ","; break; case "BaoMatNangCao": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String BaoMatNangCao = String.Join(",", Str).Insert(0, "["); BaoMatNangCao = BaoMatNangCao.Insert(BaoMatNangCao.Length, "]"); //Console.WriteLine(BaoMatNangCao); jsonString += "BaoMatNangCao:" + BaoMatNangCao + ","; break; case "TinhNangDacBiet": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String TinhNangDacBiet = String.Join(",", Str).Insert(0, "["); TinhNangDacBiet = TinhNangDacBiet.Insert(TinhNangDacBiet.Length, "]"); //Console.WriteLine(TinhNangDacBiet); jsonString += "TinhNangDacBiet:" + TinhNangDacBiet + ","; break; case "GhiAm": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String GhiAm = String.Join(",", Str).Insert(0, "["); GhiAm = GhiAm.Insert(GhiAm.Length, "]"); //Console.WriteLine(GhiAm); jsonString += "XemPim:" + GhiAm + ","; break; case "Radio": String Radio = reader.ReadElementContentAsString(); jsonString += "Radio:" + "'" + Radio + "',"; break; case "XemPim": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String XemPhim = String.Join(",", Str).Insert(0, "["); XemPhim = XemPhim.Insert(XemPhim.Length, "]"); //Console.WriteLine(XemPhim); jsonString += "XemPim:" + XemPhim + ","; break; case "NgheNhac": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String NgheNhac = String.Join(",", Str).Insert(0, "["); NgheNhac = NgheNhac.Insert(NgheNhac.Length, "]"); //Console.WriteLine(NgheNhac); jsonString += "NgheNhac:" + NgheNhac + ","; break; case "ThoiDiemRaMat": String ThoiDiemRaMat = reader.ReadElementContentAsString(); jsonString += "ThoiDiemRaMat:" + "'" + ThoiDiemRaMat + "',"; break; case "MauSac": Str = reader.ReadElementContentAsString().Split(',').ToArray(); for (int i = 0; i < Str.Length; i++) { Str[i] = "'" + Str[i] + "'"; } String MauSac = String.Join(",", Str).Insert(0, "["); MauSac = MauSac.Insert(MauSac.Length, "]"); //Console.WriteLine(MauSac); jsonString += "MauSac:" + MauSac + ","; break; case "Gia": String Gia = reader.ReadElementContentAsString(); jsonString += "Gia:" + "'" + Gia + "'"; jsonString += "}"; //Console.WriteLine(jsonString + "\n________________\n"); SmartPhone phone = JsonHelper.ToClass <SmartPhone>(jsonString); PhoneList.Add(phone); break; } } } }
public Engine() { this.smartphone = new SmartPhone(); }
public PhoneCustomer(IPhoneAbstractFactory factory, string phoneType) { smartPhone = factory.GetSmartPhone(phoneType); }
static void Main(string[] args) { Vendedora celulares = new Vendedora(); Vendedora pantallas = new Vendedora(); DataTable tabla = new DataTable("historialVentas"); SqlDataAdapter dA = new SqlDataAdapter(); SqlConnection conexion = new SqlConnection(Properties.Settings.Default.conexionBD); SmartPhone s = new SmartPhone(1, "Galaxy Core", 240, "Apple", ESistemaOperativo.iOS, EMemoria.GB32); Pantalla p1 = new Pantalla(1, "Monitor", 450, "Samsung", EPulgadas.P32, EResolucion.P1080); Pantalla p2 = new Pantalla(2, "Monitor", 450, "Samsung", EPulgadas.P32, EResolucion.P1080); SmartPhone s2 = new SmartPhone(1, "Galaxy Plus", 220, "Samsung", ESistemaOperativo.Android, EMemoria.GB16); Pantalla p3 = new Pantalla(1, "Television", 500, "LG", EPulgadas.P32, EResolucion.K4); celulares += s; celulares += s2; pantallas += p1; pantallas += p2; pantallas += p3; try { conexion.Open(); if (conexion.State == System.Data.ConnectionState.Open) { conexion.Close(); Console.WriteLine("Conexion realizada con exito"); } } catch (Exception e) { Console.WriteLine(e.Message); } try { tabla.Columns.Add("idVenta", typeof(int)); tabla.PrimaryKey = new DataColumn[] { tabla.Columns[0] }; tabla.Columns[0].AutoIncrement = true; tabla.Columns[0].AutoIncrementSeed = 1; tabla.Columns[0].AutoIncrementStep = 1; Console.WriteLine("Data table configurado con exito"); } catch (Exception e) { Console.WriteLine(e.Message); } try { conexion = new SqlConnection(Properties.Settings.Default.conexionBD); dA.SelectCommand = new SqlCommand("SELECT * FROM [BaseTP4].[dbo].[pantalla] ", conexion); dA.InsertCommand = new SqlCommand("INSERT INTO [BaseTP4].[dbo].[pantalla] (producto, marca, resolucion, pulgadas, precio) VALUES (@producto, @marca, @resolucion, @pulgadas, @precio)", conexion); dA.InsertCommand.Parameters.Add("@producto", SqlDbType.VarChar, 50, "producto"); dA.InsertCommand.Parameters.Add("@marca", SqlDbType.VarChar, 50, "marca"); dA.InsertCommand.Parameters.Add("@pulgadas", SqlDbType.VarChar, 50, "pulgadas"); dA.InsertCommand.Parameters.Add("@precio", SqlDbType.Float, 10, "precio"); dA.InsertCommand.Parameters.Add("@resolucion", SqlDbType.VarChar, 50, "resolucion"); Console.WriteLine("Data adapter configurado con exito"); } catch (Exception e) { Console.WriteLine(e.Message); } //Se intenta llenar la data table con los datos de la base de datos// // try { int i = dA.Fill(tabla); if (i != 0) { Console.WriteLine("Se cargo el data table con exito"); } } catch (Exception e) { Console.WriteLine(e.Message); } //Se intenta actualziar la base de datos a traves del data adapter con los datos de la tabla // try { dA.Update(tabla); Console.WriteLine("Datos actualizados con exito"); } catch (Exception e) { Console.WriteLine(e.Message); } //Se intenta la escritura y lectura de archivos txt y xml // if (pantallas.Guardar("pantallas.txt", pantallas.ToString())) { Console.WriteLine("Archivo creado con exito"); } else { Console.WriteLine("Error al crear el archivo"); } string datos; if (pantallas.Leer("pantallas.txt", out datos)) { Console.WriteLine(datos); } else { Console.WriteLine("Error al leer el archivo"); } Console.ReadKey(true); Console.Clear(); if (Vendedora.GuardarXml("SmartPhone.xml", pantallas)) { Console.WriteLine("Vendedora serealizada con exito"); } Vendedora v2 = new Vendedora(); v2 = Vendedora.LeerXml("SmartPhone.xml"); Console.WriteLine(v2.ToString()); Console.ReadKey(true); }