Beispiel #1
0
        public MainForm()
        {
            InitializeComponent();

            _serviceProvider = flDesigner1._GetService(typeof(IServiceProvider)) as IServiceProvider;
            _copyActivity = null;
            _copyActivityString = string.Empty;

            FLActivityToolbox toolbox = new FLActivityToolbox(_serviceProvider);
            flDesigner1.AddService(typeof(IToolboxService), toolbox);
            InitFLViewContextMenu();
        }
Beispiel #2
0
        private void flDesinger1_ActivitySelected(object sender, ActivitySelectedEventArgs e)
        {
            _selectedActivity = e.SelectedActivity;

            if (_selectedActivity != null && _selectedActivity is Activity)
            {
                _MenuItemSyncInstance.Enabled = true;
                _MenuItemUpdateToEEPNetServer.Enabled = true;
                propertyGrid1.SelectedObject = _selectedActivity;

                FLActivityToolbox o = new FLActivityToolbox(_serviceProvider);
                splitContainer2.Panel1.Controls.Add(o);

                txtType.Text = _selectedActivity.GetType().ToString();
                txtModule.Text = _selectedActivity.GetType().Module.Name;

                if (!((Activity)_selectedActivity is SequentialWorkflowActivity))
                {
                    _MenuItemDeleteActivity.Enabled = true;
                    _MenuItemCutActivity.Enabled = true;
                    _MenuItemCopyActivity.Enabled = true;

                    if ((Activity)_selectedActivity is IfElseActivity)
                    {
                        _MenuItemAddIfElseBranch.Enabled = true;
                    }
                    else
                    {
                        _MenuItemAddIfElseBranch.Enabled = false;
                    }

                    if ((Activity)_selectedActivity is ParallelActivity)
                    {
                        _MenuItemAddSequence.Enabled = true;
                    }
                    else
                    {
                        _MenuItemAddSequence.Enabled = false;
                    }

                    if ((Activity)_selectedActivity is FLHyperLink || (Activity)_selectedActivity is FLQuery)
                    {
                        _MenuItemSaveLoacation.Enabled = true;
                    }
                    else
                    {
                        _MenuItemSaveLoacation.Enabled = false;
                    }
                }
                else
                {
                    _MenuItemDeleteActivity.Enabled = false;
                    _MenuItemCutActivity.Enabled = false;
                    _MenuItemCopyActivity.Enabled = false;
                }

                if (_copyActivityString != null && _copyActivityString != string.Empty)
                {
                    if (_selectedActivity is SequentialWorkflowActivity)
                    {
                        if (_copyActivity is IfElseBranchActivity || _copyActivity is SequenceActivity)
                        {
                            _MenuItemPasteActivity.Enabled = false;
                        }
                        else
                        {
                            _MenuItemPasteActivity.Enabled = true;
                        }
                    }
                    else if (_selectedActivity is IfElseActivity)
                    {
                        if (_copyActivity is IfElseBranchActivity)
                        {
                            _MenuItemPasteActivity.Enabled = true;
                        }
                        else
                        {
                            _MenuItemPasteActivity.Enabled = false;
                        }
                    }
                    else if (_selectedActivity is IfElseBranchActivity)
                    {
                        if (_copyActivity is IfElseBranchActivity)
                        {
                            _MenuItemPasteActivity.Enabled = false;
                        }
                        else
                        {
                            _MenuItemPasteActivity.Enabled = true;
                        }
                    }
                    else if (_selectedActivity is ParallelActivity)
                    {
                        if (_copyActivity is SequenceActivity && !(_copyActivity is IfElseBranchActivity))
                        {
                            _MenuItemPasteActivity.Enabled = true;
                        }
                        else
                        {
                            _MenuItemPasteActivity.Enabled = false;
                        }
                    }
                    else if (_selectedActivity is SequenceActivity)
                    {
                        if (_copyActivity is SequenceActivity || _copyActivity is IfElseBranchActivity)
                        {
                            _MenuItemPasteActivity.Enabled = false;
                        }
                        else
                        {
                            _MenuItemPasteActivity.Enabled = true;
                        }
                    }
                    else if (_selectedActivity is IEventWaiting || _selectedActivity is INonEventWaiting)
                    {
                        if (_copyActivity is IfElseBranchActivity)
                        {
                            _MenuItemPasteActivity.Enabled = false;
                        }
                        else
                        {
                            _MenuItemPasteActivity.Enabled = true;
                        }
                    }
                    else
                    {
                        _MenuItemPasteActivity.Enabled = true;
                    }
                }
                else
                {
                    _MenuItemPasteActivity.Enabled = false;
                }
            }
            else
            {
                _MenuItemDeleteActivity.Enabled = false;
                _MenuItemCutActivity.Enabled = false;
                _MenuItemCopyActivity.Enabled = false;
                _MenuItemPasteActivity.Enabled = false;
                _MenuItemAddIfElseBranch.Enabled = false;
                _MenuItemAddSequence.Enabled = false;
                _MenuItemSaveLoacation.Enabled = false;
                _MenuItemSyncInstance.Enabled = false;
                _MenuItemUpdateToEEPNetServer.Enabled = true;
            }
        }