Пример #1
0
        internal void LoadConfiguration()
        {
            model    = new MobilesModel();
            platform = new MobilePlatform();
            Mobile defaultMobile = new Mobile("Nokia 3311")
            {
                Display = new Display(300, 300)
            };

            defaultMobile.MobileApps.Add(new MessageApp());
            defaultMobile.MobileApps.Add(new ContactApp());
            defaultMobile.MobileApps.Add(new SettingApp());
            defaultMobile.MobileApps.Add(new CallApp());
            defaultMobile.MobileApps.Add(new LoggerApp());
            defaultMobile.MobileApps.Add(new BrowserApp());
            Mobile secondMobile = new Mobile("Nokia 110")
            {
                Display         = new Display(300, 300),
                BackgroundColor = Brushes.CadetBlue
            };

            secondMobile.MobileApps.Add(new MessageApp());
            secondMobile.MobileApps.Add(new ContactApp());
            secondMobile.MobileApps.Add(new SettingApp());
            secondMobile.MobileApps.Add(new CallApp());
            secondMobile.MobileApps.Add(new LoggerApp());
            model.Mobiles.Add(defaultMobile);
            model.Mobiles.Add(secondMobile);
            MobileList.ItemsSource = model.Mobiles.Items;
        }
Пример #2
0
        public async Task Register(MobilePlatform platform, string handle, string registrationId, IEnumerable <string> tags)
        {
            var hub = _factory.NotificationHubClient;
            RegistrationDescription registration = null;

            switch (platform)
            {
            case MobilePlatform.Windows:
                registration = new WindowsRegistrationDescription(handle);
                break;

            case MobilePlatform.Apple:
                registration = new AppleRegistrationDescription(handle);
                break;

            case MobilePlatform.Android:
                registration = new FcmRegistrationDescription(handle);
                break;
            }

            registration.RegistrationId = registrationId;
            registration.Tags           = new HashSet <string>(tags ?? Enumerable.Empty <string>());

            try
            {
                await hub.CreateOrUpdateRegistrationAsync(registration);
            }
            catch (MessagingException exception)
            {
                _logger.LogError(exception, "Unhandled exception was thrown during registration in Azure Notification Hub");
                throw;
            }
        }
Пример #3
0
        public string SaveToken(string refreshedToken)
        {
            MobilePlatform platform = MobilePlatform.gcm;

            if (Device.RuntimePlatform == Device.Android)
            {
                platform = MobilePlatform.gcm;
            }
            if (Device.RuntimePlatform == Device.iOS)
            {
                platform = MobilePlatform.apns;
            }


            var deviceUpdate = new DeviceRegistration()
            {
                Handle   = refreshedToken,
                Platform = platform,
                Tags     = new string[1] {
                    refreshedToken
                },
                DeviceId = CrossDeviceInfo.Current.Id
            };

            Device.BeginInvokeOnMainThread(async() =>
            {
                await plantService.EnablePushNotifications(refreshedToken, deviceUpdate);
            });
            return("refreshedToken");
        }
Пример #4
0
        public MobilePlatform FindMobilePlatformByName(string mobilePlatformName)
        {
            MobilePlatform f1 = _context.MobilePlatforms.Where(x => x.MobilePlatformName.ToUpper().StartsWith(mobilePlatformName.ToUpper())).FirstOrDefault();
            MobilePlatform f2 = (from cf in _context.MobilePlatforms
                                 where cf.MobilePlatformName.ToUpper().StartsWith(mobilePlatformName.ToUpper())
                                 select cf).FirstOrDefault();

            return(f2);
        }
        private bool TryExtractPlatform(out MobilePlatform platform)
        {
            var regex = new Regex("(?<windows>windows)|(?<apple>ipad|iphone|mac os)|(?<android>android)", RegexOptions.IgnoreCase);
            var match = regex.Match(Request.Headers["User-Agent"].ToString()).Groups.Values
                        .Where(m => m.Success && m.Name.Length > 1)
                        .Select(m => m.Name)
                        .FirstOrDefault();

            return(Enum.TryParse(match, out platform));
        }
Пример #6
0
    public void Init(MobilePlatform platform)
    {
        _bt = GetComponent <BehaviorTree>();

        SharedGameObject gameObject = (SharedGameObject)_bt.GetVariable("gameObject");

        gameObject.Value = platform.gameObject;

        _bt.enabled = true;
    }
        private RegistrationDescription BuildPlatformSpecific(MobilePlatform platform, string handle)
        {
            switch (platform)
            {
            case MobilePlatform.Apns:
                return(new AppleRegistrationDescription(handle));

            case MobilePlatform.Fcm:
                return(new FcmRegistrationDescription(handle));

            default:
                return(null);
            }
        }
Пример #8
0
    void Start()
    {
        ID = (uint)defaultID;
        gearType = "MobilePlatformGear";

        platform = gameObject.transform.parent.gameObject.GetComponent<MobilePlatform>();
        avatars = new List<Transform>();

        //triggleEnable = true;
        //stateOne = false;

        isFirstIn = true;

        AddListeners();
    }
Пример #9
0
    void Start()
    {
        ID       = (uint)defaultID;
        gearType = "MobilePlatformGear";

        platform = gameObject.transform.parent.gameObject.GetComponent <MobilePlatform>();
        avatars  = new List <Transform>();

        //triggleEnable = true;
        //stateOne = false;

        isFirstIn = true;

        AddListeners();
    }
Пример #10
0
    private void AllButtonEvent()
    {
        transform.FindOnButton("CopyButton", CopyInputFieldText);
        transform.FindOnButton("PasteButton", PasteInputFieldText);
        transform.FindOnButton("btnIsOpenGPS", () =>
        {
            m_txtAll.text = $"是否打开了定位:{MobilePlatform.IsOpenGPS()}";
        });
        transform.FindOnButton("btnOpenGPS", OpenGPS);
        transform.FindOnButton("btnOpenImage", GetPhotosImage);
        transform.FindOnButton("btnOpenUri", OpenUri);
        transform.FindOnButton("btnOpenCamera", OpenCamera);

        transform.FindOnButton("btnSetWeChat", () =>
        {
            MobilePlatform.SetIWXAPI();
        });

        transform.FindOnButton("btnShowHand", () =>
        {
            if (!string.IsNullOrEmpty(WeChat.UnionID.headimgurl))
            {
                StartCoroutine(MobilePlatform.SelectPhotos(WeChat.UnionID.headimgurl, null));
            }
        });

        transform.FindOnButton("btnLoginWeChat", () =>
        {
            MobilePlatform.SendReqWXLogin();
        });

        //transform.FindOnButton("btnLoginWeChat", () =>
        //{
        //    MobilePlatform.SendReqWXPay(null);
        //});

        transform.FindOnButton("btnShareText", () =>
        {
            MobilePlatform.SendReqWXShare(new WXShare()
            {
                type        = (int)WXShareType.ShareText,
                scene       = (int)WXShareScene.分享给好友,
                title       = "测试",
                description = "发达史蒂芬阿萨德股份阿萨德gas的gbdds",
            });
        });
    }
Пример #11
0
 public void AddMobilePlatform(MobilePlatform mp)
 {
     _context.MobilePlatforms.Add(mp);
 }
Пример #12
0
 /// <summary>
 /// 将拷贝的内容粘贴到Text
 /// </summary>
 private void PasteInputFieldText()
 {
     m_txtAll.text = MobilePlatform.GetCopyText();
 }
Пример #13
0
 /// <summary>
 /// 拷贝输入框里的内容
 /// </summary>
 private void CopyInputFieldText()
 {
     MobilePlatform.SaveCopyText(m_Content.text);
 }
Пример #14
0
 private void OpenCamera()
 {
     MobilePlatform.GetTakePhotos(TempImg, "打开摄像头拍照并返回");
 }
Пример #15
0
 private void OpenUri()
 {
     MobilePlatform.OpenHttpUri(m_Content.text);
 }
Пример #16
0
 private void GetPhotosImage()
 {
     MobilePlatform.GetPhotosOne(TempImg, "是否选取相册中的一张图片");
 }
Пример #17
0
 private void OpenGPS()
 {
     MobilePlatform.GotoSettingGPS(null);
 }