Posts

Showing posts with the label Graphics
Share:

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

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