public LazyTransactionService(ITransactionRepository transactionRepository, IFinTsService finTsService, IDate date, IInputOutput io) { this.finTsService = finTsService; this.transactionRepository = transactionRepository; this.date = date; this.io = io; }
public Cart(ICartRepository cartRepository,IProductRepository productRepository, IDiscountRepository discountRepository, IDate date) { _cartRepository = cartRepository; _productRepository = productRepository; _discountRepository = discountRepository; _date = date; }
public IWorkday FindWorkdayBy(IDate date) { if (date == null) throw new ArgumentNullException(nameof(date)); if(!_allWorkdays.Any(o => o.Date.Equals(date))) throw new ArgumentOutOfRangeException("no workday with specified date in repository"); return _allWorkdays.FirstOrDefault(o => o.Date.Equals(date)); }
public IDailyWorkTimeWeekPlan FindWorkTimePlanBy(IDate date) { if (date == null) throw new ArgumentNullException(nameof(date)); if (!_timetableOfPlannedWorktime.Any(kvp => kvp.Key.CompareTo(date) <= 0)) throw new ArgumentOutOfRangeException("plannedWorktimeRepository is empty"); return _timetableOfPlannedWorktime.Where(kvp => kvp.Key.CompareTo(date) <= 0).Aggregate((l, r) => l.Key.CompareTo(r.Key) >= 0 ? l : r).Value; }
protected void Page_Load(object sender, EventArgs e) { _logging = IoC.IoC.Get<ILog>(); _date = IoC.IoC.Get<IDate>(); _settings = IoC.IoC.Get<ISettings>(); _emailNotificationItems = IoC.IoC.Get<IEmailNotificationItems>(); _sendEmail = IoC.IoC.Get<IEmail>(); _status = IoC.IoC.Get<IStatus>(); var url = Request.Url.AbsoluteUri; if (Request.QueryString["csvfile"] == null) { numberOfRun += 1; _logging.Msg("CroneJob startet, " + numberOfRun); if (DateTime.Now.Hour == 8) { _sendEmail.SendEmail("*****@*****.**", "*****@*****.**", "Cronejob startet kl. 8:00, antal gange det er kørt siden sidst: " + numberOfRun, ""); numberOfRun = 0; } url = null; } Run(url); }
internal Leg(IVoyage the_voyage, ILocation the_load_location, ILocation the_unload_location, IDate the_load_time, IDate the_unload_time) { underlying_voyage = the_voyage; underlying_load_location = the_load_location; underlying_unload_location = the_unload_location; underlying_load_time = the_load_time; underlying_unload_time = the_unload_time; }
public Workday(IDate date, IEntryExitTime entryExitTime, IMutableTimeSpan correctionOfWorktime) { if (date == null) throw new ArgumentNullException(nameof(date)); if (entryExitTime == null) throw new ArgumentNullException(nameof(entryExitTime)); if (correctionOfWorktime == null) throw new ArgumentNullException(nameof(correctionOfWorktime)); _date = date; _entryExitTime = entryExitTime; _correctionOfWorktime = correctionOfWorktime; }
public WorkdayInMemoryRepositoryTests() { _workdays = new List<IWorkday>(); _someDate = new Date(19, 6, 1991); _someWorkday = new Workday(_someDate, new EntryExitTime(new MutableDayTime(10, 0), new MutableDayTime(11, 0)), new MutableTimeSpan()); _workdays.Add(_someWorkday); _workdays.Add(new Workday(new Date(6, 6, 1990), new EntryExitTime(new MutableDayTime(6, 0), new MutableDayTime(8, 0)), new MutableTimeSpan())); _workdays.Add(new Workday(new Date(5, 7, 1995), new EntryExitTime(new MutableDayTime(1, 0), new MutableDayTime(2, 0)), new MutableTimeSpan())); _workdayRepository = new WorkdayInMemoryRepository(_workdays); }
public EmailNotification(ILog logging, IDate date, ISettings settings, IEmailNotificationItems emailNotificationItems, IEmail sendEmail, IStatus status, String emailFrom, String url) { _settings = settings; _emailNotificationItems = emailNotificationItems; _sendEmail = sendEmail; _status = status; _date = date; _log = logging; _emailFrom = emailFrom; _url = url; }
public PlannedWorktimeInMemoryRepositoryTests() { var someDateMinus1Day = new Date(18, 6, 1991); _someDate = new Date(19, 6, 1991); var someDatePlus10Days = new Date(29, 6, 1991); var timetableDictionary = new Dictionary<IDate, IDailyWorkTimeWeekPlan>(); var modifiableWorkTimePlan = new DailyWorkTimeWeekPlan(); modifiableWorkTimePlan.GetPlannedWorkTimeFor(DayOfWeek.Wednesday).Hour = 1; timetableDictionary[_someDate] = modifiableWorkTimePlan; timetableDictionary[someDatePlus10Days] = new DailyWorkTimeWeekPlan(); timetableDictionary[someDateMinus1Day] = new DailyWorkTimeWeekPlan(); _timetable = new PlannedWorktimeInMemoryRepository(timetableDictionary); }
public ILeg create_leg_using(IVoyage the_voyage, ILocation the_load_location, ILocation the_unload_location, IDate the_load_time, IDate the_unload_time) { if (the_voyage == null) throw new ArgumentNullException("the_voyage", "Invariant Violated: a valid voyage is required in order to construct a leg."); if (the_load_location == null) throw new ArgumentNullException("the_load_location", "Invariant Violated: a valid load location is required in order to construct a leg."); if (the_unload_location == null) throw new ArgumentNullException("the_unload_location", "Invariant Violated: a valid unload location is required in order to construct a leg."); if (the_load_time == null) throw new ArgumentNullException("the_load_time", "Invariant Violated: a valid load time is required in order to construct a leg."); if (the_unload_time == null) throw new ArgumentNullException("the_unload_time", "Invariant Violated: a valid unload time is required in order to construct a leg."); return new Leg(the_voyage, the_load_location, the_unload_location, the_load_time, the_unload_time); }
public IRouteSpecification create_route_specification_using(ILocation the_origin_location, ILocation the_destination_location, IDate the_arrival_deadline) { if (the_origin_location == null) throw new ArgumentNullException("the_origin_location", "Invariant Violated: origin location is required."); if (the_destination_location == null) throw new ArgumentNullException("the_destination_location", "Invariant Violated: destination location is required."); if (the_arrival_deadline == null) throw new ArgumentNullException("the_arrival_deadline", "Invariant Violated: arrival deadline is required."); if (the_origin_location.has_the_same_identity_as(the_destination_location)) throw new ArgumentException("Invariant Violated: origin and destination locations can't be the same."); return new RouteSpecification(the_origin_location, the_destination_location, the_arrival_deadline); }
public AccountTransactionReportRecord(int cid, decimal value, string bnkjnldesc, string trxref, IDate thedate, TransactionType trxtype) { this.clientid = cid; this.bankjnldescription = bnkjnldesc; this.tranref = trxref; this.trandate = (thedate == null)?((IDate)(new Date(Convert.ToDateTime("01/01/1900")))):thedate; this.trantype = (trxtype == null)?TransactionType.Other:trxtype; if (value < 0) { this.credit = Math.Abs(value); } else { this.debit = value; } }
public bool Equals(IDate other) { return Equals((object)other); }
public Mock(IDate date) { this.date = date; }
/// <summary> /// Get overflow date value /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static DateTime?GetOverflowDate(this IDate operations) { return(Task.Factory.StartNew(s => ((IDate)s).GetOverflowDateAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult()); }
/// <summary> /// Put min date value 0000-01-01 /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dateBody'> /// </param> public static void PutMinDate(this IDate operations, DateTime?dateBody) { Task.Factory.StartNew(s => ((IDate)s).PutMinDateAsync(dateBody), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); }
private void ShowDate(int type) { if (_IDate != null) { GpDate.Controls.Remove(_IDate.Control); } switch (type) { case CGtd.TYPE_DATES: if (_UtDates == null) { _UtDates = new UtDates(this); _UtDates.Dock = DockStyle.Fill; } GpDate.Text = "时间"; _IDate = _UtDates; break; case CGtd.TYPE_EVENT: if (_UtEvent == null) { _UtEvent = new UtEvent(); _UtEvent.Dock = DockStyle.Fill; } GpDate.Text = "事件"; _IDate = _UtEvent; break; case CGtd.TYPE_MATHS: if (_UtMaths == null) { _UtMaths = new UtMaths(); _UtMaths.Dock = DockStyle.Fill; } GpDate.Text = "公式"; _IDate = _UtMaths; break; default: return; } GpDate.Controls.Add(_IDate.Control); _IDate.MGtd = MGtd; _IDate.ShowData(); }
/// <summary> /// Get null date value /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static System.DateTime?GetNull(this IDate operations) { return(operations.GetNullAsync().GetAwaiter().GetResult()); }
/// <summary> /// Get overflow date value /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <DateTime?> GetOverflowDateAsync(this IDate operations, CancellationToken cancellationToken = default(CancellationToken)) { HttpOperationResponse <DateTime?> result = await operations.GetOverflowDateWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false); return(result.Body); }
internal RouteSpecification(ILocation the_origin_location, ILocation the_destination_location, IDate the_arrival_deadline) { this.underlying_origin_location = the_origin_location; this.underlying_destination_location = the_destination_location; this.underlying_arrival_deadline = the_arrival_deadline; }
public Application(IDefault page = null) { // https://github.com/mrdoob/three.js/wiki/Migration var size = 600; var windowHalfX = size / 2; var windowHalfY = size / 2; Native.document.body.style.overflow = IStyle.OverflowEnum.hidden; var container = new IHTMLDiv(); container.AttachToDocument(); container.style.SetLocation(0, 0, Native.window.Width, Native.window.Height); container.style.backgroundColor = JSColor.Black; var camera = new THREE.PerspectiveCamera(40, Native.window.aspect, 1, 3000); camera.position.z = 1000; var scene = new THREE.Scene(); var light = new THREE.DirectionalLight(0xffffff); light.position.x = 1; light.position.y = 0; light.position.z = 1; //scene.addLight(light); scene.add(light); var renderer = new THREE.WebGLRenderer(); var geometry = new THREE.TorusGeometry(50, 20, 15, 15); var uniforms = new MyUniforms(); // ShaderMaterial var material_base = new THREE.ShaderMaterial( new { uniforms = THREE.UniformsUtils.clone(uniforms), vertex_shader = new GeometryVertexShader().ToString(), fragment_shader = new GeometryFragmentShader().ToString() } ); //renderer.initMaterial(material_base, scene.lights, scene.fog); #region addObject var r = new Random(); Func <float> Math_random = () => (float)r.NextDouble(); for (var i = 0; i < 100; i++) { //var material_uniforms = (MyUniforms)THREE.__ThreeExtras.Uniforms.clone(uniforms); var material_uniforms = (MyUniforms)THREE.UniformsUtils.clone(uniforms); var material = new THREE.ShaderMaterial( new { uniforms = material_uniforms, vertex_shader = new GeometryVertexShader().ToString(), fragment_shader = new GeometryFragmentShader().ToString() } ); material.program = material_base.program; material_uniforms.uDirLightPos.value = light.position; material_uniforms.uDirLightColor.value = light.color; material_uniforms.uBaseColor.value = new THREE.Color((int)(Math_random() * 0xffffff)); var mesh = new THREE.Mesh(geometry, material); mesh.position.x = Math_random() * 800f - 400f; mesh.position.y = Math_random() * 800f - 400f; mesh.position.z = Math_random() * 800f - 400f; mesh.rotation.x = Math_random() * 360f * (float)Math.PI / 180f; mesh.rotation.y = Math_random() * 360f * (float)Math.PI / 180f; mesh.rotation.z = Math_random() * 360f * (float)Math.PI / 180f; //scene.addObject(mesh); scene.add(mesh); } #endregion /////////////////////////////// var c = 0; container.appendChild(renderer.domElement); #region AtResize Action AtResize = delegate { container.style.SetLocation(0, 0, Native.window.Width, Native.window.Height); camera.aspect = (int)Native.window.aspect; camera.updateProjectionMatrix(); renderer.setSize(Native.window.Width, Native.window.Height); }; Native.window.onresize += delegate { AtResize(); }; AtResize(); #endregion #region IsDisposed var IsDisposed = false; Dispose = delegate { if (IsDisposed) { return; } IsDisposed = true; renderer.domElement.Orphanize(); }; #endregion #region tick Native.window.onframe += delegate { if (IsDisposed) { return; } c++; var l = scene.children.Length; Native.document.title = new { l }.ToString(); var time = new IDate().getTime() * 0.0004; //var l = scene.objects.Length; for (var i = 0; i < l; i++) { scene.children[i].rotation.x += 0.01f; scene.children[i].rotation.y += 0.01f; } /* * light.position.x = Math.sin( time ); * light.position.z = Math.cos( time ); * light.position.y = 0.5; * light.position.normalize(); */ renderer.render(scene, camera); }; #endregion #region requestFullscreen Native.Document.body.ondblclick += delegate { if (IsDisposed) { return; } // http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/ Native.Document.body.requestFullscreen(); }; #endregion }
public RetentionAdjustments(int id, string clientName, Date endOfMonth, string status, IDate releaseDate, int clientId) { this.id = id; this.clientId = clientId; this.clientName = clientName; this.endOfMonth = endOfMonth; this.status = status; this.releaseDate = releaseDate; }
public Date(IDate date) : this(date.Year, date.Month, date.Day) { }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefault page = null) { // works in IE! var size = 500; var gl = new WebGLRenderingContext(); var canvas = gl.canvas.AttachToDocument(); Native.document.body.style.overflow = IStyle.OverflowEnum.hidden; canvas.style.SetLocation(0, 0, size, size); canvas.width = size; canvas.height = size; var gl_viewportWidth = size; var gl_viewportHeight = size; var toolbar = new Toolbar(); if (page != null) { toolbar.Container.AttachToDocument(); toolbar.Container.style.Opacity = 0.7; toolbar.HideButton.onclick += delegate { // ScriptCoreLib.Extensions toolbar.HideTarget.ToggleVisible(); }; } #region IsDisposed var IsDisposed = false; this.Dispose = delegate { if (IsDisposed) { return; } IsDisposed = true; canvas.Orphanize(); }; #endregion #region AtResize Action AtResize = delegate { gl_viewportWidth = Native.window.Width; gl_viewportHeight = Native.window.Height; canvas.style.SetLocation(0, 0, gl_viewportWidth, gl_viewportHeight); canvas.width = gl_viewportWidth; canvas.height = gl_viewportHeight; }; Native.window.onresize += e => { AtResize(); }; AtResize(); #endregion #region requestFullscreen Native.Document.body.ondblclick += delegate { if (IsDisposed) { return; } // http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/ Native.Document.body.requestFullscreen(); }; #endregion #region createShader Func <ScriptCoreLib.GLSL.Shader, WebGLShader> createShader = (src) => { var shader = gl.createShader(src); // verify if (gl.getShaderParameter(shader, gl.COMPILE_STATUS) == null) { Native.window.alert("error in SHADER:\n" + gl.getShaderInfoLog(shader)); throw new InvalidOperationException("shader failed"); } return(shader); }; #endregion #region programs var programs = new[] { gl.createProgram(new Shaders.PerFragmentLightingVertexShader(), new Shaders.PerFragmentLightingFragmentShader() ) }.Select( shaderProgram => { gl.linkProgram(shaderProgram); var vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); gl.enableVertexAttribArray((uint)vertexPositionAttribute); var vertexNormalAttribute = gl.getAttribLocation(shaderProgram, "aVertexNormal"); gl.enableVertexAttribArray((uint)vertexNormalAttribute); var textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); gl.enableVertexAttribArray((uint)textureCoordAttribute); var pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); var mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); var nMatrixUniform = gl.getUniformLocation(shaderProgram, "uNMatrix"); var samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); var materialShininessUniform = gl.getUniformLocation(shaderProgram, "uMaterialShininess"); var showSpecularHighlightsUniform = gl.getUniformLocation(shaderProgram, "uShowSpecularHighlights"); var useTexturesUniform = gl.getUniformLocation(shaderProgram, "uUseTextures"); var useLightingUniform = gl.getUniformLocation(shaderProgram, "uUseLighting"); var ambientColorUniform = gl.getUniformLocation(shaderProgram, "uAmbientColor"); var pointLightingLocationUniform = gl.getUniformLocation(shaderProgram, "uPointLightingLocation"); var pointLightingSpecularColorUniform = gl.getUniformLocation(shaderProgram, "uPointLightingSpecularColor"); var pointLightingDiffuseColorUniform = gl.getUniformLocation(shaderProgram, "uPointLightingDiffuseColor"); return(new { program = shaderProgram, vertexPositionAttribute, vertexNormalAttribute, textureCoordAttribute, pMatrixUniform, mvMatrixUniform, nMatrixUniform, samplerUniform, materialShininessUniform, showSpecularHighlightsUniform, useTexturesUniform, useLightingUniform, ambientColorUniform, pointLightingLocationUniform, pointLightingSpecularColorUniform, pointLightingDiffuseColorUniform }); } ).ToArray(); #endregion var currentProgram = programs.First(); var mvMatrix = glMatrix.mat4.create(); var mvMatrixStack = new Stack <Float32Array>(); var pMatrix = glMatrix.mat4.create(); #region mvPushMatrix Action mvPushMatrix = delegate { var copy = glMatrix.mat4.create(); glMatrix.mat4.set(mvMatrix, copy); mvMatrixStack.Push(copy); }; #endregion #region mvPopMatrix Action mvPopMatrix = delegate { mvMatrix = mvMatrixStack.Pop(); }; #endregion #region degToRad Func <float, float> degToRad = (degrees) => { return(degrees * (f)Math.PI / 180f); }; #endregion // await earth new HTML.Images.FromAssets.earth().InvokeOnComplete( earth => // await metail new HTML.Images.FromAssets.arroway_de_metal_structure_06_d100_flat().InvokeOnComplete( metal => { #region setMatrixUniforms Action setMatrixUniforms = delegate { #region [uniform] mat4 uPMatrix <- pMatrix gl.uniformMatrix4fv(currentProgram.pMatrixUniform, false, pMatrix); #endregion #region [uniform] mat4 uMVMatrix <- mvMatrix gl.uniformMatrix4fv(currentProgram.mvMatrixUniform, false, mvMatrix); #endregion var normalMatrix = glMatrix.mat3.create(); glMatrix.mat4.toInverseMat3(mvMatrix, normalMatrix); glMatrix.mat3.transpose(normalMatrix); #region [uniform] mat3 uNMatrix <- normalMatrix gl.uniformMatrix3fv(currentProgram.nMatrixUniform, false, normalMatrix); #endregion }; #endregion #region handleLoadedTexture Action <WebGLTexture, IHTMLImage> handleLoadedTexture = (texture, texture_image) => { gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1); gl.bindTexture(gl.TEXTURE_2D, texture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture_image); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.LINEAR_MIPMAP_NEAREST); gl.generateMipmap(gl.TEXTURE_2D); gl.bindTexture(gl.TEXTURE_2D, null); }; #endregion var earthTexture = gl.createTexture(); handleLoadedTexture(earthTexture, earth); var galvanizedTexture = gl.createTexture(); handleLoadedTexture(galvanizedTexture, metal); new WebGLLesson14.Data.Teapot().Content.AttachToDocument().onload += delegate { #region loadTeapot var teapotData = Application.Teapot; var teapotVertexNormalBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexNormalBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(teapotData.vertexNormals), gl.STATIC_DRAW); var teapotVertexNormalBuffer_itemSize = 3; var teapotVertexNormalBuffer_numItems = teapotData.vertexNormals.Length / 3; var teapotVertexTextureCoordBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexTextureCoordBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(teapotData.vertexTextureCoords), gl.STATIC_DRAW); var teapotVertexTextureCoordBuffer_itemSize = 2; var teapotVertexTextureCoordBuffer_numItems = teapotData.vertexTextureCoords.Length / 2; var teapotVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexPositionBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(teapotData.vertexPositions), gl.STATIC_DRAW); var teapotVertexPositionBuffer_itemSize = 3; var teapotVertexPositionBuffer_numItems = teapotData.vertexPositions.Length / 3; var teapotVertexIndexBuffer = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, teapotVertexIndexBuffer); gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(teapotData.indices), gl.STATIC_DRAW); var teapotVertexIndexBuffer_itemSize = 1; var teapotVertexIndexBuffer_numItems = teapotData.indices.Length; #endregion gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f); gl.enable(gl.DEPTH_TEST); var teapotAngle = 180f; var lastTime = 0L; #region animate Action animate = () => { var timeNow = new IDate().getTime(); if (lastTime != 0) { var elapsed = timeNow - lastTime; teapotAngle += 0.05f * elapsed; } lastTime = timeNow; }; #endregion //Func<string, f> parseFloat = Convert.ToSingle; Func <string, f> parseFloat = x => float.Parse(x); #region drawScene Action drawScene = () => { gl.useProgram(currentProgram.program); gl.viewport(0, 0, gl_viewportWidth, gl_viewportHeight); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); //if (teapotVertexPositionBuffer == null || teapotVertexNormalBuffer == null || teapotVertexTextureCoordBuffer == null || teapotVertexIndexBuffer == null) { // return; //} glMatrix.mat4.perspective(45, gl_viewportWidth / gl_viewportHeight, 0.1f, 100.0f, pMatrix); var shaderProgram = currentProgram; var specularHighlights = toolbar.specular.@checked; #region [uniform] bool uShowSpecularHighlights <- toolbar.specular.@checked gl.uniform1i(shaderProgram.showSpecularHighlightsUniform, Convert.ToInt32(specularHighlights)); #endregion var lighting = toolbar.lighting.@checked; #region [uniform] bool uUseLighting <- toolbar.lighting.@checked gl.uniform1i(shaderProgram.useLightingUniform, Convert.ToInt32(lighting)); #endregion if (lighting) { #region [uniform] uAmbientColor <- ambientR, ambientG, ambientB gl.uniform3f( shaderProgram.ambientColorUniform, parseFloat(toolbar.ambientR.value), parseFloat(toolbar.ambientG.value), parseFloat(toolbar.ambientB.value) ); #endregion #region [uniform] uPointLightingLocation <- lightPositionX, lightPositionY, lightPositionZ gl.uniform3f( shaderProgram.pointLightingLocationUniform, parseFloat(toolbar.lightPositionX.value), parseFloat(toolbar.lightPositionY.value), parseFloat(toolbar.lightPositionZ.value) ); #endregion #region [uniform] uPointLightingSpecularColor <- specularR, specularG, specularB gl.uniform3f( shaderProgram.pointLightingSpecularColorUniform, parseFloat(toolbar.specularR.value), parseFloat(toolbar.specularG.value), parseFloat(toolbar.specularB.value) ); #endregion #region [uniform] uPointLightingDiffuseColor <- diffuseR, diffuseG, diffuseB gl.uniform3f( shaderProgram.pointLightingDiffuseColorUniform, parseFloat(toolbar.diffuseR.value), parseFloat(toolbar.diffuseG.value), parseFloat(toolbar.diffuseB.value) ); #endregion } var texture = toolbar.texture[toolbar.texture.selectedIndex].value; gl.uniform1i(shaderProgram.useTexturesUniform, Convert.ToInt32(texture != "none")); glMatrix.mat4.identity(mvMatrix); glMatrix.mat4.translate(mvMatrix, new f[] { 0, 0, -40 }); glMatrix.mat4.rotate(mvMatrix, degToRad(23.4f), new f[] { 1, 0, -1 }); glMatrix.mat4.rotate(mvMatrix, degToRad(teapotAngle), new f[] { 0, 1, 0 }); gl.activeTexture(gl.TEXTURE0); if (texture == "earth") { gl.bindTexture(gl.TEXTURE_2D, earthTexture); } else if (texture == "galvanized") { gl.bindTexture(gl.TEXTURE_2D, galvanizedTexture); } gl.uniform1i(shaderProgram.samplerUniform, 0); gl.uniform1f(shaderProgram.materialShininessUniform, parseFloat(toolbar.shininess.value)); gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexPositionBuffer); gl.vertexAttribPointer((uint)shaderProgram.vertexPositionAttribute, teapotVertexPositionBuffer_itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexTextureCoordBuffer); gl.vertexAttribPointer((uint)shaderProgram.textureCoordAttribute, teapotVertexTextureCoordBuffer_itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, teapotVertexNormalBuffer); gl.vertexAttribPointer((uint)shaderProgram.vertexNormalAttribute, teapotVertexNormalBuffer_itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, teapotVertexIndexBuffer); setMatrixUniforms(); gl.drawElements(gl.TRIANGLES, teapotVertexIndexBuffer_numItems, gl.UNSIGNED_SHORT, 0); }; #endregion Native.window.onframe += delegate { if (IsDisposed) { return; } animate(); drawScene(); }; }; } ) ); }
/// <summary> /// Get invalid date value /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <DateTime?> GetInvalidDateAsync(this IDate operations, CancellationToken cancellationToken = default(CancellationToken)) { var _result = await operations.GetInvalidDateWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false); return(_result.Body); }
public void AddOrUpdateWorkTimePlanBeginningAt(IDate startDate, IDailyWorkTimeWeekPlan workTimePlan) { if (startDate == null) throw new ArgumentNullException(nameof(startDate)); if (workTimePlan == null) throw new ArgumentNullException(nameof(workTimePlan)); _timetableOfPlannedWorktime[startDate] = workTimePlan; }
public void Delete(string Owner, IDate beginDate, ITime beginTime, IDate endDate, ITime endTime) { DeleteJobQueue.Enqueue(GetKey(Owner, tmc.ToDateTime(beginDate, beginTime), tmc.ToDateTime(endDate, endTime))); }
public AccountAdapter(IDate date) { _date = date; _balance = Money.ValueOf(0); operations = new List <Operation>(); }
public BatchSchedule(int number, string statusDescription, short status, IDate date, IDate released, IDate modifiedDate, IDate dateFinished, string header, string note, string createdBy, string modifiedBy, BatchScheduleFinanceInfo scheduleFinanceInfo, ClientAttribute clientAttribute) { this.number = number; this.clientAttribute = clientAttribute; this.scheduleFinanceInfo = scheduleFinanceInfo; this.note = note; this.status = status; this.dateFinished = dateFinished; this.date = date; this.released = released; this.statusDescription = statusDescription; this.createdBy = createdBy; this.modifiedDate = modifiedDate; this.modifiedBy = modifiedBy; this.header = header; }
public File(string name = null, string fullPath = null, string type = null, IDate lastModifiedDate = null, int size = 0) { }
/// <summary> /// Put min date value 0000-01-01 /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dateBody'> /// </param> public static void PutMinDate(this IDate operations, System.DateTime dateBody) { operations.PutMinDateAsync(dateBody).GetAwaiter().GetResult(); }
void InitializeContent(IDefault page = null) { #region make sure we atleast have our invisible DOM if (page == null) { page = new HTML.Pages.Default(); } #endregion #region container Native.document.body.style.overflow = IStyle.OverflowEnum.hidden; var container = new IHTMLDiv(); container.AttachToDocument(); container.style.backgroundColor = "#000000"; container.style.SetLocation(0, 0, Native.window.Width, Native.window.Height); #endregion #region code port double SCREEN_WIDTH = Native.window.Width; double SCREEN_HEIGHT = Native.window.Height; var animDelta = 0; var animDeltaDir = -1; var lightVal = 0; var lightDir = 1; var soundVal = 0; var oldSoundVal = 0; var soundDir = 1; #region animate it animDeltaDir *= -1; #endregion var clock = new THREE.Clock(); var morphs = new List <THREE.MorphAnimMesh>(); var updateNoise = true; var mlib = new Dictionary <string, THREE.ShaderMaterial>(); var soundtrack = new Five_Armies { loop = true, volume = 0.9 }; #region HasFocus var HasFocus = false; Native.window.onblur += delegate { HasFocus = false; soundtrack.volume = 0.1; }; Native.window.onfocus += delegate { HasFocus = true; soundtrack.volume = 0.9; }; // Native.Document.onmousemove += //delegate //{ // if (HasFocus) // return; // soundtrack.play(); //}; // Native.Document.onmouseout += // delegate // { // if (HasFocus) // return; // soundtrack.pause(); // }; #endregion var THREE_RepeatWrapping = 0; var THREE_FaceColors = 1; var THREE_LinearFilter = 6; var THREE_RGBFormat = 17; var THREE_LinearMipMapLinearFilter = 8; #region SCENE (RENDER TARGET) var sceneRenderTarget = new THREE.Scene(); var cameraOrtho = new THREE.OrthographicCamera( (int)SCREEN_WIDTH / -2, (int)SCREEN_WIDTH / 2, (int)SCREEN_HEIGHT / 2, (int)SCREEN_HEIGHT / -2, -10000, 10000 ); cameraOrtho.position.z = 100; sceneRenderTarget.add(cameraOrtho); #endregion #region SCENE (FINAL) var scene = new THREE.Scene(); scene.fog = new THREE.Fog(0x050505, 2000, 4000); scene.fog.color.setHSV(0.102, 0.9, 0.825); var camera = new THREE.PerspectiveCamera(40, (int)Native.window.aspect, 2, 4000); camera.position.set(-1200, 800, 1200); scene.add(camera); var controls = new THREE.TrackballControls(camera); controls.target.set(0, 0, 0); controls.rotateSpeed = 1.0; controls.zoomSpeed = 1.2; controls.panSpeed = 0.8; controls.noZoom = false; controls.noPan = false; controls.staticMoving = false; controls.dynamicDampingFactor = 0.15; controls.keys = new[] { 65, 83, 68 }; #endregion #region LIGHTS scene.add(new THREE.AmbientLight(0x111111)); var spotLight = new THREE.SpotLight(0xffffff, 1.15); spotLight.position.set(500, 2000, 0); spotLight.castShadow = true; scene.add(spotLight); var pointLight = new THREE.PointLight(0xff4400, 1.5); pointLight.position.set(0, 0, 0); scene.add(pointLight); #endregion #region HEIGHT + NORMAL MAPS var normalShader = __THREE.ShaderExtras.normalmap; var rx = 256; var ry = 256; var pars = new THREE.WebGLRenderTargetArguments { minFilter = THREE_LinearMipMapLinearFilter, magFilter = THREE_LinearFilter, format = THREE_RGBFormat }; var heightMap = new THREE.WebGLRenderTarget(rx, ry, pars); var normalMap = new THREE.WebGLRenderTarget(rx, ry, pars); var uniformsNoise = new MyUniformsNoise { time = new THREE.ShaderExtrasModuleItem_uniforms_item { type = "f", value = 1.0 }, scale = new THREE.ShaderExtrasModuleItem_uniforms_item { type = "v2", value = new THREE.Vector2(1.5, 1.5) }, offset = new THREE.ShaderExtrasModuleItem_uniforms_item { type = "v2", value = new THREE.Vector2(0, 0) } }; var uniformsNormal = __THREE.UniformsUtils.clone(normalShader.uniforms); uniformsNormal.height.value = 0.05; ((THREE.Vector2)uniformsNormal.resolution.value).set(rx, ry); uniformsNormal.heightMap.texture = heightMap; var vertexShader = new Shaders.NoiseVertexShader().ToString(); #endregion #region before TEXTURES var textureCounter = 0; #region RENDERER var renderer = new THREE.WebGLRenderer(); renderer.setSize(Native.window.Width, Native.window.Height); renderer.setClearColor(scene.fog.color, 1); renderer.domElement.style.position = IStyle.PositionEnum.absolute; renderer.domElement.style.top = "0px"; renderer.domElement.style.left = "0px"; container.appendChild(renderer.domElement); // // renderer.gammaInput = true; renderer.gammaOutput = true; #endregion #region applyShader Action <THREE.ShaderExtrasModuleItem, object, object> applyShader = (shader, texture, target) => { var shaderMaterial = new THREE.ShaderMaterial( new THREE.ShaderMaterialArguments { fragmentShader = shader.fragmentShader, vertexShader = shader.vertexShader, uniforms = __THREE.UniformsUtils.clone(shader.uniforms) } ); shaderMaterial.uniforms.tDiffuse.texture = texture; var sceneTmp = new THREE.Scene(); var meshTmp = new THREE.Mesh(new THREE.PlaneGeometry(Native.window.Width, Native.window.Height), shaderMaterial); meshTmp.position.z = -500; sceneTmp.add(meshTmp); renderer.render(sceneTmp, cameraOrtho, target, true); }; #endregion var terrain = default(THREE.Mesh); #region loadTextures Action loadTextures = () => { textureCounter += 1; if (textureCounter == 3) { terrain.visible = true; //document.getElementById("loading").style.display = "none"; } }; //// #endregion #endregion #region TEXTURES var specularMap = new THREE.WebGLRenderTarget(2048, 2048, pars); var diffuseTexture1 = default(THREE.WebGLRenderTarget); diffuseTexture1 = __THREE.ImageUtils.loadTexture( new global::WebGLDynamicTerrainTemplate.HTML.Images.FromAssets.grasslight_big().src, null, IFunction.Of( delegate() { loadTextures(); applyShader(__THREE.ShaderExtras.luminosity, diffuseTexture1, specularMap); } ) ); var diffuseTexture2 = __THREE.ImageUtils.loadTexture( new global::WebGLDynamicTerrainTemplate.HTML.Images.FromAssets.backgrounddetailed6().src, null, IFunction.Of( delegate() { loadTextures(); } ) ); var detailTexture = __THREE.ImageUtils.loadTexture( new global::WebGLDynamicTerrainTemplate.HTML.Images.FromAssets.grasslight_big_nm().src, null, IFunction.Of( delegate() { loadTextures(); } ) ); diffuseTexture1.wrapS = THREE_RepeatWrapping; diffuseTexture1.wrapT = THREE_RepeatWrapping; diffuseTexture2.wrapS = THREE_RepeatWrapping; diffuseTexture2.wrapT = THREE_RepeatWrapping; detailTexture.wrapS = THREE_RepeatWrapping; detailTexture.wrapT = THREE_RepeatWrapping; specularMap.wrapS = THREE_RepeatWrapping; specularMap.wrapT = THREE_RepeatWrapping; #endregion #region TERRAIN SHADER var terrainShader = __THREE.ShaderTerrain.terrain; var uniformsTerrain = __THREE.UniformsUtils.clone(terrainShader.uniforms); uniformsTerrain.tNormal.texture = normalMap; uniformsTerrain.uNormalScale.value = 3.5; uniformsTerrain.tDisplacement.texture = heightMap; uniformsTerrain.tDiffuse1.texture = diffuseTexture1; uniformsTerrain.tDiffuse2.texture = diffuseTexture2; uniformsTerrain.tSpecular.texture = specularMap; uniformsTerrain.tDetail.texture = detailTexture; uniformsTerrain.enableDiffuse1.value = true; uniformsTerrain.enableDiffuse2.value = true; uniformsTerrain.enableSpecular.value = true; ((THREE.Color)uniformsTerrain.uDiffuseColor.value).setHex(0xffffff); ((THREE.Color)uniformsTerrain.uSpecularColor.value).setHex(0xffffff); ((THREE.Color)uniformsTerrain.uAmbientColor.value).setHex(0x111111); uniformsTerrain.uShininess.value = 30; uniformsTerrain.uDisplacementScale.value = 375; ((THREE.Vector2)uniformsTerrain.uRepeatOverlay.value).set(6, 6); var _params = new[] { new { id = "heightmap", fragmentShader = new Shaders.NoiseFragmentShader().ToString(), vertexShader = vertexShader, uniforms = (object)uniformsNoise, lights = false }, new { id = "normal", fragmentShader = normalShader.fragmentShader, vertexShader = normalShader.vertexShader, uniforms = (object)uniformsNormal, lights = false }, new { id = "terrain", fragmentShader = terrainShader.fragmentShader, vertexShader = terrainShader.vertexShader, uniforms = (object)uniformsTerrain, lights = true } }; for (var i = 0; i < _params.Length; i++) { var material = new THREE.ShaderMaterial( new THREE.ShaderMaterialArguments { uniforms = (THREE.ShaderExtrasModuleItem_uniforms)_params[i].uniforms, vertexShader = _params[i].vertexShader, fragmentShader = _params[i].fragmentShader, lights = _params[i].lights, fog = true } ); mlib[(string)_params[i].id] = material; } var plane = new THREE.PlaneGeometry(Native.window.Width, Native.window.Height); var quadTarget = new THREE.Mesh( plane, new THREE.MeshBasicMaterial( new THREE.MeshBasicMaterialArguments { color = 0xff0000 } ) ); quadTarget.position.z = -500; sceneRenderTarget.addObject(quadTarget); #endregion #region TERRAIN MESH var geometryTerrain = new THREE.PlaneGeometry(6000, 6000, 256, 256); geometryTerrain.computeFaceNormals(); geometryTerrain.computeVertexNormals(); geometryTerrain.computeTangents(); terrain = new THREE.Mesh(geometryTerrain, mlib["terrain"]); terrain.rotation.set(-Math.PI / 2.0, 0, 0); terrain.position.set(0, -125, 0); terrain.visible = false; scene.add(terrain); #endregion #region COMPOSER renderer.autoClear = false; var renderTargetParameters = new THREE.WebGLRenderTargetArguments { minFilter = THREE_LinearFilter, magFilter = THREE_LinearFilter, format = THREE_RGBFormat, stencilBufer = false }; var renderTarget = new THREE.WebGLRenderTarget((int)SCREEN_WIDTH, (int)SCREEN_HEIGHT, renderTargetParameters); var effectBloom = new THREE.BloomPass(0.6); var effectBleach = new THREE.ShaderPass(__THREE.ShaderExtras.bleachbypass); var hblur = new THREE.ShaderPass(__THREE.ShaderExtras.horizontalTiltShift); var vblur = new THREE.ShaderPass(__THREE.ShaderExtras.verticalTiltShift); var bluriness = 6; hblur.uniforms.h.value = bluriness / SCREEN_WIDTH; vblur.uniforms.v.value = bluriness / SCREEN_HEIGHT; hblur.uniforms.r.value = 0.5; vblur.uniforms.r.value = 0.5; effectBleach.uniforms.opacity.value = 0.65; var composer0 = new THREE.EffectComposer(renderer, renderTarget); var renderModel = new THREE.RenderPass(scene, camera); vblur.renderToScreen = true; var composer = new THREE.EffectComposer(renderer, renderTarget); composer.addPass(renderModel); composer.addPass(effectBloom); //composer.addPass( effectBleach ); composer.addPass(hblur); composer.addPass(vblur); #endregion var r = new Random(); Func <f> Math_random = () => (f)r.NextDouble(); #region addMorph Action <MyModelGeometry, f, f, f, f, f> addMorph = (geometry, speed, duration, x, y, z) => { var material = new THREE.MeshLambertMaterial( new THREE.MeshLambertMaterialArguments { color = 0xffaa55, morphTargets = true, vertexColors = THREE_FaceColors } ); var meshAnim = new THREE.MorphAnimMesh(geometry, material); meshAnim.speed = speed; meshAnim.duration = duration; meshAnim.time = 600.0 * Math_random(); meshAnim.position.set(x, y, z); meshAnim.rotation.y = (f)(Math.PI / 2f); meshAnim.castShadow = true; meshAnim.receiveShadow = false; scene.add(meshAnim); morphs.Add(meshAnim); renderer.initWebGLObjects(scene); }; #endregion #region morphColorsToFaceColors Action <MyModelGeometry> morphColorsToFaceColors = (geometry) => { if (geometry.morphColors != null) { if (geometry.morphColors.Length > 0) { var colorMap = geometry.morphColors[0]; for (var i = 0; i < colorMap.colors.Length; i++) { geometry.faces[i].color = colorMap.colors[i]; } } } }; #endregion #region Models var loader = new THREE.JSONLoader(); var startX = -3000; loader.load( new Models.parrot().Content.src, IFunction.OfDelegate( new Action <MyModelGeometry>( geometry => { morphColorsToFaceColors(geometry); addMorph(geometry, 250, 500, startX - 500, 500, 700); addMorph(geometry, 250, 500, startX - Math_random() * 500, 500, -200); addMorph(geometry, 250, 500, startX - Math_random() * 500, 500, 200); addMorph(geometry, 250, 500, startX - Math_random() * 500, 500, 1000); } ) ) ); loader.load( new Models.flamingo().Content.src, IFunction.OfDelegate( new Action <MyModelGeometry>( geometry => { morphColorsToFaceColors(geometry); addMorph(geometry, 500, 1000, startX - Math_random() * 500, 350, 40); } ) ) ); loader.load( new Models.stork().Content.src, IFunction.OfDelegate( new Action <MyModelGeometry>( geometry => { morphColorsToFaceColors(geometry); addMorph(geometry, 350, 1000, startX - Math_random() * 500, 350, 340); } ) ) ); #endregion #region PRE-INIT renderer.initWebGLObjects(scene); #endregion #region onkeydown Native.document.body.onkeydown += (e) => { if (e.KeyCode == 78) { lightDir *= -1; } if (e.KeyCode == 77) { animDeltaDir *= -1; } if (e.KeyCode == 66) { soundDir *= -1; } }; #endregion Action __loaded = null; #region event Action loaded; Native.window.parent.With( parent => { __loaded = delegate { __loaded = null; parent.postMessage("WebGLDynamicTerrainTemplate.loaded"); }; } ); #endregion #region render Action render = () => { var delta = clock.getDelta(); soundVal = __THREE.Math.clamp(soundVal + delta * soundDir, 0, 1); if (soundVal != oldSoundVal) { if (soundtrack != null) { soundtrack.volume = soundVal; oldSoundVal = soundVal; } } //Native.Document.title = "textureCounter " + textureCounter; if (terrain.visible) { controls.update(); var Date_now = new IDate().getTime(); var time = Date_now * 0.001; var fLow = 0.4; var fHigh = 0.825; lightVal = __THREE.Math.clamp(lightVal + 0.5 * delta * lightDir, fLow, fHigh); var valNorm = (lightVal - fLow) / (fHigh - fLow); var sat = __THREE.Math.mapLinear(valNorm, 0, 1, 0.95, 0.25); scene.fog.color.setHSV(0.1, sat, lightVal); renderer.setClearColor(scene.fog.color, 1); spotLight.intensity = __THREE.Math.mapLinear(valNorm, 0, 1, 0.1, 1.15); pointLight.intensity = __THREE.Math.mapLinear(valNorm, 0, 1, 0.9, 1.5); uniformsTerrain.uNormalScale.value = __THREE.Math.mapLinear(valNorm, 0, 1, 0.6, 3.5); if (updateNoise) { animDelta = __THREE.Math.clamp(animDelta + 0.00075 * animDeltaDir, 0, 0.05); uniformsNoise.time.value = ((f)uniformsNoise.time.value) + delta * animDelta; var uniformsNoise_offset_value = (THREE.Vector3)uniformsNoise.offset.value; uniformsNoise_offset_value.x += delta * 0.05f; var uniformsTerrain_uOffset_value = (THREE.Vector3)uniformsTerrain.uOffset.value; uniformsTerrain_uOffset_value.x = 4.0f * uniformsNoise_offset_value.x; quadTarget.material = mlib["heightmap"]; renderer.render(sceneRenderTarget, cameraOrtho, heightMap, true); quadTarget.material = mlib["normal"]; renderer.render(sceneRenderTarget, cameraOrtho, normalMap, true); //updateNoise = false; } for (var i = 0; i < morphs.Count; i++) { var morph = morphs[i]; morph.updateAnimation(1000 * delta); morph.position.x += morph.speed * delta; if (morph.position.x > 2000) { morph.position.x = -1500 - Math_random() * 500; } } //renderer.render( scene, camera ); composer.render(0.1); if (__loaded != null) { __loaded(); } } else { } }; #endregion Native.window.onframe += delegate { if (IsDisposed) { return; } render(); }; #endregion #region IsDisposed Dispose = delegate { if (IsDisposed) { return; } IsDisposed = true; //page.song.pause(); soundtrack.pause(); container.Orphanize(); }; #endregion #region AtResize Action AtResize = delegate { container.style.SetLocation(0, 0, Native.window.Width, Native.window.Height); renderer.setSize(Native.window.Width, Native.window.Height); camera.aspect = Native.window.Width / Native.window.Height; camera.updateProjectionMatrix(); }; Native.window.onresize += delegate { AtResize(); }; AtResize(); #endregion Native.document.body.onmousedown += e => { if (e.MouseButton == IEvent.MouseButtonEnum.Middle) { Native.document.body.requestFullscreen(); } }; #region requestFullscreen Native.document.body.ondblclick += delegate { if (IsDisposed) { return; } // http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/ Native.document.body.requestFullscreen(); //AtResize(); }; #endregion }
/// <summary> /// Get overflow date value /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static System.DateTime?GetOverflowDate(this IDate operations) { return(operations.GetOverflowDateAsync().GetAwaiter().GetResult()); }
public bool has_the_same_value_as(IDate the_other_date) { return the_other_date != null && underlying_date == the_other_date.datetime_value(); }
public PromptReportRecord(int id, int clientNumber, string clientName, int customerId, int customerNumber, string customerName, IDate dated, string reference, decimal amount, IDate factored, int batchId, TransactionStatus transactionStatus, decimal balance, int age, string trnNumber, TransactionType transactionType) : base(transactionType.Type, batchId) { ArgumentChecker.ThrowIfNull(transactionStatus, "transactionStatus"); ArgumentChecker.ThrowIfNullOrEmpty(customerName, "customerName"); ArgumentChecker.ThrowIfNullOrEmpty(trnNumber, "trnNumber"); ArgumentChecker.ThrowIfNullOrEmpty(clientName, "clientName"); this.id = id; this.clientNumber = clientNumber; this.clientName = clientName; this.customerId = customerId; this.customerNumber = customerNumber; this.customerName = customerName; this.dated = dated; this.reference = reference; this.amount = amount; this.factored = factored; this.transactionStatus = transactionStatus; this.balance = balance; this.age = age; this.trnNumber = trnNumber; }
public bool is_posterior_to(IDate the_other_date) { return this.underlying_date > the_other_date.datetime_value(); }
/// <summary> /// Put min date value 0000-01-01 /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='dateBody'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task PutMinDateAsync(this IDate operations, DateTime?dateBody, CancellationToken cancellationToken = default(CancellationToken)) { await operations.PutMinDateWithHttpMessagesAsync(dateBody, null, cancellationToken).ConfigureAwait(false); }
public Logic() { data = new SqlDate(); }
public CreditLine(int transactionId, int customerId, int customerNumber, string customerName, string transactionNumber, IDate dated, decimal amount, decimal sum, int batch, IDate created, IDate modified, string modifiedBy) : base(TransactionType.Credit.Type, batch) { ArgumentChecker.ThrowIfNullOrEmpty(customerName, "customerName"); ArgumentChecker.ThrowIfNullOrEmpty(transactionNumber, "transactionNumber"); ArgumentChecker.ThrowIfNullOrEmpty(modifiedBy, "modifiedBy"); this.transactionId = transactionId; this.customerId = customerId; this.customerNumber = customerNumber; this.customerName = customerName; this.transactionNumber = transactionNumber; this.dated = dated; this.amount = amount; this.sum = sum; this.created = created; this.modified = modified; this.modifiedBy = modifiedBy; }
public DownloadItem(IDate date) { _date = date; DownloadState = DownloadState.Queued; Priority = DownloadPriority.Normal; }
public int CompareTo(IDate other) { if (other == null) return -1; return GetHashCode().CompareTo(other.GetHashCode()); }
internal static object ConvertParameterStringToObject(Type desiredType, string parameters, object defaultObject) { try { //DO NOT ADD CUSTOM CLASSES TO CONVERT TYPE! USE A DATABASE PRIMARY KEY INSTEAD! //System Objects #region Boolean if (desiredType == typeof(Boolean)) { Boolean output; return(Boolean.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region Byte if (desiredType == typeof(Byte)) { Byte output; return(Byte.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region SByte if (desiredType == typeof(SByte)) { SByte output; return(SByte.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region Int16 if (desiredType == typeof(Int16)) { Int16 output; return(Int16.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region UInt16 if (desiredType == typeof(UInt16)) { UInt16 output; return(UInt16.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region Int32 if (desiredType == typeof(Int32)) { Int32 output; return(Int32.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region UInt32 if (desiredType == typeof(UInt32)) { UInt32 output; return(UInt32.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region Int64 if (desiredType == typeof(Int64)) { Int64 output; return(Int64.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region UInt64 if (desiredType == typeof(UInt64)) { UInt64 output; return(UInt64.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region Single if (desiredType == typeof(Single)) { Single output; return(Single.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region Double if (desiredType == typeof(Double)) { Double output; return(Double.TryParse(parameters, out output) ? output : defaultObject); } #endregion #region IPAddress if (desiredType == typeof(IHostAddress)) { IHostAddress Default = defaultObject as IHostAddress; try { IHostAddress HostAddress = ObjectFactory.CreateHostAddress(parameters); return((Default.IpAddress.ToString() == HostAddress.IpAddress.ToString()) ? Default : HostAddress); } catch { } return(defaultObject); } #endregion #region String if (desiredType == typeof(String)) { return(parameters); } #endregion //Units Of Measurement #region Angle if (desiredType == typeof(IAngle)) { IAngle nullConversion; ObjectFactory.TryParse("0DEGREES", out nullConversion); IAngle converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Area if (desiredType == typeof(IArea)) { IArea nullConversion; ObjectFactory.TryParse("0SQUAREMETERS", out nullConversion); IArea converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Distance if (desiredType == typeof(IDistance)) { IDistance nullConversion; ObjectFactory.TryParse("0METERS", out nullConversion); IDistance converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Durations if (desiredType == typeof(IDate)) { IDate nullConversion = ObjectFactory.CreateDate(""); IDate converted = ObjectFactory.CreateDate(parameters); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } if (desiredType == typeof(IDateTime)) { IDateTime nullConversion = ObjectFactory.CreateDateTime(""); IDateTime converted = ObjectFactory.CreateDateTime(parameters); return((converted.ToString() == nullConversion.ToSystemString()) ? defaultObject : converted); } if (desiredType == typeof(ITime)) { ITime nullConversion = ObjectFactory.CreateTime(""); ITime converted = ObjectFactory.CreateTime(parameters); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } if (desiredType == typeof(ITimeSpan)) { ITimeSpan nullConversion = ObjectFactory.CreateTimeSpan(""); ITimeSpan converted = ObjectFactory.CreateTimeSpan(parameters); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Energy if (desiredType == typeof(IEnergy)) { IEnergy nullConversion; ObjectFactory.TryParse("0KILOJOULES", out nullConversion); IEnergy converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Mass if (desiredType == typeof(IMass)) { IMass nullConversion; ObjectFactory.TryParse("0KILOGRAMS", out nullConversion); IMass converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Power if (desiredType == typeof(IPower)) { IPower nullConversion; ObjectFactory.TryParse("0KILOWATTS", out nullConversion); IPower converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Pressure if (desiredType == typeof(IPressure)) { IPressure nullConversion; ObjectFactory.TryParse("0PASCALS", out nullConversion); IPressure converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Speed if (desiredType == typeof(ISpeed)) { ISpeed nullConversion; ObjectFactory.TryParse("0M/SEC", out nullConversion); ISpeed converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Temperature if (desiredType == typeof(ITemperature)) { ITemperature nullConversion; ObjectFactory.TryParse("0CELCIUS", out nullConversion); ITemperature converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion #region Volume if (desiredType == typeof(IVolume)) { IVolume nullConversion; ObjectFactory.TryParse("0LITRES", out nullConversion); IVolume converted; ObjectFactory.TryParse(parameters, out converted); return((converted.ToString() == nullConversion.ToString()) ? defaultObject : converted); } #endregion //Colors #region XRGBColor if (desiredType == typeof(I24BitColor)) { string[] split = parameters.Split(' '); byte red = 255; byte green = 255; byte blue = 255; I24BitColor Default = defaultObject as I24BitColor; if (split.Length < 3) { return(Default); } try { red = Convert.ToByte(split[0]); green = Convert.ToByte(split[1]); blue = Convert.ToByte(split[2]); } catch (OverflowException) { //Debug return(Default); } catch (FormatException) { //Debug return(Default); } I24BitColor output = ObjectFactory.CreateColor(red, green, blue).Get24BitColor(); return(output); } #endregion } catch (Exception e) { Debug.AddErrorMessage(e, "Error converting setting from string."); } return(defaultObject); }
public CreditLimitExceededReportRecord(int id, int clientNumber, string clientName, int customerNumber, string customerName, decimal?currentBalance, decimal?monthOldBalance, decimal?twoMonthsOldBalance, decimal?threeMonthsOrOlderBalance, decimal balance, decimal limit, IDate nextCallDate, string contact, string phone, string cell, string email) { this.id = id; this.clientNumber = clientNumber; this.clientName = clientName; this.customerNumber = customerNumber; this.customerName = customerName; this.currentBalance = currentBalance; this.monthOldBalance = monthOldBalance; this.twoMonthsOldBalance = twoMonthsOldBalance; this.threeMonthsOrOlderBalance = threeMonthsOrOlderBalance; this.balance = balance; this.limit = limit; this.nextCallDate = nextCallDate; this.contact = contact; this.phone = phone; this.cell = cell; this.email = email; }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefault page = null) { var size = 500; var gl = new WebGLRenderingContext(); var canvas = gl.canvas.AttachToDocument(); Native.document.body.style.overflow = IStyle.OverflowEnum.hidden; canvas.style.SetLocation(0, 0, size, size); canvas.width = size; canvas.height = size; var gl_viewportWidth = size; var gl_viewportHeight = size; #region IsDisposed var IsDisposed = false; this.Dispose = delegate { if (IsDisposed) { return; } IsDisposed = true; canvas.Orphanize(); }; #endregion #region AtResize Action AtResize = delegate { gl_viewportWidth = Native.window.Width; gl_viewportHeight = Native.window.Height; canvas.style.SetLocation(0, 0, gl_viewportWidth, gl_viewportHeight); canvas.width = gl_viewportWidth; canvas.height = gl_viewportHeight; }; Native.window.onresize += e => { AtResize(); }; AtResize(); #endregion #region requestFullscreen Native.Document.body.ondblclick += delegate { if (IsDisposed) { return; } // http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/ Native.Document.body.requestFullscreen(); }; #endregion var toolbar = new Toolbar(); if (page != null) { toolbar.Container.style.Opacity = 0.7; toolbar.Container.AttachToDocument(); toolbar.HideButton.onclick += delegate { // ScriptCoreLib.Extensions toolbar.HideTarget.ToggleVisible(); }; } #region initShaders var shaderProgram = gl.createProgram( new GeometryVertexShader(), new GeometryFragmentShader() ); gl.linkProgram(shaderProgram); gl.useProgram(shaderProgram); #region getAttribLocation Func <string, long> getAttribLocation = name => gl.getAttribLocation(shaderProgram, name); var shaderProgram_vertexPositionAttribute = getAttribLocation("aVertexPosition"); gl.enableVertexAttribArray((uint)shaderProgram_vertexPositionAttribute); var shaderProgram_vertexNormalAttribute = getAttribLocation("aVertexNormal"); gl.enableVertexAttribArray((uint)shaderProgram_vertexNormalAttribute); var shaderProgram_textureCoordAttribute = getAttribLocation("aTextureCoord"); gl.enableVertexAttribArray((uint)shaderProgram_textureCoordAttribute); #endregion #region getUniformLocation Func <string, WebGLUniformLocation> getUniformLocation = name => gl.getUniformLocation(shaderProgram, name); var shaderProgram_pMatrixUniform = getUniformLocation("uPMatrix"); var shaderProgram_mvMatrixUniform = getUniformLocation("uMVMatrix"); var shaderProgram_nMatrixUniform = getUniformLocation("uNMatrix"); var shaderProgram_samplerUniform = getUniformLocation("uSampler"); var shaderProgram_useLightingUniform = getUniformLocation("uUseLighting"); var shaderProgram_ambientColorUniform = getUniformLocation("uAmbientColor"); var shaderProgram_lightingDirectionUniform = getUniformLocation("uLightingDirection"); var shaderProgram_directionalColorUniform = getUniformLocation("uDirectionalColor"); #endregion #endregion var mvMatrix = glMatrix.mat4.create(); var mvMatrixStack = new Stack <Float32Array>(); var pMatrix = glMatrix.mat4.create(); #region new in lesson 03 Action mvPushMatrix = delegate { var copy = glMatrix.mat4.create(); glMatrix.mat4.set(mvMatrix, copy); mvMatrixStack.Push(copy); }; Action mvPopMatrix = delegate { mvMatrix = mvMatrixStack.Pop(); }; #endregion #region setMatrixUniforms Action setMatrixUniforms = delegate { gl.uniformMatrix4fv(shaderProgram_pMatrixUniform, false, pMatrix); gl.uniformMatrix4fv(shaderProgram_mvMatrixUniform, false, mvMatrix); #region new in lesson 07 var normalMatrix = glMatrix.mat3.create(); glMatrix.mat4.toInverseMat3(mvMatrix, normalMatrix); glMatrix.mat3.transpose(normalMatrix); gl.uniformMatrix3fv(shaderProgram_nMatrixUniform, false, normalMatrix); #endregion }; #endregion #region init buffers #region cubeVertexPositionBuffer var cubeVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer); var vertices = new[] { // Front face RED -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, // Back face YELLOW -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, // Top face GREEN -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, // Bottom face BEIGE -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, -1.0f, -1.0f, 1.0f, // Right face PURPLE 1.0f, -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, // Left face -1.0f, -1.0f, -1.0f, -1.0f, -1.0f, 1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, -1.0f }; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); var cubeVertexPositionBuffer_itemSize = 3; var cubeVertexPositionBuffer_numItems = 6 * 6; #endregion #region cubeVertexNormalBuffer - new in lesson 07 var cubeVertexNormalBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexNormalBuffer); var vertexNormals = new[] { // Front face 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, // Back face 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, // Top face 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // Bottom face 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, // Right face 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, // Left face -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, -1.0f, 0.0f, 0.0f, }; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexNormals), gl.STATIC_DRAW); var cubeVertexNormalBuffer_itemSize = 3; var cubeVertexNormalBuffer_numItems = 24; #endregion #region cubeVertexTextureCoordBuffer var cubeVertexTextureCoordBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer); var textureCoords = new float[] { // Front face 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, // Back face 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, // Top face 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, // Bottom face 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, // Right face 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, // Left face 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, }; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoords), gl.STATIC_DRAW); var cubeVertexTextureCoordBuffer_itemSize = 2; var cubeVertexTextureCoordBuffer_numItems = 24; var cubeVertexIndexBuffer = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer); var cubeVertexIndices = new UInt16[] { 0, 1, 2, 0, 2, 3, // Front face 4, 5, 6, 4, 6, 7, // Back face 8, 9, 10, 8, 10, 11, // Top face 12, 13, 14, 12, 14, 15, // Bottom face 16, 17, 18, 16, 18, 19, // Right face 20, 21, 22, 20, 22, 23 // Left face }; gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeVertexIndices), gl.STATIC_DRAW); var cubeVertexIndexBuffer_itemSize = 1; var cubeVertexIndexBuffer_numItems = cubeVertexPositionBuffer_numItems; #endregion #endregion // initTexture new in lesson 05 var textures = new[] { gl.createTexture(), gl.createTexture(), gl.createTexture(), }; var xRot = 0.0f; var xSpeed = 2.0f; var yRot = 0.0f; var ySpeed = 2.0f; var z = -5.0f; var filter = 2; #region currentlyPressedKeys var currentlyPressedKeys = new Dictionary <int, bool> { { 33, false }, { 34, false }, { 37, false }, { 39, false }, { 38, false }, { 40, false } }; Native.Document.onkeydown += e => { currentlyPressedKeys[e.KeyCode] = true; if (e.KeyCode == 13) { filter += 1; if (filter == 3) { filter = 0; } } }; Native.Document.onkeyup += e => { currentlyPressedKeys[e.KeyCode] = false; }; #endregion new WebGLLesson07.HTML.Images.FromAssets.crate().InvokeOnComplete( texture_image => { #region handleLoadedTexture gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1); gl.bindTexture(gl.TEXTURE_2D, textures[0]); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture_image); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.NEAREST); gl.bindTexture(gl.TEXTURE_2D, textures[1]); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture_image); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.LINEAR); gl.bindTexture(gl.TEXTURE_2D, textures[2]); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, texture_image); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.LINEAR_MIPMAP_NEAREST); gl.generateMipmap(gl.TEXTURE_2D); gl.bindTexture(gl.TEXTURE_2D, null); #endregion gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f); gl.enable(gl.DEPTH_TEST); #region animate var lastTime = 0L; Action animate = delegate { var timeNow = new IDate().getTime(); if (lastTime != 0) { var elapsed = timeNow - lastTime; xRot += (xSpeed * elapsed) / 1000.0f; yRot += (ySpeed * elapsed) / 1000.0f; } lastTime = timeNow; }; #endregion Func <float, float> degToRad = (degrees) => { return(degrees * (f)Math.PI / 180f); }; #region drawScene Action drawScene = delegate { gl.viewport(0, 0, gl_viewportWidth, gl_viewportHeight); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); glMatrix.mat4.perspective(45f, (float)gl_viewportWidth / (float)gl_viewportHeight, 0.1f, 100.0f, pMatrix); glMatrix.mat4.identity(mvMatrix); glMatrix.mat4.translate(mvMatrix, new float[] { 0.0f, 0.0f, z }); glMatrix.mat4.rotate(mvMatrix, degToRad(xRot), new[] { 1f, 0f, 0f }); glMatrix.mat4.rotate(mvMatrix, degToRad(yRot), new[] { 0f, 1f, 0f }); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer); gl.vertexAttribPointer((uint)shaderProgram_vertexPositionAttribute, cubeVertexPositionBuffer_itemSize, gl.FLOAT, false, 0, 0); #region new in lesson 07 gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexNormalBuffer); gl.vertexAttribPointer((uint)shaderProgram_vertexNormalAttribute, cubeVertexNormalBuffer_itemSize, gl.FLOAT, false, 0, 0); #endregion gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer); gl.vertexAttribPointer((uint)shaderProgram_textureCoordAttribute, cubeVertexTextureCoordBuffer_itemSize, gl.FLOAT, false, 0, 0); gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, textures[filter]); gl.uniform1i(shaderProgram_samplerUniform, 0); #region new in lesson 07 var lighting = toolbar.lighting.@checked; gl.uniform1i(shaderProgram_useLightingUniform, lighting.ToInt32()); if (lighting) { gl.uniform3f( shaderProgram_ambientColorUniform, toolbar.ambientR, toolbar.ambientG, toolbar.ambientB ); var lightingDirection = new float[] { toolbar.lightDirectionX, toolbar.lightDirectionY, toolbar.lightDirectionZ }; var adjustedLD = glMatrix.vec3.create(); glMatrix.vec3.normalize(lightingDirection, adjustedLD); glMatrix.vec3.scale(adjustedLD, new f[] { -1 }); gl.uniform3fv(shaderProgram_lightingDirectionUniform, adjustedLD); gl.uniform3f( shaderProgram_directionalColorUniform, toolbar.directionalR, toolbar.directionalG, toolbar.directionalB ); } #endregion gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer); setMatrixUniforms(); gl.drawElements(gl.TRIANGLES, cubeVertexIndexBuffer_numItems, gl.UNSIGNED_SHORT, 0); }; drawScene(); #endregion #region handleKeys Action handleKeys = delegate { if (currentlyPressedKeys[33]) { // Page Up z -= 0.05f; } if (currentlyPressedKeys[34]) { // Page Down z += 0.05f; } if (currentlyPressedKeys[37]) { // Left cursor key ySpeed -= 1f; } if (currentlyPressedKeys[39]) { // Right cursor key ySpeed += 1f; } if (currentlyPressedKeys[38]) { // Up cursor key xSpeed -= 1f; } if (currentlyPressedKeys[40]) { // Down cursor key xSpeed += 1f; } }; #endregion var c = 0; Native.window.onframe += delegate { c++; Native.document.title = "" + new { c, filter }; handleKeys(); drawScene(); animate(); }; } ); }
public Application(IDefault page = null) { var size = 500; var gl = new WebGLRenderingContext(antialias: true, preserveDrawingBuffer: true); this.canvas = gl.canvas.AttachToDocument(); canvas.style.backgroundColor = "black"; //canvas.style.backgroundColor = "blue"; Native.document.body.style.overflow = IStyle.OverflowEnum.hidden; canvas.style.SetLocation(0, 0, size, size); canvas.width = size; canvas.height = size; var gl_viewportWidth = size; var gl_viewportHeight = size; canvas.style.SetLocation(0, 0, gl_viewportWidth, gl_viewportHeight); #region IsDisposed var IsDisposed = false; this.Dispose = delegate { if (IsDisposed) { return; } IsDisposed = true; canvas.Orphanize(); }; #endregion #region AtResize Action AtResize = delegate { gl_viewportWidth = Native.window.Width; gl_viewportHeight = Native.window.Height; canvas.style.SetSize(gl_viewportWidth, gl_viewportHeight); canvas.width = gl_viewportWidth; canvas.height = gl_viewportHeight; }; if (page != null) { Native.window.onresize += e => { AtResize(); } } ; AtResize(); #endregion #region requestFullscreen Native.Document.body.ondblclick += delegate { if (IsDisposed) { return; } // http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/ Native.Document.body.requestFullscreen(); }; #endregion #region initShaders var shaderProgram = gl.createProgram( new GeometryVertexShader(), new GeometryFragmentShader() ); gl.linkProgram(shaderProgram); gl.useProgram(shaderProgram); var shaderProgram_vertexPositionAttribute = gl.getAttribLocation(shaderProgram, "aVertexPosition"); gl.enableVertexAttribArray((uint)shaderProgram_vertexPositionAttribute); var shaderProgram_textureCoordAttribute = gl.getAttribLocation(shaderProgram, "aTextureCoord"); gl.enableVertexAttribArray((uint)shaderProgram_textureCoordAttribute); var shaderProgram_pMatrixUniform = gl.getUniformLocation(shaderProgram, "uPMatrix"); var shaderProgram_mvMatrixUniform = gl.getUniformLocation(shaderProgram, "uMVMatrix"); // new in lesson 05 var shaderProgram_samplerUniform = gl.getUniformLocation(shaderProgram, "uSampler"); #endregion var mvMatrix = glMatrix.mat4.create(); var mvMatrixStack = new Stack <Float32Array>(); var pMatrix = glMatrix.mat4.create(); #region new in lesson 03 Action mvPushMatrix = delegate { var copy = glMatrix.mat4.create(); glMatrix.mat4.set(mvMatrix, copy); mvMatrixStack.Push(copy); }; Action mvPopMatrix = delegate { mvMatrix = mvMatrixStack.Pop(); }; #endregion #region setMatrixUniforms Action setMatrixUniforms = delegate { gl.uniformMatrix4fv(shaderProgram_pMatrixUniform, false, pMatrix); gl.uniformMatrix4fv(shaderProgram_mvMatrixUniform, false, mvMatrix); }; #endregion #region init buffers #region cubeVertexPositionBuffer var cubeVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer); var vertices = new[] { // Front face RED -1.0f, -1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, 1.0f, 1.0f, -1.0f, 1.0f, 1.0f, //// Back face YELLOW //-1.0f, -1.0f, -1.0f, //-1.0f, 1.0f, -1.0f, // 1.0f, 1.0f, -1.0f, // 1.0f, -1.0f, -1.0f, //// Top face GREEN //-1.0f, 1.0f, -1.0f, //-1.0f, 1.0f, 1.0f, // 1.0f, 1.0f, 1.0f, // 1.0f, 1.0f, -1.0f, //// Bottom face BEIGE //-1.0f, -1.0f, -1.0f, // 1.0f, -1.0f, -1.0f, // 1.0f, -1.0f, 1.0f, //-1.0f, -1.0f, 1.0f, //// Right face PURPLE // 1.0f, -1.0f, -1.0f, // 1.0f, 1.0f, -1.0f, // 1.0f, 1.0f, 1.0f, // 1.0f, -1.0f, 1.0f, //// Left face //-1.0f, -1.0f, -1.0f, //-1.0f, -1.0f, 1.0f, //-1.0f, 1.0f, 1.0f, //-1.0f, 1.0f, -1.0f }; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertices), gl.STATIC_DRAW); var cubeVertexPositionBuffer_itemSize = 3; //var cubeVertexPositionBuffer_numItems = 6 * 6; var cubeVertexPositionBuffer_numItems = 6 * 1; #endregion #region cubeVertexTextureCoordBuffer var cubeVertexTextureCoordBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer); var textureCoords = new float[] { // Front face 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f, 0.0f, 1.0f, //// Back face //1.0f, 0.0f, //1.0f, 1.0f, //0.0f, 1.0f, //0.0f, 0.0f, //// Top face //0.0f, 1.0f, //0.0f, 0.0f, //1.0f, 0.0f, //1.0f, 1.0f, //// Bottom face //1.0f, 1.0f, //0.0f, 1.0f, //0.0f, 0.0f, //1.0f, 0.0f, //// Right face //1.0f, 0.0f, //1.0f, 1.0f, //0.0f, 1.0f, //0.0f, 0.0f, //// Left face //0.0f, 0.0f, //1.0f, 0.0f, //1.0f, 1.0f, //0.0f, 1.0f, }; gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(textureCoords), gl.STATIC_DRAW); var cubeVertexTextureCoordBuffer_itemSize = 2; var cubeVertexTextureCoordBuffer_numItems = 24; var cubeVertexIndexBuffer = gl.createBuffer(); gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer); var cubeVertexIndices = new UInt16[] { 0, 1, 2, 0, 2, 3, // Front face 4, 5, 6, 4, 6, 7, // Back face 8, 9, 10, 8, 10, 11, // Top face 12, 13, 14, 12, 14, 15, // Bottom face 16, 17, 18, 16, 18, 19, // Right face 20, 21, 22, 20, 22, 23 // Left face }; gl.bufferData(gl.ELEMENT_ARRAY_BUFFER, new Uint16Array(cubeVertexIndices), gl.STATIC_DRAW); var cubeVertexIndexBuffer_itemSize = 1; var cubeVertexIndexBuffer_numItems = cubeVertexPositionBuffer_numItems; #endregion #endregion var tex1 = gl.createTexture(); var tex1i = new WebGLSVGAnonymous.HTML.Images.FromAssets.Anonymous_LogosSingleNoWings(); //var tex1i = new WebGLSVGAnonymous.HTML.Images.FromAssets.nehe(); // WebGL: drawElements: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled. tex1i.width = 1024 * 2; tex1i.height = 1024 * 2; // initTexture new in lesson 05 var tex0 = gl.createTexture(); var tex0i = new WebGLSVGAnonymous.HTML.Images.FromAssets.Anonymous_LogosSingleWings(); //var tex0i = new WebGLSVGAnonymous.HTML.Images.FromAssets.nehe(); // WebGL: drawElements: texture bound to texture unit 0 is not renderable. It maybe non-power-of-2 and have incompatible texture filtering or is not 'texture complete'. Or the texture is Float or Half Float type with linear filtering while OES_float_linear or OES_half_float_linear extension is not enabled. tex0i.width = 1024 * 2; tex0i.height = 1024 * 2; tex1i.InvokeOnComplete( delegate { tex0i.InvokeOnComplete( delegate { // this is a workaround // chrome has a bug where svg textures are merged.. var tex1ii = new CanvasRenderingContext2D(1024 * 2, 1024 * 2); tex1ii.drawImage( tex1i, 0, 0, 1024 * 2, 1024 * 2); { gl.activeTexture(gl.TEXTURE1); gl.bindTexture(gl.TEXTURE_2D, tex1); gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, tex1ii.canvas); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.NEAREST); gl.generateMipmap(gl.TEXTURE_2D); gl.bindTexture(gl.TEXTURE_2D, null); } { gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tex0); gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1); // http://msdn.microsoft.com/en-us/library/ie/dn302435(v=vs.85).aspx gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, tex0i); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.NEAREST); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.NEAREST); gl.generateMipmap(gl.TEXTURE_2D); gl.bindTexture(gl.TEXTURE_2D, null); } //gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f); //gl.enable(gl.DEPTH_TEST); gl.enable(gl.BLEND); //gl.enable(gl.CULL_FACE); // http://stackoverflow.com/questions/11521035/blending-with-html-background-in-webgl gl.blendFuncSeparate(gl.SRC_ALPHA, gl.ONE_MINUS_SRC_ALPHA, gl.ONE, gl.ONE_MINUS_SRC_ALPHA); var xRot = 0.0f; var yRot = 0.0f; var zRot = 0.0f; var lastTime = 0L; Action animate = delegate { var timeNow = new IDate().getTime(); if (lastTime != 0) { var elapsed = timeNow - lastTime; //xRot += (9 * elapsed) / 1000.0f; yRot += (40 * elapsed) / 1000.0f; //zRot += (9 * elapsed) / 1000.0f; } lastTime = timeNow; }; Func <float, float> degToRad = (degrees) => { return(degrees * (f)Math.PI / 180f); }; var f = new Designer(); f.trackBar1.Value = -20; f.trackBar2.Value = -10; if (page != null) { f.Show(); } Action <bool> drawScene = Anonymous_LogosSingleNoWings_Checked => { glMatrix.mat4.perspective(45f, (float)gl_viewportWidth / (float)gl_viewportHeight, 0.1f, 100.0f, pMatrix); glMatrix.mat4.identity(mvMatrix); var u1 = f.trackBar1.Value * 0.1f; glMatrix.mat4.translate(mvMatrix, new float[] { 0.0f, 0.0f, u1 }); //glMatrix.mat4.rotate(mvMatrix, degToRad(xRot), new[] { 1f, 0f, 0f }); if (Anonymous_LogosSingleNoWings_Checked) { glMatrix.mat4.rotate(mvMatrix, degToRad(yRot), new[] { 0f, 1f, 0f }); } else { glMatrix.mat4.rotate(mvMatrix, degToRad(f.trackBar3.Value), new[] { 0f, 1f, 0f }); } var u2 = f.trackBar2.Value * 0.1f; glMatrix.mat4.translate(mvMatrix, new float[] { 0.0f, 0.0f, u2 }); Native.document.title = new { u1, u2 }.ToString(); //glMatrix.mat4.rotate(mvMatrix, degToRad(zRot), new[] { 0f, 0f, 1f }); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexPositionBuffer); gl.vertexAttribPointer((uint)shaderProgram_vertexPositionAttribute, cubeVertexPositionBuffer_itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, cubeVertexTextureCoordBuffer); gl.vertexAttribPointer((uint)shaderProgram_textureCoordAttribute, cubeVertexTextureCoordBuffer_itemSize, gl.FLOAT, false, 0, 0); if (Anonymous_LogosSingleNoWings_Checked) { gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tex0); gl.uniform1i(shaderProgram_samplerUniform, 0); } else { gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, tex1); gl.uniform1i(shaderProgram_samplerUniform, 0); } gl.bindBuffer(gl.ELEMENT_ARRAY_BUFFER, cubeVertexIndexBuffer); setMatrixUniforms(); gl.drawElements(gl.TRIANGLES, cubeVertexIndexBuffer_numItems, gl.UNSIGNED_SHORT, 0); gl.bindTexture(gl.TEXTURE_2D, null); }; var c = 0; Native.window.onframe += delegate { c++; if (page == null) { gl_viewportWidth = canvas.clientWidth; gl_viewportHeight = canvas.clientHeight; canvas.style.SetLocation(0, 0, gl_viewportWidth, gl_viewportHeight); canvas.width = gl_viewportWidth; canvas.height = gl_viewportHeight; } gl.viewport(0, 0, gl_viewportWidth, gl_viewportHeight); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); if (f.Anonymous_LogosSingleNoWings.Checked) { drawScene(false); } if (f.Anonymous_LogosSingleWings.Checked) { drawScene(true); } animate(); }; } ); } ); } }
public CookieContext(IHttpCookie httpCookie, IEncoder encoder, IDate date) { _httpCookie = httpCookie; _encoder = encoder; _date = date; }
public RetentionReleaseEstimateReportRecord(int id, int customerId, int customerNumber, string customerName, IDate date, string number, string reference, decimal amount, decimal openingBalance, decimal balance, decimal retention, TransactionStatus status) { this.id = id; this.customerId = customerId; this.retention = retention; this.customerNumber = customerNumber; this.customerName = customerName; this.date = date; this.number = number; this.reference = reference; this.amount = amount; this.balance = balance; this.openingBalance = openingBalance; this.status = status; currentTransaction = openingBalance - balance; }
public bool Exists(string Owner, IDate beginDate, ITime beginTime, IDate endDate, ITime endTime) { return(System.IO.File.Exists(Filename(GetKey(Owner, tmc.ToDateTime(beginDate, beginTime), tmc.ToDateTime(endDate, endTime))))); }
/// <summary> /// This is a javascript application. /// </summary> /// <param name="page">HTML document rendered by the web server which can now be enhanced.</param> public Application(IDefault page = null) { // works in IE11 style.Content.AttachToHead(); var gl_viewportWidth = Native.window.Width; var gl_viewportHeight = Native.window.Height; var gl = new WebGLRenderingContext(); var canvas = gl.canvas.AttachToDocument(); Native.document.body.style.overflow = IStyle.OverflowEnum.hidden; canvas.style.SetLocation(0, 0, gl_viewportWidth, gl_viewportHeight); canvas.width = gl_viewportWidth; canvas.height = gl_viewportHeight; #region IsDisposed var IsDisposed = false; this.Dispose = delegate { if (IsDisposed) { return; } IsDisposed = true; canvas.Orphanize(); }; #endregion #region requestFullscreen Native.Document.body.ondblclick += delegate { if (IsDisposed) { return; } // http://tutorialzine.com/2012/02/enhance-your-website-fullscreen-api/ Native.Document.body.requestFullscreen(); }; #endregion #region init shaders var shaderProgram = gl.createProgram( new Shaders.GeometryVertexShader(), new Shaders.GeometryFragmentShader() ); gl.linkProgram(shaderProgram); gl.useProgram(shaderProgram); #region getAttribLocation Func <string, long> getAttribLocation = name => gl.getAttribLocation(shaderProgram, name); #endregion #region getUniformLocation Func <string, WebGLUniformLocation> getUniformLocation = name => gl.getUniformLocation(shaderProgram, name); #endregion #endregion var shaderProgram_vertexPositionAttribute = getAttribLocation("aVertexPosition"); gl.enableVertexAttribArray((uint)shaderProgram_vertexPositionAttribute); var shaderProgram_textureCoordAttribute = getAttribLocation("aTextureCoord"); gl.enableVertexAttribArray((uint)shaderProgram_textureCoordAttribute); var shaderProgram_pMatrixUniform = getUniformLocation("uPMatrix"); var shaderProgram_mvMatrixUniform = getUniformLocation("uMVMatrix"); var shaderProgram_samplerUniform = getUniformLocation("uSampler"); var mvMatrix = glMatrix.mat4.create(); var mvMatrixStack = new Stack <Float32Array>(); var pMatrix = glMatrix.mat4.create(); #region mvPushMatrix Action mvPushMatrix = delegate { var copy = glMatrix.mat4.create(); glMatrix.mat4.set(mvMatrix, copy); mvMatrixStack.Push(copy); }; #endregion #region mvPopMatrix Action mvPopMatrix = delegate { mvMatrix = mvMatrixStack.Pop(); }; #endregion #region setMatrixUniforms Action setMatrixUniforms = delegate { gl.uniformMatrix4fv(shaderProgram_pMatrixUniform, false, pMatrix); gl.uniformMatrix4fv(shaderProgram_mvMatrixUniform, false, mvMatrix); }; #endregion #region degToRad Func <float, float> degToRad = (degrees) => { return(degrees * (f)Math.PI / 180f); }; Func <float, float> radToDeg = (rad) => { return(rad * 180f / (f)Math.PI); }; #endregion var pitch = 0f; var pitchRate = 0f; var yaw = 0f; var yawRate = 0f; var xPos = 0f; var yPos = 0.4f; var zPos = 0f; var speed = 0f; #region currentlyPressedKeys var currentlyPressedKeys = new Dictionary <int, bool> { { 33, false }, { 34, false }, { 37, false }, { 39, false }, { 38, false }, { 40, false }, { 83, false }, { 87, false }, { 65, false }, { 68, false }, }; Native.Document.onkeydown += e => { currentlyPressedKeys[e.KeyCode] = true; }; Native.Document.onkeyup += e => { currentlyPressedKeys[e.KeyCode] = false; }; #endregion #region currentlyPressedKeysEitherOf Func <int, int, bool> currentlyPressedKeysEitherOf = (a, b) => { if (currentlyPressedKeys[a]) { return(true); } if (currentlyPressedKeys[b]) { return(true); } return(false); }; #endregion #region handleKeys Action handleKeys = delegate { if (currentlyPressedKeys[33]) { // Page Up pitchRate = 0.1f; } else if (currentlyPressedKeys[34]) { // Page Down pitchRate = -0.1f; } else { pitchRate = 0; } if (currentlyPressedKeysEitherOf(37, 65)) { // Left cursor key or A yawRate = 0.1f; } else if (currentlyPressedKeysEitherOf(39, 68)) { // Right cursor key or D yawRate = -0.1f; } else { yawRate = 0; } if (currentlyPressedKeysEitherOf(38, 87)) { // Up cursor key or W speed = 0.003f; } else if (currentlyPressedKeysEitherOf(40, 83)) { // Down cursor key speed = -0.003f; } else { speed = 0; } }; #endregion #region requestPointerLock var __pointer_x = 0; var __pointer_y = 0; canvas.onmousedown += delegate { // http://connect.microsoft.com/IE/feedback/details/793718/ie11-feature-request-support-for-pointer-lock-api canvas.requestPointerLock(); }; canvas.onmousemove += e => { if (Native.document.pointerLockElement == canvas) { __pointer_x += e.movementX; __pointer_y += e.movementY; } }; canvas.onmouseup += delegate { // keep at it... //Native.Document.exitPointerLock(); }; #endregion #region AtResize Action AtResize = delegate { gl_viewportWidth = Native.window.Width; gl_viewportHeight = Native.window.Height; canvas.style.SetLocation(0, 0, gl_viewportWidth, gl_viewportHeight); canvas.width = gl_viewportWidth; canvas.height = gl_viewportHeight; }; Native.window.onresize += e => { AtResize(); }; AtResize(); #endregion new HTML.Images.FromAssets.mud().InvokeOnComplete( mud => { var mudTexture = gl.createTexture(); gl.pixelStorei(gl.UNPACK_FLIP_Y_WEBGL, 1); gl.bindTexture(gl.TEXTURE_2D, mudTexture); gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, mud); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, (int)gl.LINEAR); gl.texParameteri(gl.TEXTURE_2D, gl.TEXTURE_MIN_FILTER, (int)gl.LINEAR); gl.bindTexture(gl.TEXTURE_2D, null); Func <string, f> parseFloat = x => (f)double.Parse(x); var lines = data.Split('\n'); var vertexCount = 0; var vertexPositions = new List <f>(); var vertexTextureCoords = new List <f>(); foreach (var i in lines) { var vals = i.Trim().Replace(" ", " ").Replace(" ", " ").Split(' '); if (vals.Length == 5) { if (vals[0] != "//") { // It is a line describing a vertex; get X, Y and Z first vertexPositions.Add(parseFloat(vals[0])); vertexPositions.Add(parseFloat(vals[1])); vertexPositions.Add(parseFloat(vals[2])); // And then the texture coords vertexTextureCoords.Add(parseFloat(vals[3])); vertexTextureCoords.Add(parseFloat(vals[4])); vertexCount += 1; } } } var worldVertexPositionBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, worldVertexPositionBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexPositions.ToArray()), gl.STATIC_DRAW); var worldVertexPositionBuffer_itemSize = 3; var worldVertexPositionBuffer_numItems = vertexCount; var worldVertexTextureCoordBuffer = gl.createBuffer(); gl.bindBuffer(gl.ARRAY_BUFFER, worldVertexTextureCoordBuffer); gl.bufferData(gl.ARRAY_BUFFER, new Float32Array(vertexTextureCoords.ToArray()), gl.STATIC_DRAW); var worldVertexTextureCoordBuffer_itemSize = 2; var worldVertexTextureCoordBuffer_numItems = vertexCount; gl.clearColor(0.0f, 0.0f, 0.0f, 1.0f); gl.enable(gl.DEPTH_TEST); var lastTime = 0L; // Used to make us "jog" up and down as we move forward. var joggingAngle = 0f; #region animate Action animate = () => { var timeNow = new IDate().getTime(); if (lastTime != 0) { var elapsed = timeNow - lastTime; if (speed != 0) { xPos -= (f)Math.Sin(degToRad(yaw)) * speed * elapsed; zPos -= (f)Math.Cos(degToRad(yaw)) * speed * elapsed; joggingAngle += elapsed * 0.6f; // 0.6 "fiddle factor" - makes it feel more realistic :-) yPos = (f)Math.Sin(degToRad(joggingAngle)) / 20 + 0.4f; } else { joggingAngle += elapsed * 0.06f; // 0.6 "fiddle factor" - makes it feel more realistic :-) yPos = (f)Math.Sin(degToRad(joggingAngle)) / 200 + 0.4f; } yaw += yawRate * elapsed; pitch += pitchRate * elapsed; } lastTime = timeNow; }; #endregion #region drawScene Action drawScene = () => { gl.viewport(0, 0, gl_viewportWidth, gl_viewportHeight); gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT); glMatrix.mat4.perspective(45, (float)Native.window.aspect, 0.1f, 100.0f, pMatrix); glMatrix.mat4.identity(mvMatrix); if (__pointer_y != 0) { pitch = radToDeg(__pointer_y * -0.01f); } if (__pointer_x != 0) { yaw = radToDeg(__pointer_x * -0.01f); } glMatrix.mat4.rotate(mvMatrix, degToRad(-pitch), new f[] { 1, 0, 0 }); glMatrix.mat4.rotate(mvMatrix, degToRad(-yaw), new f[] { 0, 1, 0 }); //glMatrix.mat4.rotate(mvMatrix, __pointer_y * 0.01f, 1, 0, 0); //glMatrix.mat4.rotate(mvMatrix, __pointer_x * 0.01f, 0, 1, 0); glMatrix.mat4.translate(mvMatrix, new[] { -xPos, -yPos, -zPos }); gl.activeTexture(gl.TEXTURE0); gl.bindTexture(gl.TEXTURE_2D, mudTexture); gl.uniform1i(shaderProgram_samplerUniform, 0); gl.bindBuffer(gl.ARRAY_BUFFER, worldVertexTextureCoordBuffer); gl.vertexAttribPointer((uint)shaderProgram_textureCoordAttribute, worldVertexTextureCoordBuffer_itemSize, gl.FLOAT, false, 0, 0); gl.bindBuffer(gl.ARRAY_BUFFER, worldVertexPositionBuffer); gl.vertexAttribPointer((uint)shaderProgram_vertexPositionAttribute, worldVertexPositionBuffer_itemSize, gl.FLOAT, false, 0, 0); setMatrixUniforms(); gl.drawArrays(gl.TRIANGLES, 0, worldVertexPositionBuffer_numItems); }; #endregion Native.window.onframe += delegate { if (IsDisposed) { return; } handleKeys(); drawScene(); animate(); }; } ); }
public RetentionSchedule(int id, string clientName, Date endOfMonth, string status, IDate releaseDate, int clientId, string RetnNotes, int clientFacilityType) { this.id = id; this.clientId = clientId; this.clientName = clientName; this.endOfMonth = endOfMonth; this.status = status; this.releaseDate = releaseDate; this.RetnNotes = RetnNotes; this.clientFacilityType = clientFacilityType; }