コード例 #1
0
ファイル: DeviceApp.cs プロジェクト: xtremal/SimplyMobile
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            this.window = new UIWindow(UIScreen.MainScreen.Bounds);

            // If you have defined a root view controller, set it here:
            this.controller = new MainViewController();

            this.window.RootViewController = this.controller;

            // make the window visible
            this.window.MakeKeyAndVisible();
            DependencyResolver.Current.RegisterService <IDevice>(t => AppleDevice.CurrentDevice());
            DependencyResolver.Current.RegisterService <ISQLitePlatform, SQLitePlatformIOS>();
            DependencyResolver.Current.RegisterService <IPhone, PhoneImplementation> ();
            this.OnStart();

            Resolver.GetService <StoreAccelerometerData>().Start();
            Resolver.GetService <StoreLocationChange> ().Start();

            var device = Resolver.GetService <IDevice> ();

            System.Diagnostics.Debug.WriteLine(string.Format("Device {0} a phone.", device.Phone != null ? "is" : "is not"));
            System.Diagnostics.Debug.WriteLine(device.Screen);
            System.Diagnostics.Debug.WriteLine(device.Name);
            System.Diagnostics.Debug.WriteLine(device.HardwareVersion);
            System.Diagnostics.Debug.WriteLine(device.FirmwareVersion);
            return(true);
        }
コード例 #2
0
ファイル: Mappings.cs プロジェクト: formist/LinkMe
 internal static void MapTo(this AppleDevice device, UserAppleDeviceEntity entity)
 {
     entity.id          = device.Id;
     entity.ownerId     = device.OwnerId;
     entity.deviceToken = device.DeviceToken;
     entity.active      = device.Active;
 }
コード例 #3
0
        public ActionResult RegisterDevice(string deviceToken)
        {
            try
            {
                // strip spaces and brackets
                var deviceTokenToStore = deviceToken.Replace(" ", string.Empty).Replace("<", string.Empty).Replace(">",
                                                                                                                   string.Empty);

                var employer = CurrentEmployer;
                var devices  = _appleDevicesQuery.GetDevices(employer.Id);

                if (devices == null || devices.Count == 0 || !devices.Select(s => s.DeviceToken).Contains(deviceTokenToStore))
                {
                    var newDevice = new AppleDevice
                    {
                        OwnerId     = employer.Id,
                        Active      = true,
                        DeviceToken = deviceTokenToStore,
                    };

                    _appleDevicesCommand.CreateDevice(newDevice);
                }
            }
            catch (UserException ex)
            {
                ModelState.AddModelError(ex, new StandardErrorHandler());
            }

            return(Json(new JsonResponseModel()));
        }
コード例 #4
0
        private void CreateDevice(AppleDevice device)
        {
            device.Prepare();
            device.Validate();

            _repository.CreateUserAppleDevice(device);
        }
コード例 #5
0
 public void MoveToAppleLepTop()
 {
     if (AppleDevice.Displayed)
     {
         AppleDevice.Click();
     }
 }
コード例 #6
0
        private void RegisterDevice(Guid employerId, string deviceToken)
        {
            if (string.IsNullOrEmpty(deviceToken))
            {
                return;
            }

            // strip spaces and brackets
            var deviceTokenToStore = deviceToken.Replace(" ", string.Empty).Replace("<", string.Empty).Replace(">",
                                                                                                               string.Empty);

            var devices = _appleDevicesQuery.GetDevices(employerId).Select(s => s.DeviceToken);

            if (devices.Contains(deviceTokenToStore))
            {
                return;
            }

            var newDevice = new AppleDevice
            {
                OwnerId     = employerId,
                Active      = true,
                DeviceToken = deviceTokenToStore,
            };

            _appleDevicesCommand.CreateDevice(newDevice);
        }
コード例 #7
0
ファイル: Mappings.cs プロジェクト: formist/LinkMe
        internal static UserAppleDeviceEntity Map(this AppleDevice device)
        {
            var entity = new UserAppleDeviceEntity();

            device.MapTo(entity);

            return(entity);
        }
コード例 #8
0
        void IAppleDevicesRepository.CreateUserAppleDevice(AppleDevice userDevice)
        {
            using (var dc = CreateContext())
            {
                dc.UserAppleDeviceEntities.InsertOnSubmit(userDevice.Map());

                dc.SubmitChanges();
            }
        }
コード例 #9
0
        protected AppleDevice CreateDevice(Guid ownerId, string deviceToken)
        {
            var device = new AppleDevice {
                Active = true, DeviceToken = "BogusDeviceToken", OwnerId = ownerId
            };

            _appleDevicesCommand.CreateDevice(device);

            return(device);
        }
コード例 #10
0
 void IAppleDevicesRepository.UpdateUserAppleDevice(AppleDevice userDevice)
 {
     using (var dc = CreateContext())
     {
         var entity = GetUserAppleDeviceEntityQuery(dc, userDevice.Id);
         if (entity != null)
         {
             userDevice.MapTo(entity);
             dc.SubmitChanges();
         }
     }
 }
コード例 #11
0
        static void Main(string[] args)
        {
            var winDevice = new WindowsDevice(new MicrosoftAccount("1234", "nadiac"), new WindowsStore());

            winDevice.LogIntoAppStore();
            winDevice.ResetUserPassword();
            foreach (var result in winDevice.SearchForApp("notepad"))
            {
                Console.WriteLine(result);
            }

            Console.WriteLine();

            var appleDevice = new AppleDevice();

            appleDevice.LogIntoAppStore();
            appleDevice.ResetUserPassword();
            foreach (var result in appleDevice.SearchForApp("texteditor"))
            {
                Console.WriteLine(result);
            }
        }
コード例 #12
0
        private void RegisterDevice()
        {
            var deviceInfo = AppleDevice.GetDeviceInfo();

            switch (deviceInfo.Type)
            {
            case DeviceType.Phone:
                DependencyService.Register <IDevice, Phone>();
                break;

            case DeviceType.Pad:
                DependencyService.Register <IDevice, Pad>();

                break;

            case DeviceType.Pod:
                DependencyService.Register <IDevice, Pod>();
                break;

            default:
                DependencyService.Register <IDevice, Simulator>();
                break;
            }
        }
コード例 #13
0
ファイル: Program.cs プロジェクト: ramypunna/demo1
        public void CallDeviceMethods()
        {
            IRivicDevice objrivicDevice = new AppleDevice();

            objrivicDevice.DisplayStatus();
        }
コード例 #14
0
        private void UpdateDevice(AppleDevice device)
        {
            device.Validate();

            _repository.UpdateUserAppleDevice(device);
        }
コード例 #15
0
 void IAppleDevicesCommand.UpdateDevice(AppleDevice device)
 {
     UpdateDevice(device);
 }
コード例 #16
0
 void IAppleDevicesCommand.CreateDevice(AppleDevice device)
 {
     CreateDevice(device);
 }