Пример #1
0
        public void SmartPhoneInitTest()
        {
            var smartPhone = new SmartPhone(new Apps(), new PhoneInfo("089947521", "Sumsang S8", 400, 800),
                                            new Contacts());

            smartPhone.InstallApp("GoogleDrive");
            smartPhone.LaunchApp("GoogleDrive");
            smartPhone.AddContact("TestName");
            smartPhone.GetScreenPixel();
            smartPhone.GetModel();
        }
Пример #2
0
        public void SmartPhoneBeforeTest()
        {
            var phone = new Phone();

            phone.InstallApp();
            Assert.NotNull(phone);

            var smartPhone = new SmartPhone();

            smartPhone.InstallApp();
            Assert.NotNull(smartPhone);

            var featurePhone = new FeaturePhone();

            featurePhone.InstallApp();
            Assert.NotNull(smartPhone);
        }
Пример #3
0
        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);
        }