Example #1
0
        public void TestMeshReader()
        {
            var file = Path.Combine(@"C:\Users\enohka\Desktop\teststuff", "mesh_all.spk");

            var mreader = new MeshReader();

            using (var fs = new FileStream(file, FileMode.Open))
                mreader.Read(fs);
        }
        private void EditMeshExecute(object obj)
        {
            var vm = CollectionViewSource.GetDefaultView(OpenFiles).CurrentItem as EdataFileViewModel;
            if (vm == null)
                return;

            var mesh = vm.FilesCollectionView.CurrentItem as EdataContentFile;
            if (mesh == null)
                return;

            var dispatcher = Dispatcher.CurrentDispatcher;

            Action<ViewModelBase, ViewModelBase> open = DialogProvider.ProvideView;
            Action<string> report = msg => StatusText = msg;

            var s = new Task(() =>
            {
                try
                {
                    dispatcher.Invoke(() => IsUIBusy = true);
                    dispatcher.Invoke(report, "Reading Mesh package...");

                    var reader = new MeshReader();
                    var meshfile = reader.Read(vm.EdataManager.GetRawData(mesh));

                    var detailsVm = new MeshEditorViewModel(meshfile);

                    dispatcher.Invoke(open, detailsVm, this);
                }
                catch (Exception ex)
                {
                    Trace.TraceError("Unhandeled exception in Thread occoured: {0}", ex.ToString());
                }
                finally
                {
                    dispatcher.Invoke(() => IsUIBusy = false);
                    dispatcher.Invoke(report, "Ready");
                }
            });

            s.Start();
        }