|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DotNet35WPFPerf
{
/// <summary>
/// Interaction logic for Window1.xaml
/// </summary>
public partial class Window1 : Window
{
public Window1()
{
InitializeComponent();
}
/*
private void Window_Activated(object sender, EventArgs e)
{
string txt = label1.Content.ToString();
txt += " Activated";
label1.Content = txt;
}
private void Window_Initialized(object sender, EventArgs e)
{
string txt = label1.Content.ToString();
txt += " Initialized";
label1.Content = txt;
}
*/
private const long TicksPerMiliSecond = TimeSpan.TicksPerSecond / 1000;
private void Window_Loaded(object sender, RoutedEventArgs e)
{
if (Environment.GetCommandLineArgs().Length == 1)
{
System.GC.Collect(2, GCCollectionMode.Forced);
System.GC.WaitForPendingFinalizers();
}
else if (this.WindowState == WindowState.Normal)
{
DateTime mainEntryTime = DateTime.UtcNow;
string launchtime = Environment.GetCommandLineArgs()[1];
DateTime launchTime = System.DateTime.FromFileTimeUtc(long.Parse(launchtime));
long diff = (mainEntryTime.Ticks - launchTime.Ticks) / TicksPerMiliSecond;
//string txt = label1.Content.ToString();
//txt += " Loaded";
//label1.Content = txt;
(App.Current as App)._result= (int)diff;
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Decebal Mihailescu is a software engineer with interest in .Net, C# and C++.