示例#1
0
        public async Task <ServerDescriptor> RegisterDeviceAsync(UserClientDescriptor descriptor)
        {
            var result = await RemoteUserService.RegisterDeviceAsync(descriptor.GetUserClientrDescriptorDC());

            this.Close();
            return(result.GetServerDescriptor());
        }
示例#2
0
        public async Task <ServerDescriptor> GetServerDiscriptorAsync(UserClientDescriptor descriptor)
        {
            var serverDescriptor = (await RemoteUserService.GetServerDescriptorAsync(descriptor.GetUserClientrDescriptorDC()))
                                   .GetServerDescriptor();

            this.Close();
            return(serverDescriptor);
        }
示例#3
0
 public static UserClientDescriptorDataContract GetUserClientrDescriptorDC(this UserClientDescriptor descriptor)
 {
     return(new UserClientDescriptorDataContract()
     {
         DeviceId = descriptor.DeviceId,
         OperatingSystem = descriptor.OperatingSystem,
         FriendlyName = descriptor.FriendlyName,
         SystemFirmwareVersion = descriptor.SystemFirmwareVersion,
         SystemHardwareVersion = descriptor.SystemFirmwareVersion,
         SystemManufacturer = descriptor.SystemManufacturer,
         SystemProductName = descriptor.SystemProductName,
         SystemSku = descriptor.SystemSku,
         PaasteelVersion = descriptor.PaasteelVersion,
         AutomaticUpdateEnabled = descriptor.AutomaticUpdateEnabled,
         CpuArchitecture =
             descriptor.ProcessorArchitecture == ProcessorArchitecture.Arm ? CpuArchitecture.Arm :
             (descriptor.ProcessorArchitecture == ProcessorArchitecture.X86 ? CpuArchitecture.X86 : CpuArchitecture.X64),
     });
 }
示例#4
0
        public async Task <ServerDescriptor> RegisterDeviceAsync()
        {
            try {
                var device     = LocalDeviceInfo.GetDeviceInfo();
                var descriptor = new UserClientDescriptor()
                {
                    DeviceId               = device.DeviceId,
                    OperatingSystem        = device.OperatingSystem,
                    FriendlyName           = device.FriendlyName,
                    SystemFirmwareVersion  = device.SystemFirmwareVersion,
                    SystemHardwareVersion  = device.SystemFirmwareVersion,
                    SystemManufacturer     = device.SystemManufacturer,
                    SystemProductName      = device.SystemProductName,
                    SystemSku              = device.SystemSku,
                    ProcessorArchitecture  = device.ProcessorArchitecture,
                    PaasteelVersion        = CurrentApplication.Version.ToString(),
                    AutomaticUpdateEnabled = SettingManager.AutomaticallyUpdateCurrentApp,
                };
                ServerDescriptor = await _userService.RegisterDeviceAsync(descriptor);
            }
            catch {
                ServerDescriptor = null;
            }
            IsDeviceRegistered = ServerDescriptor != null ? true : false;

            // Raise events
            if (IsDeviceRegistered && DeviceRegistered != null)
            {
                DeviceRegistered(ServerDescriptor);
            }
            if (!IsDeviceRegistered && DeviceRegisterationFailed != null)
            {
                DeviceRegisterationFailed();
            }

            return(ServerDescriptor);
        }
 public static UserClientDescriptorDataContract GetUserClientrDescriptorDC(this UserClientDescriptor discriptor)
 {
     return(new UserClientDescriptorDataContract()
     {
     });
 }