Example #1
0
        public MainViewModel()
        {
            UsabilityModeDisabled = true;
            string applicationInstance = Assembly.GetExecutingAssembly().GetName().ToString().Substring(0, 15);

            try
            {
                bytesInAllHeapsPerformanceCounter = new PerformanceCounter(".NET CLR Memory", "# bytes in all heaps", applicationInstance);
            }
            catch (Exception)
            {
            }

            Settings         = new SettingsViewModel();
            ScreenResolution = 96;

            if (String.IsNullOrEmpty(Settings.ReportPath))
            {
                Settings.ReportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                                   "UsageStats");
            }
            if (String.IsNullOrEmpty(Settings.ApplicationList))
            {
                Settings.ApplicationList = DefaultApplicationList;
            }

            InitStatistics();

            watch = new Stopwatch();
            watch.Start();

            timer = new DispatcherTimer {
                Interval = TimeSpan.FromMilliseconds(100)
            };
            timer.Tick += TimerTick;
            timer.Start();

            Hook.CreateKeyboardHook(KeyReader);
            keys  = new InterceptKeys();
            mouse = new InterceptMouse(MouseHandler);
        }
Example #2
0
        public MainViewModel()
        {
            string applicationInstance = Assembly.GetExecutingAssembly().GetName().ToString().Substring(0, 15);
            try
            {
                bytesInAllHeapsPerformanceCounter = new PerformanceCounter(".NET CLR Memory", "# bytes in all heaps", applicationInstance);
            }
            catch (Exception)
            {

            }

            Settings = new SettingsViewModel();
            ScreenResolution = 96;

            if (String.IsNullOrEmpty(Settings.ReportPath))
            {
                Settings.ReportPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Personal),
                                                   "UsageStats");
            }
            if (String.IsNullOrEmpty(Settings.ApplicationList))
            {
                Settings.ApplicationList = DefaultApplicationList;
            }

            InitStatistics();

            watch = new Stopwatch();
            watch.Start();

            timer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(100) };
            timer.Tick += TimerTick;
            timer.Start();

            Hook.CreateKeyboardHook(KeyReader);
            keys = new InterceptKeys();
            mouse = new InterceptMouse(MouseHandler);
        }