public FormatCompletionListener() { this._completed = new Command(this); SyncControls.Instance.PropertyChanged += new PropertyChangedEventHandler(this.OnDeviceChanged); this._device = SyncControls.Instance.CurrentDevice; this.SetCurrentDevice(); }
protected override void WriteDeviceInformation(TextWriter writer) { UIDevice device = UIDevice.CurrentDevice; writer.WriteLine("[{0}:\t{1} v{2}]", device.Model, device.SystemName, device.SystemVersion); writer.WriteLine("[Device Name:\t{0}]", device.Name); }
public DisplayPlatformInfoSap1Page () { InitializeComponent (); #if __IOS__ UIDevice device = new UIDevice(); modelLabel.Text = device.Model.ToString(); versionLabel.Text = String.Format("{0} {1}", device.SystemName, device.SystemVersion); #elif __ANDROID__ modelLabel.Text = String.Format("{0} {1}", Build.Manufacturer, Build.Model); versionLabel.Text = Build.VERSION.Release.ToString(); #elif WINDOWS_PHONE modelLabel.Text = String.Format("{0} {1}", DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName); versionLabel.Text = Environment.OSVersion.ToString(); #elif WINDOWS_APP || WINDOWS_PHONE_APP EasClientDeviceInformation devInfo = new EasClientDeviceInformation(); modelLabel.Text = String.Format("{0} {1}", devInfo.SystemManufacturer, devInfo.SystemProductName); versionLabel.Text = devInfo.OperatingSystem; #endif }
public WirelessStateResults StartOperation( UIDevice device, AOComplete completeFunc) { this.ResetState(); return(this.StartOperation(device, completeFunc, this._getConnectedNetworkStates)); }
public App() { // The root page of your application Label label = new Label { HorizontalTextAlignment = TextAlignment.Center, //Utilizando condicionais com Device.OS - Somente para Android ou outros BackgroundColor = Device.OS.Equals(TargetPlatform.Android) ? Color.White : Color.Red, //Utilizando Device.OnPlatforma<T>(T,T,T) TextColor = Device.OnPlatform <Color>(Color.Gray, Color.Green, Color.Blue) }; //Utilizando Condicionais de Compilação #if __ANDROID__ label.Text = $"Android API {Android.OS.Build.VERSION.Sdk}"; #elif __IOS__ UIDevice device = new UIDevice(); label.Text = $"{device.SystemName} {device.SystemVersion}"; #endif MainPage = new ContentPage { Content = new StackLayout { VerticalOptions = LayoutOptions.Center, Children = { label } } }; }
public void RegisterLogon(AccountInfo rd) { if (m_State != LogonState.LOGON_INIT) { return; } NormalAccountInfo ad = new NormalAccountInfo(); ad.UID = rd.UID; CL_Cmd_AccountRsg ncb = new CL_Cmd_AccountRsg(); ncb.SetCmdType(NetCmdType.CMD_CL_AccountRsg); ncb.AccountName = rd.UID; if (!NativeInterface.ComputeCrc(ad.UID, rd.PWD, out ad.CRC1, out ad.CRC2, out ad.CRC3)) { ncb.PasswordCrc1 = ad.CRC1; ncb.PasswordCrc2 = ad.CRC2; ncb.PasswordCrc3 = ad.CRC3; } ncb.MacAddress = UIDevice.GetMacAddress(); ncb.VersionID = ServerSetting.ClientVer; ncb.PlateFormID = (Byte)UIDevice.GetPlatformString(); ncb.PathCrc = ServerSetting.RES_VERSION; //发送命令 NetManager.Instance.Send <CL_Cmd_AccountRsg>(ncb); }
public void SendLogonHallData() { if (false) { /* NetCmdLogonHall ncl = new NetCmdLogonHall(); * ncl.SetCmdType(NetCmdType.CMD_LOGON_HALL); * ncl.CRC1 = GlobalLogon.Instance.AccountData.AccountInfo.CRC1; * ncl.CRC2 = GlobalLogon.Instance.AccountData.AccountInfo.CRC2; * ncl.CRC3 = GlobalLogon.Instance.AccountData.AccountInfo.CRC3; * ncl.UID = GlobalLogon.Instance.AccountData.AccountInfo.UID; * NetServices.Instance.Send<NetCmdLogonHall>(ncl);*/ } else { CL_Cmd_AccountOnlyID msgHall = new CL_Cmd_AccountOnlyID(); msgHall.SetCmdType(NetCmdType.CMD_CL_AccountOnlyID); msgHall.dwOnlyID = _mOnlyId; msgHall.dwUserID = _mUserId; msgHall.MacAddress = UIDevice.GetMacAddress(); //携带数据 msgHall.PlateFormID = (Byte)UIDevice.GetPlatformString(); int Witdh = GF.Resolution.GetScreenWidth(); msgHall.ScreenPoint = Convert.ToUInt32((Witdh << 16) + GF.Resolution.GetScreenHeight()); NetManager.Instance.Send <CL_Cmd_AccountOnlyID>(msgHall); } SetState(LogonState.LOGON_WAIT_HALL_RESULT); }
private void UpdateDeviceDependentPivots() { UIDevice currentDevice = SyncControls.Instance.CurrentDevice; if (this.NodesList.Contains(Applications)) { this.NodesList.Remove(Applications); } if (this.NodesList.Contains(Friends)) { this.NodesList.Remove(Friends); } if (this.NodesList.Contains(Channels)) { this.NodesList.Remove(Channels); } if (FeatureEnablement.IsFeatureEnabled(Features.eSocial) && currentDevice.SupportsUserCards) { this.NodesList.Add(Friends); } if (FeatureEnablement.IsFeatureEnabled(Features.eChannels) && currentDevice.SupportsChannels) { this.NodesList.Add(Channels); } if (!FeatureEnablement.IsFeatureEnabled(Features.eGames) || !currentDevice.SupportsSyncApplications) { return; } this.NodesList.Add(Applications); }
private void ProcessPhoneForWizard(UIDevice device) { if (this._deviceArrivalTimer != null) { this._deviceArrivalTimer.Stop(); } SingletonModelItem <UIDeviceList> .Instance.DeviceConnectedEvent -= new DeviceListEventHandler(this.OnDeviceConnected); SingletonModelItem <UIDeviceList> .Instance.AllowDeviceConnections = false; if (device.Class == DeviceClass.WindowsPhone && device.Relationship == DeviceRelationship.None && !device.RequiresAutoRestore) { if (device.SupportsOOBECompleted && !device.OOBECompleted) { SingletonModelItem <UIDeviceList> .Instance.HideDevice(device); DeviceManagement.ShowDeviceOOBEIncompleteDialog(); this.WizardType = FirstLaunchWizardType.Standard; } else { SingletonModelItem <UIDeviceList> .Instance.DeviceDisconnectedEvent += new DeviceListEventHandler(this.OnDeviceDisconnected); this.WizardType = FirstLaunchWizardType.PhoneFirstConnect; } } else { this.WizardType = FirstLaunchWizardType.Standard; } }
public void Logon(AccountInfo rd) { NormalAccountInfo ad = new NormalAccountInfo(); ad.UID = rd.UID; CL_Cmd_AccountLogon ncb = new CL_Cmd_AccountLogon(); ncb.SetCmdType(NetCmdType.CMD_CL_AccountLogon); ncb.AccountName = rd.UID; if (NativeInterface.ComputeCrc(ad.UID, rd.PWD, out ad.CRC1, out ad.CRC2, out ad.CRC3)) { ncb.PasswordCrc1 = ad.CRC1; ncb.PasswordCrc2 = ad.CRC2; ncb.PasswordCrc3 = ad.CRC3; } accountInfo = rd; ncb.VersionID = ServerSetting.ClientVer; ncb.PlateFormID = (Byte)UIDevice.GetPlatformString(); ncb.PathCrc = ServerSetting.RES_VERSION; ncb.MacAddress = UIDevice.GetMacAddress(); Debug.Log("发送登录......"); //发送命令 NetManager.Instance.Send <CL_Cmd_AccountLogon>(ncb); return; }
public WirelessStateResults StartOperation( UIDevice device, AOComplete completeFunc) { this.ResetState(); return(this.StartOperation(device, completeFunc, this._getDeviceProfileStates)); }
public WirelessStateResults StartOperation( UIDevice device, AOComplete completeFunc) { this.ResetState(); return this.StartOperation(device, completeFunc, this._getNetworkListStates); }
public SeriesSettings(SubscriptionManager subscriptionManager, int seriesId) { this.m_subscriptionManager = subscriptionManager; this.m_seriesId = seriesId; this.m_device = SyncControls.Instance.CurrentDevice; this.keepEpisodesOriginalValue = (uint)ClientConfiguration.Series.PodcastDefaultKeepEpisodes; this.playbackOrderOriginalValue = (ESeriesPlaybackOrder)ClientConfiguration.Series.PodcastDefaultPlaybackOrder; this.m_subscriptionManager.GetManagementSettings(this.m_seriesId, out this.keepEpisodesOriginalValue, out this.playbackOrderOriginalValue); this.m_keepEpisodesChoice = new Choice(this); this.m_keepEpisodesChoice.Options = NamedIntOption.PodcastKeepOptions; NamedIntOption.SelectOptionByValue(this.m_keepEpisodesChoice, (int)this.keepEpisodesOriginalValue); this.m_playbackChoice = new Choice(this); this.m_playbackChoice.Options = NamedIntOption.PodcastPlaybackOptions; NamedIntOption.SelectOptionByValue(this.m_playbackChoice, (int)this.playbackOrderOriginalValue); this.m_syncChoice = new Choice(this); this.m_syncChoice.Options = NamedIntOption.PodcastSyncOptions; if (this.m_device.IsValid) { this.syncRuleOriginalValue = this.m_device.GetPodcastSyncLimit(this.m_seriesId); NamedIntOption.SelectOptionByValue(this.m_syncChoice, (int)this.syncRuleOriginalValue); } this.m_keepEpisodesChoicePerPhone = new Choice(this); this.m_keepEpisodesChoicePerPhone.Options = NamedIntOption.PodcastKeepOptions; if (!this.m_device.IsValid) { return; } this.keepEpisodesPerPhoneOriginalValue = this.m_device.GetPodcastSyncLimitWithValue(this.m_seriesId); NamedIntOption.SelectOptionByValue(this.m_keepEpisodesChoicePerPhone, this.keepEpisodesPerPhoneOriginalValue); }
protected WirelessStateResults StartOperation( UIDevice device, AOComplete completeFunc, WirelessStates[] states) { WirelessStateResults result = WirelessStateResults.Error; if (!this.Idle) { return(WirelessStateResults.NotAvailable); } this.ResetState(); this._device = device; this._states = states; this._completeFunc = completeFunc; _iCurrentState = 0; if (device.IsConnectedToClient) { this.AddListenersInternal(); result = this.DoNextStep(); } if (result != WirelessStateResults.Success) { this.EndOperationInternal(result); } return(WirelessStateResults.Success); }
public void Battery() { UIDevice device = UIDevice.CurrentDevice; Assert.False(device.BatteryMonitoringEnabled, "false"); Assert.That(device.BatteryState, Is.EqualTo(UIDeviceBatteryState.Unknown), "false/Unknown"); Assert.That(device.BatteryLevel, Is.EqualTo(-1), "false/-1"); device.BatteryMonitoringEnabled = true; try { if (Runtime.Arch == Arch.SIMULATOR) { Assert.That(device.BatteryState, Is.EqualTo(UIDeviceBatteryState.Unknown), "true/Unknown"); Assert.That(device.BatteryLevel, Is.EqualTo(-1), "true/-1"); } else { Assert.That(device.BatteryState, Is.Not.EqualTo(UIDeviceBatteryState.Unknown), "true/Unknown"); Assert.That(device.BatteryLevel, Is.Not.EqualTo(-1), "true/-1"); } } finally { device.BatteryMonitoringEnabled = false; } }
public static string GetInfo() { UIDevice device = new UIDevice(); return(String.Format("Modelo={0}, Sistema={1}, Versão={2}", device.Model, device.SystemName, device.SystemVersion)); }
public SettingsBase() { UIDevice device = UIDevice.CurrentDevice; //Calculate Device and IsIPad string model = device.Model; if (string.IsNullOrEmpty(model)) { Device = DeviceType.iPhone; } else if (model.Contains("iPad")) { Device = DeviceType.iPad; } else if (model.Contains("iPod")) { Device = DeviceType.iPod; } else { Device = DeviceType.iPhone; } IsMultitaskingSupported = device.IsMultitaskingSupported; //Load defaults Defaults = NSUserDefaults.StandardUserDefaults; Defaults.Init(); Defaults.LoadDefaults(); }
// // 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 window = new UIWindow(UIScreen.MainScreen.Bounds); // Get the device object device = UIDevice.CurrentDevice; // Tell it to start monitoring the accelerometer for orientation device.BeginGeneratingDeviceOrientationNotifications(); device.ProximityMonitoringEnabled = true; // Get the notification center for the app NSNotificationCenter nc = NSNotificationCenter.DefaultCenter; // Add this as an observer nc.AddObserver(this, new Selector("orientationChanged:"), null, device); nc.AddObserver(this, new Selector("proximity:"), null, device); // If you have defined a root view controller, set it here: hvc = new HeavyViewController(); hvc.View.BackgroundColor = UIColor.White; window.RootViewController = hvc; // make the window visible window.MakeKeyAndVisible(); return(true); }
public PlatInfoSap1Page() { InitializeComponent(); #if __IOS__ UIDevice device = new UIDevice(); modelLabel.Text = device.Model.ToString(); versionLabel.Text = String.Format("{0} {1}", device.SystemName, device.SystemVersion); #elif __ANDROID__ modelLabel.Text = String.Format("{0} {1}", Build.Manufacturer, Build.Model); versionLabel.Text = Build.VERSION.Release.ToString(); #elif WINDOWS_PHONE modelLabel.Text = String.Format("{0} {1}", DeviceStatus.DeviceManufacturer, DeviceStatus.DeviceName); versionLabel.Text = Environment.OSVersion.ToString(); #elif WINDOWS_APP || WINDOWS_PHONE_APP EasClientDeviceInformation devInfo = new EasClientDeviceInformation(); modelLabel.Text = String.Format("{0} {1}", devInfo.SystemManufacturer, devInfo.SystemProductName); versionLabel.Text = devInfo.OperatingSystem; #elif WINDOWS_UWP EasClientDeviceInformation devInfo = new EasClientDeviceInformation(); modelLabel.Text = String.Format("{0} {1}", devInfo.SystemManufacturer, devInfo.SystemProductName); versionLabel.Text = devInfo.OperatingSystem; #endif }
// // 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 window = new UIWindow(UIScreen.MainScreen.Bounds); // Get the device object device = UIDevice.CurrentDevice; // Tell it to start monitoring the accelerometer for orientation device.BeginGeneratingDeviceOrientationNotifications(); device.ProximityMonitoringEnabled = true; // Get the notification center for the app NSNotificationCenter nc = NSNotificationCenter.DefaultCenter; // Add this as an observer nc.AddObserver(this, new Selector("orientationChanged:"), null, device); nc.AddObserver(this, new Selector("proximity:"), null, device); // If you have defined a root view controller, set it here: hvc = new HeavyViewController(); hvc.View.BackgroundColor = UIColor.White; window.RootViewController = hvc; // make the window visible window.MakeKeyAndVisible(); return true; }
/// <summary> /// Creates an instance of an object that allows the caller app to retrieve device information from the local device. /// </summary> public EasClientDeviceInformation() { #if __IOS__ || __TVOS__ _device = UIDevice.CurrentDevice; #elif WINDOWS_UWP || WINDOWS_APP || WINDOWS_PHONE_APP _deviceInformation = new Windows.Security.ExchangeActiveSyncProvisioning.EasClientDeviceInformation(); #endif }
public void HideDevice(UIDevice device) { if (!this.IsListReady) { return; } this._deviceList.HideDevice(this._uiToDeviceMap[device]); }
public IosDeviceInfo() { UIDevice device = UIDevice.CurrentDevice; Model = device.Model; FamilyType = GetDeviceFamilyType(device); Identifier = new Guid(device.IdentifierForVendor.AsString().ConvertToGuidString()); }
public void CurrentDevice() { UIDevice device = UIDevice.CurrentDevice; // under iOS 5.1 some API (mobileDevice on client) stopped reporting the identifier // this will warn us then this API "fails" too Assert.NotNull(device.UniqueIdentifier, "UniqueIdentifier"); }
public IosPlatformInfo() { UIDevice device = UIDevice.CurrentDevice; OsName = device.SystemName; OsVersion = new Version(device.SystemVersion); OsVersionSimple = float.Parse($"{OsVersion.Major}.{OsVersion.Minor}", NumberStyles.Float, CultureInfo.InvariantCulture); }
void ShowBatteryInfo() { UIDevice device = UIDevice.CurrentDevice(); device.batteryMonitoringEnabled = true; // need to enable this first Log("Battery state: " + device.batteryState); Log("Battery level: " + device.batteryLevel); }
static PowerManager() { _device = UIDevice.CurrentDevice; _isSimulator = _device.Model? .Contains( DeviceModelSimulator, StringComparison.InvariantCultureIgnoreCase) == true; _device.BatteryMonitoringEnabled = !_isSimulator; }
public PlatformInformationModel GetCurrentInformation() { UIDevice device = new UIDevice(); return(new PlatformInformationModel() { Model = $"{device.Model}", Version = $"{device.SystemName} {device.SystemVersion}" }); }
public MainPage() { InitializeComponent(); #if __IOS__ UIDevice devide = new UIDevice(); lblInfo.Text = devide.Model; #elif __ANDROID__ lblInfo.Text = Build.Manufacturer; #endif }
/// <summary> /// 获取电量 /// </summary> /// <returns></returns> public string GetBatteryMoniter() { UIDevice pDevice = UIDevice.CurrentDevice; pDevice.BatteryMonitoringEnabled = true; // 取正,防止负值出现 float electricity = Math.Abs(pDevice.BatteryLevel); return((electricity * 100).ToString("0.00") + "%"); }
protected override Installation CreateInstallation(PushConfig pushConfig) { var device = new UIDevice(); return new Installation { alias = pushConfig.Alias, categories = pushConfig.Categories, operatingSystem = device.SystemName, osVersion = device.SystemVersion }; }
public static float GetDeviceMargin(this UIDevice device) { if (device.IsPhone()) { return(3); } else { return(7); } }
public static float GetIndentation(this UIDevice device) { if (device.IsPhone()) { return(10); } else { return(40); } }
public iOSDevice(UIDevice device, UIWebView webView, ConnectionType connType, string connString) : base(connType, connString, new JsonProvider()) { _device = device; Browser = new iOSBrowser(webView); DeviceInfo = new DeviceInfo(); DeviceInfo.MobileOs = MobileOs.iOS; DeviceInfo.OsVersion = _device.SystemVersion; DeviceInfo.DeviceModel = _device.Model; DeviceInfo.UniqueId = _device.IdentifierForVendor.ToString(); DeviceInfo.IP = IP; }
public override void ViewDidLoad() { base.ViewDidLoad(); device = UIDevice.CurrentDevice; b1count = 0; b2count = 0; b3count = 0; // Perform any additional setup after loading the view, typically from a nib. slider.AutoresizingMask = (UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleWidth); image.AutoresizingMask = (UIViewAutoresizing.FlexibleDimensions | UIViewAutoresizing.FlexibleMargins); btn1.AutoresizingMask = (UIViewAutoresizing.FlexibleRightMargin | UIViewAutoresizing.FlexibleTopMargin); btn2.AutoresizingMask = (UIViewAutoresizing.FlexibleLeftMargin | UIViewAutoresizing.FlexibleTopMargin); btn3.AutoresizingMask = (UIViewAutoresizing.FlexibleTopMargin | UIViewAutoresizing.FlexibleBottomMargin | UIViewAutoresizing.FlexibleRightMargin); btn1.TouchUpInside += (sender, e) => { Console.WriteLine("Button btn1 clicked"); btn1.SetTitle("btn " + ++b1count + " clicks", UIControlState.Normal); }; btn2.TouchUpInside += (sender, e) => { Console.WriteLine("Button btn2 clicked"); btn2.SetTitle("btn " + ++b2count + " clicks", UIControlState.Normal); }; btn3.TouchUpInside += (sender, e) => { Console.WriteLine("Button btn3 clicked"); btn3.SetTitle("btn " + ++b3count + " clicks", UIControlState.Normal); }; imageSize = image.Bounds; slider.Value = 1; slider.ValueChanged += (sender, e) => { Console.WriteLine("slider value: {0}", slider.Value); if (device.Orientation == UIDeviceOrientation.LandscapeLeft || device.Orientation == UIDeviceOrientation.LandscapeRight) image.Bounds = new RectangleF(imageSize.X, imageSize.Y, imageSize.Width * 0.66f * slider.Value, imageSize.Height * 0.66f * slider.Value); else image.Bounds = new RectangleF(imageSize.X, imageSize.Y, imageSize.Width * slider.Value, imageSize.Height * slider.Value); }; }