<input @oncustompaste="HandleCustomPaste" />
<script> Blazor.registerCustomEventType('custompaste', { browserEventName: 'paste', createEventArgs: event => { // This example only deals with pasting text, but you could use arbitrary JavaScript APIs // to deal with users pasting other types of data, such as images return { eventTimestamp: new Date(), pastedData: event.clipboardData.getData('text') }; } }); </script>
namespace BlazorCustomEventArgs.CustomEvents { [EventHandler("oncustompaste", typeof(CustomPasteEventArgs), enableStopPropagation: true, enablePreventDefault: true)] public static class EventHandlers { // This static class doesn't need to contain any members. It's just a place where we can put // [EventHandler] attributes to configure event types on the Razor compiler. This affects the // compiler output as well as code completions in the editor. } public class CustomPasteEventArgs : EventArgs { // Data for these properties will be supplied by custom JavaScript logic public DateTime EventTimestamp { get; set; } public string PastedData { get; set; } } }
یک نکته: در اینجا نام oncustompaste به همان نام custompaste کدهای جاوااسکریپتی اشاره میکند. نام تعریف شدهی در قسمت سیشارپ، یک on در ابتدا اضافهتر دارد. اینکار سبب میشود که اکنون بتوان یک رویدادگردان oncustompaste@ سفارشی را که قابل مدیریت در کدهای سیشارپ است، داشت:
@page "/" <p>Try pasting into the following text box:</p> <input @oncustompaste="HandleCustomPaste" /> <p>@message</p> @code { string message; void HandleCustomPaste(CustomPasteEventArgs eventArgs) { message = $"At {eventArgs.EventTimestamp.ToShortTimeString()}, you pasted: {eventArgs.PastedData}"; } }
چهار قانون بهتر برای طراحی نرمافزار
Kent’s rules, from Extreme Programming Explained are:
- Runs all the tests
- Has no duplicated logic. Be wary of hidden duplication like parallel class hierarchies
- States every intention important to the programmer
- Has the fewest possible classes and methods
In my experience, these don’t quite serve the needs of software design. My four rules might be that a well-designed system:
- is well-covered by passing tests.
- has no abstractions not directly needed by the program.
- has unambiguous behavior.
- requires the fewest number of concepts.
.NET 8 Release Candidate 2 (RC2) is now available and includes many great new improvements to ASP.NET Core!
This is the last release candidate that we plan to share before the final .NET 8 release later this year. Most of the planned features and changes for .NET 8 are part of this release candidate and are ready for you to try out. You can find the full list of what’s new in ASP.NET Core in .NET 8 in the docs.
کتابخانه mesing
meSing.js is a JavaScript singing synthesis library that uses the Web Audio API's DSP capabilities in conjunction with the meSpeak.js speech synthesis library to provide a vocal synthesizer for the web. First, the lyrics with corresponding MIDI notes are parsed and fed to meSpeak.js; the resulting text-to-speech output is then converted into a series of AudioBufferSourceNodes, which are subsequently processed and adjusted for pitch, rhythm, and expression. Demo
معرفی OpenJDK ساخت مایکروسافت
As of the 1st of July 2019 Microsoft officially ended support for Katana 3. This means that the platform we originally built-against is now unsupported and we completely stop supporting IdentityServer3 (including security bugs) for free now as well.