Esempio n. 1
0
 public virtual void Hide()
 {
     if (visualizerDialog != null)
     {
         visualizerDialog.Close();
     }
 }
Esempio n. 2
0
        protected override void InitializeComponents(TypeVisualizerDialog visualizerDialog, IServiceProvider provider)
        {
            visualizerDialog.Text = Text;
            visualizerContext     = new ServiceContainer(provider);
            visualizerContext.AddService(typeof(ITypeVisualizerContext), this);
            visualizerContext.AddService(typeof(TypeVisualizerDialog), visualizerDialog);
            visualizerContext.AddService(typeof(IDialogTypeVisualizerService), visualizerDialog);
            visualizerContext.AddService(typeof(ExpressionBuilderGraph), workflowGraphView.Workflow);
            visualizer.Value.Load(visualizerContext);
            var visualizerOutput = visualizer.Value.Visualize(visualizerSource.Output, visualizerContext);

            visualizerDialog.AllowDrop  = true;
            visualizerDialog.KeyPreview = true;
            visualizerDialog.KeyDown   += new KeyEventHandler(visualizerDialog_KeyDown);
            visualizerDialog.DragEnter += new DragEventHandler(visualizerDialog_DragEnter);
            visualizerDialog.DragOver  += new DragEventHandler(visualizerDialog_DragOver);
            visualizerDialog.DragDrop  += new DragEventHandler(visualizerDialog_DragDrop);
            visualizerDialog.Load      += delegate
            {
                visualizerObserver = visualizerOutput.Subscribe(
                    xs => { },
                    ex => visualizerDialog.BeginInvoke((Action)(() =>
                {
                    MessageBox.Show(visualizerDialog, ex.Message, visualizerDialog.Text);
                    visualizerDialog.Close();
                })));
            };

            visualizerDialog.HandleDestroyed += delegate
            {
                if (visualizerObserver != null)
                {
                    visualizerObserver.Dispose();
                    visualizerObserver = null;
                }
            };

            visualizerDialog.FormClosed += delegate
            {
                visualizer.Value.Unload();
                visualizerContext.RemoveService(typeof(ExpressionBuilderGraph));
                visualizerContext.RemoveService(typeof(IDialogTypeVisualizerService));
                visualizerContext.RemoveService(typeof(TypeVisualizerDialog));
                visualizerContext.RemoveService(typeof(ITypeVisualizerContext));
                visualizerContext.Dispose();
                visualizerContext = null;
            };

            visualizerDialog.Shown += delegate
            {
                visualizerDialog.Activated += delegate
                {
                    workflowGraphView.SelectBuilderNode(source);
                };
            };
        }
 static IDisposable SubscribeDialog <TSource>(IObservable <TSource> source, TypeVisualizerDialog visualizerDialog)
 {
     return(source.Subscribe(
                xs => { },
                ex => visualizerDialog.BeginInvoke((Action)(() =>
     {
         MessageBox.Show(visualizerDialog, ex.Message, visualizerDialog.Text);
         visualizerDialog.Close();
     }))));
 }