/// <summary> /// Constructor /// </summary> /// <param name="collection">Moves Collection</param> /// <param name="bluetooth">Communicate Object</param> public Player(MoveItemsCollection collection, BluetoothDevice bluetooth) { Collection = collection; Bluetooth = bluetooth; // register worker Worker = new BackgroundWorker(); Worker.DoWork+= worker_DoWork; }
/// <summary> /// Import sequence from file /// </summary> /// <param name="sender">Event source</param> /// <param name="e">Event arguments</param> private void btnImport_Click(object sender, RoutedEventArgs e) { //------------------------------------------------------------------------------------- /*----------------- Get XML File -----------------*/ // Configure open file dialog box var dlg = new Microsoft.Win32.OpenFileDialog {DefaultExt = ".xml", Filter = "Text documents |*.xml"}; // Show open file dialog box bool? result = dlg.ShowDialog(); // Process open file dialog box results if (result != true) { return; } string filename = dlg.FileName; //------------------------------------------------------------------------------------- /*----------------- Process XML data -----------------*/ // load states from file Sequence = MoveItemsCollection.Import(filename); // update sequence view tblSequences.ItemsSource = Sequence; tblSequences.Items.Refresh(); }
/// <summary> /// Default constructor /// </summary> public MainWindow() { InitializeComponent(); Slow = false; // Initialize sequence Sequence = new MoveItemsCollection(); tblSequences.ItemsSource = Sequence; // Initialize Moves cbDirection.ItemsSource = MoveItem.AvailableMoves; // get local video device information LocalVideoDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice); // initialize gamepad Control object GamePad = new GamepadDevice(navUp, navDown, navLeft, navRight, actTriangle, actCircle, actCross, actSquare, actL2, actR2, actL1, actR1, actSelect, actStart); // Organize virtual keypad VirtualButtons = new Key[14]; // Register keypad Keypad_Init(); Keypad_CommandMap(); // Initialize Tracker Tracker= new BackgroundWorker(); Tracker.WorkerSupportsCancellation = true; Tracker.DoWork+= Tracking; Tracker.RunWorkerCompleted += TrackingTerminated; // initiate target Target = new Indicator(); ObjTracker = new ObjectTracker(Bluetooth, Target); ObjTracker.Worker.RunWorkerCompleted += TrackingTerminated; tabControl.Items.Remove(tabPlayer); }
public Preset(string name, MoveItemsCollection states) { Name = name; States = states; }