Posts

Share:

Signal Generator In C# | Saatody | Amit Padhiyar

using System; using System.Diagnostics; namespace SGDemo { /// <summary> /// Types of signal. /// </summary> public enum SignalTypes { Sine, Square, Triangle, Sawtooth } /// <summary> /// Directions of signal. /// </summary> public enum Directions { Forward, Backward } /// <summary> /// Signal generator. /// </summary> public class SignalGenerator { /// <summary> /// Shift signal on y axis. Value can be less than 0 too. /// </summary> private float offset = 0f; public float Offset { set { offset = value; } get { return offset; } } /// <summary> /// Amplitudet or height of signal. Value can be less than 0 too. /// </summary>

Color Palette In C# | WPF | Saatody | Amit Padhiyar

There are three class(es) in color palette tool. 1] ColorPalette, 2] ColorCell, 3] AddColorCell. Today, I will write reference and example about color palette. This tool is available for private use only. And the API is written in WPF C#. 1] ColorPalette Class API This is a main class of my color palette tool. This class provides functionalities for set current color, add new cell, remove exist cell, and remove all exist cells. Also has an event fire while current color change. We also set functionalities of importing and exporting ColorPalette. Properties This property stores color and also fire an event CurrentColorChanged. Syntax public Color CurrentColor Constructors This is one and default constructor. Syntax public ColorPalette() Methods These methods are used for adding and removing ColorCell from the ColorPalette. Also used for importing and exporting ColorPalette. Syntax public void AddColorCell(ColorCell ColorCell) public void RemoveColorCell(ColorCell ColorCell) public void

Async Task In C# | Async And Await Keywords | Saatody | Amit Padhiyar

Today we will discuss about async and await keyword. And will know some examples about Task. private async void MyTask() { await Task.Run(() => { // Code Here }); } Avoid use of void. use Task or Task<return_type>. private async Task MyTask() { await Task.Run(() => { // Code Here }); } It can use for non return value. private async Task<int> MyTask() { await Task.Run(() => { // Code Here }); return int; } Returns int values.

Windows 10 IoT Applications With UWP C# | Raspberry Pi | Amit Padhiyar | Saatody

How To Get Removable Devices? Before using this code, You need to enable (check) Removable Storage in Capabilities (in Package.appxmanifest). Warning : Due to async and await keywords, The debugger might not receive some values at breakpoints.  StorageFolder Instance = KnownFolders.RemovableDevices; This how you can get Removable Devices. How To Get List Of Removable Devices? StorageFolder Instance = KnownFolders.RemovableDevices; IReadOnlyList<StorageFolder> Devices = await Instance.GetFoldersAsync(); How To Get Removable Devices By Array Index? Get devices using array index like Devices[0] indicate first device for example "C:", Devices[1] indicate second device for example "D:". If index out of range then it will gives you exception. StorageFolder Instance = KnownFolders.RemovableDevices; IReadOnlyList<StorageFolder> Devices = await Instance.GetFoldersAsync(); StorageFolder Device = Devices[0]; How To Get All Directories And All Files From Current Pat

Number Validation In TextBox WPF | C# | Amit Padhiyar | Saatody

I will create number validation in TextBox. This algorithm only allow numbers while user press any key. TB.PreviewTextInput += (sender, e) => { if (e.Text != "0" && e.Text != "1" && e.Text != "2" && e.Text != "3" && e.Text != "4" && e.Text != "5" && e.Text != "6" && e.Text != "7" && e.Text != "8" && e.Text != "9") { e.Handled = true; } }; Here is little demo on PreviewTextInput. I am researching on validations for TextBox. In future, I will create more detail about it.

Setup Dart Programming Language | Saatody | Amit Padhiyar

In this post, I will describe about how to download and install Dart SDK? Here is the Dart official website . If you want to download Flutter then the Dart will be install default. Otherwise, You can download Dart SDK using command-line tools. Actually, SDK Installation is depending on your operating system. For example: If you want to download Dart SDK for Windows then you can download package from 'Chocolatey Package Manager'. The 'Chocolatey Package Manager' is one kind of package manager tool like NPM for JavaScript, NuGet for .Net and Pub for Dart and Flutter. This how there is different processes available for different operating system. So you can see this documentation  for downloading Dart on your operating system. If you want direct download Dart SDK .ZIP file for your platform then download from here the stable version, beta version and dev version of Dart. You can find the zip files at predictable URLs using the following pattern: https://storage.googleapis

Millions Of Objects Performance In C# WPF | Amit Padhiyar | Saatody

This is little experiment about memory management and time management in WPF while we create millions of objects in small amount of time. Let's see first example while we create one simple class with no properties (empty class). Before we start, we must define some properties in MainWindow. private readonly int TotalObjects = 10000000; private int i = 0; private List<PointClass> Objs = new List<PointClass>(); private Stopwatch Timer = new Stopwatch(); private TimeSpan TS = new TimeSpan(); TotalObjects is variable. And this number used in loop for repeating same process. It means we will create PointClass's object in each cycle and store in Objs List<>. The 'i' is index for loop. Using Stopwatch we will calculate the time and store elapsed time in TimeSpan TS. This experiment uses two loop; 1] for loop and 2] while loop. public class PointClass { } First create empty class. This class hasn't any property. See the below example to see How much time