Пример #1
0
        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;
            }
            InteractionLiteral   interaction     = (InteractionLiteral)mainWindow.CurrentDocument;
            InteractionViewModel interactionView = typeFactory.CreateInstanceWithParametersAndAutoCompletion <InteractionViewModel>(interaction);
            InteractionControl   control         = new InteractionControl(interactionView);

            control.interactionWorkspace.ViewModel = new NodeNetwork.ViewModels.NetworkViewModel();
            InteractionNode node = new InteractionNode(interaction);

            control.interactionWorkspace.ViewModel.Nodes.Add(node);
            node.Name = interaction.Title;

            control.CurrentDocument = interaction;
            document.Content        = control;
        }
Пример #2
0
        public static async Task CreateAsync(IUIVisualizerService _uiVisualizerService, MasterViewModel viewModel)
        {
            _ = viewModel.Dispatcher.Invoke(async() =>
            {
                InteractionLiteral interaction_new = new InteractionLiteral();
                ITypeFactory dialogueFactory       = viewModel.GetTypeFactory();
                var interactionView = dialogueFactory.CreateInstanceWithParametersAndAutoCompletion <InteractionViewModel>(interaction_new);
                DocumentAdded      += (object sender, UICompletedEventArgs e) =>
                {
                    if (!interaction_new.IsCanceled)
                    {
                        Console.WriteLine("[RodskaNote]: New Interaction - " + interaction_new.Title);
                        Interactions.Add(interaction_new);
                        RodskaApp app          = (RodskaApp)RodskaApp.Current;
                        MainWindow window      = (MainWindow)app.MainWindow;
                        window.CurrentDocument = interaction_new;
                    }
                };
                var result     = await GetFromPrompt(_uiVisualizerService, interactionView);
                DocumentAdded -= (object sender, UICompletedEventArgs e) =>
                {
                    if (!interaction_new.IsCanceled)
                    {
                        Console.WriteLine("[RodskaNote]: New Interaction - " + interaction_new.Title);
                        Interactions.Add(interaction_new);
                        RodskaApplication app  = (RodskaApplication)RodskaApplication.Current;
                        MainWindow window      = (MainWindow)app.MainWindow;
                        window.CurrentDocument = interaction_new;
                    }
                };
            });


            await Task.CompletedTask;
        }