Example #1
0
        // This function is called at the very start of application execution.
        public void StartApplication()
        {
            // make an acquisitor and connect ourself to its events
            acquisitor               = new Acquisitor();
            acquisitor.Data         += new DataEventHandler(DataHandler);
            acquisitor.ScanFinished += new ScanFinishedEventHandler(ScanFinishedHandler);

            // ask the remoting system for access to the EDMHardwareController
            //RemotingConfiguration.RegisterWellKnownClientType(
            //    Type.GetType("EDMHardwareControl.Controller, EDMHardwareControl"),
            //    "tcp://localhost:1172/controller.rem"
            //    );

            controllerWindow = new ControllerWindow(this);
            controllerWindow.Show();

            // initialise the profile manager
            profileManager.Window = controllerWindow;
            profileManager.Start();

            // try to load in the last profile set
            // first deserialize the profile set path
            //try
            //{
            //    BinaryFormatter bf = new BinaryFormatter();
            //    String settingsPath = (string)Environs.FileSystem.Paths["settingsPath"];
            //    String filePath = settingsPath + "\\ScanMaster\\profilePath.bin";
            //    FileStream fs = File.Open(filePath, FileMode.Open);
            //    lastProfileSetPath = (string)bf.Deserialize(fs);
            //    fs.Close();
            //}
            //catch (Exception)
            //{
            //    Console.Error.WriteLine("Couldn't find saved profile path");
            //}
            //try
            //{
            //    if (lastProfileSetPath != null) LoadProfileSet(lastProfileSetPath);
            //}
            //catch (Exception e)
            //{
            //    Console.Error.WriteLine("Couldn't load last profile set");
            //    Console.Error.WriteLine(e.Message);
            //}

            // initialise the parameter helper
            parameterHelper = new ParameterHelper();
            parameterHelper.Initialise();

            // connect the acquisitor to the profile manager, which will send it events when the
            // user is in tweak mode.
            profileManager.Tweak += new TweakEventHandler(acquisitor.HandleTweak);

            // Get access to any other applications required
            Environs.Hardware.ConnectApplications();

            // run the main event loop
            Application.Run(controllerWindow);
        }
    /*
     * Open the window where the mapping will be shown to the user
     */
    static void GetXBOX360Controller()
    {
        ControllerWindow _window = new ControllerWindow();

        _window.titleContent = new GUIContent("Controller Mapping");
        _window.Init();
        _window.Show();
    }