Example #1
0
        protected override void OnStartup(StartupEventArgs e)
        {
            TrackingDataContext trackingDataContext = new TrackingDataContext();
            MouseTracker        mouseTracker        = new MouseTracker();
            KeyboardTracker     keyboardTracker     = new KeyboardTracker();


            //Set timer to record activity data every second
            DispatcherTimer timer = new DispatcherTimer
            {
                Interval = TimeSpan.FromMilliseconds(1000)
            };

            //Start tracking productivity and logging it
            timer.Tick += (o, e) =>
            {
                var newTrackingRecord = new TrackingRecord
                {
                    Active      = false,
                    ProcessName = ProcessTracker.GetActiveProcessName(),
                    Timestamp   = DateTime.Now
                };

                if (mouseTracker.HasMouseMoved() || keyboardTracker.GetTimeElapsedSinceLastKeyPress() < timer.Interval.TotalMilliseconds)
                {
                    newTrackingRecord.Active = true;
                    trackingDataContext.Add(newTrackingRecord);
                }
                else
                {
                    trackingDataContext.Add(newTrackingRecord);
                }

                trackingDataContext.SaveChanges();
            };
            timer.IsEnabled = true;

            //Code for setting up MVVM
            ViewNavigator viewNavigator    = new ViewNavigator();
            MainViewModel defaultViewModel = new MainViewModel(viewNavigator);

            viewNavigator.CurrentViewModel = defaultViewModel;
            Window window = new MainWindow();

            window.DataContext = defaultViewModel;
            window.Show();
            base.OnStartup(e);
        }
Example #2
0
    public override void OnInspectorGUI()
    {
        KeyboardTracker kt = target as KeyboardTracker;

        EditorGUILayout.LabelField("Axes", EditorStyles.boldLabel);



        if (kt.axisKeys.Length == 0)
        {
            EditorGUILayout.HelpBox("No Axes defined in Input Manager.", MessageType.Info);
        }
        else
        {
            SerializedProperty prop = serializedObject.FindProperty("axisKeys");
            for (int i = 0; i < kt.axisKeys.Length; i++)
            {
                EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), new GUIContent("Axis " + i));
            }
        }



        EditorGUILayout.LabelField("Buttons", EditorStyles.boldLabel);



        if (kt.buttonKeys.Length == 0)
        {
            EditorGUILayout.HelpBox("No buttons defined in Input Manager.", MessageType.Info);
        }
        else
        {
            for (int i = 0; i < kt.buttonKeys.Length; i++)
            {
                kt.buttonKeys[i] = (KeyCode)EditorGUILayout.EnumPopup("Button " + i.ToString(), kt.buttonKeys[i]);
            }
        }

        serializedObject.ApplyModifiedProperties();
        serializedObject.Update();
    }
    public override void OnInspectorGUI()
    {
        //base.OnInspectorGUI();

        KeyboardTracker tracker = target as KeyboardTracker;

        EditorGUILayout.LabelField("Axes", EditorStyles.boldLabel);
        if (tracker.axisKeys.Length == 0)
        {
            EditorGUILayout.HelpBox("No axes defined in InputManager.", MessageType.Info);
        }
        else
        {
            //draw axisKeys array, which is a SerialitedProperty (see AxisKeyDrawer)
            SerializedProperty prop = serializedObject.FindProperty("axisKeys");
            for (int i = 0; i < tracker.axisKeys.Length; i++)
            {
                EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), new GUIContent("Axis " + i));
            }
        }

        EditorGUILayout.Space();

        EditorGUILayout.LabelField("Buttons", EditorStyles.boldLabel);
        if (tracker.buttonKeys.Length == 0)
        {
            EditorGUILayout.HelpBox("No axes defined in InputManager.", MessageType.Info);
        }
        else
        {
            SerializedProperty prop = serializedObject.FindProperty("buttonKeys");
            for (int i = 0; i < tracker.buttonKeys.Length; i++)
            {
                //tracker.buttonKeys[i] = (KeyCode)EditorGUILayout.EnumPopup("Button " + i, tracker.buttonKeys[i]);
                EditorGUILayout.PropertyField(prop.GetArrayElementAtIndex(i), new GUIContent("Button " + i));
            }
        }

        serializedObject.ApplyModifiedProperties();
        serializedObject.Update();
    }
Example #4
0
        static void Main()
        {
            MouseTracker.RegisterClicks(OnLeftClick);
            KeyboardTracker.RegisterKeys(OnKeyPress);
            TrayManager.HideInTray.Track();

            client = new DiscordRpcClient("793662574088290325");

            client.Initialize();

            started_at = DateTime.UtcNow;

            Console.WriteLine("Successfully started RPC in " + (compact ? "compact" : "full") + " mode.");
            Console.WriteLine("To exit, simply close the command prompt window.");

            Thread MainThread = new Thread(StartRPCUpdates);

            MainThread.Start();

            Console.WriteLine("Main update thread spawned.");

            Console.ReadLine();
        }
Example #5
0
        public Epsilon()
        {
            _graphicsDeviceManager = new GraphicsDeviceManager(this)
            {
                PreferredBackBufferWidth  = Constants.ScreenBufferWidth,
                PreferredBackBufferHeight = Constants.ScreenBufferHeight
            };

            Content.RootDirectory = "_Content";

            _eventManager = new EventManager();

            _map = new Map(_eventManager);

            _mouseTracker    = new MouseTracker();
            _keyBoardTracker = new KeyboardTracker();

            // TODO: Maybe use some assembly scanning technique to pick all IActors up...
            _actors = new List <IActor>
            {
                new Stars(_eventManager, _map),
                new Terrain(_map, _eventManager)
            };
        }
Example #6
0
 public override void OnInspectorGUI()
 {
     keyTracker = target as KeyboardTracker;
     DrawAxes();
     DrawButtons();
 }