예제 #1
0
 internal void Initialize(NodeSelectionManager selectionManger, NodeConfiguration source, Func<NodeConfiguration> targetGetter, Action<NodeConfiguration> targetSetter)
 {
     this.selectionManger = selectionManger;
     this.source = source;
     this.targetGetter = targetGetter;
     this.targetSetter = targetSetter;
 }
        void IConfigurationControl.Initialize(ConfigurationManager configManager, ConfigurationTreeItem configTreeItem)
        {
            ConfigManager = configManager;
            ConfigTreeItem = configTreeItem;

            NodeSelectionManager = new NodeSelectionManager(uiNodePropertiesContainer, ConfigManager);

            Messageflow = ConfigManager.Configuration.GetMessageFlow();
            MessageflowGraphPresenter = new MessageflowGraphPresenter(Messageflow, NodeSelectionManager);
            NodeSelectionManager.MessageflowGraphPresenter = MessageflowGraphPresenter;
            
            graphCanvas = MessageflowGraphPresenter.CreateGraphCanvas();
            uiDesignerContainer.Child = graphCanvas;
            uiDesignerContainer.ContextMenu = CreateGraphCanvasContextMenu();

            PrepareLayoutConfiguration();
        }
        private void uiImport_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog();
            dialog.Filter = "Messageflow configuration|*.xmf";
            dialog.DefaultExt = ".xmf";
            dialog.CheckFileExists = true;
            if (dialog.ShowDialog() == true) {
                using (var fs = new FileStream(dialog.FileName, FileMode.Open)) {
                    Messageflow = MessageFlowConfiguration.Read(fs);
                }
                NodeSelectionManager = new NodeSelectionManager(uiNodePropertiesContainer, ConfigManager);
                uiNodePropertiesContainer.Child = null;
                MessageflowGraphPresenter = new MessageflowGraphPresenter(Messageflow, NodeSelectionManager);
                NodeSelectionManager.MessageflowGraphPresenter = MessageflowGraphPresenter;
                graphCanvas = MessageflowGraphPresenter.CreateGraphCanvas();
                uiDesignerContainer.Child = graphCanvas;

                PrepareLayoutConfiguration();
            }
        }