protected void CreateInputDevices(Control target) { // create keyboard device. keyboard = new Device(SystemGuid.Keyboard); if (keyboard == null) { throw new Exception("No keyboard found."); } // create mouse device. mouse = new Device(SystemGuid.Mouse); if (mouse == null) { throw new Exception("No mouse found."); } // set cooperative level. keyboard.SetCooperativeLevel(target, CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background); mouse.SetCooperativeLevel(target, CooperativeLevelFlags.NonExclusive | CooperativeLevelFlags.Background); // Acquire devices for capturing. keyboard.Acquire(); mouse.Acquire(); }
public RenderObjectODF(odfParser parser, HashSet<int> meshIDs) { HighlightSubmesh = new SortedSet<int>(); highlightMaterial = new Material(); highlightMaterial.Ambient = new Color4(1, 1, 1, 1); highlightMaterial.Diffuse = new Color4(1, 0, 1, 0); this.device = Gui.Renderer.Device; Textures = new Texture[parser.TextureSection != null ? parser.TextureSection.Count : 0]; TextureDic = new Dictionary<int, int>(parser.TextureSection != null ? parser.TextureSection.Count : 0); Materials = new Material[parser.MaterialSection.Count]; BoneMatrixDic = new Dictionary<string, Matrix>(); rootFrame = CreateHierarchy(parser, meshIDs, device, out meshFrames); AnimationController = new AnimationController(numFrames, 30, 30, 1); Frame.RegisterNamedMatrices(rootFrame, AnimationController); for (int i = 0; i < meshFrames.Count; i++) { if (i == 0) { Bounds = meshFrames[i].Bounds; } else { Bounds = BoundingBox.Merge(Bounds, meshFrames[i].Bounds); } } }
public void RenderFace(Device device) { device.Border = new Border() { Thickness = 1, FooterHeight = 0, HeaderHeight = 0 }; string time = (device.Time.HourMinute + " " + device.Time.AMPM).ToLower(); device.Painter.PaintCentered(time, device.Digital20, Color.White); }
public AudioMixerPlayerOperativeControl(Device device, IPlayerCommand playerProvider, IEventLogging logging) : this() { _countSwitch = 0; InitializeController(new AudioMixerPlayerController(device, playerProvider, this, logging)); SetControlPlayerTimerEnable(true, 3000); }
public Model Load(string file, Device device) { XmlDocument document = new XmlDocument(); document.Load(file); XmlNamespaceManager ns = new XmlNamespaceManager(document.NameTable); ns.AddNamespace("c", "http://www.collada.org/2005/11/COLLADASchema"); // Read vertex positions var positionsNode = document.SelectSingleNode("/c:COLLADA/c:library_geometries/c:geometry/c:mesh/c:source/c:float_array", ns); var indicesNode = document.SelectSingleNode("/c:COLLADA/c:library_geometries/c:geometry/c:mesh/c:triangles/c:p", ns); var positions = ParseVector3s(positionsNode.InnerText).ToArray(); var indices = ParseInts(indicesNode.InnerText).ToArray(); // Mixing concerns here, but oh well var model = new Model() { VertexBuffer = Buffer.Create(device, BindFlags.VertexBuffer, positions), IndexBuffer = Buffer.Create(device, BindFlags.IndexBuffer, indices), IndexCount = indices.Length, VertexPositions = positions, Indices = indices }; return model; }
public Form1() { InitializeComponent(); //set form title this.Text += " " + Application.ProductVersion; //set worker thread properties backgroundWorkerGetLineData.WorkerSupportsCancellation = true; backgroundWorkerGetLineData.WorkerReportsProgress = true; //load embedded xml profiles _profiles = ProfileUtils.loadEmbeddedProfiles(); //do live update, update profiles backgroundWorkerLiveUpdate.RunWorkerAsync(); //load settings if saved ToolSettings settings = SettingsUtils.loadSettings(); if (settings != null) { _selectedModem = settings.Device; textBoxIpAddress.Text = settings.Host; textBoxUsername.Text = settings.Username; textBoxPassword.Text = settings.Password; checkBoxSave.Checked = true; setSelectedDevice(); } else { //detect device backgroundWorkerDetectDevice.RunWorkerAsync(); checkBoxSave.Checked = false; } }
public TgcDrawText(Device d3dDevice) { textSprite = new Sprite(d3dDevice); //Fuente default dxFont = new Microsoft.DirectX.Direct3D.Font(d3dDevice, VERDANA_10); }
public override void ShowDialog(object sender, EventArgs e) { if (d3d == null) { d3d = new Direct3D(); var pm = new SlimDX.Direct3D9.PresentParameters(); pm.Windowed = true; device = new Device(d3d, 0, DeviceType.Reference, IntPtr.Zero, CreateFlags.FpuPreserve, pm); } string[] files; string path; if (ConvDlg.Show(Name, GetOpenFilter(), out files, out path) == DialogResult.OK) { ProgressDlg pd = new ProgressDlg(DevStringTable.Instance["GUI:Converting"]); pd.MinVal = 0; pd.Value = 0; pd.MaxVal = files.Length; pd.Show(); for (int i = 0; i < files.Length; i++) { string dest = Path.Combine(path, Path.GetFileNameWithoutExtension(files[i]) + ".x"); Convert(new DevFileLocation(files[i]), new DevFileLocation(dest)); pd.Value = i; } pd.Close(); pd.Dispose(); } }
public void load_image(string DDS) { if (this.gs != null) { this.gs.Dispose(); } try { PresentParameters presentParameters = new PresentParameters(); presentParameters.SwapEffect = SwapEffect.Discard; Format format = Manager.Adapters[0].CurrentDisplayMode.Format; presentParameters.Windowed = true; Device device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, new PresentParameters[] { presentParameters }); Texture texture = TextureLoader.FromFile(device, DDS); this.gs = TextureLoader.SaveToStream(ImageFileFormat.Png, texture); texture.Dispose(); this.pictureBox.Image = Image.FromStream(this.gs); device.Dispose(); this.gs.Close(); } catch (Exception var_4_B4) { } }
public DX11DynamicStructuredBuffer(Device dev, Buffer buffer, int cnt) //Dynamic default buffer { this.Size = cnt; this.Buffer = buffer; this.Stride = buffer.Description.StructureByteStride; this.SRV = new ShaderResourceView(dev, this.Buffer); }
/// <summary> /// Creates a simple twin barreled TurretHead at the given location /// facing the given rotation and controlled by the given kayboard /// Device. /// </summary> /// <param name="location">Location of the TurretHead</param> /// <param name="rotation">Rotation the TurretHead is facing</param> /// <param name="scale">Scale of the TurretHead</param> /// <param name="keyboard"> /// Keyboard Device used to controll the Turret /// </param> public TestTurretHead(Vector3 location, Vector3 rotation, Vector3 scale, Device keyboard) : base(location + Settings.TEST_TURRET_HEAD_OFFSET, rotation, scale, Settings.TEST_TURRET_HEAD_ROTATION_SPEED, Settings.TEST_TURRET_BARREL_ROTATION_SPEED, keyboard) { this.models.Add(ContentLoader.TestTurretHeadModel); addChild(new TurretBarrel( new Vector3(this.location.X, this.location.Y, this.location.Z) + Settings.TEST_TURRET_BARREL_ONE_OFFSET, new Vector3(this.rotation.X, this.rotation.Y, this.rotation.Z) + Settings.TEST_TURRET_BARREL_DEFAULT_ROTATION, scale, ContentLoader.TestTurretBarrelModel, Settings.TEST_TURRET_BARREL_MAX_PITCH, Settings.TEST_TURRET_BARREL_MIN_PITCH, Settings.TEST_TURRET_BARREL_SHOOT_DELAY, Settings.TEST_TURRET_BARREL_PUSH_SPEED, Settings.TEST_TURRET_BARREL_PULL_SPEED, keyboard )); addChild(new TurretBarrel( new Vector3(this.location.X, this.location.Y, this.location.Z) + Settings.TEST_TURRET_BARREL_TWO_OFFSET, new Vector3(this.rotation.X, this.rotation.Y, this.rotation.Z) + Settings.TEST_TURRET_BARREL_DEFAULT_ROTATION, scale, ContentLoader.TestTurretBarrelModel, Settings.TEST_TURRET_BARREL_MAX_PITCH, Settings.TEST_TURRET_BARREL_MIN_PITCH, Settings.TEST_TURRET_BARREL_SHOOT_DELAY, Settings.TEST_TURRET_BARREL_PUSH_SPEED, Settings.TEST_TURRET_BARREL_PULL_SPEED, keyboard )); }
public ImageSprite(Bitmap bitmap, Device device, Color color) { _color = color; _bitmap = bitmap; Rebuild(device); }
/* Queries the number of available devices and creates a list with device data. */ public static List<Device> EnumerateDevices() { /* Create a list for the device data. */ List<Device> list = new List<Device>(); /* Enumerate all camera devices. You must call PylonEnumerateDevices() before creating a device. */ uint count = Pylon.EnumerateDevices(); /* Get device data from all devices. */ for( uint i = 0; i < count; ++i) { /* Create a new data packet. */ Device device = new Device(); /* Get the device info handle of the device. */ PYLON_DEVICE_INFO_HANDLE hDi = Pylon.GetDeviceInfoHandle(i); /* Get the name. */ device.Name = Pylon.DeviceInfoGetPropertyValueByName(hDi, Pylon.cPylonDeviceInfoFriendlyNameKey); /* Set the index. */ device.Index = i; /* Add to the list. */ list.Add(device); } return list; }
public void EndToEndTest() { // Arrange. var device = new Device(); var logger = new TracefileBuilder(device); var expectedData = RenderScene(device); var stringWriter = new StringWriter(); logger.WriteTo(stringWriter); var loggedJson = stringWriter.ToString(); var logReader = new StringReader(loggedJson); var tracefile = Tracefile.FromTextReader(logReader); // Act. var swapChainPresenter = new RawSwapChainPresenter(); var replayer = new Replayer( tracefile.Frames[0], tracefile.Frames[0].Events.Last(), swapChainPresenter); replayer.Replay(); var actualData = swapChainPresenter.Data; // Assert. Assert.That(actualData, Is.EqualTo(expectedData)); }
private float glowStrength; // Strength of the glow. #endregion Fields #region Constructors /// <summary> /// Default Constructor. /// </summary> /// <param name="device">Copy of the rendering device.</param> /// <param name="effect">Copy of the effect class.</param> public EmissiveClass(Device device, Effect effect) { pathName = ""; this.device = device; this.effect = effect; glowStrength = 3.0f; }
public static Model FromScene(Scene scene, Device device) { VertexDeclaration vertexDeclaration = new VertexDeclaration(device, VertexPositionNormalTexture.VertexElements); Model result = new Model(scene, device, vertexDeclaration); foreach (Mesh mesh in scene.Meshes) { VertexBuffer vertexBuffer = new VertexBuffer(device, mesh.Positions.Count * VertexPositionNormalTexture.SizeInBytes, Usage.WriteOnly, VertexFormat.None, Pool.Default); DataStream vertexDataStream = vertexBuffer.Lock(0, mesh.Positions.Count * VertexPositionNormalTexture.SizeInBytes, LockFlags.None); VertexPositionNormalTexture[] vertices = new VertexPositionNormalTexture[mesh.Positions.Count]; for (int i = 0; i < vertices.Length; ++i) vertices[i] = new VertexPositionNormalTexture(mesh.Positions[i], (mesh.Normals.Count > i) ? mesh.Normals[i] : Vector3D.Zero, Point2D.Zero); vertexDataStream.WriteRange(vertices); vertexBuffer.Unlock(); IndexBuffer indexBuffer = new IndexBuffer(device, mesh.Indices.Count * sizeof(int), Usage.WriteOnly, Pool.Default, false); DataStream indexDataStream = indexBuffer.Lock(0, mesh.Indices.Count * sizeof(int), LockFlags.None); indexDataStream.WriteRange(mesh.Indices.ToArray()); indexBuffer.Unlock(); ModelMesh modelMesh = new ModelMesh(mesh, device, vertexBuffer, mesh.Positions.Count, indexBuffer, mesh.PrimitiveCount, Matrix3D.Identity, mesh.Material); result.Meshes.Add(modelMesh); } return result; }
/// <summary> /// Create a shader-resource view from a file. Read the characteristics of a texture when the texture is loaded. /// </summary> /// <param name="device">A reference to the device (see <see cref="SharpDX.Direct3D10.Device"/>) that will use the resource. </param> /// <param name="fileName">Name of the file that contains the shader-resource view.</param> /// <returns>Returns a reference to the shader-resource view (see <see cref="SharpDX.Direct3D10.ShaderResourceView"/>). </returns> /// <unmanaged>HRESULT D3DX10CreateShaderResourceViewFromFileW([None] ID3D10Device* pDevice,[None] const wchar_t* pSrcFile,[In, Optional] D3DX10_IMAGE_LOAD_INFO* pLoadInfo,[None] ID3DX10ThreadPump* pPump,[None] ID3D10ShaderResourceView** ppShaderResourceView,[None] HRESULT* pHResult)</unmanaged> public static ShaderResourceView FromFile(Device device, string fileName) { ShaderResourceView temp; Result hResult; D3DX10.CreateShaderResourceViewFromFile(device, fileName, null, IntPtr.Zero, out temp, out hResult); return temp; }
/// <summary> /// Create a shader-resource view from a file. /// </summary> /// <param name="device">A reference to the device (see <see cref="SharpDX.Direct3D10.Device"/>) that will use the resource. </param> /// <param name="fileName">Name of the file that contains the shader-resource view.</param> /// <param name="loadInformation">Identifies the characteristics of a texture (see <see cref="SharpDX.Direct3D10.ImageLoadInformation"/>) when the data processor is created. </param> /// <returns>Returns a reference to the shader-resource view (see <see cref="SharpDX.Direct3D10.ShaderResourceView"/>). </returns> /// <unmanaged>HRESULT D3DX10CreateShaderResourceViewFromFileW([None] ID3D10Device* pDevice,[None] const wchar_t* pSrcFile,[In, Optional] D3DX10_IMAGE_LOAD_INFO* pLoadInfo,[None] ID3DX10ThreadPump* pPump,[None] ID3D10ShaderResourceView** ppShaderResourceView,[None] HRESULT* pHResult)</unmanaged> public static ShaderResourceView FromFile(Device device, string fileName, ImageLoadInformation loadInformation) { ShaderResourceView temp; Result hResult; D3DX10.CreateShaderResourceViewFromFile(device, fileName, loadInformation, IntPtr.Zero, out temp, out hResult); return temp; }
public TextureCache(Device device) { _device = device; _cache = new Dictionary<string, CachedTexture>(); _textureCache = new Dictionary<int, CachedTexture>(); _nextTextureId = 1; }
public override WriteableBitmap Initialize(Device device) { const int width = 600; const int height = 400; // Create device and swap chain. var swapChainPresenter = new WpfSwapChainPresenter(); _swapChain = device.CreateSwapChain(width, height, swapChainPresenter); _deviceContext = device.ImmediateContext; // Create RenderTargetView from the backbuffer. var backBuffer = Texture2D.FromSwapChain(_swapChain, 0); _renderTargetView = device.CreateRenderTargetView(backBuffer); // Create DepthStencilView. var depthStencilBuffer = device.CreateTexture2D(new Texture2DDescription { ArraySize = 1, MipLevels = 1, Width = width, Height = height, BindFlags = BindFlags.DepthStencil }); var depthStencilView = device.CreateDepthStencilView(depthStencilBuffer); // Prepare all the stages. _deviceContext.Rasterizer.SetViewports(new Viewport(0, 0, width, height, 0.0f, 1.0f)); _deviceContext.OutputMerger.SetTargets(depthStencilView, _renderTargetView); return swapChainPresenter.Bitmap; }
public static void DrawBox(int ulx, int uly, int width, int height, float z, int color, Device device) { CustomVertex.TransformedColored[] verts = new CustomVertex.TransformedColored[4]; verts[0].X = (float) ulx; verts[0].Y = (float) uly; verts[0].Z = z; verts[0].Color = color; verts[1].X = (float) ulx; verts[1].Y = (float) uly + height; verts[1].Z = z; verts[1].Color = color; verts[2].X = (float) ulx + width; verts[2].Y = (float) uly; verts[2].Z = z; verts[2].Color = color; verts[3].X = (float) ulx + width; verts[3].Y = (float) uly + height; verts[3].Z = z; verts[3].Color = color; device.VertexFormat = CustomVertex.TransformedColored.Format; device.TextureState[0].ColorOperation = TextureOperation.Disable; device.DrawUserPrimitives(PrimitiveType.TriangleStrip, verts.Length - 2, verts); }
public int vertexStartIndex; // Start offset for VB #endregion Fields #region Methods public void Render(Effect effect, Device device, bool setMaterial) { // Set material if (setMaterial) material.ApplyMaterial(device); // Calculate number of primitives to draw. int primCount = 0; switch (Type) { case PrimitiveType.TriangleList: primCount = nIndices / 3; break; case PrimitiveType.TriangleFan: case PrimitiveType.TriangleStrip: primCount = nIndices - 2; break; } // Draw if (primCount > 0) { device.DrawIndexedPrimitives(Type, vertexStartIndex, lowestIndiceValue, nVerts, IndiceStartIndex, primCount); } }
public static bool InitializeGraphics(Control handle) { try { presentParams.Windowed = true; presentParams.SwapEffect = SwapEffect.Discard; presentParams.EnableAutoDepthStencil = true; presentParams.AutoDepthStencilFormat = DepthFormat.D16; device = new Device(0, DeviceType.Hardware, handle, CreateFlags.SoftwareVertexProcessing, presentParams); CamDistance = 10; Mat = new Material(); Mat.Diffuse = Color.White; Mat.Specular = Color.LightGray; Mat.SpecularSharpness = 15.0F; device.Material = Mat; string loc = Path.GetDirectoryName(Application.ExecutablePath); DefaultTex = TextureLoader.FromFile(device, loc + "\\exec\\Default.bmp"); CreateCoordLines(); init = true; return true; } catch (DirectXException) { return false; } }
public BufferedGeometryData(Device device, int numItems) { this.device = device; this.numItems = numItems; dataValidity = DataValidityType.Source; }
public static bool IsSupported(Device device) { if (device == null) throw new ArgumentNullException("device"); return device.Extensions.Contains(ExtensionName); }
public void Draw(Device device, DeviceContext context, RenderTargetView renderTargetView) { var deviceChanged = _device != device || _context != context; _device = device; _context = context; if (deviceChanged) { DrawingSurfaceState.Device = _device; DrawingSurfaceState.Context = _context; DrawingSurfaceState.RenderTargetView = renderTargetView; } if (!_game.Initialized) { // Start running the game. _game.Run(GameRunBehavior.Asynchronous); } else if (deviceChanged) { _game.GraphicsDevice.Initialize(); Microsoft.Xna.Framework.Content.ContentManager.ReloadGraphicsContent(); // DeviceReset events _game.graphicsDeviceManager.OnDeviceReset(EventArgs.Empty); _game.GraphicsDevice.OnDeviceReset(); } _game.GraphicsDevice.UpdateTarget(renderTargetView); _game.GraphicsDevice.ResetRenderTargets(); _game.Tick(); _host.RequestAdditionalFrame(); }
public override void loop(Device i_d3d) { lock (this._ss) { this._ms.update(this._ss); this._rs.drawBackground(i_d3d, this._ss.getSourceImage()); i_d3d.BeginScene(); i_d3d.Clear(ClearFlags.ZBuffer, Color.DarkBlue, 1.0f, 0); if (this._ms.isExistMarker(this.mid)) { //get marker plane pos from Mouse X,Y Point p=this.form.PointToClient(Cursor.Position); Vector3 mp = new Vector3(); this._ms.getMarkerPlanePos(this.mid, p.X,p.Y,ref mp); mp.Z = 20.0f; //立方体の平面状の位置を計算 Matrix transform_mat2 = Matrix.Translation(mp); //変換行列を掛ける transform_mat2 *= this._ms.getD3dMarkerMatrix(this.mid); // 計算したマトリックスで座標変換 i_d3d.SetTransform(TransformType.World, transform_mat2); // レンダリング(描画) this._rs.colorCube(i_d3d, 40); } i_d3d.EndScene(); } i_d3d.Present(); }
/// <summary> /// Create DrawModel /// </summary> public void CreateDrawModel(Device DXDevice , int Name , string TextureFileName) { ModelForDraw CreateModel = new ModelForDraw(DXDevice , Name); CreateModel.TextureLoad(TextureFileName); DrawModelList.Add(CreateModel); }
public bool start(string name) { self.name = name; DeviceList joysticklist = Manager.GetDevices(DeviceClass.GameControl, EnumDevicesFlags.AttachedOnly); bool found = false; foreach (DeviceInstance device in joysticklist) { if (device.ProductName == name) { joystick = new Device(device.InstanceGuid); found = true; break; } } if (!found) return false; joystick.SetDataFormat(DeviceDataFormat.Joystick); joystick.Acquire(); enabled = true; System.Threading.Thread t11 = new System.Threading.Thread(new System.Threading.ThreadStart(mainloop)) { Name = "Joystick loop", Priority = System.Threading.ThreadPriority.AboveNormal, IsBackground = true }; t11.Start(); return true; }
/// <summary> /// Initializes a new instance of the <see cref="MonoGameNoesisGUIWrapper" /> class. /// </summary> /// <param name="game">The MonoGame game instance.</param> /// <param name="graphics">Graphics device manager of the game instance.</param> /// <param name="rootXamlPath">Local XAML file path - will be used as the UI root element</param> /// <param name="stylePath">(optional) Local XAML file path - will be used as global ResourceDictionary (UI style)</param> /// <param name="dataLocalPath">(optional) Local path to the folder which will be used as root for other paths</param> /// <remarks> /// PLEASE NOTE: .XAML-files should be prebuilt to .NSB-files by NoesisGUI Build Tool). /// </remarks> public MonoGameNoesisGUIWrapper( Game game, GraphicsDeviceManager graphics, string rootXamlPath, string stylePath = null, string dataLocalPath = "Data") { this.game = game; this.graphics = graphics; this.graphicsDevice = graphics.GraphicsDevice; var device = ((Device)this.graphicsDevice.Handle); this.DeviceDX11 = device; GUI.InitDirectX11(device.NativePointer); GUI.AddResourceProvider(dataLocalPath); this.uiRenderer = this.CreateRenderer(rootXamlPath, stylePath); this.inputManager = new MonoGameNoesisGUIWrapperInputManager(this.uiRenderer); game.Window.TextInput += (sender, args) => this.inputManager.OnTextInput(args); game.Window.ClientSizeChanged += this.WindowClientSizeChangedHandler; this.graphicsDevice.DeviceReset += this.DeviceResetHandler; this.graphicsDevice.DeviceLost += this.DeviceLostHandler; this.UpdateSize(); }
public PiranhaMessage(Device device, Reader reader) { Device = device; Reader = reader; }
/// <summary> /// Identifies a PS/2 device. /// </summary> /// <param name="aPort">The port of the PS/2 device to identify.</param> /// <param name="aDevice">An instance of the identified device.</param> private void IdentifyDevice(byte aPort, out Device aDevice, bool InitScrollWheel) { aDevice = null; if (aPort == 1 || aPort == 2) { var xSecondPort = aPort == 2; WaitToWrite(); SendDeviceCommand(DeviceCommand.DisableScanning, xSecondPort); WaitToWrite(); SendDeviceCommand(DeviceCommand.IdentifyDevice, xSecondPort); byte xFirstByte = 0; byte xSecondByte = 0; if (ReadByteAfterAckWithTimeout(ref xFirstByte)) { /* * |--------|---------------------------| * | Byte | Device Type | * |--------|---------------------------| * | 0x00 | Standard PS/2 mouse | * |--------|---------------------------| * | 0x03 | Mouse with scroll wheel | * |--------|---------------------------| * | 0x04 | 5-button mouse | * |--------|---------------------------| * | 0x50 | Laptop Touchpad | * |--------|---------------------------| */ bool InitBytes; if (InitScrollWheel) { InitBytes = xFirstByte == 0x00 || xFirstByte == 0x03 || xFirstByte == 0x04 || xFirstByte == 0x50; } else { InitBytes = xFirstByte == 0x00 || xFirstByte == 0x04 || xFirstByte == 0x50; mDebugger.Send("Mousewheel detection disabled"); } if (InitBytes) { var xDevice = new PS2Mouse(aPort, xFirstByte); xDevice.Initialize(); aDevice = xDevice; } /* * |-----------------|----------------------------------------------------------------| * | Bytes | Device Type | * |-----------------|----------------------------------------------------------------| * | 0xAB, 0x41 | MF2 keyboard with translation enabled in the PS/2 Controller | * | or 0xAB, 0xC1 | (not possible for the second PS/2 port) | * |-----------------|----------------------------------------------------------------| * | 0xAB, 0x83 | MF2 keyboard | * |-----------------|----------------------------------------------------------------| */ else if (xFirstByte == 0xAB && ReadDataWithTimeout(ref xSecondByte)) { // TODO: replace xTest with (xSecondByte == 0x41 || xSecondByte == 0xC1) // when the stack corruption detection works better for complex conditions var xTest = (xSecondByte == 0x41 || xSecondByte == 0xC1); if (xTest && aPort == 1) { var xDevice = new PS2Keyboard(aPort); xDevice.Initialize(); aDevice = xDevice; } else if (xSecondByte == 0x83) { var xDevice = new PS2Keyboard(aPort); xDevice.Initialize(); aDevice = xDevice; } } } /* * |--------|---------------------------------------------------------------------| * | Byte | Device Type | * |--------|---------------------------------------------------------------------| * | None | Ancient AT keyboard with translation enabled in the PS/Controller | * | | (not possible for the second PS/2 port) | * |--------|---------------------------------------------------------------------| */ else if (aPort == 1) { var xDevice = new PS2Keyboard(aPort); xDevice.Initialize(); aDevice = xDevice; } if (aDevice == null) { mDebugger.SendInternal("(PS/2 Controller) Device detection failed:"); mDebugger.SendInternal("First Byte: " + xFirstByte); mDebugger.SendInternal("Second Byte: " + xSecondByte); Console.WriteLine("(PS/2 Controller) Device detection failed."); Console.WriteLine("This is usually Fine for USB to PS / 2 Emulation"); Console.WriteLine("Press any key to Resume (Good Luck)"); Console.ReadLine(); } } else { throw new Exception("(PS/2 Controller) Port " + aPort + " doesn't exist"); } }
public ShaderBase(Device device, byte[] shaderBytecode) : base(device) { _shaderBytecode = BytecodeContainer.Parse(shaderBytecode); }
public AboutViewModel() { Title = "About"; OpenWebCommand = new Command(() => Device.OpenUri(new Uri("https://xamarin.com/platform"))); }
public MyZXingOverlay() { BindingContext = this; //ColumnSpacing = 0; VerticalOptions = LayoutOptions.FillAndExpand; HorizontalOptions = LayoutOptions.FillAndExpand; RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(3, GridUnitType.Star) }); RowDefinitions.Add(new RowDefinition { Height = new GridLength(2, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); ColumnDefinitions.Add(new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }); var boxview = new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }; var boxview2 = new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }; Children.Add(boxview, 0, 0); Children.Add(boxview2, 0, 2); SetColumnSpan(boxview, 5); SetColumnSpan(boxview2, 5); // Children.Add(boxview, 0, 3); Children.Add(new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }, 0, 1); Children.Add(new BoxView { VerticalOptions = LayoutOptions.Fill, HorizontalOptions = LayoutOptions.FillAndExpand, BackgroundColor = Color.Black, Opacity = 0.7, }, 4, 1); //Children.Add(new BoxView //{ // VerticalOptions = LayoutOptions.Fill, // HorizontalOptions = LayoutOptions.FillAndExpand, // BackgroundColor = Color.Black, // Opacity = 0.7, //}, 0, 3); //Children.Add(new BoxView //{ // VerticalOptions = LayoutOptions.Fill, // HorizontalOptions = LayoutOptions.FillAndExpand, // BackgroundColor = Color.Black, // Opacity = 0.7, //}, 0, 2); var AbsoluteLayouts = new AbsoluteLayout(); var redline = new Image { Source = "saomiao.png" }; AbsoluteLayout.SetLayoutBounds(redline, new Rectangle(1, weizhi, 1, 1)); AbsoluteLayout.SetLayoutFlags(redline, AbsoluteLayoutFlags.SizeProportional); AbsoluteLayouts.Children.Add(redline); Children.Add(AbsoluteLayouts, 1, 1); SetColumnSpan(AbsoluteLayouts, 3); topText = new Label { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, AutomationId = "zxingDefaultOverlay_TopTextLabel", }; topText.SetBinding(Label.TextProperty, new Binding(nameof(TopText))); Children.Add(topText, 0, 0); SetColumnSpan(topText, 5); botText = new Label { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, TextColor = Color.White, AutomationId = "zxingDefaultOverlay_BottomTextLabel", }; botText.SetBinding(Label.TextProperty, new Binding(nameof(BottomText))); //Children.Add(botText, 0, 2); //SetColumnSpan(botText, 5); var MyStackLayout = new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center }; flash = new Button { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, //HeightRequest = 3, Text = "按钮", TextColor = Color.White, BackgroundColor = Color.FromHex("7fadf7"), Opacity = 0.7, AutomationId = "zxingDefaultOverlay_FlashButton", }; flash.SetBinding(Button.IsVisibleProperty, new Binding(nameof(ShowFlashButton))); flash.SetBinding(Button.TextProperty, new Binding(nameof(ButtonText))); flash.Clicked += (sender, e) => { FlashButtonClicked?.Invoke(flash, e); }; MyStackLayout.Children.Add(botText); MyStackLayout.Children.Add(flash); Children.Add(MyStackLayout, 0, 2); SetColumnSpan(MyStackLayout, 5); //this.ColumnSpacing = 0; this.RowSpacing = 0; Device.StartTimer(TimeSpan.FromSeconds(0.2), () => { weizhi += 7; AbsoluteLayout.SetLayoutBounds(redline, new Rectangle(1, weizhi, 1, 1)); if (weizhi > 150) { weizhi = -100; } return true; }); }
protected async override void OnAppearing() { base.OnAppearing(); if (_syncService.SyncInProgress) { IsBusy = true; } _broadcasterService.Subscribe(_pageName, async(message) => { if (message.Command == "syncStarted") { Device.BeginInvokeOnMainThread(() => IsBusy = true); } else if (message.Command == "syncCompleted") { if (!_vm.LoadedOnce) { return; } await Task.Delay(500); Device.BeginInvokeOnMainThread(() => { IsBusy = false; var task = _vm.LoadAsync(); }); } }); var migratedFromV1 = await _storageService.GetAsync <bool?>(Constants.MigratedFromV1); await LoadOnAppearedAsync(_mainLayout, false, async() => { if (!_syncService.SyncInProgress) { try { await _vm.LoadAsync(); } catch (Exception e) when(e.Message.Contains("No key.")) { await Task.Delay(5000); await _vm.LoadAsync(); } } else { await Task.Delay(5000); if (!_vm.Loaded) { await _vm.LoadAsync(); } } // Forced sync if for some reason we have no data after a v1 migration if (_vm.MainPage && !_syncService.SyncInProgress && migratedFromV1.GetValueOrDefault() && !_vm.HasCiphers && Xamarin.Essentials.Connectivity.NetworkAccess != Xamarin.Essentials.NetworkAccess.None) { var triedV1ReSync = await _storageService.GetAsync <bool?>(Constants.TriedV1Resync); if (!triedV1ReSync.GetValueOrDefault()) { await _storageService.SaveAsync(Constants.TriedV1Resync, true); await _syncService.FullSyncAsync(true); } } }, _mainContent); if (!_vm.MainPage) { return; } // Push registration var lastPushRegistration = await _storageService.GetAsync <DateTime?>(Constants.PushLastRegistrationDateKey); lastPushRegistration = lastPushRegistration.GetValueOrDefault(DateTime.MinValue); if (Device.RuntimePlatform == Device.iOS) { var pushPromptShow = await _storageService.GetAsync <bool?>(Constants.PushInitialPromptShownKey); if (!pushPromptShow.GetValueOrDefault(false)) { await _storageService.SaveAsync(Constants.PushInitialPromptShownKey, true); await DisplayAlert(AppResources.EnableAutomaticSyncing, AppResources.PushNotificationAlert, AppResources.OkGotIt); } if (!pushPromptShow.GetValueOrDefault(false) || DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1)) { await _pushNotificationService.RegisterAsync(); } } else if (Device.RuntimePlatform == Device.Android) { if (DateTime.UtcNow - lastPushRegistration > TimeSpan.FromDays(1)) { await _pushNotificationService.RegisterAsync(); } if (!_deviceActionService.AutofillAccessibilityServiceRunning() && !_deviceActionService.AutofillServiceEnabled()) { if (migratedFromV1.GetValueOrDefault()) { var migratedFromV1AutofillPromptShown = await _storageService.GetAsync <bool?>( Constants.MigratedFromV1AutofillPromptShown); if (!migratedFromV1AutofillPromptShown.GetValueOrDefault()) { await DisplayAlert(AppResources.Autofill, AppResources.AutofillServiceNotEnabled, AppResources.Ok); } } } await _storageService.SaveAsync(Constants.MigratedFromV1AutofillPromptShown, true); } }
void d3d_DxLost(Direct3d d3d, Device dx) { isDxLost = true; }
void d3d_DxRestore(Direct3d d3d, Device dx) { isDxLost = false; }
public MyPage2() { UserModel.insertUser("鈴木"); if (UserModel.selectUser() != null) { _ar = new ObservableCollection<UserModel>(UserModel.selectUser()); } var listView = new ListView { //ItemsSource = Enumerable.Range(0, 50).Select(n => "item-" + n), ItemsSource = _ar, //ItemTemplate = new DataTemplate(() => new MyCell2(this)), }; //文字入力 var entry = new Entry { HorizontalOptions = LayoutOptions.FillAndExpand }; //追加 var buttonAdd = new Button { WidthRequest = 60, TextColor = Color.Black, Text = "Add" }; buttonAdd.Clicked += (s, a) => {//追加ボタンの処理 if (!String.IsNullOrEmpty(entry.Text)) { //UserModel.insertUser(entry.Text); _ar.Add(new UserModel { Name = entry.Text }); //id++; //Application.Current.MainPage = new MainPage4(); //entry.Text = ""; } }; Content = new StackLayout { Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0), Children = { new StackLayout { BackgroundColor = Color.HotPink, Padding = 5, Orientation = StackOrientation.Horizontal, Children = {entry,buttonAdd}//Entryコントロールとボタンコントロールを配置 }, listView//その下にリストボックス } }; //Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); //Content = listView; }
public ProductPage(Product product) { _product = product; Title = "Product"; var addToCartButton = new Button { VerticalOptions = LayoutOptions.Start, BorderWidth = 1, BorderColor = Color.Gray, Text = "Add", Image = "cart.png" }; addToCartButton.Clicked += OnAddToCartButtonClicked; var productImageTapGestureRecognizer = new TapGestureRecognizer(); productImageTapGestureRecognizer.Tapped += OnProductImageTap; var grid = new Grid { Padding = new Thickness(5, 0), HorizontalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = new GridLength(100) } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(100) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(100) } } }; grid.Children.Add(new ContentView { Content = new Image { HeightRequest = 100, WidthRequest = 100, Source = ImageSource.FromResource((_product.ImageSource)), GestureRecognizers = { productImageTapGestureRecognizer } } }, 0, 0); grid.Children.Add(new ContentView { Content = new Label { Text = string.Format("${0:0.00}", _product.Price), TextColor = Color.Red, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), HorizontalOptions = LayoutOptions.CenterAndExpand } }, 1, 0); grid.Children.Add(new ContentView { Content = addToCartButton }, 2, 0); Content = new StackLayout { Spacing = 0, Children = { new ContentView { Padding = new Thickness(5), Content = new Label { Text = _product.Name, FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)) }, }, grid, new ContentView { VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(5), Content = new InfoView() { CornerRadius = 10d, StrokeThickness = 1d, Stroke = Color.Gray, HeaderText = _product.Name, BodyText = _product.Description } } } }; }
public void LaunchBrowser(Uri uri) => Device.OpenUri(uri);
void OnFrameTapped(object sender, EventArgs e) { Frame currFrame = (Frame)sender; currFrame.OutlineColor = Color.Fuchsia; int imageIndex = Int32.Parse(currFrame.ClassId); _stopTimer = true; _timerInterval = 1; currImageIndex = imageIndex; imageDisplayed = imageIndex + 1; imageCount.Text = imageDisplayed + " / " + (imageStack.Children.Count); app.CurrImageIndex = currImageIndex; app.ImageDisplayed = imageDisplayed; //Switch toggle off when tapped on new added images if (imageIndex > 3) { switchToggle.IsToggled = false; } else { removeButton.IsVisible = false; removeButton.IsEnabled = false; switchToggle.IsToggled = true; } //Delay loading of image to trigger activity indicator ActivityIndicatorSetStatus(true); Device.StartTimer(TimeSpan.FromSeconds(3), () => { currFrame.OutlineColor = Color.Accent; // set the timer to false after 3 secs. if (!switchToggle.IsToggled) { removeButton.IsVisible = true; removeButton.IsEnabled = true; // _stopTimer = false; } KeyValuePair <String, ImageSource> imageKvIndex = imageSourceDict[imageIndex]; CurrentImage.Source = imageKvIndex.Value; if (currImageIndex == 0) { currImageIndex = imageSourceDict.Count - 1; } _timerInterval = displayTimeInterval; ActivityIndicatorSetStatus(false); if (switchToggle.IsToggled) { _stopTimer = false; if (currImageIndex != 0) { if (!_stopTimer) { currImageIndex--; } } } return(false); }); }
public FontPageCs() { var label = new Label { Text = "Hello, Forms!", Font = Device.OnPlatform( Font.OfSize("SF Hollywood Hills", 24), Font.SystemFontOfSize(NamedSize.Medium), Font.SystemFontOfSize(NamedSize.Large) ), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var myLabel = new MyLabel { Text = "MyLabel for Android!", // temporarily disable the size setting, since it's breaking the custom font on 1.2.2 :-( // Font = Device.OnPlatform ( // Font.SystemFontOfSize (NamedSize.Small), // Font.SystemFontOfSize (NamedSize.Medium), // will get overridden in custom Renderer // Font.SystemFontOfSize (NamedSize.Large) // ), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var labelBold = new Label { Text = "Bold", Font = Font.SystemFontOfSize(14, FontAttributes.Bold), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var labelItalic = new Label { Text = "Italic", Font = Font.SystemFontOfSize(14, FontAttributes.Italic), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var labelBoldItalic = new Label { Text = "BoldItalic", Font = Font.SystemFontOfSize(14, FontAttributes.Bold | FontAttributes.Italic), VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, }; // Span formatting support var labelFormatted = new Label(); var fs = new FormattedString(); fs.Spans.Add(new Span { Text = "Red, ", ForegroundColor = Color.Red, Font = Font.SystemFontOfSize(20, FontAttributes.Italic) }); fs.Spans.Add(new Span { Text = " blue, ", ForegroundColor = Color.Blue, Font = Font.SystemFontOfSize(32) }); fs.Spans.Add(new Span { Text = " and green!", ForegroundColor = Color.Green, Font = Font.SystemFontOfSize(12) }); labelFormatted.FormattedText = fs; Content = new StackLayout { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.CenterAndExpand, Children = { label, myLabel, labelBold, labelItalic, labelBoldItalic, labelFormatted } }; }
public override int GetHashCode() { return(Name.GetHashCode() ^ DeviceId.GetHashCode() ^ Device.GetHashCode()); }
public MainPage() { InitializeComponent(); CrossConnectivity.Current.ConnectivityChanged += async(sender, args) => { if (!CrossConnectivity.Current.IsConnected && !wasNotConn) { wasNotConn = true; await Navigation.PushModalAsync(new NoConnection()); } else { wasNotConn = false; } }; NavigationPage.SetHasBackButton(this, false); NavigationPage.SetHasNavigationBar(this, false); Device.BeginInvokeOnMainThread(() => { var homePage = new HomePage(); var navigationHomePage = new NavigationPage(homePage); //navigationHomePage.Title = "Főmenü"; navigationHomePage.Icon = GlobalVariables.homepng; navigationHomePage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(homePage, false); var searchPage = new SearchPage(); var navigationSearchPage = new NavigationPage(searchPage); //navigationSearchPage.Title = "Keresés"; navigationSearchPage.Icon = GlobalVariables.searchpng; navigationSearchPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(searchPage, false); var peopleSearchPage = new PeopleSearchPage(); var navigationPeopleSearchPage = new NavigationPage(peopleSearchPage); //navigationMyAccountPage.Title = "Fiók"; navigationPeopleSearchPage.Icon = GlobalVariables.peoplepng; navigationPeopleSearchPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(peopleSearchPage, false); var uploadPhotoPage = new UploadPhotoPage(); var navigationUploadPhotoPage = new NavigationPage(uploadPhotoPage); //navigationUploadPhotoPage.Title = "Fotó"; navigationUploadPhotoPage.Icon = GlobalVariables.camerapng; navigationUploadPhotoPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(uploadPhotoPage, false); var myAccountPage = new MyAccountPage(); var navigationMyAccountPage = new NavigationPage(myAccountPage); //navigationMyAccountPage.Title = "Fiók"; navigationMyAccountPage.Icon = GlobalVariables.profilepng; navigationMyAccountPage.Style = GlobalVariables.NavigationPageStyle; NavigationPage.SetHasNavigationBar(myAccountPage, false); Children.Add(navigationHomePage); Children.Add(navigationSearchPage); Children.Add(navigationPeopleSearchPage); Children.Add(navigationUploadPhotoPage); Children.Add(navigationMyAccountPage); }); }
private void OnDrawing(Device device) { try { OverlaySettings settings = OverlaySettings.Instance; if (settings.OnlyDrawInForeground && Imports.GetForegroundWindow() != StyxWoW.Memory.Process.MainWindowHandle) { return; } if (!StyxWoW.IsInGame) { DrawHelper.DrawShadowedText("Not in game!", settings.GameStatsPositionX, settings.GameStatsPositionY, settings.GameStatsForegroundColor, settings.GameStatsShadowColor, settings.GameStatsFontSize ); return; } if (!TreeRoot.IsRunning) { ObjectManager.Update(); } WoWPoint mypos = StyxWoW.Me.Location; Vector3 vecStart = new Vector3(mypos.X, mypos.Y, mypos.Z); int myLevel = StyxWoW.Me.Level; if (settings.DrawGameStats) { StringBuilder sb = new StringBuilder(); WoWUnit currentTarget = StyxWoW.Me.CurrentTarget; if (currentTarget != null) { sb.AppendLine("Current Target: " + currentTarget.Name + ", Distance: " + Math.Round(currentTarget.Distance, 3)); WoWPoint end = currentTarget.Location; Vector3 vecEnd = new Vector3(end.X, end.Y, end.Z); DrawHelper.DrawLine(vecStart, vecEnd, 2f, Color.FromArgb(150, Color.Black)); } sb.AppendLine("My Position: " + StyxWoW.Me.Location); sb.AppendLine(""); sb.AppendLine(string.Format(Globalization.XP_HR___0_, GameStats.XPPerHour.ToString("F0"))); sb.AppendLine(string.Format(Globalization.Kills___0____1__hr_, GameStats.MobsKilled, GameStats.MobsPerHour.ToString("F0"))); sb.AppendLine(string.Format(Globalization.Deaths___0____1__hr_, GameStats.Deaths, GameStats.DeathsPerHour.ToString("F0"))); sb.AppendLine(string.Format(Globalization.Loots___0____1__hr_, GameStats.Loots, GameStats.LootsPerHour.ToString("F0"))); if (BotManager.Current is BGBuddy) { sb.AppendLine(string.Format("Honor Gained: {0} ({1}/hr)", GameStats.HonorGained, GameStats.HonorPerHour.ToString("F0"))); sb.AppendLine(string.Format("BGs Won: {0} Lost: {1} Total: {2} ({3}/hr)", GameStats.BGsWon, GameStats.BGsLost, GameStats.BGsCompleted, GameStats.BGsPerHour.ToString("F0"))); } if (myLevel < 90) { sb.AppendLine(string.Format("Time to Level: {0}", GameStats.TimeToLevel)); } sb.AppendLine(string.Format("TPS: {0}", GameStats.TicksPerSecond.ToString("F2"))); sb.AppendLine(); if (!string.IsNullOrEmpty(TreeRoot.GoalText)) { sb.AppendLine(string.Format(Globalization.Goal___0_, TreeRoot.GoalText)); } if (settings.UseShadowedText) { DrawHelper.DrawShadowedText(sb.ToString(), settings.GameStatsPositionX, settings.GameStatsPositionY, settings.GameStatsForegroundColor, settings.GameStatsShadowColor, settings.GameStatsFontSize ); } else { DrawHelper.DrawText(sb.ToString(), settings.GameStatsPositionX, settings.GameStatsPositionY, settings.GameStatsForegroundColor, settings.GameStatsFontSize ); } } if (settings.DrawHostilityBoxes || settings.DrawUnitLines || settings.DrawGameObjectBoxes || settings.DrawGameObjectLines) { foreach (WoWObject obj in ObjectManager.GetObjectsOfType <WoWObject>(true)) { string name = obj.Name; WoWPoint objLoc = obj.Location; Vector3 vecCenter = new Vector3(objLoc.X, objLoc.Y, objLoc.Z); WoWGameObject gobject = obj as WoWGameObject; if (gobject != null) { Color color = Color.FromArgb(150, Color.Blue); if (gobject.IsMineral) { color = Color.FromArgb(150, Color.DarkGray); } if (gobject.IsHerb) { color = Color.FromArgb(150, Color.Fuchsia); } if (settings.DrawGameObjectNames) { DrawHelper.Draw3DText(name, vecCenter); } if (settings.DrawGameObjectBoxes) { DrawHelper.DrawOutlinedBox(vecCenter, 2.0f, 2.0f, 2.0f, Color.FromArgb(150, color) ); } if (settings.DrawGameObjectLines) { bool inLos = gobject.InLineOfSight; if (settings.DrawGameObjectLinesLos && inLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, Color.FromArgb(150, color)); } else { if (!settings.DrawGameObjectLinesLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, Color.FromArgb(150, color)); } } } } WoWPlayer player = obj as WoWPlayer; if (player != null) { if (OverlaySettings.Instance.DrawPlayerNames) { DrawHelper.Draw3DText(name, vecCenter); } } WoWUnit u = obj as WoWUnit; if (u != null) { Color hostilityColor = Color.FromArgb(150, Color.Green); if (u.IsHostile) { hostilityColor = Color.FromArgb(150, Color.Red); if (settings.DrawAggroRangeCircles) { DrawHelper.DrawCircle(vecCenter, u.MyAggroRange, 16, Color.FromArgb(75, Color.DeepSkyBlue)); } } if (u.IsNeutral) { hostilityColor = Color.FromArgb(150, Color.Yellow); } if (u.IsFriendly) { hostilityColor = Color.FromArgb(150, Color.Green); } if (settings.DrawHostilityBoxes) { float boundingHeight = u.BoundingHeight; float boundingRadius = u.BoundingRadius; DrawHelper.DrawOutlinedBox(vecCenter, boundingRadius, boundingRadius, boundingHeight, hostilityColor ); //DrawHelper.DrawSphere(vecCenter, 1f, 5, 5, hostilityColor); } if (OverlaySettings.Instance.DrawUnitNames) { DrawHelper.Draw3DText(name, vecCenter); } if (settings.DrawUnitLines) { vecCenter.Z += u.BoundingHeight / 2; bool inLos = u.InLineOfSight; if (settings.DrawUnitLinesLos && inLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, hostilityColor); } else { if (!settings.DrawUnitLinesLos) { DrawHelper.DrawLine(vecStart, vecCenter, 2f, hostilityColor); } } } } } } if (settings.DrawCurrentPath) { MeshNavigator navigator = Navigator.NavigationProvider as MeshNavigator; if (navigator != null && navigator.CurrentMovePath != null) { Tripper.Tools.Math.Vector3[] points = navigator.CurrentMovePath.Path.Points; for (int i = 0; i < points.Length; i++) { Vector3 vecEnd = new Vector3(points[i].X, points[i].Y, points[i].Z); if (i - 1 >= 0) { Tripper.Tools.Math.Vector3 prevPoint = points[i - 1]; Vector3 vecPreviousPoint = new Vector3(prevPoint.X, prevPoint.Y, prevPoint.Z); DrawHelper.DrawLine(vecPreviousPoint, vecEnd, 2f, Color.FromArgb(150, Color.Black)); } DrawHelper.DrawBox(vecEnd, 1.0f, 1.0f, 1.0f, Color.FromArgb(150, Color.BlueViolet)); } } } if (settings.DrawBgMapboxes && BGBuddy.Instance != null) { Battleground curBg = BGBuddy.Instance.Battlegrounds.FirstOrDefault(bg => bg.MapId == StyxWoW.Me.MapId); if (curBg != null) { BgBotProfile curBgProfile = curBg.Profile; if (curBgProfile != null) { foreach (var box in curBgProfile.Boxes[curBg.Side]) { float width = box.BottomRight.X - box.TopLeft.X; float height = box.BottomRight.Z - box.TopLeft.Z; var c = box.Center; Vector3 vecCenter = new Vector3(c.X, c.Y, c.Z); DrawHelper.DrawOutlinedBox(vecCenter, width, width, height, Color.FromArgb(150, Color.Gold)); } foreach (Blackspot bs in curBgProfile.Blackspots) { var p = bs.Location; Vector3 vec = new Vector3(p.X, p.Y, p.X); DrawHelper.DrawCircle(vec, bs.Radius, 32, Color.FromArgb(200, Color.Black)); if (!string.IsNullOrWhiteSpace(bs.Name)) { DrawHelper.Draw3DText("Blackspot: " + bs.Name, vec); } else { DrawHelper.Draw3DText("Blackspot", vec); } } } } } Profile curProfile = ProfileManager.CurrentProfile; if (curProfile != null) { if (settings.DrawHotspots) { GrindArea ga = QuestState.Instance.CurrentGrindArea; if (ga != null) { if (ga.Hotspots != null) { foreach (Hotspot hs in ga.Hotspots) { var p = hs.Position; Vector3 vec = new Vector3(p.X, p.Y, p.Z); DrawHelper.DrawCircle(vec, 10.0f, 32, Color.FromArgb(200, Color.Red)); if (!string.IsNullOrWhiteSpace(hs.Name)) { DrawHelper.Draw3DText("Hotspot: " + hs.Name, vec); } else { DrawHelper.Draw3DText("Hotspot", vec); } } } } // This is only used by grind profiles. if (curProfile.HotspotManager != null) { foreach (WoWPoint p in curProfile.HotspotManager.Hotspots) { Vector3 vec = new Vector3(p.X, p.Y, p.Z); DrawHelper.DrawCircle(vec, 10.0f, 32, Color.FromArgb(200, Color.Red)); DrawHelper.Draw3DText("Hotspot", vec); } } } if (settings.DrawBlackspots) { if (curProfile.Blackspots != null) { foreach (Blackspot bs in curProfile.Blackspots) { var p = bs.Location; Vector3 vec = new Vector3(p.X, p.Y, p.Z); DrawHelper.DrawCircle(vec, bs.Radius, 32, Color.FromArgb(200, Color.Black)); if (!string.IsNullOrWhiteSpace(bs.Name)) { DrawHelper.Draw3DText("Blackspot: " + bs.Name, vec); } else { DrawHelper.Draw3DText("Blackspot: " + vec, vec); } } } } } if (settings.DrawDbAvoidObjects) { foreach (var avoid in AvoidanceManager.Avoids) { var c = avoid.Location; var center = new Vector3(c.X, c.Y, c.Z); DrawHelper.DrawCircle(center, avoid.Radius, 32, Color.FromArgb(200, Color.LightBlue)); center.Z += 1.0f; DrawHelper.Draw3DText("Db Avoid Object", center); } } } catch (Exception) { } }
public void Init() { Password = new Label { FontSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)), Margin = new Thickness(15, 40, 15, 40), HorizontalTextAlignment = TextAlignment.Center, FontFamily = Helpers.OnPlatform(iOS: "Menlo-Regular", Android: "monospace", Windows: "Courier"), LineBreakMode = LineBreakMode.TailTruncation, VerticalOptions = LayoutOptions.Start, TextColor = Color.Black }; Tgr = new TapGestureRecognizer(); Password.GestureRecognizers.Add(Tgr); Password.SetBinding(Label.TextProperty, nameof(PasswordGeneratorPageModel.Password)); SliderCell = new SliderViewCell(this, _passwordGenerationService, _settings); var buttonColor = Color.FromHex("3c8dbc"); RegenerateCell = new ExtendedTextCell { Text = AppResources.RegeneratePassword, TextColor = buttonColor }; CopyCell = new ExtendedTextCell { Text = AppResources.CopyPassword, TextColor = buttonColor }; UppercaseCell = new ExtendedSwitchCell { Text = "A-Z", On = _settings.GetValueOrDefault(Constants.PasswordGeneratorUppercase, true) }; LowercaseCell = new ExtendedSwitchCell { Text = "a-z", On = _settings.GetValueOrDefault(Constants.PasswordGeneratorLowercase, true) }; SpecialCell = new ExtendedSwitchCell { Text = "!@#$%^&*", On = _settings.GetValueOrDefault(Constants.PasswordGeneratorSpecial, true) }; NumbersCell = new ExtendedSwitchCell { Text = "0-9", On = _settings.GetValueOrDefault(Constants.PasswordGeneratorNumbers, true) }; AvoidAmbiguousCell = new ExtendedSwitchCell { Text = AppResources.AvoidAmbiguousCharacters, On = !_settings.GetValueOrDefault(Constants.PasswordGeneratorAmbiguous, false) }; NumbersMinCell = new StepperCell(AppResources.MinNumbers, _settings.GetValueOrDefault(Constants.PasswordGeneratorMinNumbers, 1), 0, 5, 1, () => { _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinNumbers, Convert.ToInt32(NumbersMinCell.Stepper.Value)); Model.Password = _passwordGenerationService.GeneratePassword(); }); SpecialMinCell = new StepperCell(AppResources.MinSpecial, _settings.GetValueOrDefault(Constants.PasswordGeneratorMinSpecial, 1), 0, 5, 1, () => { _settings.AddOrUpdateValue(Constants.PasswordGeneratorMinSpecial, Convert.ToInt32(SpecialMinCell.Stepper.Value)); Model.Password = _passwordGenerationService.GeneratePassword(); }); var table = new ExtendedTableView { VerticalOptions = LayoutOptions.Start, EnableScrolling = false, Intent = TableIntent.Settings, HasUnevenRows = true, NoHeader = true, Root = new TableRoot { new TableSection(Helpers.GetEmptyTableSectionTitle()) { RegenerateCell, CopyCell }, new TableSection(AppResources.Options) { SliderCell, UppercaseCell, LowercaseCell, NumbersCell, SpecialCell }, new TableSection(Helpers.GetEmptyTableSectionTitle()) { NumbersMinCell, SpecialMinCell }, new TableSection(Helpers.GetEmptyTableSectionTitle()) { AvoidAmbiguousCell } } }; if (Device.RuntimePlatform == Device.iOS) { table.RowHeight = -1; table.EstimatedRowHeight = 44; if (_passwordValueAction != null) { ToolbarItems.Add(new DismissModalToolBarItem(this, AppResources.Cancel)); } } var stackLayout = new StackLayout { Orientation = StackOrientation.Vertical, Children = { Password, table }, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 0 }; var scrollView = new ScrollView { Content = stackLayout, Orientation = ScrollOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand }; if (_passwordValueAction != null) { var selectToolBarItem = new ToolbarItem(AppResources.Select, Helpers.ToolbarImage("ion_chevron_right.png"), async() => { if (_fromAutofill) { _googleAnalyticsService.TrackExtensionEvent("SelectedGeneratedPassword"); } else { _googleAnalyticsService.TrackAppEvent("SelectedGeneratedPassword"); } _passwordValueAction(Password.Text); await Navigation.PopForDeviceAsync(); }, ToolbarItemOrder.Default, 0); ToolbarItems.Add(selectToolBarItem); } Title = AppResources.PasswordGenerator; Content = scrollView; BindingContext = Model; }
void UpdateFont() { if (Control == null) { return; } TimePicker timePicker = Element; if (timePicker == null) { return; } bool timePickerIsDefault = timePicker.FontFamily == null && timePicker.FontSize == Device.GetNamedSize(NamedSize.Default, typeof(TimePicker), true) && timePicker.FontAttributes == FontAttributes.None; if (timePickerIsDefault && !_fontApplied) { return; } if (timePickerIsDefault) { // ReSharper disable AccessToStaticMemberViaDerivedType Control.ClearValue(ComboBox.FontStyleProperty); Control.ClearValue(ComboBox.FontSizeProperty); Control.ClearValue(ComboBox.FontFamilyProperty); Control.ClearValue(ComboBox.FontWeightProperty); Control.ClearValue(ComboBox.FontStretchProperty); // ReSharper restore AccessToStaticMemberViaDerivedType } else { Control.ApplyFont(timePicker); } _fontApplied = true; }
private void TwitterOnTapped(object obj) { Device.OpenUri(new Uri("http://www.twitter.com")); }
void FacebookOnTapped(object obj) { Device.OpenUri(new Uri("http://www.facebook.com")); }
private void Form1_Load(object sender, EventArgs e) { lr1.Text = Convert.ToString(R1) + " см"; lr2.Text = Convert.ToString(R2) + " см"; lr3.Text = Convert.ToString(R2) + " см"; LOmega.Text = Convert.ToString(Omega) + " рад/с"; try { // Устанавливаем режим отображения трехмерной графики PresentParameters d3Dpp = new PresentParameters { BackBufferCount = 1, SwapEffect = SwapEffect.Discard, Windowed = true, // Выводим графику в окно MultiSample = MultiSampleType.None, // Выключаем антиалиасинг EnableAutoDepthStencil = true, // Разрешаем создание z-буфера AutoDepthStencilFormat = DepthFormat.D16 // Z-буфер в 16 бит }; d3D = new Device(0, // D3D_ADAPTER_DEFAULT - видеоадаптер по // умолчанию DeviceType.Hardware, // Тип устройства - аппаратный ускоритель this, // Окно для вывода графики CreateFlags.SoftwareVertexProcessing, // Геометрию обрабатывает CPU d3Dpp); } catch (Exception exc) { MessageBox.Show(this, exc.Message, "Ошибка инsициализации"); Close(); // Закрываем окно } wheel1 = Mesh.Cylinder(d3D, (float)R1 / Coeff, (float)R1 / Coeff, 0.1f, 50, 10); wheel2 = Mesh.Cylinder(d3D, (float)R2 / Coeff, (float)R2 / Coeff, 0.15f, 20, 10); wheel3 = Mesh.Cylinder(d3D, (float)R3 / Coeff, (float)R3 / Coeff, 0.1f, 30, 10); torus1 = Mesh.Torus(d3D, 0.006f, (R1 + 0.006f) / Coeff, 36, 80); torus2 = Mesh.Torus(d3D, 0.006f, (R2 + 0.006f) / Coeff, 36, 80); torus3 = Mesh.Torus(d3D, 0.006f, (R3 + 0.006f) / Coeff, 36, 80); bearing1 = Mesh.Sphere(d3D, 0.05f, 10, 10); bearing2 = Mesh.Sphere(d3D, 0.05f, 10, 10); crank1 = Mesh.Cylinder(d3D, 0.006f, 0.006f, (float)(2 * R1) / Coeff, 10, 10); crank2 = Mesh.Cylinder(d3D, 0.006f, 0.006f, (float)(R1 + R3) / Coeff, 10, 10); crank3 = Mesh.Cylinder(d3D, 0.006f, 0.006f, (float)(R1 + R3) / Coeff, 10, 10); cube1 = Mesh.Box(d3D, 0.1f, 0.1f, 0.1f); wheelMaterial = new Material { Diffuse = Color.Blue, Specular = Color.White }; crankMaterial = new Material { Diffuse = Color.Silver, Specular = Color.White }; cubeMaterial = new Material { Diffuse = Color.Red, Specular = Color.White }; }
private void LinkedInOnTapped(object obj) { Device.OpenUri(new Uri("http://www.linkedin.com")); }
public AboutViewModel() { Title = "About"; OpenWebCommand = new Command(() => Device.OpenUri(new Uri("https://google.com"))); }
void _fcm_OnNotificationReceived(object source, FirebasePushNotificationDataEventArgs e) { Debug.WriteLine(e); Device.BeginInvokeOnMainThread(UpdateUser); }
public RespondToAllianceJoinRequestMessage(Device device, IByteBuffer buffer) : base(device, buffer) { Id = 14321; }
public TechDialog(bool isVisibleApp = true) { var stack = Rg.Plugins.Popup.Services.PopupNavigation.PopupStack; if (stack.Count == 0) { Device.BeginInvokeOnMainThread(async() => await SendTechTask()); } else if (stack != null) { Device.BeginInvokeOnMainThread(async() => await Rg.Plugins.Popup.Services.PopupNavigation.PopAsync()); } InitializeComponent(); Analytics.TrackEvent("Диалог тех.поддержки"); LabelInfo.Text = AppResources.TechAdditionalText1 + Settings.MobileSettings.main_name + AppResources.TechAdditionalText2; BtnApp.Text = AppResources.TechAdditionalText3 + Settings.MobileSettings.main_name; var appOpen = new TapGestureRecognizer(); StackLayoutApp.IsVisible = isVisibleApp && Settings.AppIsVisible; var close = new TapGestureRecognizer(); close.Tapped += async(s, e) => { await PopupNavigation.Instance.PopAsync(); }; IconViewClose.GestureRecognizers.Add(close); appOpen.Tapped += async(s, e) => { if (isVisibleApp) { if (Settings.Person.Accounts.Count > 0) { if (Settings.TypeApp.Count > 0) { await Navigation.PushModalAsync(new NewAppPage()); } else { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorAppsNoTypes, "OK"); } } else { await DisplayAlert(AppResources.ErrorTitle, AppResources.ErrorAppsNoIdent, "OK"); } await PopupNavigation.Instance.PopAsync(); } }; FrameBtnApp.GestureRecognizers.Add(appOpen); var openUrlWhatsapp = new TapGestureRecognizer(); openUrlWhatsapp.Tapped += async(s, e) => { await LoadUrl("https://wa.me/79955052402", "com.whatsapp"); }; ImageWhatsapp.GestureRecognizers.Add(item: openUrlWhatsapp); var openUrlTelegram = new TapGestureRecognizer(); openUrlTelegram.Tapped += async(s, e) => { await LoadUrl("https://teleg.run/oiCVE7GCt3Z0bot", "org.telegram.messenger"); }; ImageTelegram.GestureRecognizers.Add(item: openUrlTelegram); var openUrlVider = new TapGestureRecognizer(); openUrlVider.Tapped += async(s, e) => { await LoadUrl("https://clc.am/4YSqZg", "com.viber.voip"); }; ImageViber.GestureRecognizers.Add(item: openUrlVider); var openMail = new TapGestureRecognizer(); openMail.Tapped += async(s, e) => { try { var message = new EmailMessage { Subject = $"{AppResources.PhoneNumber+" "+Settings.Person.Phone}, {AppResources.application+": "+Settings.MobileSettings.main_name}", //Body= , To = new List <string> { "*****@*****.**" } }; await Email.ComposeAsync(message); } catch (FeatureNotSupportedException fbsEx) { Analytics.TrackEvent("Диалог тех.поддержки, невозможно отправить письмо, не поддерживается устройством"); Crashes.TrackError(fbsEx); // Email is not supported on this device } catch (Exception ex) { Crashes.TrackError(ex); // Some other exception occurred } }; mailSpan.GestureRecognizers.Add(openMail); }
public static CommandBufferPool CreateCommandBufferPool(Vk api, Device device, Queue queue, uint queueFamilyIndex) { return(new CommandBufferPool(api, device, queue, queueFamilyIndex)); }
public PiranhaMessage(Device device) { Device = device; Stream = new MemoryStream(); }
private void BuildPageObjects() { var btnSize = Device.GetNamedSize(NamedSize.Large, typeof(Button)); var lblSize = Device.GetNamedSize(NamedSize.Large, typeof(Label)); innerGrid = new Grid(); #if __ANDROID__ innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(6, GridUnitType.Star) }); innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); #endif #if __IOS__ innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(4, GridUnitType.Star) }); innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); innerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); #endif outerGrid = new Grid(); outerGrid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) }); accountTitle = new Label(); accountTitle.FontFamily = "AmericanTypewriter-Bold"; accountTitle.FontSize = lblSize * 2; accountTitle.Text = "Mahecha BJJ Account"; accountTitle.TextColor = Color.Black; accountTitle.FontAttributes = FontAttributes.Bold; accountInfo = new Label(); accountInfo.FontFamily = "AmericanTypewriter-Bold"; accountInfo.FontSize = lblSize; accountInfo.Text = "-Ability to create and manage you're own playlists.\n-Access to Mahecha BJJ Web Application(Coming soon)"; accountInfo.TextColor = Color.Black; accountBtn = new Button(); accountBtn.Style = (Style)Application.Current.Resources["common-blue-btn"]; accountBtn.FontFamily = "AmericanTypewriter-Bold"; accountBtn.FontSize = btnSize * 2; accountBtn.Text = "Create"; accountBtn.Clicked += async(sender, e) => { ToggleButtons(); await Navigation.PushModalAsync(new SignUpPage(package)); ToggleButtons(); }; noAccountBtn = new Button(); noAccountBtn.Style = (Style)Application.Current.Resources["common-red-btn"]; noAccountBtn.FontFamily = "AmericanTypewriter-Bold"; noAccountBtn.FontSize = btnSize * 2; noAccountBtn.Text = "No Account"; noAccountBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PushModalAsync(new SummaryPage(package)); ToggleButtons(); }; backBtn = new Button(); backBtn.Style = (Style)Application.Current.Resources["common-red-btn"]; backBtn.Image = "back.png"; backBtn.VerticalOptions = LayoutOptions.FillAndExpand; backBtn.HorizontalOptions = LayoutOptions.FillAndExpand; backBtn.Clicked += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PopModalAsync(); ToggleButtons(); }; #if __ANDROID__ var pd = new PaintDrawable(Android.Graphics.Color.Rgb(58, 93, 174)); pd.SetCornerRadius(100); androidNoAccountBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidNoAccountBtn.Text = "No Account"; androidNoAccountBtn.Typeface = Constants.COMMONFONT; androidNoAccountBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidNoAccountBtn.SetBackground(pd); androidNoAccountBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidNoAccountBtn.Gravity = Android.Views.GravityFlags.Center; androidNoAccountBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PushModalAsync(new SummaryPage(package)); ToggleButtons(); }; androidNoAccountBtn.SetAllCaps(false); androidAccountBtn = new Android.Widget.Button(MainApplication.ActivityContext); androidAccountBtn.Text = "Create"; androidAccountBtn.Typeface = Constants.COMMONFONT; androidAccountBtn.SetAutoSizeTextTypeWithDefaults(Android.Widget.AutoSizeTextType.Uniform); androidAccountBtn.SetBackground(pd); androidAccountBtn.SetTextColor(Android.Graphics.Color.Rgb(242, 253, 255)); androidAccountBtn.Gravity = Android.Views.GravityFlags.Center; androidAccountBtn.Click += async(object sender, EventArgs e) => { ToggleButtons(); await Navigation.PushModalAsync(new SignUpPage(package)); ToggleButtons(); }; androidAccountBtn.SetAllCaps(false); androidAccountTitle = new Android.Widget.TextView(MainApplication.ActivityContext); androidAccountTitle.Text = "Mahecha BJJ Account"; androidAccountTitle.Typeface = Constants.COMMONFONT; androidAccountTitle.SetTextSize(Android.Util.ComplexUnitType.Fraction, 100); androidAccountTitle.SetTextColor(Android.Graphics.Color.Black); androidAccountTitle.Gravity = Android.Views.GravityFlags.Center; androidAccountTitle.SetTypeface(androidAccountTitle.Typeface, Android.Graphics.TypefaceStyle.Bold); androidAccountInfo = new Android.Widget.TextView(MainApplication.ActivityContext); androidAccountInfo.Text = "-Ability to create and manage you're own playlists.\n-Access to Mahecha BJJ Web Application(Coming soon)"; androidAccountInfo.SetTextSize(Android.Util.ComplexUnitType.Fraction, 75); androidAccountInfo.Typeface = Constants.COMMONFONT; androidAccountInfo.SetTextColor(Android.Graphics.Color.Black); androidAccountInfo.Gravity = Android.Views.GravityFlags.Start; #endif }
private void DeviceContext_DeleteContext_Core() { using (Device device = new Device()) Assert.Throws <ArgumentException>(() => device.Context.DeleteContext(IntPtr.Zero)); }