Long time no post! I know I know and I am very sorry for that.
I just came here to say Merry Christmas.
Long time no post! I know I know and I am very sorry for that.
I just came here to say Merry Christmas.
Although this post is about software development, it is not related to C# or other programming languages.
Project estimation is one of the most challenging duties of project managers. Among various estimation methods, Use Case Points is the most reliable method.
If you are not familiar with UCP please read this article.
As you may know, Use Case Points method involves different factors and needs calculation. For most software project managers it seems difficult and time consuming to use it manually.
In this article I will show you how to estimate effort of a software project using Sparx Enterprise Architect (EA) which is a famous CASE tool.
Read the complete article in PDF here:
Project estimation with Use Case Points using Enterprise Architect
Update:
Sparx Systems Community has published this article. Click here to read it.
There are three timer controls in the .NET Framework:
If you are using Windows Forms and probably updating a UI, use System.Windows.Forms.Timer.
For server-based timer functionality, you might consider using System.Timers.Timer, which is also more accurate and has additional features.
The third one, System.Threading.Timer, uses a separate thread for it’s operation. If you need to do an asynchronous job periodically, it may be useful.
Using System.Threading.Timer:
System.Threading.Timer timer; timer = new System.Threading.Timer(new TimerCallback(DoSomething), null, 0, 1000);
DoSomething() executes at specified intervals(1000 ms here). Note that DoSomething() does not execute on the thread that created the timer; it executes on a ThreadPool thread supplied by the system.
private void DoSomething(object obj)
{
//it executes every second
}
To enable/disable timer, use Change() method:
timer.Change(Timeout.Infinite, Timeout.Infinite); //disable timer.Change(0, 1000); //enable
The following class is probably the world simplest text logger.
There are several ways to open a file and write texts into it but I used File.AppendAllText() method because by using this method, it is guaranteed that the file handle will be closed, even if exceptions are raised.
public static class Logger
{
public static void Log(string message)
{
File.AppendAllText("C:\\MyLogFile.txt", DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString() + ":\t" + message + Environment.NewLine);
}
}
Using the Logger class:
By handling Application.ThreadException event in Program.cs , you can log every un-handled exception into a text file for further examination.
static void Main(string[] args)
{
Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException); //it must be before Application.Run
...
Application.Run();
}
static void Application_ThreadException(object sender, System.Threading.ThreadExceptionEventArgs e)
{
Logger.Log(e.Exception.ToString());
}
I have written a program (named ShareMonitor) that allows you to monitor any access to your network shared files. When a user remotely opens shared files on your computer, application detects it and displays information such as who opened it, when it was opened, duration, etc. about that file. All details will be logged and can be saved to .CSV or .XML files for further analysis.
You can also disconnect any active connection whenever you want.
For more details and source code, visit ShareMonitor’s Code Project page.
Download ShareMonitor (from Softpedia)
Update:
Since it was published, many articles have been written by experts to introduce and recommend ShareMonitor. Here you can find some of them:
Sometimes you may need to let user run your .Net application without installing .Net framework.
There are several tools called “.Net Linker” which pack a .Net application with all needed files into a single package.
Here are some of them:
• http://www.vmware.com/products/thinapp/
• http://spoon.net/Studio/
• http://www.remotesoft.com/linker/
DataGridView has a facility to select multiple cells (or a range of cells) using mouse dragging, Cltrl+Click or Shift+Click. This feature is similar to cell selection in spreadsheet applications such as Microsoft Excel.
In order to enable this feature in DataGridView, use ‘SelectionMode’ property as follows:
DataGridViewCell.SelectionMode = DataGridViewSelectionMode.CellSelect;
To read/write data from/to selected cells simply write:
foreach (DataGridViewCell cell in dataGridView1.SelectedCells)
{
//read cell data
MessageBox.Show(cell.Value.ToString());
//change cell data
dataGridView1.Rows[cell.RowIndex].Cells[cell.ColumnIndex].Value = 1;
}
There are several ways to sort data in C# but one of the easiest ways is using BindingSource sort capability.
Depending on what object (underlying list) is linked to the BindingSource as its DataSource and whether it has implemented IBindingList or IBindingListView interfaces or not, you can use this feature.
To find out whether a BindingSource with current DataSource supports sorting, use ‘SupportsSorting’ property:
if (bindingSource1.SupportsSorting)
{
bindingSource1.Sort = "Code, Name";
}
Similarly, you can benefit from BindingSource.Filter .
If you want to capture changes in ComboBox you can use ‘SelectedIndexChanged’ or ‘SelectedValueChanged’ events. However, if you want to get changes only when the user changes the selection, use ‘SelectionChangeCommitted’ event instead.
SelectionChangeCommitted occurs only when the ComboBox selection changes by user (via keyboard or mouse) and it is not raised when the selection changes programmatically.
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex == 1)
{
//do something...
}
}