Exemple #1
0
        private static DeterministicTransitionClipData DTToClipFormat(DeterministicTransition dt, DataSheet stratumSheet, DataSheet stateClassSheet)
        {
            Debug.Assert(stratumSheet.Name == Strings.DATASHEET_STRATA_NAME);
            Debug.Assert(stateClassSheet.Name == Strings.DATASHEET_STATECLASS_NAME);

            DeterministicTransitionClipData cd = new DeterministicTransitionClipData();

            if (dt.StratumIdSource.HasValue)
            {
                cd.StratumSource = stratumSheet.ValidationTable.GetDisplayName(dt.StratumIdSource.Value);
            }

            cd.StateClassSource = stateClassSheet.ValidationTable.GetDisplayName(dt.StateClassIdSource);

            if (dt.StratumIdDestination.HasValue)
            {
                cd.StratumDest = stratumSheet.ValidationTable.GetDisplayName(dt.StratumIdDestination.Value);
            }

            if (cd.StateClassIdDest.HasValue)
            {
                cd.StateClassDest = stateClassSheet.ValidationTable.GetDisplayName(dt.StateClassIdDestination.Value);
            }

            return(cd);
        }
Exemple #2
0
        private static bool ValidateDTClipData(DeterministicTransitionClipData dt, DataSheet stratumSheet, DataSheet stateClassSheet)
        {
            Debug.Assert(stratumSheet.Name == Strings.DATASHEET_STRATA_NAME);
            Debug.Assert(stateClassSheet.Name == Strings.DATASHEET_STATECLASS_NAME);

            if (dt.StratumSource != null)
            {
                if (!stratumSheet.ValidationTable.ContainsValue(dt.StratumSource))
                {
                    FormsUtilities.ErrorMessageBox("The stratum '{0}' does not exist in this project.", dt.StratumSource);
                    return(false);
                }
            }

            if (!stateClassSheet.ValidationTable.ContainsValue(dt.StateClassSource))
            {
                FormsUtilities.ErrorMessageBox("The state class '{0}' does not exist in this project.", dt.StateClassSource);
                return(false);
            }

            if (dt.StratumDest != null)
            {
                if (!stratumSheet.ValidationTable.ContainsValue(dt.StratumDest))
                {
                    FormsUtilities.ErrorMessageBox("The stratum '{0}' does not exist in this project.", dt.StratumDest);
                    return(false);
                }
            }

            if (dt.StateClassDest != null)
            {
                if (!stateClassSheet.ValidationTable.ContainsValue(dt.StateClassDest))
                {
                    FormsUtilities.ErrorMessageBox("The state class '{0}' does not exist in this project.", dt.StateClassDest);
                    return(false);
                }
            }

            if (dt.StratumSource != null)
            {
                dt.StratumIdSource = stratumSheet.ValidationTable.GetValue(dt.StratumSource);
            }

            dt.StateClassIdSource = stateClassSheet.ValidationTable.GetValue(dt.StateClassSource);

            if (dt.StratumDest != null)
            {
                dt.StratumIdDest = stratumSheet.ValidationTable.GetValue(dt.StratumDest);
            }

            if (dt.StateClassDest != null)
            {
                dt.StateClassIdDest = stateClassSheet.ValidationTable.GetValue(dt.StateClassDest);
            }

#if DEBUG
            if (dt.StratumIdSource.HasValue)
            {
                Debug.Assert(dt.StratumIdSource.Value > 0);
            }

            Debug.Assert(dt.StateClassIdSource > 0);

            if (dt.StratumDest != null)
            {
                Debug.Assert(dt.StratumIdDest.Value > 0);
            }

            if (dt.StateClassDest != null)
            {
                Debug.Assert(dt.StateClassIdDest.Value > 0);
            }
#endif

            return(true);
        }