public static async Task CreateAsync(IUIVisualizerService _uiVisualizerService, MasterViewModel viewModel) { ProgressionTree progression = new ProgressionTree(); ITypeFactory localizationFactory = viewModel.GetTypeFactory(); RodskaApplication app = (RodskaApplication)RodskaApplication.Current; var localeVM = localizationFactory.CreateInstanceWithParametersAndAutoCompletion <ProgressTreeViewModel>(progression); viewModel.Dispatcher.Invoke(() => { app.SetDocument(progression); }); await Task.CompletedTask; }
public static new void CreateEditor(ContentControl document) { RodskaApp app = (RodskaApp)RodskaApp.Current; document.Content = null; ITypeFactory typeFactory = app.currentMainVM.GetTypeFactory(); MainWindow mainWindow = (MainWindow)app.MainWindow; if (mainWindow.CurrentDocument == null) { return; } ProgressionTree tree = (ProgressionTree)mainWindow.CurrentDocument; ProgressTreeViewModel viewModel = typeFactory.CreateInstanceWithParametersAndAutoCompletion <ProgressTreeViewModel>(tree); ProgressionTreeControl control = new ProgressionTreeControl(viewModel); document.Content = control; }
public static ProgressionTree LoadFromFile(Catel.Runtime.Serialization.Xml.XmlSerializer seri, FileStream stream) { ProgressionTree tree = new ProgressionTree(); try { stream.Position = 0; seri.Warmup(new List <Type>() { typeof(TreeEntry), typeof(ProgressionEntry), typeof(ProgressionTree) }); tree = SavableModelBase <ProgressionTree> .Load(stream, seri); } catch (SerializationException ex) { Console.WriteLine(ex.Message); } return(tree); // return seri.Deserialize<ProgressionTree>(stream); }