public MainWindow()
        {
            InitializeComponent();

            var tsi = new TsiFile(@"C:\Users\Ivan\Desktop\test.tsi");


            DataContext = new MappingsObservableCollection(tsi.Devices.First());
        }
        private async void OpenMenuItemClick(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog { Filter = "TSI|*.tsi" };

            if (dialog.ShowDialog() == true)
            {
                var currentCursor = Cursor;
                Cursor = Cursors.Wait;
                var tsi = new TsiFile(dialog.FileName);

                var createModel = Task<List<MappingModel>>.Factory.StartNew(() => MainWindowController.CreateModel(tsi.Devices.First()));

                await createModel;
                model.Filter = "";
                model.Mappings = new ObservableCollection<MappingModel>(createModel.Result);
                model.MappingView = CollectionViewSource.GetDefaultView(model.Mappings);
                model.MappingView.Filter = Filter;

                model.FileName = dialog.FileName;

                Cursor = currentCursor;
            }
        }
        private async void SaveTsi(object sender, RoutedEventArgs e)
        {
            if (!String.IsNullOrWhiteSpace(model.FileName))
            {
                var currentCursor = Cursor;
                Cursor = Cursors.Wait;

                var saveFile = Task.Factory.StartNew(() =>
                {
                    var tsi = new TsiFile(model.FileName);
                    if (MainWindowController.SaveModel(model.Mappings, tsi.Devices.First()) == SaveModelResult.SuccessWithNonSavedUnknownMappings)
                    {
                        MessageBox.Show("You have made changes to mappings associated with unknown traktor functions. " +
                            "Please note that these changes will not be saved. All other changes will be saved as normal.");
                    }
                    tsi.Save();
                });

                await saveFile;

                Cursor = currentCursor;
            }
        }