private bool UpdateDataEx(EcasAction a, bool bGuiToInternal,
			EcasTypeDxMode dxType)
		{
			m_bBlockTypeSelectionHandler = true;
			bool bResult = EcasUtil.UpdateDialog(EcasObjectType.Action, m_cmbActions,
				m_dgvParams, a, bGuiToInternal, dxType);
			m_bBlockTypeSelectionHandler = false;
			return bResult;
		}
Exemple #2
0
        private bool UpdateDataEx(EcasCondition c, bool bGuiToInternal,
                                  EcasTypeDxMode dxType)
        {
            m_bBlockTypeSelectionHandler = true;
            bool bResult = EcasUtil.UpdateDialog(EcasObjectType.Condition, m_cmbConditions,
                                                 m_dgvParams, c, bGuiToInternal, dxType);

            m_bBlockTypeSelectionHandler = false;
            return(bResult);
        }
Exemple #3
0
        public static bool UpdateDialog(EcasObjectType objType, ComboBox cmbTypes,
                                        DataGridView dgvParams, IEcasObject o, bool bGuiToInternal,
                                        EcasTypeDxMode dxType)
        {
            bool bResult = true;

            try
            {
                if (bGuiToInternal)
                {
                    IEcasParameterized eTypeInfo = null;

                    if (dxType == EcasTypeDxMode.Selection)
                    {
                        string strSel = (cmbTypes.SelectedItem as string);
                        if (!string.IsNullOrEmpty(strSel))
                        {
                            if (objType == EcasObjectType.Event)
                            {
                                eTypeInfo = Program.EcasPool.FindEvent(strSel);
                                o.Type    = eTypeInfo.Type;
                            }
                            else if (objType == EcasObjectType.Condition)
                            {
                                eTypeInfo = Program.EcasPool.FindCondition(strSel);
                                o.Type    = eTypeInfo.Type;
                            }
                            else if (objType == EcasObjectType.Action)
                            {
                                eTypeInfo = Program.EcasPool.FindAction(strSel);
                                o.Type    = eTypeInfo.Type;
                            }
                            else
                            {
                                Debug.Assert(false);
                            }
                        }
                    }
                    else if (dxType == EcasTypeDxMode.ParamsTag)
                    {
                        IEcasParameterized p = (dgvParams.Tag as IEcasParameterized);
                        if ((p != null) && (p.Type != null))
                        {
                            eTypeInfo = p;
                            o.Type    = eTypeInfo.Type;
                        }
                        else
                        {
                            Debug.Assert(false);
                        }
                    }

                    EcasUtil.DataGridViewToParameters(dgvParams, o, eTypeInfo);
                }
                else                 // Internal to GUI
                {
                    if (dxType == EcasTypeDxMode.Selection)
                    {
                        if (o.Type.Equals(PwUuid.Zero))
                        {
                            cmbTypes.SelectedIndex = 0;
                        }
                        else
                        {
                            int i = -1;
                            if (objType == EcasObjectType.Event)
                            {
                                i = cmbTypes.FindString(Program.EcasPool.FindEvent(o.Type).Name);
                            }
                            else if (objType == EcasObjectType.Condition)
                            {
                                i = cmbTypes.FindString(Program.EcasPool.FindCondition(o.Type).Name);
                            }
                            else if (objType == EcasObjectType.Action)
                            {
                                i = cmbTypes.FindString(Program.EcasPool.FindAction(o.Type).Name);
                            }
                            else
                            {
                                Debug.Assert(false);
                            }

                            if (i >= 0)
                            {
                                cmbTypes.SelectedIndex = i;
                            }
                            else
                            {
                                Debug.Assert(false);
                            }
                        }
                    }
                    else
                    {
                        Debug.Assert(dxType != EcasTypeDxMode.ParamsTag);
                    }

                    IEcasParameterized t = null;
                    if (objType == EcasObjectType.Event)
                    {
                        t = Program.EcasPool.FindEvent(cmbTypes.SelectedItem as string);
                    }
                    else if (objType == EcasObjectType.Condition)
                    {
                        t = Program.EcasPool.FindCondition(cmbTypes.SelectedItem as string);
                    }
                    else if (objType == EcasObjectType.Action)
                    {
                        t = Program.EcasPool.FindAction(cmbTypes.SelectedItem as string);
                    }
                    else
                    {
                        Debug.Assert(false);
                    }

                    if (t != null)
                    {
                        EcasUtil.ParametersToDataGridView(dgvParams, t, o);
                    }
                }
            }
            catch (Exception e) { MessageService.ShowWarning(e); bResult = false; }

            return(bResult);
        }
Exemple #4
0
        public static bool UpdateDialog(EcasObjectType objType, ComboBox cmbTypes,
            DataGridView dgvParams, IEcasObject o, bool bGuiToInternal,
            EcasTypeDxMode dxType)
        {
            bool bResult = true;

            try
            {
                if(bGuiToInternal)
                {
                    IEcasParameterized eTypeInfo = null;

                    if(dxType == EcasTypeDxMode.Selection)
                    {
                        string strSel = (cmbTypes.SelectedItem as string);
                        if(!string.IsNullOrEmpty(strSel))
                        {
                            if(objType == EcasObjectType.Event)
                            {
                                eTypeInfo = Program.EcasPool.FindEvent(strSel);
                                o.Type = eTypeInfo.Type;
                            }
                            else if(objType == EcasObjectType.Condition)
                            {
                                eTypeInfo = Program.EcasPool.FindCondition(strSel);
                                o.Type = eTypeInfo.Type;
                            }
                            else if(objType == EcasObjectType.Action)
                            {
                                eTypeInfo = Program.EcasPool.FindAction(strSel);
                                o.Type = eTypeInfo.Type;
                            }
                            else { Debug.Assert(false); }
                        }
                    }
                    else if(dxType == EcasTypeDxMode.ParamsTag)
                    {
                        IEcasParameterized p = (dgvParams.Tag as IEcasParameterized);
                        if((p != null) && (p.Type != null))
                        {
                            eTypeInfo = p;
                            o.Type = eTypeInfo.Type;
                        }
                        else { Debug.Assert(false); }
                    }

                    EcasUtil.DataGridViewToParameters(dgvParams, o, eTypeInfo);
                }
                else // Internal to GUI
                {
                    if(dxType == EcasTypeDxMode.Selection)
                    {
                        if(o.Type.Equals(PwUuid.Zero))
                            cmbTypes.SelectedIndex = 0;
                        else
                        {
                            int i = -1;
                            if(objType == EcasObjectType.Event)
                                i = cmbTypes.FindString(Program.EcasPool.FindEvent(o.Type).Name);
                            else if(objType == EcasObjectType.Condition)
                                i = cmbTypes.FindString(Program.EcasPool.FindCondition(o.Type).Name);
                            else if(objType == EcasObjectType.Action)
                                i = cmbTypes.FindString(Program.EcasPool.FindAction(o.Type).Name);
                            else { Debug.Assert(false); }

                            if(i >= 0) cmbTypes.SelectedIndex = i;
                            else { Debug.Assert(false); }
                        }
                    }
                    else { Debug.Assert(dxType != EcasTypeDxMode.ParamsTag); }

                    IEcasParameterized t = null;
                    if(objType == EcasObjectType.Event)
                        t = Program.EcasPool.FindEvent(cmbTypes.SelectedItem as string);
                    else if(objType == EcasObjectType.Condition)
                        t = Program.EcasPool.FindCondition(cmbTypes.SelectedItem as string);
                    else if(objType == EcasObjectType.Action)
                        t = Program.EcasPool.FindAction(cmbTypes.SelectedItem as string);
                    else { Debug.Assert(false); }

                    if(t != null) EcasUtil.ParametersToDataGridView(dgvParams, t, o);
                }
            }
            catch(Exception e) { MessageService.ShowWarning(e); bResult = false; }

            return bResult;
        }