/// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateFunction_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SequenceParametersWindow win = new SequenceParametersWindow();

            win.Title                    = "New Function parameters";
            win.InputName                = "name of the function";
            win.InputDescription         = "";
            win.IsValidInputNameCallback = GraphDataManager.Instance.IsValidFunctionName;
            win.Owner                    = MainWindow.Instance;

            if (win.ShowDialog() == false)
            {
                return;
            }

            SequenceFunction newSeq = new SequenceFunction(win.InputName);

            newSeq.Description = win.InputDescription;
            GraphDataManager.Instance.AddFunction(newSeq);

            FlowGraphControlViewModel wm = new FlowGraphControlViewModel(newSeq);

            wm.InitialNodeFromNewFunction();
            FlowGraphManager.Instance.Add(wm);

            MainWindow.Instance.FlowGraphManagerControl.OpenGraphInNewTab(newSeq);
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="seq_"></param>
        public void OpenGraphInNewTab(SequenceBase seq_)
        {
            foreach (TabItem item in tabControl.Items)
            {
                if ((item.DataContext as FlowGraphControlViewModel).ID == seq_.Id)
                {
                    tabControl.SelectedItem = item;
                    return;
                }
            }

            TabItem tab = new TabItem();
            FlowGraphControlViewModel fgvm = FlowGraphManager.Instance.GetViewModelByID(seq_.Id);

            tab.DataContext = fgvm;

            FlowGraphControl fgc = new FlowGraphControl();

            fgc.DataContext = fgvm;
            tab.Content     = fgc;

            Binding bind = new Binding("Name");

            bind.Source = fgvm;
            tab.SetBinding(TabItem.HeaderProperty, bind);

            tabControl.SelectedIndex = tabControl.Items.Add(tab);
        }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="vm_"></param>
 //         public void OpenGraphInNewTab(FlowGraphControlViewModel vm_)
 //         {
 //             foreach (TabItem item in tabControl.Items)
 //             {
 //                 FlowGraphControlViewModel fgvm = item.DataContext as FlowGraphControlViewModel;
 //                 if (fgvm.Id == vm_.Id)
 //                 {
 //                     tabControl.SelectedItem = item;
 //                     return;
 //                 }
 //             }
 //
 //             TabItem tab = new TabItem();
 //             tab.DataContext = vm_;
 //             FlowGraphControl fgc = new FlowGraphControl();
 //             fgc.DataContext = vm_;
 //             tab.Content = fgc;
 //
 //             Binding bind = new Binding("Name");
 //             bind.Source = vm_;
 //             tab.SetBinding(TabItem.HeaderProperty, bind);
 //
 //             tabControl.SelectedIndex = tabControl.Items.Add(tab);
 //         }
 /// <summary>
 /// 
 /// </summary>
 /// <param name="vm_"></param>
 public void CloseTab(FlowGraphControlViewModel vm_)
 {
     foreach (TabItem item in tabControl.Items)
     {
         FlowGraphControlViewModel fgvm = item.DataContext as FlowGraphControlViewModel;
         if (fgvm.ID == vm_.ID)
         {
             tabControl.Items.Remove(item);
             return;
         }
     }
 }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="vm_"></param>
//         public void OpenGraphInNewTab(FlowGraphControlViewModel vm_)
//         {
//             foreach (TabItem item in tabControl.Items)
//             {
//                 FlowGraphControlViewModel fgvm = item.DataContext as FlowGraphControlViewModel;
//                 if (fgvm.Id == vm_.Id)
//                 {
//                     tabControl.SelectedItem = item;
//                     return;
//                 }
//             }
//
//             TabItem tab = new TabItem();
//             tab.DataContext = vm_;
//             FlowGraphControl fgc = new FlowGraphControl();
//             fgc.DataContext = vm_;
//             tab.Content = fgc;
//
//             Binding bind = new Binding("Name");
//             bind.Source = vm_;
//             tab.SetBinding(TabItem.HeaderProperty, bind);
//
//             tabControl.SelectedIndex = tabControl.Items.Add(tab);
//         }

        /// <summary>
        ///
        /// </summary>
        /// <param name="vm_"></param>
        public void CloseTab(FlowGraphControlViewModel vm_)
        {
            foreach (TabItem item in tabControl.Items)
            {
                FlowGraphControlViewModel fgvm = item.DataContext as FlowGraphControlViewModel;
                if (fgvm.ID == vm_.ID)
                {
                    tabControl.Items.Remove(item);
                    return;
                }
            }
        }
示例#5
0
        /// <summary>
        /// 
        /// </summary>
        public CreateNodesUndoCommand(FlowGraphControlViewModel fgvm_, IEnumerable<NodeViewModel> nodesVM_)
        {
            m_FlowGraphVM = fgvm_;

            List<ConnectionViewModel> connections = new List<ConnectionViewModel>();
            foreach (var node in nodesVM_)
            {
                connections.AddRange(node.AttachedConnections);
            }
            CopyConnections(connections);

            m_NodesVM = nodesVM_;
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteFunction_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (listBoxGraphFunctions.SelectedItem != null &&
                listBoxGraphFunctions.SelectedItem is SequenceFunction)
            {
                FlowGraphControlViewModel flowGraphVM =
                    FlowGraphManager.Instance.GetViewModelByID((listBoxGraphFunctions.SelectedItem as SequenceBase).Id);

                if (MessageBox.Show(
                        "Do you really want to delete the function " + flowGraphVM.Name + " ?",
                        "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
                {
                    MainWindow.Instance.FlowGraphManagerControl.CloseTab(flowGraphVM);
                    FlowGraphManager.Instance.Remove(flowGraphVM);
                    GraphDataManager.Instance.RemoveFunction(flowGraphVM.Sequence as SequenceFunction);
                }
            }
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="vm_"></param>
        public SequenceParametersWindow(FlowGraphControlViewModel vm_ = null, IsValidInputNameDelegate callback_ = null)
        {
            InitializeComponent();

            IsValidInputNameCallback = callback_;

            if (vm_ == null)
            {
                Title = "New Graph parameters";
            }
            else
            {
                Title                   = "Graph " + vm_.Name + " parameters";
                textBoxName.Text        = vm_.Name;
                textBoxDescription.Text = vm_.Description;
            }

            Closing += new CancelEventHandler(OnClosing);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="vm_"></param>
        public SequenceParametersWindow(FlowGraphControlViewModel vm_ = null, IsValidInputNameDelegate callback_ = null)
        {
            InitializeComponent();

            IsValidInputNameCallback = callback_;

            if (vm_ == null)
            {
                Title = "New Graph parameters";
            }
            else
            {
                Title = "Graph " + vm_.Name + " parameters";
                textBoxName.Text = vm_.Name;
                textBoxDescription.Text = vm_.Description;
            }

            Closing += new CancelEventHandler(OnClosing);
        }
        /// <summary>
        /// 
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CreateFunction_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            SequenceParametersWindow win = new SequenceParametersWindow();
            win.Title = "New Function parameters";
            win.InputName = "name of the function";
            win.InputDescription = "";
            win.IsValidInputNameCallback = GraphDataManager.Instance.IsValidFunctionName;
            win.Owner = MainWindow.Instance;

            if (win.ShowDialog() == false)
            {
                return;
            }

            SequenceFunction newSeq = new SequenceFunction(win.InputName);
            newSeq.Description = win.InputDescription;
            GraphDataManager.Instance.AddFunction(newSeq);

            FlowGraphControlViewModel wm = new FlowGraphControlViewModel(newSeq);
            wm.InitialNodeFromNewFunction();
            FlowGraphManager.Instance.Add(wm);

            MainWindow.Instance.FlowGraphManagerControl.OpenGraphInNewTab(newSeq);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void RenameFunction_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            if (listBoxGraphFunctions.SelectedItem != null &&
                listBoxGraphFunctions.SelectedItem is SequenceFunction)
            {
                FlowGraphControlViewModel flowGraphVM =
                    FlowGraphManager.Instance.GetViewModelByID((listBoxGraphFunctions.SelectedItem as SequenceBase).Id);

                SequenceParametersWindow win = new SequenceParametersWindow();
                win.Title                    = "Function " + flowGraphVM.Name + " parameters";
                win.InputName                = flowGraphVM.Name;
                win.InputDescription         = flowGraphVM.Description;
                win.IsValidInputNameCallback = GraphDataManager.Instance.IsValidFunctionName;
                win.Owner                    = MainWindow.Instance;

                if (win.ShowDialog() == false)
                {
                    return;
                }

                flowGraphVM.Sequence.Name        = win.InputName;
                flowGraphVM.Sequence.Description = win.InputDescription;
            }
        }
示例#11
0
 /// <summary>
 /// 
 /// </summary>
 public CreateNodeUndoCommand(FlowGraphControlViewModel fgvm_, NodeViewModel nodeVM_)
 {
     m_FlowGraphVM = fgvm_;
     m_NodeVM = nodeVM_;
 }
示例#12
0
 /// <summary>
 /// 
 /// </summary>
 public DeleteNodeUndoCommand(FlowGraphControlViewModel fgvm_, NodeViewModel nodeVM_)
 {
     m_FlowGraphVM = fgvm_;
     m_NodeVM = nodeVM_;
     CopyConnections(m_NodeVM.AttachedConnections);
 }
示例#13
0
 /// <summary>
 /// 
 /// </summary>
 internal void Remove(FlowGraphControlViewModel viewModel_)
 {
     m_FlowGraphList.Remove(viewModel_);
 }
示例#14
0
 /// <summary>
 /// 
 /// </summary>
 internal void Add(FlowGraphControlViewModel viewModel_)
 {
     m_FlowGraphList.Add(viewModel_);
 }
示例#15
0
 /// <summary>
 /// 
 /// </summary>
 public CreateConnectionUndoCommand(FlowGraphControlViewModel fgvm_, ConnectionViewModel connectionVM_)
 {
     m_FlowGraphVM = fgvm_;
     //m_ConnectionVM = connectionVM_.Copy();
     m_DestConnector = connectionVM_.DestConnector;
     m_DestConnectorHotspot = connectionVM_.DestConnectorHotspot;
     m_Points = connectionVM_.Points;
     m_SourceConnector = connectionVM_.SourceConnector;
     m_SourceConnectorHotspot = connectionVM_.SourceConnectorHotspot;
 }
示例#16
0
 /// <summary>
 /// 
 /// </summary>
 public CreateConnectionsUndoCommand(FlowGraphControlViewModel fgvm_, IEnumerable<ConnectionViewModel> connectionsVM_)
 {
     m_FlowGraphVM = fgvm_;
     m_ConnectionsVM = connectionsVM_;
 }
示例#17
0
        /// <summary>
        /// 
        /// </summary>
        public DeleteConnectionsUndoCommand(FlowGraphControlViewModel fgvm_, IEnumerable<ConnectionViewModel> connectionsVM_)
        {
            m_FlowGraphVM = fgvm_;

            foreach (ConnectionViewModel c in connectionsVM_)
            {
                m_ConnectionInfoList.Add(new ConnectionInfo
                    {
                        ConnectionVM = null,
                        DestConnector = c.DestConnector,
                        DestConnectorHotspot = c.DestConnectorHotspot,
                        Points = c.Points,
                        SourceConnector = c.SourceConnector,
                        SourceConnectorHotspot = c.SourceConnectorHotspot
                    });
            }
        }
示例#18
0
 /// <summary>
 /// 
 /// </summary>
 public PositionNodeUndoCommand(FlowGraphControlViewModel fgvm_, IEnumerable<NodeDraggingInfo> nodeInfosVM_)
 {
     m_FlowGraphVM = fgvm_;
     m_NodeInfosVM = new List<NodeDraggingInfo>(nodeInfosVM_);
 }