示例#1
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ContextName.Length != 0)
            {
                hash ^= ContextName.GetHashCode();
            }
            if (PredName.Length != 0)
            {
                hash ^= PredName.GetHashCode();
            }
            if (PivotName.Length != 0)
            {
                hash ^= PivotName.GetHashCode();
            }
            if (Branch != 0)
            {
                hash ^= Branch.GetHashCode();
            }
            if (valuesDef_ != null)
            {
                hash ^= ValuesDef.GetHashCode();
            }
            return(hash);
        }
示例#2
0
        private bool MovePivot(Pivot pivot)
        {
            bool result = false;

            if (PivotNext)
            {
                pivot.SelectedIndex = (pivot.SelectedIndex + 1) % pivot.Items.Count;
                result = true;
            }
            else if (PivotLast)
            {
                if (pivot.SelectedIndex == 0)
                {
                    pivot.SelectedIndex = pivot.Items.Count - 1;
                    result = true;
                }
                else
                {
                    pivot.SelectedIndex = pivot.SelectedIndex - 1;
                    result = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(PivotName))
            {
                var index      = 0;
                var pivotFound = false;

                foreach (var pivotItem in pivot.Items.Cast <PivotItem>())
                {
                    if (pivotItem.Name.ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant()) ||
                        pivotItem.GetValue(AutomationProperties.NameProperty)
                        .ToString()
                        .ToLowerInvariant()
                        .StartsWith(PivotName.ToLowerInvariant()))
                    {
                        pivotFound = true;
                        break;
                    }
                    index++;
                }

                if (pivotFound)
                {
                    pivot.SelectedIndex = index;
                    result = true;
                }
                else
                {
                    SendNotFoundResult(string.Format("PivotCommand: Could not find the Pivot : {0}", PivotName));
                }
            }
            else
            {
                SendNotFoundResult("PivotCommand: Could not find the pivot");
            }

            return(result);
        }
示例#3
0
        private bool MovePano(Panorama pano)
        {
            bool result = false;

            if (PivotNext)
            {
                pano.DefaultItem = pano.Items[(pano.SelectedIndex + 1) % pano.Items.Count];
                result           = true;
            }
            else if (PivotLast)
            {
                if (pano.SelectedIndex == 0)
                {
                    pano.DefaultItem = pano.Items[pano.Items.Count - 1];
                    result           = true;
                }
                else
                {
                    pano.DefaultItem = pano.Items[pano.SelectedIndex - 1];
                    result           = true;
                }
            }
            else if (!string.IsNullOrWhiteSpace(PivotName))
            {
                var panoToGo =
                    pano.Items.Cast <PanoramaItem>()
                    .FirstOrDefault(item => item.Name.ToLowerInvariant().StartsWith(PivotName.ToLowerInvariant())
                                    ||
                                    item.GetValue(AutomationProperties.NameProperty)
                                    .ToString()
                                    .StartsWith(PivotName.ToLowerInvariant()));

                if (panoToGo != null)
                {
                    pano.DefaultItem = panoToGo;
                    result           = true;
                }
                else
                {
                    SendNotFoundResult(string.Format("PivotCommand: Could not find the Panorama : {0}", PivotName));
                }
            }
            else
            {
                SendNotFoundResult("PivotCommand: Could nto find the Panorama element");
            }

            return(result);
        }
示例#4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (ContextName.Length != 0)
            {
                hash ^= ContextName.GetHashCode();
            }
            if (ParallelIterations != 0)
            {
                hash ^= ParallelIterations.GetHashCode();
            }
            if (BackProp != false)
            {
                hash ^= BackProp.GetHashCode();
            }
            if (SwapMemory != false)
            {
                hash ^= SwapMemory.GetHashCode();
            }
            if (PivotName.Length != 0)
            {
                hash ^= PivotName.GetHashCode();
            }
            if (PivotForPredName.Length != 0)
            {
                hash ^= PivotForPredName.GetHashCode();
            }
            if (PivotForBodyName.Length != 0)
            {
                hash ^= PivotForBodyName.GetHashCode();
            }
            hash ^= loopExitNames_.GetHashCode();
            hash ^= loopEnterNames_.GetHashCode();
            if (valuesDef_ != null)
            {
                hash ^= ValuesDef.GetHashCode();
            }
            if (MaximumIterationsName.Length != 0)
            {
                hash ^= MaximumIterationsName.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }